Swift 使用ijkplayer架構播放直播視頻2(RTSP視頻流播放)

來源:互聯網
上載者:User

我介紹了 ijkplayer 架構的配置和使用。當時使用的是 ijkplayer 預設的編譯配置,也就是精簡配置。這種編譯出來的包比較小,也支援大多數的視頻格式。比如前文的 RTMP 或 HTTP 協議的直播視頻都是可以播放的。

但有時我們需要支援更多的視頻類型(比如做 RTSP 協議的ApsaraVideo for Live),那麼就需要修改預設的編譯配置。

1,將Ijkplayer項目下載到本地,這個就不多說了

git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-ios

2,在整合ffmpeg之前,需要先修改預設的module.sh

原來使用的是 module-lite.sh,這裡改成 module-default.sh


cd ijkplayer-ios
cd config
rm module.sh
ln -s module-default.sh module.sh
cd ..
cd ios
sh compile-ffmpeg.sh clean

3,接下來的整合ffmpeg同之前的一樣


cd ijkplayer-ios
git checkout -B latest k0.6.0
 
./init-ios.sh
 
cd ios
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all

4,framework編譯、項目配置這些也是和前文一樣。這裡就不多說了

5,這裡使用前文的範例做測試
把地址改成 RTSP 視頻地址(rtsp://218.204.223.237:554/live/1/66251FC11353191F/e7ooqwcfbqjoo80j.sdp)
可以看到視頻播放成功:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.