目前在做视频应用的时候,比较先进的技术就是RTSP流媒体了,那么如和利用Android的播放控件VideoView来播放RTSP的流呢?

RTSP流媒体链接:
http://218.204.223.237:8081/wap/

这个链接含有所有的RTSP流媒体的链接,现在咱们就用VideoView来播放里面的RTSP的流,咱们以其中的一个链接来测试下好了:

rtsp://218.204.223.237:554/live/1/66251FC11353191F/e7ooqwcfbqjoo80j.sdp.

效果截图:



核心代码如下:
package com.video.rtsp;import android.app.Activity;import android.net.Uri;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.EditText;import android.widget.VideoView;public class rtspActivity extends Activity {/** Called when the activity is first created. */Button playButton ;VideoView videoView ;EditText rtspUrl ;@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);rtspUrl = (EditText)this.findViewById(R.id.url);playButton = (Button)this.findViewById(R.id.start_play);playButton.setOnClickListener(new Button.OnClickListener(){public void onClick(View v) {PlayRtspStream(rtspUrl.getEditableText().toString());}});videoView = (VideoView)this.findViewById(R.id.rtsp_player);}//play rtsp streamprivate void PlayRtspStream(String rtspUrl){videoView.setVideoURI(Uri.parse(rtspUrl));videoView.requestFocus();videoView.start();}}


在点击开始播放后,一般要等个10几秒中才开始播放的,直接的设置需要播放的RTSP的地址:setVideoURI(rtsp的地址)

转自:http://www.shouyanwang.org/thread-96-1-1.html

更多相关文章

  1. 【移动开发】Android无线调试 使用adbWireless软件
  2. android 通过局域网udp广播自动建立socket连接
  3. Android(安卓)4.1 Jelly Bean(果冻豆) SDK4.1最新下载
  4. android:TextView中的文本链接之--链接的几种方式
  5. android SDK安装代理设置
  6. TextView 借助Linkify,使用自定义模式设置链接
  7. android 2.3 ubuntu 下编译环境配置
  8. android为模拟器安装应用
  9. android 蓝牙知识链接汇总

随机推荐

  1. Android相对布局(RelativeLayout)
  2. Android(安卓)Apk反编译得到Java源代码(
  3. Android的事件类型及事件处理机制
  4. Android(安卓)Studio生成aar、jar包及其
  5. Root你的设备
  6. Android:这是一份全面 & 详细的Webview使
  7. 教你安装配置Android(安卓)Studio
  8. 关于Android(安卓)Wifi NetworkId的一些
  9. Android(安卓)截图功能源码的分析
  10. Android(安卓)IME