Dynamic Theming with the Open Standard Media Player PHP Library

Before you read this article, it is important that you first take a look at the prerequisites

The Open Standard Media Player PHP library is very powerful in that it allows you to dynamically theme the media player by literally writing the HTML code for you. This allows you to quickly customize the look and feel of your media player on the page. Below are some parameters that can be used to dynamically theme your media player when you create the OSMPlayer object.

Dynamic Theming Parameters

Below are a list of the parameters that you can use to dynamically theme the Open Standard Media Player.

  • width - To set the width of the player on the page.
  • height - To set the height of the player on the page.
  • theme - The ThemeRoller theme to use for this player.
  • template - Allows you to provide a different template found in the templates folder.
  • vertical - Specify if you wish the playlist to be horizontal ( false ) or vertical ( true ).
  • logo - The URL of a different image to use as the logo for the player.
  • logopos - The quadrant for the logo to reside. Possible options: "sw", "se", "nw", "ne"
  • logowidth - The scaled width of the logo.
  • logoheight - The scaled height of the logo.
  • logox - The x-offset of the logo to the nearest vertical edge.
  • logoy - The y-offset of the logo to the nearest horizontal edge.
  • showController - If you wish to show the control bar or not.
  • showPlaylist - To hide / show the playlist at the start.
  • disablePlaylist - To completely disable the playlist, like when you just wish to play a single media file.
  • playlistOnly - If you ONLY want to show the playlist, like when you wish to connect a remote playlist to a media player.
  • controllerOnly - If you would only like to see the controller. This is used for Remote Control functionality.
  • showNodeVoter - Used to hide / show the node voter ( needs a voting service to work ).
  • showTeaserVoter - Used to hide / show the teaser voter ( needs a voting service to work ).
  • showTitleBar - Used to hide / show the title bar.

Example 1: Make the playlist horizontal

The following will make the playlist horizontal.

<?php
  
include("OSMPlayer.php");
  
$player = new OSMPlayer(array(
     
'vertical'=> false,
     
'playlist' => 'playlist.xml'
  
));
?>

<html>
   <head>
      <title>Open Standard Media (OSM) Player: PHP Demo</title>
      <script type="text/javascript" src="jquery-ui/js/jquery.js"></script>
      <?php print $player->getHeader(); ?>
   </head>
   <body>
      <h2>Open Standard Media (OSM) Player</h2><br/>
      <?php print $player->getPlayer(); ?>
   </body>
</html>

Example 2: To completely disable the playlist and only show the node region.

<?php
  
include("OSMPlayer.php");
  
$player = new OSMPlayer(array(
     
'disablePlaylist'=> true,
     
'file' => 'http://www.mysite.com/files/myvideo.flv'
  
));
?>

<html>
   <head>
      <title>Open Standard Media (OSM) Player: PHP Demo</title>
      <script type="text/javascript" src="jquery-ui/js/jquery.js"></script>
      <?php print $player->getHeader(); ?>
   </head>
   <body>
      <h2>Open Standard Media (OSM) Player</h2><br/>
      <?php print $player->getPlayer(); ?>
   </body>
</html>

Sponsors