从HTTP URL中的Andr​​oid播放SDP文件(RTSP流) [英] Playing sdp file (rtsp stream) from http url in android

查看:1346
本文介绍了从HTTP URL中的Andr​​oid播放SDP文件(RTSP流)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的本地主机RTSP服务器上的RTSP流。
我会播放此文件与Android的MediaPlayer类

I have a rtsp stream on my rtsp server in localhost. I would to play this file with the android class MediaPlayer.

如果我做的setDataSource(RTSP://localhost/file.sdp)它的作品!

If I do setDataSource(rtsp://localhost/file.sdp) it works!!

我的问题是...如果我将文件复制我的HTTP服务器上,我

My problem is... if I copy the file on my http server and I do

setDataSource(http://localhost/file.sdp) 

这是行不通的!我收到一个I / O异常。

it does not work!! I receive an I/O exception.

filePath = "http://localhost/file.sdp";
mediaPlayer.setDataSource(filePath);
mediaPlayer.prepare();
mediaPlayer.start();

如果我打这个文件用VLC应用它的作品。

If I play this file with vlc application it works.

推荐答案

RTSP实时流协议是流媒体服务器。您可以通过RTSP协议电脑/移动设备上观看来自远程服务器实时视频广播。该协议只处理媒体文件的播放。下面是RTSP的一些特点:

RTSP "Real Time Streaming Protocol" is for streaming media server. You can watch live video broadcasting from remote server on your computer/mobile device through RTSP protocol. This protocol only handle playback of media files. Below are some features of RTSP:


  1. 这适用于TCP连接

  2. RTSP请求都发出同样的TCP连接上

  3. 该协议有非常少的端至​​端延迟

  4. 这也被称为真流

  5. 没有文件被下载到用户的系统

  6. 播放电影的实时

  7. 可以做现场直播

  8. 用户计算机上的某些防火墙会阻止该协议

的HTTP超文本传输​​协议是用于在万维网上传输文件(文本,图形图像,声音,视频和其他多媒体文件)。网页(含文字,图形图像,声音,视频和其它多媒体)主办的远程服务器和用户在其系统上的浏览器上的HTTP协议进行通信。我们可以通过HTTP协议观看流媒体视频。下面是HTTP的一些特点:

HTTP "Hypertext Transfer Protocol" is for transferring files (text, graphic images, sound, video, and other multimedia files) on the World Wide Web. HTTP protocol communicate between Web pages (Contain text, graphic images, sound, video and other multimedia) hosted on remote server and the user's browsers on their system. We can watch streaming video through HTTP protocol. Below are some features of HTTP:


  1. 这适用于TCP连接

  2. HTTP通常会发送一个单独的TCP
  3. 每个请求
  4. 相比,RTSP该协议有高端到终端的时延

  5. 即成从标准的Web服务器内容

  6. 从Web服务器这种支持渐进式下载

  7. 文件下载到用户的系统,但可以开始播放前完全下载

  8. 这适用于所有的防火墙,因为它使用标准的HTTP协议

SDP会话描述协议包含了一系列其中的相互作用以及一组通信终点。 SDP包含有关流媒体信息。它主要包含三部分有关媒体 - 会话描述,时间的描述和媒体的描述。 SDP不是本身就是一种文件类型,但它是一个协议,负责流媒体。 HTTP和RTSP都支持SDP。

SDP "Session Description Protocol" consists of a set of communications end points along with a series of interactions among them. SDP contains information about streaming media. It contains mainly three parts about media - Session description, Time description and Media description. SDP not itself is a file type but it is a protocol and responsible for steaming media. HTTP and RTSP both support SDP.

这篇关于从HTTP URL中的Andr​​oid播放SDP文件(RTSP流)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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