Set up the MediaPlayer

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(;

    Below is the code snippet to create _viewGroup.

     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:


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

On this page