Google Exoplayer 之全面認識

2021-08-16 19:12:19 字數 4307 閱讀 8877

**:

demo - 演示類庫的使用

支援高階 hls (http live streaming)功能,如正確處理 #ext-x-discontinuity的標籤。

能夠無縫融合,串聯和迴圈**資源。

支援定製和擴充套件,exoplayer是考慮到這一點而設計的,並允許許多部件與定製實現替換。

更新起來更方便

裝置通用性更強

支援在android 4.3(api級別18)和更高的widevine通用加密。

2library overview

建立乙個 ******exoplayer 例項

repositories
compile 'com.google.android.exoplayer:exoplayer:r2.x.x'
// 1. create a default trackselector

handler mainhandler = new handler();

bandwidthmeter bandwidthmeter = new defaultbandwidthmeter();

trackselection.factory videotrackselectionfactory =

new adaptivevideotrackselection.factory(bandwidthmeter);

trackselector trackselector =

new defaulttrackselector(mainhandler,

videotrackselectionfactory);

// 2. create a default loadcontrol

loadcontrol loadcontrol = new defaultloadcontrol();

// 3. create the player

******exoplayer player =

exoplaye***ctory.new******instance(context,

trackselector, loadcontrol);

5attaching the player to a view
******exoplayerview.setplayer(player);

// measures bandwidth during playback. can be null if not required.

defaultbandwidthmeter bandwidthmeter = new defaultbandwidthmeter();

// produces datasource instances through which media data is loaded.

datasource.factory datasourcefactory = new defaultdatasourcefactory(

// produces extractor instances for parsing the media data.

extractorsfactory extractorsfactory = new defaultextractorsfactory();

// this is the mediasource representing the media to be played.

mediasource videosource = new extractormediasource(mp4videouri,

datasourcefactory, extractorsfactory, null, null);

// prepare the player with the source.

player.prepare(videosource);

mediasource videosource = new extractormediasource(videouri, ...);

mediasource subtitlesource =

new singlesamplemediasource(subtitleuri, ...);

// plays the video with the sideloaded subtitle.

mergingmediasource mergedsource =

new mergingmediasource(videosource, subtitlesource);

mediasource source = new extractormediasource(videouri, ...);

// loops the video indefinitely.

loopingmediasource loopingsource = new loopingmediasource(source);

mediasource firstsource = 

new extractormediasource(firstvideouri, ...);

mediasource secondsource =

new extractormediasource(secondvideouri, ...);

// plays the first video, then the second video.

concatenatingmediasource concatenatedsource =

new concatenatingmediasource(firstsource, secondsource);

mediasource firstsource = 

new extractormediasource(firstvideouri, ...);

mediasource secondsource =

new extractormediasource(secondvideouri, ...);

// plays the first video twice.

loopingmediasource firstsourcetwice =

new loopingmediasource(firstsource, 2);

// plays the first video twice, then the second video.

concatenatingmediasource concatenatedsource =

new concatenatingmediasource(firstsourcetwice, secondsource);

// loops the sequence indefinitely.

loopingmediasource compositesource =

new loopingmediasource(concatenatedsource);

mediasource firstsource = 

new extractormediasource(firstvideouri, ...);

mediasource secondsource =

new extractormediasource(secondvideouri, ...);

// plays the first video twice, then the second video.

concatenatingmediasource concatenatedsource =

new concatenatingmediasource(

firstsource, firstsource, secondsource);

// loops the sequence indefinitely.

loopingmediasource compositesource =

new loopingmediasource(concatenatedsource);

如果自定義元件需要向應用程式發布事件,我們建議您一定要使用現有的 exoplayer 元件模型,在構造元件的時候同時傳遞***和 handler

我們建議的自定義元件使用現有 exoplayer 元件相同的模型,允許在playback 的過程中重新配置。要做到這一點,就需要實現exoplayercomponent 介面,並在 handlemessage 方法中處理接收到的配置改變資訊。您的應用程式應該呼叫 exoplayer 的 sendmessages和blockingsendmessages 方法來傳遞改變的配置資訊。

CentOS7之ssh Xshell金鑰認證登陸

作業系統版本 centos linux release 7.2.1511 core ssh版本 openssh 6.6.1p1,openssl 1.0.1e fips 1.開啟xshell工具,點選 工具 選擇 新建使用者金鑰生成嚮導 如圖所示 2.選擇金鑰型別為 rsa 金鑰長度為 1024 如圖...

IK FK之全面了解

很久以前就想寫這麼乙個帖子,但是覺得要寫起來需要配圖比較麻煩,但是又經常看到有人對ik fk有錯誤的認識。所以決定還是開始寫,慢慢去完善和補充。我想這個帖子看下來,應該可以讓美術以及不了解ik fk的技術美術有個正確的概念。ik是inverse kinematics,逆向運動或者叫反向運動。與之相對...

好萊客原態系列板材全面公升級,多國檢測共同認證!

2020年伊始,好萊客原態5.0全新上市,實現從板材環保到空間環保的躍級。與此同時,原態系列獲得多國權威檢測機構共同認證,在家居環保的道路上更進一步。原態系列板材是經過國家林業局南京人造板質量監督檢測站 日本工業標準 jis 檢測機構 美國加州空氣資源委員會 美國環境保護署和瑞士sgs等多國權威檢測...