在VideoView在三星Galaxy S2无法播放视频RTSP [英] Cannot play RTSP video in VideoView in Samsung Galaxy S2

查看:467
本文介绍了在VideoView在三星Galaxy S2无法播放视频RTSP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想现场演奏一段视频RTSP(从的rtsp://media2.tripsmarter.com/LiveTV/BTV/ )使用 VideoView ,这是我的code:

I'm trying to play a live RTSP video (from rtsp://media2.tripsmarter.com/LiveTV/BTV/) using VideoView, and here's my code:

public class ViewTheVideo extends Activity {
    VideoView vv;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        vv = (VideoView) this.findViewById(R.id.VideoView);

        Uri videoUri = Uri.parse("rtsp://media2.tripsmarter.com/LiveTV/BTV/");
        vv.setMediaController(new MediaController(this));
        vv.setVideoURI(videoUri);
        vv.requestFocus();
        vv.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                vv.start();
            }           
        });
    }
}

这code适用于三星Galaxy Y的微调,甚至在模拟器上也是如此,但它不会对三星Galaxy S2运行(很抱歉,此视频无法播放)!两者的装置和仿真器运行姜饼

This code works fine on Samsung Galaxy Y, and even on the emulator too, but it doesn't run on Samsung Galaxy S2 (Sorry, this video cannot be played)! Both the devices and the emulator are running Gingerbread.

这里的LogCat中的消息:

Here's the LogCat messages:

07-30 10:48:28.310: I/MediaPlayer(24573): uri is:rtsp://media2.tripsmarter.com/LiveTV/BTV/
07-30 10:48:28.310: I/MediaPlayer(24573): path is null
07-30 10:48:28.310: D/MediaPlayer(24573): Couldn't open file on client side, trying server side
07-30 10:49:13.025: W/MediaPlayer(24573): info/warning (1, 26)
07-30 10:49:13.025: I/MediaPlayer(24573): Info (1,26)
07-30 10:49:13.075: E/MediaPlayer(24573): error (1, -1)
07-30 10:49:13.075: E/MediaPlayer(24573): Error (1,-1)
07-30 10:49:13.075: D/VideoView(24573): Error: 1,-1

我无法弄清楚这些错误codeS是什么。

I could not figure out what those error codes are about.

有任何问题三星Galaxy S2与流?我也试图与YouTube的流(<$c$c>rtsp://v2.cache2.c.youtube.com/CjgLENy73wIaLwm3JbT_9HqWohMYESARFEIJbXYtZ29vZ2xlSARSB3Jlc3VsdHNg_vSmsbeSyd5JDA==/0/0/0/video.3gp),但它是完全一样的。

Is there any issues with Samsung Galaxy S2 with streaming? I also tried with a YouTube stream (rtsp://v2.cache2.c.youtube.com/CjgLENy73wIaLwm3JbT_9HqWohMYESARFEIJbXYtZ29vZ2xlSARSB3Jlc3VsdHNg_vSmsbeSyd5JDA==/0/0/0/video.3gp), but it's all the same.

更新:
后来我记录银河S2视频(格式:3GP,恩codeR:H.264,比特率:56kbps的,帧率:15fps的),并使用VLC媒体播放器的PC机直播的节目。这可以在银河S2(和其他人)没有任何错误进行查看。然而,没有任何其他的视频可以在S2播放。

Update: Later I recorded a video with Galaxy S2 (Format: 3GP, Encoder: H.264, Bitrate: 56kbps, Framerate: 15fps) and streamed the video from the PC using VLC media player. This one can be viewed in Galaxy S2 (and others) without any error. However, no other video could be played on S2.

推荐答案

@Andro塞尔瓦我这是怎么流了链接

@Andro Selva this is how I streamed his link

 video_url = "rtsp://media2.tripsmarter.com/LiveTV/BTV/"; 
try {
            videoView =(VideoView)findViewById(R.id.videoView1);
            //Set video link (mp4 format )
            Uri video = Uri.parse(video_url);
            videoView.setVideoURI(video);
            videoView.setOnPreparedListener(new OnPreparedListener() {
            public void onPrepared(MediaPlayer mp) {

                videoView.start();
                }
            });
         }catch(Exception e){
         }

这篇关于在VideoView在三星Galaxy S2无法播放视频RTSP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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