Set up the Media player

TVSDK provides tools for creating an advanced video player application (your Primetime player), that you can integrate with other Primetime components. It also provides a number of features designed to maximize the quality of video playback.

Instantiate a MediaPlayer and place a view of it into a frame layout.

  1. Instantiate MediaPlayer, passing an android.content.Context object to the constructor:

    MediaPlayer mediaPlayer = new MediaPlayer(context);
    
  2. Provide a frame layout ( android.widget.FrameLayout) to hold a ViewGroup of mediaPlayer:

    FrameLayout playerFrame = (FrameLayout) _viewGroup.findViewById(R.id.playerFrame);
    
    NOTE

    Below is the code snippet to create _viewGroup.

    @Override 
     public ViewGroup onCreateView(LayoutInflater inflater, ViewGroup container, 
       Bundle savedInstanceState) { 
      _viewGroup = (ViewGroup) inflater.inflate( 
        R.layout.fragment_player, container, false); 
      return _viewGroup; 
     }
    
  3. Place a view of mediaPlayer inside the frame layout:

    playerFrame.addView(mediaPlayer.getView());
    
    NOTE

    The MediaPlayer instance ( mediaPlayer) is now available and properly configured to display video content on the device screen.

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