Enable video playback

Create a PlaybackManager that handles the HLS stream setup and playback operation. No other configuration is required.

  1. Create the media player object by making sure the following code exists in PlayerFragment.java:

    private MediaPlayer createMediaPlayer() { 
            MediaPlayer mediaPlayer = DefaultMediaPlayer.create(getActivity().getApplicationContext()); 
            return mediaPlayer;
    
  2. Create the playback manager through the ManagerFactory:

    playbackManager = ManagerFactory.getPlaybackManager(config, mediaPlayer);
    
  3. Implement the PlaybackManagerEventListener in the PlayerFragment to handle the playback events:

    private final PlaybackManagerEventListener playbackManagerEventListener =  
      new PlaybackManagerEventListener() 
    
  4. Register the event listener in the PlayerFragment:

    playbackManager.addEventListener(playbackManagerEventListener);
    
  5. Set up the video resource:

    playbackManager.setupVideo(url, adsManager); 
    
  6. Set up the control bar operations in the PlayerFragment:

    controlBar.pressPlay() { 
        playbackManager.play();  
    }
    
    

On this page

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