使用 hifree 應用程式,觀察其播放媒體的方式,分別使用哪種協議。
一、選擇"頻道"撥放
其作法是直接下載整首歌曲後播放,並非使用RTSP協議。
1. hifree 先向伺服器取得歌曲清單
[truncated] GET /get_channel_song.php?enc=u&oenc=kkt&hw_vendor=kkbox&hw_model=fttx&sid=V0000a.739500000000000000000000000000AbED05335PoQDS001Fn6Jjc9e1&ksid=V0000a.739500000000000000000000000000AbED05335PoQDS001Fn6Jjc9e1&kkid=KKBOX-VZQSCFAG
User-Agent: KKBOX air(Get Song List)\r\n
Host: api.kkbox.com.tw\r\n
Cookie: PPHPSESSID=267759049478910113475\r\n
2. hifree 要求取得使用者選擇的歌曲(此時並沒有使用 RTSP)
[truncated] GET /kkbox/cht/v1/NSP9rz404KNLZIR1GHEux0P4.wma?enc=u&oenc=kkt&hw_vendor=kkbox&hw_model=fttx&sid=V0000a.739500000000000000000000000000AbED05335PoQDS001Fn6Jjc9e1&ksid=V0000a.739500000000000000000000000000AbED05335PoQDS001Fn6Jjc9e
Connection: Keep-Alive\r\n
Host: 210.61.218.49\r\n
3. 伺服器回歌曲
HTTP/1.1 200 OK\r\n
Content-Length: 4651681\r\n
Content-Type: audio/mpeg\r\n
Content-Diposition: attachment; filename="311701_2_r2_v1.mp3"\r\n
二、選擇"廣播" 撥放
其作法是使用 HTTP Get 方式,利用 chunked encoding 方式,透過多個HTTP封包,取得欲撥放的資料。整個過程實際上是根據 Windows Media HTTP Streaming Protocol Specification 運作。
1.試著使用 RTSP over TCP 連線,試了三個不同的 IP 都失敗
2. 利用 HTTP 取得封包( [MS-WMSP])
GET /RA000038 HTTP/1.1
Accept: */*
User-Agent: NSPlayer/12.0.7601.17514
Host: bcr.media.hinet.net
X-Accept-Authentication: Negotiate, NTLM, Digest, Basic
Pragma: version11-enabled=1
Pragma: no-cache,rate=1.000,stream-time=0,stream-offset=0:0,packet-num=4294967295,max-duration=0
Pragma: packet-pair-experiment=1
Pragma: pipeline-experiment=1
HTTP/1.1 200 OK
Pragma: packet-pair-experiment=1, no-cache, pipeline-experiment=1, client-id=900276797, xResetStrm=1, features="broadcast", timeout=60000
Content-Type: application/vnd.ms.wms-hdr.asfv1
Server: Cougar/9.6.7600.16564
Content-Length: 7709
GET /RA000038 HTTP/1.1
Accept: */*
User-Agent: NSPlayer/12.0.7601.17514
Host: bcr.media.hinet.net
Pragma: no-cache
Pragma: pipeline-request=1
Pragma: client-id=900276797
Connection: keep-alive
HTTP/1.1 200 OK
Server: Cougar/9.6.7600.16564
Date: Mon, 04 Jun 2012 07:56:10 GMT
Pragma: no-cache, client-id=900276797, features="broadcast", timeout=60000
Cache-Control: no-cache, x-wms-stream-type="broadcast"
Last-Modified: Sat, 30 Dec 1899 00:00:00 GMT
Transfer-Encoding: chunked
Supported: com.microsoft.wm.srvppair, com.microsoft.wm.sswitch, com.microsoft.wm.predstrm, com.microsoft.wm.fastcache, com.microsoft.wm.startupprofile
GET /RA000038 HTTP/1.1
Accept: */*
User-Agent: NSPlayer/12.0.7601.17514
Host: bcr.media.hinet.net
X-Accept-Authentication: Negotiate, NTLM, Digest, Basic
Pragma: version11-enabled=1
Pragma: no-cache,rate=1.000,stream-time=0,stream-offset=4294967295:4294967295,packet-num=4294967295,max-duration=0
Pragma: xPlayStrm=1
Pragma: client-id=900276797
Pragma: LinkBW=2147483647, AccelBW=2147483647, AccelDuration=18000
Supported: com.microsoft.wm.srvppair, com.microsoft.wm.sswitch, com.microsoft.wm.predstrm, com.microsoft.wm.startupprofile
Pragma: playlist-gen-id=2239130
Pragma: xClientGUID={3300AD50-2C39-46c0-AE0A-85B3343DBEA0}
Pragma: stream-switch-count=2
Pragma: stream-switch-entry=ffff:1:0 ffff:2:2
Accept-Language: en-us, *;q=0.1
HTTP/1.1 200 OK
Content-Type: application/x-mms-framed
Server: Cougar/9.6.7600.16564
Date: Mon, 04 Jun 2012 07:56:10 GMT
Pragma: no-cache, client-id=900276797, features="broadcast", timeout=60000, AccelBW=3500000, AccelDuration=18139, Speed=1.000
Cache-Control: no-cache, x-wms-stream-type="broadcast"
Last-Modified: Sat, 30 Dec 1899 00:00:00 GMT
Transfer-Encoding: chunked
...
三、選擇"MV" 撥放,此處也是使用 [MS-WMSP] 的協議
GET /hichannelmv/20120411/13087_2000.wmv?hichF74058A9-EC6C-4026-B273-28B3752FC2D0 HTTP/1.1
Accept: */*
User-Agent: NSPlayer/12.0.7601.17514
Host: wms.media.hinet.net
X-Accept-Authentication: Negotiate, NTLM, Digest, Basic
Pragma: version11-enabled=1
Pragma: no-cache,rate=1.000,stream-time=0,stream-offset=0:0,packet-num=4294967295,max-duration=0
Pragma: packet-pair-experiment=1
Pragma: pipeline-experiment=1
Supported: com.microsoft.wm.srvppair, com.microsoft.wm.sswitch, com.microsoft.wm.predstrm, com.microsoft.wm.startupprofile
Pragma: xClientGUID={3300AD50-2C39-46c0-AE0A-73DC9EBC7F9B}
Accept-Language: zh-TW, *;q=0.1
HTTP/1.1 200 OK
Pragma: packet-pair-experiment=1, no-cache, pipeline-experiment=1, client-id=2781389862, xResetStrm=1, features="seekable,stridable", timeout=60000
Content-Type: application/vnd.ms.wms-hdr.asfv1
Server: Cougar/9.5.6001.18281
Content-Length: 7963
Date: Mon, 04 Jun 2012 09:10:10 GMT
Cache-Control: no-cache, x-wms-content-size=56758879, max-age=86399, user-public, must-revalidate, proxy-public, proxy-revalidate
Last-Modified: Tue, 10 Apr 2012 06:40:20 GMT
Etag: "56758879"
Supported: com.microsoft.wm.srvppair, com.microsoft.wm.sswitch, com.microsoft.wm.predstrm, com.microsoft.wm.fastcache, com.microsoft.wm.startupprofile
GET /hichannelmv/20120411/13087_2000.wmv?hichF74058A9-EC6C-4026-B273-28B3752FC2D0 HTTP/1.1
Accept: */*
User-Agent: NSPlayer/12.0.7601.17514
Host: wms.media.hinet.net
X-Accept-Authentication: Negotiate, NTLM, Digest, Basic
Pragma: version11-enabled=1
Pragma: no-cache,rate=1.000,stream-time=0,stream-offset=4294967295:4294967295,packet-num=4294967295,max-duration=0
Pragma: xPlayStrm=1
Pragma: client-id=2781389862
Pragma: LinkBW=2147483647, AccelBW=2147483647, AccelDuration=18000, Speed=912.67
Supported: com.microsoft.wm.srvppair, com.microsoft.wm.sswitch, com.microsoft.wm.startupprofile
Pragma: playlist-seek-id=117280
Pragma: xClientGUID={3300AD50-2C39-46c0-AE0A-73DC9EBC7F9B}
Pragma: stream-switch-count=2
Pragma: stream-switch-entry=ffff:1:0 ffff:2:0
Accept-Language: zh-tw, *;q=0.1
HTTP/1.1 200 OK
Content-Type: application/x-mms-framed
Server: Cougar/9.5.6001.18281
Date: Mon, 04 Jun 2012 09:10:12 GMT
Pragma: no-cache, client-id=2781389862, features="seekable,stridable", timeout=60000, AccelBW=3500000, AccelDuration=18000, Speed=1.731
Cache-Control: no-cache, x-wms-content-size=56758879, max-age=86397, user-public, must-revalidate, proxy-public, proxy-revalidate
Last-Modified: Tue, 10 Apr 2012 06:40:20 GMT
Etag: "56758879"
Transfer-Encoding: chunked
X-StartupProfile: Rate=10,12,15,20,30;MaxBytes=49713,9953,5161,5161,5161;Time=8108,266,0,0,0;StartTime=3000;LastTime=17951;MaxDiffTime=8544;MaxDiffSndTime=2108;ByteRate=248783,219443,252607,252607,252607;
Supported: com.microsoft.wm.srvppair, com.microsoft.wm.sswitch, com.microsoft.wm.predstrm, com.microsoft.wm.fastcache, com.microsoft.wm.startupprofile
參考資料
1. Windows Media HTTP Streaming Protocol Specification
2. application/x-mms-framed