首页 > 解决方案 > 当我使用 YoutubePlayer.loadVideo 时出现异常

问题描述

当我调用 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)

标签: androidandroid-youtube-api

解决方案


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

在这里分享,因为这可能有助于了解他们的错误。

谢谢


推荐阅读