本文介绍了YouTube嵌入式播放器在iOS 8上与gpus_ReturnNotPermittedKillClient崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用UIWebView创建了一个iOS应用程序,用于加载YouTube iFrame播放器。
一切顺利,它甚至可以在背景上播放视频,只有一个问题。



这个问题只发生在本月以来,不仅发生在最新更新(iOS 8.3)以及iOS 8.1,所以我认为它与YouTube iFrame API最近的一些修改有关。



在iOS 8上(当我将应用程序置于后台时(例如,转到主屏幕,锁定设备),视频正常播放,但一旦视频播放,设备上只有iOS 8,而不是8之前的任何iOS,甚至不是模拟器上的任何iOS已完成并且应用程序尝试在应用程序的播放列表中加载下一个视频,应用程序崩溃(实际上似乎iOS强制终止它。)



有一个EXC_BAD_ACCESS WebThread with



libGPUSupportMercury.dylib gpus_ReturnNotPermittedKillClient



崩溃日志中的相关调用堆栈如下所示:

 线程6名称:WebThread 
线程6崩溃:
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< WebCore :: GraphicsContext3D>,WebCore :: GraphicsContext3D :: Attributes)+ 600
5 WebCore 0x0000000191e92c54 WebCore :: WebGLRenderingContext :: create(WebCore :: HTMLCanvasElement *,WebCore :: WebGLContextAttributes *)+ 1144
6 WebCore 0x000000019132f6ec WebCore :: HTMLCanvasElement: :getContext(WTF :: String const&,WebCore :: CanvasContextAttrib utes *)+ 312

根据我的理解,当我调用YTPlayer.loadVideoById(.. 。)YouTube API加载视频并尝试创建新的WebGL渲染上下文,iOS不允许(不允许在后台模式下使用GL渲染相关说明),因此它会终止应用。



我一直在谷歌上搜索并整整一个星期来处理这个但没有运气,有没有人知道如何处理它?

非常感谢你的任何建议和任何帮助!

解决方案

好的,我还没有这个问题的工作解决方案,但我只是找到了解决方法。



看起来,只要你不打电话,YouTube iFrame播放器就不会创建WebGL渲染上下文YTPlayer.loadVideoById(或cueVideoById,loadVideoByUrl,cueVideoByUrl,loadPlaylist,cuePlaylist。)所以我只需在loadPlaylist的播放列表中加载所有视频随着播放列表的改变。



通过这种方法,我的应用程序不再崩溃。这很好,但我仍然想知道是否有人有这个真正的解决方案,请让我知道,非常感谢!!!


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.

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.

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.)

There is an EXC_BAD_ACCESS on the WebThread with

libGPUSupportMercury.dylib gpus_ReturnNotPermittedKillClient

and the relevent call stack in the crash log is as below:

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<WebCore::GraphicsContext3D>, WebCore::GraphicsContext3D::Attributes) + 600
5   WebCore                         0x0000000191e92c54 WebCore::WebGLRenderingContext::create(WebCore::HTMLCanvasElement*, WebCore::WebGLContextAttributes*) + 1144
6   WebCore                         0x000000019132f6ec WebCore::HTMLCanvasElement::getContext(WTF::String const&, WebCore::CanvasContextAttributes*) + 312

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.

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?

Thank you so much for any suggestion and any help!!!

解决方案

OK, I still don't have a working solution for this problem but I just figured out a work around.

It seems like YouTube iFrame player does not create WebGL rendering context as long as you don't call YTPlayer.loadVideoById (or cueVideoById, loadVideoByUrl, cueVideoByUrl, loadPlaylist, cuePlaylist.) So I just load all the video on my playlist with loadPlaylist whenever the playlist is changed.

With this work around, my app doesn't crash anymore. It's good but I still wonder if anyone has a real solution for this, please let me know and it's very much appreciated!!!

这篇关于YouTube嵌入式播放器在iOS 8上与gpus_ReturnNotPermittedKillClient崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 04:10