只有使用以下链接后,我才能播放 YouTube 视频。
但我的问题是他们要求在 Chrome 客户端中添加以下行
@Override public void onPrepared(MediaPlayer mp) {
customViewCallback.onCustomViewHidden();
}
多次显示视频但没有运气。为此而崩溃。以下是崩溃的详细信息
任何链接或示例代码都对我有很大帮助,在此先感谢
01-09 11:25:27.999: ERROR/MediaPlayer(3833): <!>android.media.MediaPlayer 732<!> IOException: java.io.FileNotFoundException: No content provider: http://r2---sn-ci5gup-cage.c.youtube.com/videoplayback?itag=18&yms=LMB29RrCiYc&gcr=in&fexp=906373%2C922206%2C901054%2C916624%2C920704%2C912806%2C928001%2C922403%2C922405%2C929901%2C913605%2C929104%2C929110%2C913546%2C913556%2C908493%2C908496%2C920201%2C913302%2C919009%2C911116%2C926403%2C901451%2C902556&app=youtube_mobile&newshard=yes&ratebypass=yes&cp=U0hUTFdOT19GTENONF9PSFNJOkpKQTU0VXFabVZh&ms=au&mv=m&el=watch&expire=1357731812&ip=223.239.139.176&key=yt1&sver=3&id=538eced585584e54&source=youtube&ipbits=8&sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&mt=1357710850&signature=71FD38C03ABA06281CFF021A543051861ED0FEC3.A1F7E9E860349E8D3240D8156346C344FFA08731&dnc=1&upn=5y6eEl8pixM
01-09 11:25:28.009: ERROR/MediaPlayerService(1507): [MediaPlayerService::Client::setDataSource]player type = 4
01-09 11:25:29.069: ERROR/QCvdec(1507): Setparameter: unknown param 2130706451
01-09 11:25:31.099: ERROR/QCvdec(1507): Omx Flush issued when vdec is not initialized yet.
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): FATAL EXCEPTION: main
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): java.lang.NullPointerException
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.webkit.HTML5VideoViewProxy$VideoPlayer$2.surfaceDestroyed(HTML5VideoViewProxy.java:322)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.SurfaceView.reportSurfaceDestroyed(SurfaceView.java:596)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.SurfaceView.updateWindow(SurfaceView.java:490)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:215)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.View.dispatchDetachedFromWindow(View.java:6169)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.ViewGroup.removeViewInternal(ViewGroup.java:2201)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.ViewGroup.removeViewInternal(ViewGroup.java:2187)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.ViewGroup.removeView(ViewGroup.java:2135)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.webkit.HTML5VideoViewProxy$VideoPlayer$1.onCustomViewHidden(HTML5VideoViewProxy.java:160)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at com.android.rmtest.SocialMedia$chromeClient.onPrepared(SocialMedia.java:155)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.widget.VideoView$2.onPrepared(VideoView.java:298)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:1313)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.os.Handler.dispatchMessage(Handler.java:99)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.os.Looper.loop(Looper.java:130)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.app.ActivityThread.main(ActivityThread.java:3737)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at java.lang.reflect.Method.invokeNative(Native Method)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at java.lang.reflect.Method.invoke(Method.java:507)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:660)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at dalvik.system.NativeStart.main(Native Method)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): [Blue Error Handler] Make Debugging Report file for main
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): java.lang.NullPointerException
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.webkit.HTML5VideoViewProxy$VideoPlayer$2.surfaceDestroyed(HTML5VideoViewProxy.java:322)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.SurfaceView.reportSurfaceDestroyed(SurfaceView.java:596)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.SurfaceView.updateWindow(SurfaceView.java:490)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:215)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.View.dispatchDetachedFromWindow(View.java:6169)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.ViewGroup.removeViewInternal(ViewGroup.java:2201)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.ViewGroup.removeViewInternal(ViewGroup.java:2187)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.view.ViewGroup.removeView(ViewGroup.java:2135)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.webkit.HTML5VideoViewProxy$VideoPlayer$1.onCustomViewHidden(HTML5VideoViewProxy.java:160)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at com.android.rmtest.SocialMedia$chromeClient.onPrepared(SocialMedia.java:155)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.widget.VideoView$2.onPrepared(VideoView.java:298)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:1313)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.os.Handler.dispatchMessage(Handler.java:99)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.os.Looper.loop(Looper.java:130)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at android.app.ActivityThread.main(ActivityThread.java:3737)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at java.lang.reflect.Method.invokeNative(Native Method)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at java.lang.reflect.Method.invoke(Method.java:507)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:660)
01-09 11:25:31.139: ERROR/AndroidRuntime(3833): at dalvik.system.NativeStart.main(Native Method)