CarGuo / GSYVideoPlayer

视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,16k page size,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。
https://juejin.cn/user/817692379985752/posts
Apache License 2.0
20.24k stars 4.2k forks source link

源码 缓存下载支持页面 奔溃 #3438

Closed zjianflys closed 3 years ago

zjianflys commented 3 years ago

问题描述:

点击

binding.startDown.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String url = proxyCacheServer.getProxyUrl(getUrl());
                startDownload(url);

            }
        });

问题机型/系统:

例如 真机 荣耀想x10

GSY依赖版本

源码 v8.1.6

Demo中的复现步骤

Demo中的DetailDownloadPlayer页面点击startDown按钮

问题log(如果有)


2021-10-27 11:10:08.260 18006-18006/? E/libc: Access denied finding property "persist.device_config.runtime_native.use_app_image_startup_cache"
2021-10-27 11:10:08.260 18006-18006/? E/.gsyvideoplaye: LoadAppImageStartupCache enabled : 1
2021-10-27 11:10:08.261 18006-18006/? E/.gsyvideoplaye: Unknown bits set in runtime_flags: 0x8000
2021-10-27 11:10:08.257 18006-18006/? W/.gsyvideoplaye: type=1400 audit(0.0:136757): avc: denied { read } for pid=18006 name="u:object_r:device_config_runtime_native_prop:s0" dev="tmpfs" ino=12650 scontext=u:r:untrusted_app:s0:c22,c257,c512,c768 tcontext=u:object_r:device_config_runtime_native_prop:s0 tclass=file permissive=0
        at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1254)
        at okhttp3.Request$Builder.url(Request.kt:184)
2021-10-27 11:10:08.262 18006-18006/? I/.gsyvideoplaye: Reinit property: dalvik.vm.checkjni= false
2021-10-27 11:10:08.262 18006-18006/? I/.gsyvideoplaye: ReInitProperties: persist.vm.debug.dumpapi= false
        at com.example.gsyvideoplayer.DetailDownloadPlayer.startDownload(DetailDownloadPlayer.java:262)

https://github.com/zjianflys/flyDemo/blob/main/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86/1.jpg https://github.com/zjianflys/flyDemo/blob/main/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86/2.jpg

CarGuo commented 3 years ago

测试正常啊,没发现问题??

zjianflys commented 3 years ago

我又从主页下载了app 切换3中内核 点击缓存下载支持 按钮 都报错 闪退

zjianflys commented 3 years ago

我录屏 群里面发不进来

CarGuo commented 3 years ago

我这边看log和效果都正常播放,不大理解为什么你闪退,你闪退 crash 的原因是?

zjianflys commented 3 years ago
2021-10-27 15:06:49.013 20121-20121/? E/libc: Access denied finding property "persist.device_config.runtime_native.use_app_image_startup_cache"
2021-10-27 15:06:49.048 20121-20121/com.example.gsyvideoplayer D/ApplicationLoaders: createClassLoader zip: /data/app/com.example.gsyvideoplayer-_Z_ff9FOlRf80K_013cWWw==/base.apk librarySearchPath: /data/app/com.example.gsyvideoplayer-_Z_ff9FOlRf80K_013cWWw==/lib/arm64:/data/app/com.example.gsyvideoplayer-_Z_ff9FOlRf80K_013cWWw==/base.apk!/lib/arm64-v8a libraryPermittedPath: /data/user/0/com.example.gsyvideoplayer parent: java.lang.BootClassLoader@a3e8ad0 targetSdkVersion: 30 isBundled: false classLoaderName: null sharedLibraries: null
2021-10-27 15:06:49.013 20121-20121/? E/.gsyvideoplaye: LoadAppImageStartupCache enabled : 1
2021-10-27 15:06:49.013 20121-20121/? E/.gsyvideoplaye: Unknown bits set in runtime_flags: 0x8000

createClassLoader zip: /data/app/com.example.gsyvideoplayer-_Z_ff9FOlRf80K_013cWWw==/base.apk librarySearchPath: /data/app/com.example.gsyvideoplayer-_Z_ff9FOlRf80K_013cWWw==/lib/arm64:/data/app/com.example.gsyvideoplayer-_Z_ff9FOlRf80K_013cWWw==/base.apk!/lib/arm64-v8a libraryPermittedPath: /data/user/0/com.example.gsyvideoplayer parent: java.lang.BootClassLoader@a3e8ad0 targetSdkVersion: 30 isBundled: false classLoaderName: null sharedLibraries: null

我有点不理解这句话是什么意思

zjianflys commented 3 years ago

我在Q群里面留言了 不晓得大神在里面没得

CarGuo commented 3 years ago

你这个log看不出东西啊,也看不出来和gsy有什么关系

zjianflys commented 3 years ago
2021-10-28 16:09:41.784 7490-7490/com.example.gsyvideoplayer E/GSYVideoPlayer: ###### url file:///data/user/0/com.example.gsyvideoplayer/cache/video-cache/09096f089ee62e47028790742e8e0c1a.mp4
2021-10-28 16:09:41.794 7490-7490/com.example.gsyvideoplayer D/AndroidRuntime: Shutting down VM
2021-10-28 16:09:41.795 7490-7490/com.example.gsyvideoplayer E/AndroidRuntime: JUNK_FATAL_EXCEP: FATAL EXCEPTION: main,Process: com.example.gsyvideoplayer, PID: 7490
2021-10-28 16:09:41.796 7490-7490/com.example.gsyvideoplayer E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.gsyvideoplayer, PID: 7490
    java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but was 'file'
        at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1254)
        at okhttp3.HttpUrl$Companion.get(HttpUrl.kt:1633)
        at okhttp3.Request$Builder.url(Request.kt:184)
        at com.zhy.http.okhttp.request.OkHttpRequest.initBuilder(OkHttpRequest.java:49)
        at com.zhy.http.okhttp.request.OkHttpRequest.<init>(OkHttpRequest.java:39)
        at com.zhy.http.okhttp.request.GetRequest.<init>(GetRequest.java:15)
        at com.zhy.http.okhttp.builder.GetBuilder.build(GetBuilder.java:26)
        at com.example.gsyvideoplayer.DetailDownloadPlayer.startDownload(DetailDownloadPlayer.java:262)
        at com.example.gsyvideoplayer.DetailDownloadPlayer.access$500(DetailDownloadPlayer.java:33)
        at com.example.gsyvideoplayer.DetailDownloadPlayer$5.onClick(DetailDownloadPlayer.java:165)
        at android.view.View.performClick(View.java:7250)
        at android.view.View.performClickInternal(View.java:7227)
        at android.view.View.access$3500(View.java:819)
        at android.view.View$PerformClick.run(View.java:27749)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:224)
        at android.app.ActivityThread.main(ActivityThread.java:7562)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

大神 麻烦看一下呀 这个报错

zjianflys commented 3 years ago
    private void startDownload(String url) {
        //打印:###### url file:///data/user/0/com.example.gsyvideoplayer/cache/video-cache/09096f089ee62e47028790742e8e0c1a.mp4
        Debuger.printfError("###### url " + url);
        //下载demo然后设置
        requestCall = OkHttpUtils.get().url(url)
            .build();
        requestCall.execute(new MemoryCallBack() {
            @Override
            public void onError(Call call, Exception e, int id) {
            }

            @Override
            public void onResponse(Boolean response, int id) {
                stopDownload();
            }

        });
    }

这个请求url 地址不是以http或https 开始 ,您那边测试不会报这个错嘛

zjianflys commented 3 years ago
 private void startDownload(String url) {
        //打印:###### url file:///data/user/0/com.example.gsyvideoplayer/cache/video-cache/09096f089ee62e47028790742e8e0c1a.mp4
        Debuger.printfError("###### url " + url);

//        url = "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4";
//        url = "http://vfx.mtime.cn/Video/2019/02/04/mp4/190204084208765161.mp4";
        url = "http://www.baidu.com";
        //下载demo然后设置
        requestCall = OkHttpUtils.get().url(url)
            .build();
        requestCall.execute(new MemoryCallBack() {
            @Override
            public void onError(Call call, Exception e, int id) {
            }

            @Override
            public void onResponse(Boolean response, int id) {
                LogUtils.i("--------\nresponse:" + response + "\nid:" + id);
                stopDownload();
            }
        });
    }

我分析了一下这点的代码
requestCall = OkHttpUtils.get().url(url) .build(); 这个只是获取RequestCall 这点的url 没得实际作用
我在这点把uri 改成百度网站 下载的文件还是用的getUrl()里面的网址

    private String getUrl() {

        String url = "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4";
        url = "http://vfx.mtime.cn/Video/2019/02/04/mp4/190204084208765161.mp4";
        return url;
    }

这点我大概懂起了.. HttpProxyCacheServer 这个代理 目前还没搞懂哦....