Android 不播放视频 .mp4 [英] Android not playing Video .mp4

查看:41
本文介绍了Android 不播放视频 .mp4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我准备了一个代码来播放 res 文件夹中的一个简单的 mp4 文件.编码是这样的:

I have prepared a code to just play a simple mp4 file from my res folder. The coding is something like this:

    public class VideoPlayer extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.video);
        VideoView video = (VideoView)findViewById(R.id.VideoView);
        Uri uri = Uri.parse("android.resource://company.software.myapp/"
                + R.raw.myvideo);
        MediaController mc = new MediaController(this);
        video.setMediaController(mc);
        video.setVideoURI(uri);
        //video.requestFocus();
        video.start();
    }
}

现在虽然播放没有错误.该活动会自动生成一个对话框,提示抱歉,无法播放此视频",但我可以听到音频并一直播放到结束.有什么问题?

Now though there is no error in playing. The activity automatically generates a dialog saying "sorry this video cannot be played", but I can hear the audio and it plays till end. What is the problem?

推荐答案

非常感谢 commonsware.com...但我找到了问题的解决方案...令人惊讶的是,它的罪魁祸首是 PC 处理器...我检查了更高的配置并猜测它...它工作得很好...虽然有时如果我们在后台进行一些处理,对话框确实会出现,但单击确定后它会在一段时间后开始播放视频...

Thanx a lot commonsware.com... but i found the solution to the problem... And astonishingly its the PC processor which is the culprit... I checked n a higher configuration and guess wat... it worked perfectly fine... though sometimes if we do some processing in the background the dialog box does come up but on clicking ok it starts playing the video after some time...

但我确认,据我所知,这种从资源播放文件的技术是可以的...

But i confirm that this technique of playing file from resource is ok as far as i know...

很抱歉在一个普通的硬件问题上浪费了您宝贵的时间...但希望它对遇到此问题的其他人有用...

sorry to waste ur precious time in a mundane hardware problem... but hope it'll be useful for other people who get this problem...

这篇关于Android 不播放视频 .mp4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆