Android:“无法播放此视频";媒体播放器VideoView错误1

编程入门 行业动态 更新时间:2024-10-09 18:19:55
本文介绍了Android:“无法播放此视频";媒体播放器VideoView错误1 -38的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试使用以下代码播放视频.但是,在运行时出现了无法播放此视频"弹出窗口,出现了经典错误消息.我在搜索android资料并查看其他人的问题时做了尽职调查,但似乎找不到问题a)因为在文档中找不到MediaPlayer的错误代码(1,-38)和b)我的视频符合android媒体格式(h.264和MPEG-4)所需的规范.如果有人可以帮助我指出正确的方向,我将不胜感激!谢谢

I tried to play a video with the code below. However, I get the classic error of 'Can't play this video' pop-up at run time. I did my due diligence in searching the android literature and looking through other people's questions, but I can't seem to find the problem a) because no where in the documentation can I find the error code (1 ,-38) for MediaPlayer and b) my video meets the specifications required for android media formats (h.264 and MPEG-4). If anyone can help point me in the right direction I'd really appreciate it! Thanks

private void startVideo() { Log.v(TAG, "videoUrl = " + mVideoUrl); Uri uri = Uri.parse(mVideoUrl); mVideo = (VideoView) getView().findViewById(R.id.preview_videoView); MediaController mediaController = new MediaController(getActivity()); mediaController.setAnchorView(mVideo); mVideo.setMediaController(mediaController); mVideo.setVideoURI(uri); mVideo.start(); }

这些是日志

10-07 21:08:38.529 9986-9986/com.trainwithtanya.hiitandroid V/﹕ videoUrl = files.parsetfss/2bb9a4a0-9f35-4124-a634-d2fa7f8b165e/tfss-ca535209-4b4c-4022-95b8-8f011ed41daf-High%20Knees.mp4 10-07 21:08:38.579 9986-10011/com.trainwithtanya.hiitandroid W/EGL_emulation﹕ eglSurfaceAttrib not implemented 10-07 21:08:38.579 9986-10011/com.trainwithtanya.hiitandroid W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa5245c20, error=EGL_SUCCESS 10-07 21:08:38.609 9986-9986/com.trainwithtanya.hiitandroid D/MediaPlayer﹕ Couldn't open file on client side, trying server side 10-07 21:08:39.582 9986-9986/com.trainwithtanya.hiitandroid D/MediaPlayer﹕ getMetadata 10-07 21:08:39.637 9986-9999/com.trainwithtanya.hiitandroid E/MediaPlayer﹕ error (1, -38) 10-07 21:08:39.637 9986-9986/com.trainwithtanya.hiitandroid E/MediaPlayer﹕ Error (1,-38) 10-07 21:08:39.637 9986-9986/com.trainwithtanya.hiitandroid D/VideoView﹕ Error: 1,-38 10-07 21:08:39.650 9986-10000/com.trainwithtanya.hiitandroid E/MediaPlayer﹕ error (1, -38) 10-07 21:08:39.702 9986-9986/com.trainwithtanya.hiitandroid E/MediaPlayer﹕ Error (1,-38) 10-07 21:08:39.702 9986-9986/com.trainwithtanya.hiitandroid D/VideoView﹕ Error: 1,-38

这是视频格式 i288.photobucket/albums/ll185/akhan007/mediaType_zpsjfvfdpto.png

推荐答案

我认为,您需要在onPrepare

mVideo.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { public void onPrepared(MediaPlayer mp) { mVideo.start(); } });

更多推荐

Android:“无法播放此视频";媒体播放器VideoView错误1

本文发布于:2023-11-27 18:46:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639173.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:媒体播放器   无法播放   错误   视频   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!