NWA25HN 2021-06-24 09:59 采纳率: 0%
浏览 950

VideoView无法播放此视频

读写权限加过了、路径也设置对了

用res/raw播放能成功

//这是设置的视频路径  
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
            videoView.setVideoPath(Environment.getExternalStorageDirectory() + "/gm.mp4");
            /**
             * Environment.DIRECTORY_MOVIES:获取手机中电影存放的标准目录
             * Environment.DIRECTORY_PICTURES:获取手机中图片存放的标准目录
             */
            String moviesDir = Environment.DIRECTORY_MOVIES;
            String picturesDir = Environment.DIRECTORY_PICTURES;

            Log.d("--------------->>", moviesDir);
            Log.d("--------------->>", picturesDir);
        }



//这是logcat

2021-06-24 09:47:56.628 15447-15447/? I/m.example.vide: Late-enabling -Xcheck:jni
2021-06-24 09:47:56.655 15447-15447/? E/libc: Access denied finding property "persist.device_config.runtime_native.use_app_image_startup_cache"
2021-06-24 09:47:56.648 15447-15447/? W/m.example.vide: type=1400 audit(0.0:95095): avc: denied { read } for pid=15447 name="u:object_r:device_config_runtime_native_prop:s0" dev="tmpfs" ino=13704 scontext=u:r:untrusted_app:s0:c32,c257,c512,c768 tcontext=u:object_r:device_config_runtime_native_prop:s0 tclass=file permissive=0
2021-06-24 09:47:56.655 15447-15447/? E/m.example.vide: LoadAppImageStartupCache enabled : 1
2021-06-24 09:47:56.655 15447-15447/? E/m.example.vide: Unknown bits set in runtime_flags: 0x8000
2021-06-24 09:47:56.655 15447-15447/? I/m.example.vide: Reinit property: dalvik.vm.checkjni= false
2021-06-24 09:47:56.655 15447-15447/? I/m.example.vide: ReInitProperties: persist.vm.debug.dumpapi= false
2021-06-24 09:47:56.669 15447-15447/? D/ActivityThread: Attach thread to application
2021-06-24 09:47:56.693 15447-15710/com.example.video I/ActivityThread: Init compatible state: true
2021-06-24 09:47:56.693 15447-15710/com.example.video D/HwFrameworkSecurityPartsFactory: HwFrameworkSecurityPartsFactory in.
2021-06-24 09:47:56.693 15447-15710/com.example.video I/HwFrameworkSecurityPartsFactory: add HwFrameworkSecurityPartsFactory to memory.
2021-06-24 09:47:56.693 15447-15710/com.example.video D/BehaviorCollectManager: hook process for AI virus second
2021-06-24 09:47:56.694 15447-15710/com.example.video I/BehaviorCollectManager: bindAnalyzerService: huawei.android.security.IAppBehaviorDataAnalyzer$Stub$Proxy@e04edd4 pid:15447
2021-06-24 09:47:56.703 15447-15447/com.example.video D/ApplicationLoaders: createClassLoader zip: /data/app/com.example.video-smIWLa7Jv-CPOiW1ExWiuw==/base.apk librarySearchPath: /data/app/com.example.video-smIWLa7Jv-CPOiW1ExWiuw==/lib/arm64 libraryPermittedPath: /data/user/0/com.example.video parent: java.lang.BootClassLoader@74e7fe6 targetSdkVersion: 30 isBundled: false classLoaderName: null sharedLibraries: null
2021-06-24 09:47:56.718 15447-15726/com.example.video I/HwPartIawareFactory: add android.common.HwPartIawareFactoryImpl to memory.
2021-06-24 09:47:56.754 15447-15447/com.example.video D/SystemFonts: areFontsVariable: script=Latn
2021-06-24 09:47:56.755 15447-15447/com.example.video I/ActivityThread: finishPreloaded preloadStatus 0
2021-06-24 09:47:56.755 15447-15447/com.example.video I/RmeSchedManager: init Rme, version is: v1.0
2021-06-24 09:47:56.755 15447-15447/com.example.video I/RtgSchedEvent: current pid:15447 AppType:-1
2021-06-24 09:47:56.755 15447-15447/com.example.video I/RmeSchedManager: init Rme, version is: v1.0
2021-06-24 09:47:56.756 15447-15710/com.example.video I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.video#10288#256
2021-06-24 09:47:56.756 15447-15710/com.example.video I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=0 newCnt=1
2021-06-24 09:47:56.758 15447-15710/com.example.video I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.video#10288#0
2021-06-24 09:47:56.758 15447-15710/com.example.video I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=1 newCnt=1
2021-06-24 09:47:56.761 15447-15447/com.example.video D/OpenGLRenderer: disableOutlineDraw is true
2021-06-24 09:47:56.764 15447-15753/com.example.video E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@fabfec3
2021-06-24 09:47:56.765 15447-15710/com.example.video I/AwareBitmapCacher: init processName:com.example.video pid=15447 uid=10288
2021-06-24 09:47:56.766 15447-15751/com.example.video I/OpenGLRenderer: RenderThread: progress name = [com.example.video], viewCornerType = 0
2021-06-24 09:47:56.766 15447-15754/com.example.video I/iGraphics: [0020080c] pn: com.example.video, p: 15447
2021-06-24 09:47:56.766 15447-15754/com.example.video I/iGraphics: [0030080c] no spt app: com.example.video
2021-06-24 09:47:56.785 15447-15447/com.example.video V/ActivityThread: callActivityOnCreate
2021-06-24 09:47:56.797 15447-15447/com.example.video I/DecorView[]: pkgName:com.example.video old windowMode:0 new windoMode:1, isFixedSize:false
2021-06-24 09:47:56.807 15447-15447/com.example.video I/OverScrollerOptimization: start init SmartSlideOverScroller and get the overscroller config
2021-06-24 09:47:56.807 15447-15447/com.example.video I/OverScrollerOptimization: get the overscroller config
2021-06-24 09:47:56.823 15447-15447/com.example.video W/m.example.vide: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2021-06-24 09:47:56.823 15447-15447/com.example.video W/m.example.vide: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2021-06-24 09:47:56.830 15447-15447/com.example.video I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.video#10288#256
2021-06-24 09:47:56.830 15447-15447/com.example.video I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=1 newCnt=1
2021-06-24 09:47:56.831 15447-15447/com.example.video I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.video#10288#0
2021-06-24 09:47:56.831 15447-15447/com.example.video I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=1 newCnt=1
2021-06-24 09:47:56.831 15447-15447/com.example.video I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.video#10288#256
2021-06-24 09:47:56.831 15447-15447/com.example.video I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=1 newCnt=1
2021-06-24 09:47:56.831 15447-15447/com.example.video D/--------------->>: Movies
2021-06-24 09:47:56.831 15447-15447/com.example.video D/--------------->>: Pictures
2021-06-24 09:47:56.833 15447-15447/com.example.video I/DecorView[]: pkgName:com.example.video old windowMode:0 new windoMode:1, isFixedSize:false
2021-06-24 09:47:56.836 15447-15447/com.example.video D/ActivityThread: add activity client record, r= ActivityRecord{359c7cc token=android.os.BinderProxy@e880b7d {com.example.video/com.example.video.MainActivity}} token= android.os.BinderProxy@e880b7d
2021-06-24 09:47:56.841 15447-15447/com.example.video I/HwPartMagicWindowFactory: add android.common.HwPartMagicWindowFactoryImpl to memory.
2021-06-24 09:47:56.847 15447-15447/com.example.video D/MouseWheelSynthesizer: mMoveStepInDp: 64, mMoveStepInPixel: 224, mUpTimeDelayed: 100
2021-06-24 09:47:56.848 15447-15447/com.example.video D/ViewRootImpl: ViewRootImpl mIsInProductivePCDisplay: false
2021-06-24 09:47:56.849 15447-15447/com.example.video I/HwPartPowerOfficeFactory: add HwPartPowerOfficeFactoryImpl to memory.
2021-06-24 09:47:56.854 15447-15447/com.example.video D/InputEventReceiver: dispatchInputInterval 0
2021-06-24 09:47:56.856 15447-15447/com.example.video I/RmeSchedManager: init Rme, version is: v1.0
2021-06-24 09:47:56.856 15447-15447/com.example.video I/RtgSchedEvent: current pid:15447 AppType:-1
2021-06-24 09:47:56.857 15447-15751/com.example.video D/OpenGLRenderer: disableOutlineDraw is true
2021-06-24 09:47:56.865 15447-15772/com.example.video D/HiTouch_PressGestureDetector: onAttached, package=com.example.video, windowType=1, mIsHiTouchRestricted=false
2021-06-24 09:47:56.875 15447-15447/com.example.video D/RenderService: RCS is disable
2021-06-24 09:47:56.884 15447-15447/com.example.video W/MediaPlayer: Couldn't open uri in attemptDataSource
2021-06-24 09:47:56.885 15447-15447/com.example.video W/VideoView: Unable to open content: /storage/emulated/0/gm.mp4
    java.io.FileNotFoundException: /storage/emulated/0/gm.mp4: open failed: EACCES (Permission denied)
        at libcore.io.IoBridge.open(IoBridge.java:496)
        at java.io.FileInputStream.<init>(FileInputStream.java:159)
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1281)
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1225)
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1141)
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1162)
        at android.widget.VideoView.openVideo(VideoView.java:412)
        at android.widget.VideoView.access$2200(VideoView.java:83)
        at android.widget.VideoView$7.surfaceCreated(VideoView.java:694)
        at android.view.SurfaceView.updateSurface(SurfaceView.java:869)
        at android.view.SurfaceView$2.onPreDraw(SurfaceView.java:176)
        at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1098)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3357)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2154)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8866)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1280)
        at android.view.Choreographer.doCallbacks(Choreographer.java:1019)
        at android.view.Choreographer.doFrame(Choreographer.java:911)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1248)
        at android.os.Handler.handleCallback(Handler.java:900)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loop(Looper.java:219)
        at android.app.ActivityThread.main(ActivityThread.java:8674)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
     Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
        at libcore.io.Linux.open(Native Method)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
        at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8472)
        at libcore.io.IoBridge.open(IoBridge.java:482)
        at java.io.FileInputStream.<init>(FileInputStream.java:159) 
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1281) 
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1225) 
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1141) 
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1162) 
        at android.widget.VideoView.openVideo(VideoView.java:412) 
        at android.widget.VideoView.access$2200(VideoView.java:83) 
        at android.widget.VideoView$7.surfaceCreated(VideoView.java:694) 
        at android.view.SurfaceView.updateSurface(SurfaceView.java:869) 
        at android.view.SurfaceView$2.onPreDraw(SurfaceView.java:176) 
        at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1098) 
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3357) 
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2154) 
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8866) 
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1280) 
        at android.view.Choreographer.doCallbacks(Choreographer.java:1019) 
        at android.view.Choreographer.doFrame(Choreographer.java:911) 
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1248) 
        at android.os.Handler.handleCallback(Handler.java:900) 
        at android.os.Handler.dispatchMessage(Handler.java:103) 
        at android.os.Looper.loop(Looper.java:219) 
        at android.app.ActivityThread.main(ActivityThread.java:8674) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109) 
2021-06-24 09:47:56.885 15447-15447/com.example.video D/VideoView: Error: 1,0
2021-06-24 09:47:56.885 15447-15447/com.example.video I/tag: ---------------------视频播放失败...........
  • 写回答

2条回答 默认 最新

  • 雲枭 2021-06-24 17:21
    关注

    你设置的播放路径是sd卡的根目录,mp4文件在sd卡根目录下吗?

    评论

报告相同问题?

悬赏问题

  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错