Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To begin with, this is <strong>not</strong> a problem caused by network access on the main thread (at least not any network access you have control over). The UIWebView method called on the main thread is loadHTMLString:baseURL:, which simply stuffs the specified string into the web view as its HTML content. The contents of the specified HTML string imply a network request to YouTube, but that doesn't create a user-initiated network request on the main thread any more than clicking on a link in a web view.</p> <p>Any suggestion to perform this operation in a background thread is wrong, and will almost certainly result in a crash. Any interaction with a web view should be in the main thread; iOS will give you a crash error for even instantiating a web view on a background thread.</p> <p>Unfortunately, and here lies the rub, there may be nothing you can do about this lag. When the UIWebView sees the <code>&lt;embed&gt;</code> tag in the specified HTML and determines that the content is meant to come from YouTube, it starts up a native YouTube player process to play the video. The lag may be caused by the time the native player takes to start, it may be caused by the native player contacting YouTube, it may be caused by gnomes that live in the native player's basement. I don't know the cause, and since the native player is an entirely opaque process (short of jailbreaking a devices and going at some libraries with a disassembler) I don't have a good suggestion for how to find out. Even if you did find out, there's almost certainly little to nothing you could do about it.</p> <p>I appreciate that this is an unsatisfying answer, and I'd be happy for someone to prove me wrong.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload