Show Menu
TOPICS×

Set up the MediaPlayer

A MediaPlayer object encapsulates the behavior and functionality of a media player.
  1. Instantiate a MediaPlayer using the following:
    var player = new AdobePSDK.MediaPlayer();
    
    
  2. Create a MediaPlayerView instance:
    var view = new AdobePSDK.MediaPlayerView(container);
    
    
    where container is the target div element that contains your HTMLMediaElement .
    For example, on an HTML page:
    <div id="videoDiv"> 
    <codeph>
      <div id="video-controls"> 
           ... custom video controls 
      </div> 
    </codeph> 
    </div>
    
    
    Call:
    var view = new  
    <codeph>
    AdobePSDK.MediaPlayerView 
    </codeph>( 
          document.getElementById("videoDiv"));  
    
    
  3. Attach your MediaPlayerView instance to your MediaPlayer instance:
    player.view = view;
    
    
  4. Attach the custom controls div element to your MediaPlayer instance.
    For example, in HTML:
    <div id="videoDiv"> 
       <div id="video-controls"> 
          ..... custom video controls 
       </div> 
    </div>
    
    
    Call:
    if (typeof player.getView() !== 'undefined') { 
        var view = player.view; 
        view.attachVideoControls(document.getElementById("video-controls")); 
    }
    
    
The MediaPlayer instance is now available and properly configured to display video content on the device screen.