使用YoutubePlayer.loadVideo时出现异常

时间:2019-01-08 17:43:00

标签: android android-youtube-api

调用YoutubePlayer.loadVideo()方法时出现异常。

以下是我正在使用的代码:

  onInitializedListener=new YouTubePlayer.OnInitializedListener()
    {
        @Override
        public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) {
            Log.d("onInitializationFailure","Unable to load");
        }

        @Override
        public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
            //player.loadVideo(strVideoURL);
            player.cueVideo(strVideoURL,1);
        }
    };

以下是我在androidstudio中遇到的异常(由于此异常它仅显示黑屏,之后我也无法调用任何其他视频):

01-08 23:00:11.868 32736-3385/? E/YouTubeAndroidPlayerAPI: Failed to construct CronetEngine. Using fallback Java implementation.
    java.lang.IllegalStateException: Disk cache storage path already in use
        at org.chromium.net.impl.CronetUrlRequestContext.<init>(SourceFile:49)
        at awpo.a(SourceFile:5)
        at awkn.a(SourceFile:18)
        at vot.a(SourceFile:24)
        at vov.get(SourceFile:16)
        at autw.get(SourceFile:9)
        at lfx.M(SourceFile:140)
        at lfh.get(SourceFile:4)
        at vrf.c(SourceFile:78)
        at vrf.run(SourceFile:27)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at vgy.run(SourceFile:12)
        at java.lang.Thread.run(Thread.java:764)

1 个答案:

答案 0 :(得分:0)

我最近观察到在活动之间导航时,我得到的“ strVideoURL”为空。所以我们出现黑屏的原因。

在这里共享,因为这可能有助于查找他们的错误。

谢谢