title: YouTube embedded player crashed with gpus_ReturnNotPermittedKillClient on iOS 8
body: <p>I made an iOS app with UIWebView which loads YouTube iFrame player.
  Everything went well and it can even keep playing video on background with only one problem.</p>
  
  <p>This problem only happens since this month, and it happens not only on the latest update (iOS 8.3) but also on iOS 8.1, so I figure that it has something to do with some recent modification on the YouTube iFrame API.</p>
  
  <p>On iOS 8 (only iOS 8 on the device, not any iOS before 8, and not even on the emulator,) when I put the app to background (e.g. go to home screen, lock the device,) the video plays normally, but once the video is finished and the app tries to load the next video on the app's playlist, the app crashes (actually it seems like iOS forces terminating it.)</p>
  
  <p>There is an EXC_BAD_ACCESS on the WebThread with </p>
  
  <p><code>libGPUSupportMercury.dylib gpus_ReturnNotPermittedKillClient</code></p>
  
  <p>and the relevent call stack in the crash log is as below:</p>
  
  <pre><code>Thread 6 name:  WebThread
  Thread 6 Crashed:
  0   libGPUSupportMercury.dylib      0x000000018b829f90 gpus_ReturnNotPermittedKillClient + 12
  1   libGPUSupportMercury.dylib      0x000000018b82af3c gpusSubmitDataBuffers + 168
  2   WebCore                         0x0000000191620820 WebCore::GraphicsContext3D::reshape(int, int) + 528
  3   WebCore                         0x0000000191e93ce0 WebCore::WebGLRenderingContext::initializeNewContext() + 1136
  4   WebCore                         0x0000000191e93594 WebCore::WebGLRenderingContext::WebGLRenderingContext(WebCore::HTMLCanvasElement*, WTF::PassRefPtr&lt;WebCore::GraphicsContext3D&gt;, WebCore::GraphicsContext3D::Attributes) + 600
  5   WebCore                         0x0000000191e92c54 WebCore::WebGLRenderingContext::create(WebCore::HTMLCanvasElement*, WebCore::WebGLContextAttributes*) + 1144
  6   WebCore                         0x000000019132f6ec WebCore::HTMLCanvasElement::getContext(WTF::String const&amp;, WebCore::CanvasContextAttributes*) + 312
  </code></pre>
  
  <p>simply put, in my understanding, when I call YTPlayer.loadVideoById(...) YouTube API loads the video and tries to create a new WebGL rendering context, which iOS does not allow (GL rendering related instructions during background mode is not allowed,) so it terminates the app.</p>
  
  <p>I've been googling and scratching my head for a whole week to deal with this but without any luck, does anyone has any idea how to deal with it?</p>
  
  <p>Thank you so much for any suggestion and any help!!!</p>