播放RTSP流媒体在Android应用程序 [英] Play RTSP streaming in an Android application
本文介绍了播放RTSP流媒体在Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想开发一个基于Android的应用程序,它可以从实时流播放视频。这活流是利用 Wowza媒体服务器产生的。
I am trying to develop an Android based application, which can play video from a live stream. This live stream is produced using Wowza Media Server.
网址为:
rtsp://tv.hindiworldtv.com:1935/live/getpun
我曾尝试以下code在ecliplse:
I have tried following code in ecliplse:
package com.kalloh.wpa;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.Window;
import android.widget.MediaController;
import android.widget.VideoView;
public class a extends Activity {
VideoView videoView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
//Create a VideoView widget in the layout file
//use setContentView method to set content of the activity to the layout file which contains videoView
this.setContentView(R.layout.videoplayer);
videoView = (VideoView)this.findViewById(R.id.videoView);
//add controls to a MediaPlayer like play, pause.
MediaController mc = new MediaController(this);
videoView.setMediaController(mc);
//Set the path of Video or URI
videoView.setVideoURI(Uri.parse("rtsp://tv.hindiworldtv.com:1935/live/getpnj"));
//
//Set the focus
videoView.requestFocus();
}
}
首先,这是行不通的。
At first, it was not working.
现在它开始工作,但以20〜30秒后停止。我该如何解决这个问题呢?
Now it started working, but it stops after 20 to 30 seconds. How can I fix this problem?
推荐答案
我找到了解决办法。传输应该是Android上的preferred内设置。欲了解更多详细信息,请参阅 支持的媒体格式 的
I found the solution. Transmission should be within the preferred setting by Android. For more details, see Supported Media Formats.
这篇关于播放RTSP流媒体在Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文