•web
server
•media
server (must, streaming many kind of media files to transport streams and send
to APPs, and more, store the downloading media files via cloud server )
•Third-party
APP server for C2DM (Android Push Notification )
•media
player (must, a APP with GCM-enabled
Android application for “Push
VOD”)
C2DM(Android Push Notification )考量:
•大部分行動裝置從internet更新或獲取資料一種方法是定期詢問(poll)server,
當在沒有新資料的週期,
就浪費網路頻寬與手機的電.
•另一種方法是當server知道有資料更新了,才去接觸行動app. 當資料不常常更新,這是比較好的方法.
C2DM(Cloud to device messaging )
•The
service to push information to an Android app is called Cloud
to Device messaging or
short C2DM.
•In a
C2DM you have three involved parties. The application server which
wants to push messages to the Android device, Googles
C2DM servers and
the
Android app. The
program on the application server can be written in any programming language,
e.g. Java, PHP, Python, etc.
•When
the application server needs to push a message to the Android application, it
sends the message via an HTTP POST to Google’s C2DM servers.
•The
C2DM servers route the message to the device. If the device is not online, the
message will be delivered once the device is available. Once the message is
received, an Broadcast Intent is created. The mobile app has registered an
Intent Receiver for this Broadcast. The app is started and processes the
message via the defined Intent Receiver.
•C2DM
messages are limited in size to 1024 bytes and are intended to inform the
device about new data not to transfer it. The typical workflow is that Googles C2DM
servers notify the Android app that new data is available. Afterwards the
Android app fetches the data from a different server.
•Android
devices maintain an connection to the Android Play server. C2DM uses this
existing connections to the Google servers. This connection is highly optimize
to minimize bandwidth and battery consumption.
•C2DM
is currently still in beta and you need to apply to use it. C2DM applies a
limit of approximately 200 000 messages per sender per day and is currently
free of charge.
•Media
player --- VLS, MPlayer
•which
can
stream MPEG-1, MPEG-2 and MPEG-4 files, DVDs, digital satellite channels,
digital terrestial
television channels and live videos on the network in unicast or multicast.
Most of the VLS functionality can now be found VLC. Usage
of VLC instead of VLS is advised.
•MPlayer can
play files from the network, using the HTTP, FTP, MMS or RTSP/RTP protocol.
•can
receive and play standards-compliant RTP audio/video streams, using the "LIVE555 Streaming Media"
source code libraries – VLC, and MPlayer
•Candidates:
(Open source)
•1.
VLC - cross-platform
multimedia player and framework that plays most multimedia files as well as
DVDs, Audio CDs, VCDs, and various streaming protocols. VLC plays most codecs
(MPEG-2, DivX,
H.264, MKV, WebM,
WMV, MP3, etc.) so no codec packs are needed.
•2.
Mplayer
•General Function:
–RTSP
Streaming Protocol, HTTP Streaming Protocol
–Support
Video Server: live555
–Plays
everything: Files, Discs, Webcams, Devices and Streams.
–plays
most codecs with
no codec packs needed:
–
MPEG-2, DivX,
H.264, MKV, WebM,
WMV, MP3...
–Completely
Free, no spyware, no ads and no user tracking.
•Video On Demand
–Video
Format : MP4
–Playback
: Pause, Play, Resume, Forward/Backward Seek
–Menu
Bar for Movie Category
–Automatic
and Real-Time Movie Category Update
–Ref:
http://vlc-media-player.en.softonic.com/android
•1.
media file format
•2.
max players can receive the transport stream from the server
•3.
how activate :
–Play,
playback,pause,fast
forward, fast reverse,stop
•PLAY
•
•客户端發出播放請求:
•PLAY
rtsp://192.168.20.136:5000/xxx666 RTSP/1.0
•CSeq: 4
•Session:
6310936469860791894
•Range:
npt=0.000-
//设置播放时间的范围
•User-Agent:
VLC media player (LIVE555 Streaming Media v2005.11.10)
•
•
•服務器回應信息:
•RTSP/1.0
200 OK Server: UServer
0.9.7_rc1 Cseq: 4
Session: 6310936469860791894 Range: npt=0.000000- RTP-Info: url=trackID=0;seq=17040;rtptime=1467265309
//seq 和rtptime 都是 rtp 包中的信息
•OPTION
•
•目的是得到服务器提供的可用方法:
•OPTIONS
rtsp://192.168.20.136:5000/xxx666 RTSP/1.0
•CSeq: 1
//每个消息都有序号来标记,第一个包通常是option请求消息
•User-Agent:
VLC media player (LIVE555 Streaming Media v2005.11.10)
•
•
•服务器的回应信息包括提供的一些方法,例如:
•
•RTSP/1.0
200 OK
•Server:
UServer
0.9.7_rc1
•Cseq: 1
//每个回应消息的cseq数值和请求消息的cseq相对应
•Public:
OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, SCALE,
•GET_PARAMETER
//服务器提供的可用的方法
•PAUSE
•
•客户端发起暂停请求:
•PAUSE
rtsp://192.168.20.136:5000/xxx666 RTSP/1.0
•Cseq: 5
•Session:
6310936469860791894
•
•
•服务器回应:
•RTSP/1.0
200 OK
•Server:
UServer
0.9.7_rc1
•Cseq: 5
•Session:
6310936469860791894
•TEARDOWN
•
•客户端发起关闭请求:
•TEARDOWN
rtsp://192.168.20.136:5000/xxx666 RTSP/1.0
•CSeq: 6
•Session:
6310936469860791894
•User-Agent:
VLC media player (LIVE555 Streaming Media v2005.11.10)
•
•
•服务器回应:
•
•RTSP/1.0
200 OK
•Server:
UServer
0.9.7_rc1
•Cseq: 6
•Session:
6310936469860791894
•Connection:
Close
•SETUP
•
•客户端提醒服务器建立会话,并确定传输模式:
•SETUP
rtsp://192.168.20.136:5000/xxx666/trackID=0 RTSP/1.0
•CSeq: 3
•Transport:
RTP/AVP/TCP;unicast;interleaved=0-1
•User-Agent:
VLC media player (LIVE555 Streaming Media v2005.11.10)
•
•
•uri中带有trackID=0,表示对该通道进行设置。Transport参数设置了传输模式,包
•
的结构。接下来的数据包头部第二个字节位置就是interleaved,它的值是每个通道都
•
不同的,trackID=0的interleaved值有两个0或1,0表示rtp包,1表示rtcp包,接受端
•
根据interleaved的值来区别是哪种数据包。
•
•服务器回应信息:
•RTSP/1.0
200 OK
•Server:
UServer
0.9.7_rc1
•Cseq: 3
•Session:
6310936469860791894 //服务器回应的会话标识符
•Cache-Control:
no-cache
•Transport:
RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=6B8B4567
•RTSP点播消息流程实例
•
•客户端:VLC
•
RTSP服务器:LIVE555
Media Server
•1)C(Client)->
M(Media Server)
•OPTIONS
rtsp://192.168.1.109/1.mpg RTSP/1.0
•CSeq: 1
•user-Agent:
VLC media player(LIVE555 Streaming Media v2007.02.20)
•
•1)M
-> C
•RTSP/1.0
200 OK
•CSeq: 1
•Date:
wed, Feb 20 2008 07:13:24 GMT
•Public:
OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE
•
•2)C
-> M
•DESCRIBE
rtsp://192.168.1.109/1.mpg RTSP/1.0
•CSeq: 2
•Accept:
application/sdp
•User-Agent:
VLC media player(LIVE555 Streaming Media v2007.02.20)
•
•2)M
-> C
•RTSP/1.0
200 OK
•CSeq: 2
•Date:
wed, Feb 20 2008 07:13:25 GMT
•Content-Base:
rtsp://192.168.1.109/1.mpg/
•Content-type:
application/sdp
•Content-length:
447
•v=0
•o
=- 2284269756 1 IN IP4 192.168.1.109
•s=MPEG-1
or 2 program Stream, streamed by the LIVE555 Media Server
•i=1.mpg
•t=0
0
•a=tool:LIVE555
Streaming Media v2008.02.08
•a=type:broadcast
•a=control:*
•a=range:npt=0-66.181
•a=x-qt-text-nam:MPEG-1
or Program Stream, streamed by the LIVE555 Media Server
•a=x-qt-text-inf:1.mpg
•m=video
0 RTP/AVP 32
•c=IN
IP4 0.0.0.0
•a=control:track1
•m=audio
0 RTP/AVP 14
•c=IN
IP4 0.0.0.0
•a=control:track2
•
•3)C
-> M
•SETUP
rtsp://192.168.1.109/1.mpg/track1 RTSP/1.0
•CSeq: 3
•Transport:
RTP/AVP; unicast;client_port=1112-1113
•User-Agent:
VLC media player(LIVE555 Streaming Media v2007.02.20)
•
•3)M
-> C
•RTSP/1.0
200 OK
•CSeq: 3
•Date:
wed, Feb 20 2008 07:13:25 GMT
•Transport:
RTP/AVP;unicast;destination=192.168.1.222;source=192.168.1.109;client_port=1112-1113;server_port=6970-6971
•Session:
3
•
•4)C
-> M
•SETUP
rtsp://192.168.1.109/1.mpg/track2 RTSP/1.0
•CSeq: 4
•Transport:
RTP/AVP; unicast;client_port=1114-1115
•Session:
3
•User-Agent:
VLC media player(LIVE555 Streaming Media v2007.02.20)
•
•4)M
-> C
•RTSP/1.0
200 OK
•CSeq: 4
•Date:
wed, Feb 20 2008 07:13:25 GMT
•Transport:
RTP/AVP;unicast;destination=192.168.1.222;source=192.168.1.109;client_port=1114-1115;server_port=6972-6973
•Session:
3
•
•5)C
-> M
•PLAY
rtsp://192.168.1.109/1.mpg/ RTSP/1.0
•CSeq: 5
•Session:
3
•Range:
npt=0.000-
•User-Agent:
VLC media player(LIVE555 Streaming Media v2007.02.20)
•
•5)M
-> C
•RTSP/1.0
200 OK
•CSeq: 5
•Range:
npt=0.000-
•Session:
3
•RTP-Info:
url=rtsp://192.168.1.109/1.mpg/track1;seq=9200;rtptime=214793785,url=rtsp://192.168.1.109/1.mpg/track2;seq=12770;rtptime=31721



沒有留言:
張貼留言