PlayerFragment

您可在PlayerFragment類別中編輯程式碼,以建立全功能管理員。

PlayerFragment類別包含所有UI元件,例如playerFrameControlBarplayerClickableAdFragmentadOverlay

它可處理所有這些元件的初始化,以及建立播放器、設定檢視、建立媒體播放器的功能管理程式、處理媒體事件,例如繼續、播放和暫停,並處理QoSManagerDRMManagerCCManagerAAManagerAdsManagerPlaybackManagerEntitlementManager的事件監聽程式。

包含PlayerFragment配置參數的XML檔案為res/layout/fragment_player.xml

在建立功能管理員之前,您必須先確定PlayerFragment.java檔案中包含下列程式碼,以建立媒體播放器:

private MediaPlayer createMediaPlayer() { 
  MediaPlayer mediaPlayer =  
    DefaultMediaPlayer.create(getActivity().getApplicationContext()); 
  return mediaPlayer; 
}

本頁內容

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now