简体   繁体   English

抱歉,这部影片无法播放! 错误/ PlayerDriver

[英]Sorry,This video cannot be played! Error/PlayerDriver

I'm having problems playing my video on my Samsung Galaxy S ..it play fine if its from the sdcard but when I upload to a server and then send the url it gives me "Sorry, This video cannot be played". 我在Samsung Galaxy S上播放视频时遇到问题。如果它是从sdcard播放的,则可以正常播放,但是当我上传到服务器并发送URL时,它提示我“抱歉,无法播放此视频”。 It's a .mp4 video and I converted it to android format using Sothink video converter. 这是一个.mp4视频,我使用Sothink视频转换器将其转换为android格式。

This is my VideoView code: 这是我的VideoView代码:

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setListAdapter(ArrayAdapter.createFromResource(getApplicationContext(),
       R.array.lecturehalls,R.layout.list_item));


final String[] links = getResources().getStringArray(R.array.vid_links);

getListView().setOnItemClickListener(new OnItemClickListener() {

    public void onItemClick(AdapterView<?> parent, View view,
            int position, long id) {

        String content = links[position];
        Intent showContent = new Intent(getApplicationContext(),
               VideoOutput.class);
        showContent.setData(Uri.parse(content));
        startActivity(showContent);

          }




  });
}

Note: URL paths are stored in an array in strings.xml It works fine when I use this link : http://www.pocketjourney.com/downloads/pj/video/famous.3gp my link works fine as well I tested it on my computer but when on the phone it doesn't work! 注意:URL路径存储在strings.xml中的数组中。当我使用此链接时,它工作正常: http : //www.pocketjourney.com/downloads/pj/video/famous.3gp我的链接也工作正常,我对此进行了测试在我的计算机上,但是在电话上却无法使用!

This is what I get : 这就是我得到的:

12-14 02:11:01.621: ERROR/PlayerDriver(1287): Command PLAYER_INIT completed with an error or info PVMFFailure

EDIT: VideoOutput class 编辑:VideoOutput类

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.videoview);   


        MediaController mediaController = new MediaController(this);
        VideoView videoView = (VideoView) findViewById(R.id.video);


        Intent launchingIntent = getIntent();
        String content = launchingIntent.getData().toString();

    mediaController.setMediaPlayer(videoView);

    videoView.setVideoPath(content);

    videoView.setMediaController(mediaController);

    videoView.requestFocus();

    videoView.start();

    mediaController.show();


    }

I've found that the streaming media playback is very finicky about the video files it likes to play. 我发现流媒体播放对它喜欢播放的视频文件非常挑剔。

If you can point your code to a different movie file and it works, then I would suggest either finding a different converter, or tweaking the settings related to the codec in yours and trying again. 如果您可以将代码指向其他电影文件并且可以工作,那么我建议您找到其他转换器,或者调整与您的编解码器相关的设置,然后重试。 Or you could set it up to download the video the the SD and then play it from there. 或者,您可以将其设置为将视频下载到SD,然后从那里播放。

EDIT: 编辑:

I've had pretty good luck with Wondershare Video Converter Platinum. 我对Wondershare Video Converter Platinum感到非常幸运。 There is a free version I think, but I've ponied up the money for it once I tested it and found it to work for my needs. 我认为有一个免费版本,但是一旦我对其进行测试并发现它可以满足我的需求,我便为此花了很多钱。

Post the code that is inside your VideoOutput class also. 也要发布VideoOutput类内部的代码。 That might help to shed some light on what is going on. 这可能有助于阐明正在发生的事情。

Also you should replace both instances of getApplicationContext() with YourActivityName.this . 另外,您应该将两个getApplicationContext()实例替换为YourActivityName.this Using getApplicationContext() in this manner is prone to keeping copies of your context around in memory longer than they need to be. 以这种方式使用getApplicationContext()倾向于使您的上下文副本在内存中的保存时间比需要的更长。 Plus your Activity already is a Context, so you don't need to get a new reference to a context with a larger scope. 另外,您的“活动”已经一个上下文,因此您无需获取对具有更大范围的上下文的新引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM