我想從MPMoviePlayer(例如:http://localhost/api?file_id=2313mk)從URL播放視頻(MP4)文件,但無法讓它工作,想知道是否有任何解決方案。MPMoviePlayer無法播放沒有擴展名的URL的視頻流
很少試驗如下進行:
1)在計算機的瀏覽器Play網址:SUCCESS
2)在iPhone上播放URL(4.2+)的瀏覽器/ MPMoviePlayer:FAILED
3)複製文件和重命名,然後在iPhone瀏覽器中播放/ MPMoviePlayer從擴展新的URL(如:http://localhost/video.mp4):成功
4)檢查頭的內容類型(視頻/ MP4):EXISTS
爲無擴展URL響應頭:(例如:HTTP://本地主機/ API的file_id = 2313mk)
HTTP/1.1 200 Download accepted Date: Tue, 29 Mar 2011 04:48:03 GMT Server: Apache Content-Transfer-Encoding: binary Content-Length: 24897567 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: video/mp4
與擴展URL響應頭:(例如:HTTP://localhost/video.mp4 )
HTTP/1.1 200 OK Date: Tue, 29 Mar 2011 04:11:19 GMT Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8l DAV/2 PHP/5.3.4 Last-Modified: Fri, 18 Mar 2011 05:38:16 GMT Etag: "d1b78c-17be81f-49ebb2f458200" Accept-Ranges: bytes Content-Length: 24897567 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: video/mp4
它實際上適用於mp3格式,如果服務器的url(例如:http:// localhost/api?file_id = 2313mk)返回mp3 – alvinsj 2011-03-30 04:11:42