使用ALVideoPlayerSurface制作視頻播放器


頭兩天介紹了開源控件包alcinoe,現在利用其中的ALVideoPlayerSurface視頻播放控件,實作一個視頻播放器。

首先,建一個fmx項目,然后從組件面版,拖放一個TAlVideoPlayerSurface組件。

設置對齊方式為Client,占整個窗大小,然后再放一個Button,實現Click事件:

procedure TForm3.Button1Click(Sender: TObject);
begin

    if ALVideoPlayerSurface1.VideoPlayer.state in [vpsIdle] then begin
      ALVideoPlayerSurface1.VideoPlayer.setLooping(true);
     ALVideoPlayerSurface1.VideoPlayer.prepare('http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4', True{AutoStartWhenPrepared}); // << no sound on ios, don't know why :(
    end;

end;

在Libraries中,增加三個jar庫:

這三個庫在alcinoe組件的lib目錄中,如D:\Component\alcinoe\lib\jar。

最后,我們還要使用作者修改的Delphi官方源代碼,這個代碼在下面這個目錄

D:\Component\alcinoe\demos\ALFmxControls\_source\embarcadero\tokyo

手工將這個目錄加入到項目的Search path中:

編譯並運行,可以正常播放視頻了,效果沒得說。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM