Using the Dash Media Player within Drupal CMS

You have chosen wisely, my friend... Using Drupal CMS with the Dash Player is by far the most flexible and powerful combination that you will not find elsewhere. The only drawback to this approach is that the setup is a little bit more tedious than using the other approach, but trust me, the payoff is much worth it. Also keep in mind that TMT Digital offers an integration service. If you would like to use Drupal CMS for your Dash Player, and don't feel like reading all these tutorials, then by all means contact us at http://www.tmtdigital.com/contact and we will be more than happy to assist you.

If you are more than willing to learn first hand, then by all means... lets get started.

Dash Player in Drupal CMS: Step-By-Step Tutorial

To begin this tutorial, it is assumed that you already have the Drupal CMS installed on your web server. If you need help with this crucial step, then I suggest reading the following tutorial. So, lets begin with the installation of the necessary modules needed for the Dash Player.

Also keep in mind that TMT Digital provides a Complete Integration Service. We would love to take care of whatever needs you have to get your project off the ground.

Please click on the topics below...

Install the required Drupal Modules

To use the Dash Player in the Drupal System, it is required that you install 3 different modules, the Services Module, AMFPHP, and the Dash Player Module. The Services module is a fantastic module that interfaces a remoting gateway for your Drupal CMS. Basically what this means is that it allows outside components to remotely call functions in your Drupal system to retrieve information. This is how the Dash Player communicates to your Drupal CMS. Using this method provides a number of benefits not available in other commercial players, which makes this player very unique. So, lets begin by following the following steps...

Install Required Modules

  • Download the Services Module by clicking on the link provided.
    • IMPORTANT NOTE:. If you are using PHP4, you will not be able to use the latest version of Services. PHP4 does not include a required function to allow for the latest Services module. If anyone is using PHP4, you must use the older version of Services which is

      Old Services for Drupal 6: http://ftp.drupal.org/files/projects/services-6.x-0.11.tar.gz
      Old Services for Drupal 5: http://ftp.drupal.org/files/projects/services-5.x-0.91.tar.gz

      After you do this, you will then need to provide the api key with the parameters that you pass to the DMP like the following... Keep in mind that the following code is only used if you are using the older version of Services.

      <?php
      $params
      ['width'] = 652;
      $params['height'] = 432;
      $params['playlist'] = 'videos';
      $params['api'] = 1;
      print
      dashplayer_get_player($params);
      ?>
  • Extract this module and place it in your modules directory.
  • The next module that you will need is the AMFPHP module needed to use the fantastic and highly recommended AMFPHP remoting gateway. You can download this module by going to http://www.drupal.org/project/amfphp. Important: If you are using Drupal 6, you may have noticed that there is currently no AMFPHP. Don't fret, you can just use the AMFPHP that I use by downloading it here.
  • Now before you install both of these module in your Drupal system, you will also need to download the AMFPHP services gateway. This is required by AMFPHP module to work properly. You can download this gateway by going to http://sourceforge.net/project/showfiles.php?group_id=72483. Once you have downloaded this package, you will need to extract it, and then place all of that code in the modules/amfphp/amfphp directory.
  • Our next step is to download the Dash Player module and place that in your modules directory. You can get the Dash Player Module at http://www.drupal.org/project/dashplayer.
  • Now that you have the code in the right place, the next step is to install these modules in your Drupal Administrator. You will need to install the following...
    • Services
    • AMFPHP
    • Node Service
    • System Service
    • Views Service
    • Voting Service (if you wish to have dash player voting)
    • DASH Player

Install Support Modules

This next step is really depending on what your requirements are... For our example, I wish to show videos in my player, have voting capabilities within the player, as well as keep track of the view counter. For this example, we will use the following Drupal Modules to achieve this. Download and install the following modules...

  • Views (this is required if you want to have a playlist)
  • FlashVideo (for video)
  • Upload Module (comes with Drupal)
  • Voting API (if you wish to have voting capabilities
  • FiveStar (for showing the ranking of our videos without the player).
  • Statistics Module (comes with Drupal) - Use this if you wish to keep track of utilize the view counter.

Once you have these installed, you are ready to move onto the next steps...

Download and install the Dash Player in Drupal

To install the Dash Player for use in the Drupal System, you must first download the latest version at http://www.tmtdigital.com/project/dash_player. You can click on the download link at the bottom of the page.

Once you have the package downloaded, you should extract the file on your local hard drive. In this file you will see the following...

  • dashPlayer.swf - The actual video player that does all the magic
  • README.txt - A readme file that directs you to come here...
  • skins(directory) - A directory of any skins used for the Dash Player.
  • config (directory) - A configuration directory. We will go over this later.

Basically the next step after you download and extract the file is to place the contents on your server within the root of your Drupal install (the root of the Drupal files is where the index.php file is...). To keep everything as simple as possible and for clarity sake, I will go ahead and say to create a "player" folder in your root directory of your Drupal install and place the contents of this package in there... So basically, your directory structure should look like the following.

  • Drupal Root Directory
    • player
      • dashPlayer.swf
      • skins (directory)
      • config (directory)



Now that you have the files in the right place, the next step is to go into your Drupal Administrator under "Dash Player" and set the correct path for the Dash Player SWF file. For our example, we would provide http://{yoursite}/player/dashPlayer.swf, and of course, replace {yoursite} with the URL of your domain. This will then set up the Dash Player API to point correctly to your player.

Now that you have completed these steps, it is time to move onto the next part... Configuring the Services Module and Dash Player to show your content!

Configure the Services Module and the Dash Player

This next step is VERY important... In order to get the Dash Player to work with the Services Module, you must first configure the Services for an outside component to communicate... Please follow these steps to configure your services module correctly.

  • Once you have the services module installed, the next step is to allow all users to use the Services module. You do this by going to your Administrator section under Permissions (which is called Access Control in Drupal 5)
  • Once you are in the permissions section, you will then look for the access services, load any node data, load own node data (for Drupal 5, these are called load raw node data), and access all views (if you are using playlist support) permissions. Make sure that ALL the checkboxes are checked next to these permissions.
  • Now press the Save Permissions button at the bottom of the page.
  • The next step is to make sure that your player's path is correct in the Dash Player Settings in the Administrator section. You do this by simply going to the Dash Player Settings and make sure that the path is correct. You can change it at will.
  • The next step is to go to your Administer >> Services section.
  • Once you are there, you will need to create an API Key which the Dash Player will use to make its connection to your system. You do this by clicking on the "Keys" tab when you are viewing the Services Administrator section. Then you need to click on the link that says Create Key.
  • From there, you will then just put your domain in where it asks for the Domain (be sure to include the www) and then press the Accept button. The following are a list of sample Drupal Roots to Allowed domain values...
    Drupal root Allowed Domain
    http://www.mysite.com www.mysite.com
    http://mysite.com mysite.com
    http://www.mysite.com/subdir www.mysite.com/subdir
    http://mysite.com/subdir mysite.com/subdir
    http://localhost localhost
    http://localhost/subdir localhost/subdir
  • This will then create a new API Key which your Player will use to make its connection
  • Your next step is to highlight the API Key and then copy that to your clipboard (by pressing CTRL+C for Windows, and Apple+C for Macs).
  • Now that you have the API Key in your clipboard, your next step is to set up the configuration XML file for your player to associate with your Drupal Site. To do this, you will need to go to your Dash Player directory and look for the config directory. In there, you will (by default) open up the dashconfig.xml file.
  • Here you will see several keys along with some instructions on what data it needs to make its connection. First, go to the apiKey tag and then paste your clipboard into the contents of this tag. This should set the API Key to be the same as what your site is configured as...
  • After you have done this, you will then need to provide more information for your player, including the gateway and baseURL. These are as follows.
    • gateway - For our example is... http://{yoursite}/services/amfphp, where you would, of course, replace the {yoursite} with the URL of your site. IMPORTANT NOTE: If you do NOT have Clean URL's enabled, then your gateway will be different than described above... If this is the case, then you will need to add a ?q= to your gateway URL. For example, your gateway URL would be http://{yoursite}/?q=services/amfphp if you do not have Clean URL's enabled
    • baseURL - All you need to provide here is http://{yoursite} where the {yoursite} would be replaced with the URL of your domain name. You need to make sure that this matches up with what you provided as a domain for your API Key.
  • It is also recommended that you provide the Drupal version in the dashconfig.xml file. The reason is because the API is different between Drupal 5 and 6, and you will save about 1 second off your load time if you include the drupalversion in between your flashvars section. For example, if you are using Drupal 6, then you would need to provide the following in your dashconfig.xml file.
    <flashvars>
    <drupalversion>6</drupalversion>
    </flashvars>

    When you are finished setting up your dashconfig.xml file, it should look very similar to the following...
    <params>
       <license><!-- Enter your License here --></license>
       <gateway>http://www.mysite.com/services/amfphp</gateway>
       <apiKey>123456789012345678901234567890</apiKey>
       <baseURL>http://www.mysite.com</baseURL>
       <flashvars>
          <drupalversion>6</drupalversion>
       </flashvars>
    </params>



After you have done this, your player is now configured for your site. This next step is only if you wish to have the view counter work on your site... You can skip it if you like...

Enabling the View Counter on the Dash Player

  • You will first need to make sure that you have the Statistics module installed on your Drupal site. You do this by going to the Administer >> Modules section.
  • Once you have the Statistics module installed, you will then need to go to Administer >> Access Log Settings (close to the bottom left)
  • In here, you will need to make sure that you check on the radio button to enable Count Content Views
  • And your done!

Ok, you are ready to move onto the next step...

Create a Content Type for the Dash Player

Our next step is to create a new node type that you would like to use to show in the Dash Player. Depending on what media module you are using to create your media nodes, you might not have to do this step, but it is here if you need it. For our example, we are going to create a "video" node type which will let us upload videos and show them in the player.

The first step is to go to Administer >> Content Types
After you are there, we will want to create a new content type, so click on the link that says Add content type.

This will take you to a new page where you can then tell Drupal about the new content type that you would like to create. Since we are wanting videos, you will simply type "Video" for the name and "video" for the Type. You can leave the Description blank if you really want to.
Also, make sure that you have the Attachments checkbox checked to allow attachements to the node type.

From there, just go down to the bottom and press Save Content Type.

Now that you have set up the node type that you would like to use, the next step is to associate the FlashVideo module with this node type. You do this by following these steps...

  • Go to Administer >> FlashVideo Settings
  • Find your node type in the list given, and then click on the link that says FlashVideo Settings for this node type.
  • Once you are in there, you will simply do the following
    • Check Enable the FlashVideo for this Node Type
    • Check Require the FlashVideo for this node type.
    • Click on FFMPEG Settings, make sure all information is correct... You may need to change the "mp3" in ffmpeg command to "libmp3lame"
    • Now that you are finished, click on the Save Configuration button at the bottom

So you are now set up to upload videos. You can test this out by going to Create Content >> Video. You should see it ask for a "Video Upload". Go ahead and test it out by creating several different video nodes. After you have done this, you will then need to Run cron manually by going to the Administer >> Status Report and then clickin on Run cron manually.

After you are done with this, you are now ready to move onto the next step which is to set up the Views module.

Setup the Dash Player playlist using the Views Module

Now that you have a new "video" content type and have uploaded your videos, the next step is to set up a View of your video content to act as the playlist. Lets begin by going to Administer >> Views.

This next step differs whether you are using Views 2 (for Drupal 6) or Views version 1 (for Drupal 5). I will separate how to do both of these in the sections below... please pick the implementation that fits your version.

Setting up the Views module in Drupal 5

Once you are in the Views administrator section, you will then want to create a new view by clicking on the link that says Add. After the new view page comes up, please follow the following links to add a new view for your videos...

  • Under Name type videos
  • Expand Page and click Provide a Page View
  • Under View Type select Teaser List
  • Go down and expand the Filters section.
  • Under the Add new filter, you are going to select Node: Published and then click on the Add Filter button.
  • Now do that again, but this time, select Node: Type.
  • Once it adds the Node Type filter, you will want to then click on the "video"
  • Now go down to the bottom and click on the button that says Save

Setting up the Views 2 module in Drupal 6

Once you are in the Views administrator section, you will then want to create a new view by clicking on the link that says Add. After the new view page comes up, please follow the following links to add a new view for your videos...

  • Give your view a name.... for our case, it would be videos
  • Give it a short description... don't worry about the View tag, and then go down and press the Next button.
  • Now go over and press the + button next to the Filters section.
  • You will see something pop-up in the bottom of the screen.... Under Groups select Node
  • In the check-box, you will want to check Node: Type and then press the Add button.
  • Then you will want to select your node type that you are using for videos in the checkboxes, and then press Update.
  • Next, let's add a Field.... press the + next to the Field section.
  • Under groups, select Node, and then check the Node: Title and then press Add button... then press Update button.
  • You will then want to save your view by pressing the Save button below.


You can now use the parameter "playlist=videos" whenever you are embedding the video in your page... For example, this should now work...

<?php
   $params
['width'] = 652;
  
$params['height'] = 432;
  
$params['playlist'] = 'videos';
   print
dashplayer_get_player($params);
?>

If you do not know how to add this code to a page, then feel free to check out the next section...

Embedding the Dash Player in a page

Ok, now this is the fun part... seeing the result.

Click on Create Content >> Page.
Down in the body, you will then place the following code to show the Dash Player...

<?php
   $params
['width'] = 652;
  
$params['height'] = 432;
  
$params['playlist'] = 'videos';
   print
dashplayer_get_player($params);
?>

Basically what this is telling the dash player module API is to show the Dash Player with a width 652 and a height of 432 and to show the playlist which is denoted by the view you just created called "videos".

This, of course, is very basic compared to all the great filtering you can do using the Views module. Please check out the Advanced Topics section to learn more about how to create very smart playlists for your player.

If this does not work, then make sure you go down the Dash Player Checklist to see if you have done everything you need too... If you are still having trouble, then by all means place a topic in our help Forum

Advanced Topics

This section is dedicated to all the advanced functionality of the Dash Player.

Adding custom fields to the Dash Media Player using CCK

The Dash Player was written to be completely customized. One great feature that I added to this player is the ability to add your very own custom fields to the player using CCK. This allows you to add your own data to the player and show that information anytime that someone clicks on a teaser in the playlist. Below you will find the steps you need to add your very own fields to the Dash Media Player.

Adding a field using CCK

This step is fairly trivial. Let us suppose that we wish to not only show the title in the Dash Player, but would also like to have a description as well. To do this, let us first create a description field using CCK. Follow these steps to do this...

  • Go to Administer >> Content Types
  • Select the node type that you are using with your player and click on the Edit link
  • Next you will want to click on the Add Field in the links above.
  • For the field name, we will just type description, then select the Text Field for the field type.
  • If you are using Drupal 6, you will also need to type the Label which can just be Description
  • Go ahead and move onto the next step by pressing the Continue button.
  • In the next section, you can just keep all of the defaults the way that they are... so go ahead and press Save field settings button
  • Now, when you add a new video, you should see a new field called Description where you can add the video description

Adding the field to your skin

Our next task is to let the player load this data... we do this by simply creating a new text field in our skin file. To do this we will need to have Flash CS3 Professional
so that we can edit the skin provided in the download. Once you have Flash CS3, you are ready to start editing the Dash Media Player skin...

The first thing that you will need to do here is follow the tutorial at http://www.tmtdigital.com/node/140. Here it describes the steps to create your own skin. Once you have done that, you can do the following to add your custom CCK field to the player...

  • With the skin open in Flash CS3, you will need to navigate to the Movie Clip that holds the title of the main node or a teaser. The path to this is the following... dash/node/fields/values
  • Once you are in this Movie Clip (next to the title text field), you can then add ANY other text field and name the instance name after the field you just created using CCK. For our example, you would create a new Text Field, set the type as Dynamic Text, and then give it an instance of field_description. And that is it!!! Pretty easy, huh?


Controlling the Playlist Order (adding weight to nodes)

Because the Dash Player uses the Views Module to construct its playlist, so many options can be made to control how your playlist is views and filtered to your viewers. Lets suppose that you wish to have a sorting mechanism for your playlist by specifying a weight for each one of your nodes and wish the playlist to show them in that order... Fortunate for you, the Dash Player in conjunction with the Views and CCK modules, this can be done rather easily. So, below are the steps that you need to follow to allow your playlist to be sorted by your command.

Pre-requisites

This tutorial assumes that you already have a view set up to show your nodes... If you have not done this already then I highly suggest going to Setting up a playlist using the Views Module tutorial first. It is also assumed that you already have the Views Module, but there is one more module that you will need for this tutorial, and that is the amazing CCK (Content Construction Kit) Module. This module will allow us to create a special field in your media node type that we will use to sort your content. Once you have this module downloaded and installed, you are ready to move onto the next step.

Create a weight field for your node type

The first step that we will want to do is create a weight field for your node type. You do this by going to Administer >> Content Types and then clicking on your media type that you would like to add the weight too. Once you are there, you will then follow the following steps.

  • Click on the tab at the top of the page that says Add Field
  • Under Create new field, you will want to give your field the name weight
  • Next, you will select under Integer, Select list
  • Now, go down to the bottom and press Create Field
  • This will bring up some more things to fill out, you can keep the name the same.. weight
  • Check the box next to Required
  • Now go down to where it says PHP Code and enter the following...
    $values = array();
    for($i=-10; $i<11; $i++) {
      $values[$i] = $i;
    }
    return $values;

  • Once you have done that, you are now ready to save your field by clicking on Save field settings
  • You are now ready to set up your View

Setting up your view for node weights

The next and final step is to add this weight field in the Sort Criteria for your view. You do this by going to the view that you set up as your playlist and clicking on the Edit tab. Once you are ar in the edit section of your view, you will want to go down to the bottom where it says Sort Criteria. In the drop-down box, you will then want to select Integer: Weight (field_weight) and then press Add Criteria. And now you are done! You can then go and test this out by editing some of your media nodes and setting the weight value. You should then see them sort in your playlist based on the weight you provided!

Creating a Drupal MP3 player with the Dash Media Player

This tutorial will go over the steps to reproduce what I did in my Audio Showcase. Please note that this only applies for Drupal uses with the Dash Media Player.

 

Enable MP3 uploads to your Drupal website

  • The first step is to enable the upload of MP3 files. You can do this by going to Administer >> File Uploads, and then under Default permitted file extensions, you need to add the extension mp3
  • Also do the same thing in the Settings for ... for any other user roles that you have in your system.

Enable the required Drupal Modules

The next step is to install all the modules used in this tutorial. Make sure you install the following...

Create the Audio Content Type

  • The next thing you will need to do is create a node type that will house your Audio nodes. You can do this by using CCK module. Once you have this module installed, you can then go to Administer >> Content Types, and then click on the link that says Add Content Type.
  • You will want to give your new content type a Name of "Audio" and a Type of "audio".
  • Now make sure you go down to where it says Attachments and then make sure you enable attachments for this node type.
  • Now go down to where it says Image Attach and make sure you enable the attachment of images to your audio node. This will make it so that you can add album art to your music.
  • Now go down and press Save Content Type

Set up your Audio View

Now that you have the content type set up, the next important step is to create a view that the player will use to show all the audio nodes. You do this by first going to Administer >> Views

Download the Audio Pro skin for Dash Media Player

The next step is to download the Audio Pro skin by going to http://www.tmtdigital.com/node/694. The skin is free to download and use. Once you have the skin downloaded, you will then need to extract the contents within the skins folder in your Dash Player folder. When you are done, you should then have the skin.swf file located at skins/audiopro/skin.swf

Adding the audio player to a node

Now that you have your site configured to add audio nodes to your Drupal system, the next step is to install the player to show the audio playlist. You will do this by first going to Create Content >> Page and then in the body, you will paste the following PHP code....

<?php
$params
['width'] = 520;
$params['height'] = 111;
$params['skin'] = 'audiopro';
$params['playlist'] = 'audio';
$params['autostart'] = 'true';
print
dashplayer_get_player($params);
?>

Now make sure that you enable the PHP Code in the Input Format of the body and then go down and press Submit to save the node.

Start adding the music!!

Now it is time for the fun part... to start adding the music!

  • Go to Create Content >> Audio
  • Start by uploading your MP3 by going to File Attachments in the node and then make sure you Attach your music to the node
  • While that is uploading, go ahead and select your album art by going to Attached Image and then select the image you would like to have associated as the album art.
  • Finally, go up and give your MP3 a title.
  • Make sure that the MP3 has finished uploading, and when it has, go down and press the Submit button.
  • Now go check out your player... you now have your very own MP3 player built into your website!!


How to implement the Remote Playlist feature: Step-by-step tutorial

This tutorial will walk you through how to set up the Remote Playlist Feature. The remote playlist feature uses JavaScript to serve as a communication gateway between two different SWF objects on the page at any given time. If you are using Drupal, you will need to upgrade to the latest version of the Dash Player module by going to http://www.drupal.org/project/dashplayer. Once you have upgraded, you will then notice that there is a new JavaScript file that is included with this module called dashPlayer.js. This is the file that is used as the communication gateway between any two SWF objects on the page. The good news is that is ALL you need to know. The second you use the Dash Player API to insert an object onto the page, the dashplayer module will add the dashPlayer.js file for you. All you have to do now is understand HOW to make the connections.

Surprisingly, implementing this remote playlist feature is very simple. You basically just need to give your Playlist an id, your Player an id, and then use the connect parameter to connect both of them together. This is done with two new parameters called id and connect. You also need to indicate to the Dash Media Player that you are using a Playlist or a Player. This is done with two more parameters, playlistonly if you just want it to show the playlist, and disableplaylist on the player to say you do not want to show the playlist (since the playlist is actally somewhere else on the page. Let me give an example to illustrate...

Let us suppose that you wish to have your player in the main section of the page, and then have your playlist in a Block to the side of this main player (exactly like how I did in my showcase at http://www.tmtdigital.com/remoteplaylist). So, let me walk you though step by step how to achieve this setup. Before I begin, though, I am assuming that you have an understanding on how to set up a view and link the Dash Media Player to that view in Drupal using the playlist argument. Let's get started.

  • First, we will need to setup up our system to take video uploads, and then make a view for those videos called videos. If you need help with this step, then I suggest you start at http://www.tmtdigital.com/node/44 and come here when you are done.
  • Now that you have a view ready to show your videos in the Dash Media Player, lets first create our page that will only show the video (and not the playlist). You do this by clicking on Create Content >> Page
  • Give this page a title... like Remote Playlist Test, and then in the body, you will paste the following... I will explain what this does in a minute.

    <div style="text-align:center">
    <?php
    $params
    ['id'] = 'dashvideo';
    $params['connect'] = 'dashplaylist';
    $params['width'] = 550;
    $params['height'] = 420;
    $params['disableplaylist'] = 'true';
    print
    dashplayer_get_player($params);
    ?>

    </div>

    Make sure you select PHP Code in the Input Format before you submit.

  • Basically what you are doing here is defining a player with an id of dashvideo, and you are telling that player to connect to another player with an id of dashplaylist (which we haven't made yet). Since this is just the player, we don't really need to put the playlist parameter here since we will be doing that from the actual playlist. You are now ready to save this node. Once it is saved, Take note of the node ID that it just created by looking at the URL, where it says "node/{nodeid}". You will need to remember this later.
  • Now, lets go and create our block that will hold our playlist. You do this by going to Administer >> Blocks
  • Once you are there, you will need to add a new block by clicking on the link at the top that says Add Block
  • The block description can be anything really, but we will just use Remote Playlist
  • Then in the Block Body you will want to now create the code for the playlist. Just copy and paste the following and I will explain later...

    <div style="text-align:center;">
    <?php
    $params
    ['id'] = 'dashplaylist';
    $params['connect'] = 'dashvideo';
    $params['width'] = 200;
    $params['height'] = 520;
    $params['playlist'] = 'videos';
    $params['playlistonly'] = 'true';
    print
    dashplayer_get_player($params);
    ?>

    </div>

    Make sure you select PHP Code in the Imput Format before you submit.

  • Basically what we are doing here is now creating the playlist with an id of dashplaylist and it is now connecting to a player called dashvideo. Do you see how this works now? Pretty simple, huh? All we are doing here is establishing the connection needed for these two players to communicate. You are now ready to save the block.
  • Now that the block has been saved, we will need to make it show up for the page that we just created to hold the player. Remember the node ID that I told you to remember? That is where this will come in handy. Let's go ahead and find the block we just created in the Block list and then click on the configure link next to it.
  • This will take you to the more detailed block configuration page that lets you specify WHERE you would like to see this block. This can be done in the section called Page specific visibility settings. Go ahead and expand this section.
  • Now, where it says Pages: you will want to enter the following... node/{nodeid} where you will replace the {nodeid} with the node Id of the page that you created at the beginning of this tutorial. When you have done that, press the Submit button.
  • You are now ready to add this block to the visible blocks list. You can do this by finding your block in the block list again, and then in the drop down box next to that block, you will then select right sidebar.... or left sidebar depeding on where you want the playlist. Then go down to the very bottom and press the Save Blocks button.
  • And now go back to your original page and check out what you see... Remote Playlists!!!


Passing media file paths to the Dash Player using CCK

Another great feature of the Dash Player is that it was built to read some specific CCK fields that basically act as a replacement for an actual media file being attached to that node. You can use this if you have the paths to your files, but don't necessarily want to attach that media to your node. You can do this by using the CCK (Content Construction Kit). There are two special fields that you need to create that will represent both a playable media and image... These fields are as follows...

CCK Field IDTypeDescription
dashplayer_mediaTextUse this to pass a playable media file path to the Dash Player
dashplayer_imageTextUse this to pass a preview image file path to the Dash Player.

Using Views Arguments for your Playlists

One HUGE benefit in using the Drupal CMS with the Dash Player is that you can completely control the playlist using the Views module. Basically the Views module allows you to filter your content. One way that the views module filters content is through the powerful use of Views Arguments. Basically what this means is that it allows you to pass in certain arguments to the views which it in turns uses as a filtering mechanism for your content.

Let me give you an example... Suppose you wish to have 1000 different videos on your site that can fall into several categories (comedy, action, thriller, etc). Using any other Media Player available, you would need to literally code your own personal filtering mechanism if you wished to show a playlist for only the comedy videos. Not to mention, you would need to show them ALL!! What if there are 1000 different comedy videos alone?! Any other media player would require you to then filter it some more, unless of course, you want to show 1000 different videos in your playlist possibly bringing your users computer to its knees.

Well, good thing you have the Dash Player... Not only can you provide this filtering mechanism using the Views module, but also the Dash Player uses a playlist paging mechanism that will only query for a pages worth of content at a time! Pretty slick, huh? So, lets get started setting up that view. I am assuming that you have already been through the process of Setting up a View for your player. We will also, for the sake of this example, assume you wish to categorize your videos as "Comedy", "Thriller", and "Action". This will at least give you the idea how to do this...

  • The first step is to create a Category for your video type. You do this by going to Administer >> Categories
  • From there, you will want to click on the link that says Add Vocabulary
  • Go ahead and give your vocabulary a name... For our example, we will use Video Category. For now, lets now worry about Description... you can fill this out later.
  • Now go down to where it says Types, and you will want to select your video node type. For us, this is just video
  • Leave the rest of the items blank, and just go down and press Submit
  • Our next step is to add terms to this Video Category. We do this by clicking on the link that says add terms next to the Video Category.
  • Our first term name will be Comedy... Press Submit.
  • It will then let you add more.... Just go ahead and add Action and Thriller terms the same way you did Comedy.
  • And now you are done setting up a category for your video node type... to test this out, go ahead and try to add a new video by going to Create Content >> Video. Do you see a drop down that says Video Category?... Good, lets move on to setting up the view.
  • Go back into the administration for your view by going to Administer >> Views and then click on the Edit link for your view.
  • After you are in the edit part of your view, you will then want to go down to where it says Arguments and expand it.
  • Our goal here is to make is so that anyone can pass in a Video Category to this view, and we will then filter the list based on what category they provide (Comedy, Action, or Thriller). To do this, you will just click on the drop-down box that says Add Argument.
  • This will give you a whole slew of arguments you can pick from. The one that we want is called Taxonomy: Term Name. Go ahead and select this item, and then press the Add Argument button next to the drop-down box.
  • This will bring the argument up to where you can then edit it some more. All we really want to do is specify that if the user does not provide an argument, we would want to show all the nodes. You do this by selecting where it says "Return Page Not Found" and change it to "Display All Values".
  • Now go down to the bottom and click the Save button!

Ok, now that our view is set up, the last and final step is to provide the argument in your player to show the right playlist depending on the argument. You do this by using the arg flashvar followed by the argument number (1,2,3,etc). So, for example, if we wish to show a playlist that only shows the Comedy videos, since this is the first argument, we would just use the following PHP in our Page (make sure you change the Input Format to accept PHP)...

<?php
   $params
['width'] = 652;
  
$params['height'] = 432;
  
$params['playlist'] = 'videos';
  
$params['arg1'] = 'comedy';
   print
dashplayer_get_player($params);
?>

When you press submit on the page, you will get a wonderful surprise!!! It is only showing the comedy vidoes!! Now if you want to really take it to the next level, I highly suggest checking out the tutorial on Creating Dynamic Playlists.

Creating Dynamic Playlists

This is probably the most powerful feature of the Dash Player (besides the Remote Playlist Support, of course...). Having Dynamic Playlists basically means that your users can select how they wish to filter the playlist content by simply clicking on links in your player. And guess what... all this is built into the player! Before beginning this tutorial, it is imperative that you follow the steps on Using Views Arguments for your Playlists. This tutorial will pick up where that one left off... So lets begin.

Allowing for dynamic playlists is completely a player feature using the use of three different flashvars, linkarg, linktext, and linkindex. For an exact description of what these flashvars do, I highly recommend that you visiting the FlashVars Table. So, lets go ahead and add all of our Views arguments so that the user can dynamically select them... Using the example from Views Arguments tutorial, lets suppose that you wish to have three links on the playlist that allows the USER to select which videos they would like to see... you would use the following code.

<?php
  $params
['width'] = 652;
 
$params['height'] = 432;
 
$params['playlist'] = 'videos';
 
$params['linkarg1'] = 'comedy';
 
$params['linktext1'] = 'comedy';
 
$params['linkindex1'] = '0';
 
$params['linkarg2'] = 'action';
 
$params['linktext2'] = 'action';
 
$params['linkindex2'] = '0';
 
$params['linkarg3'] = 'thriller';
 
$params['linktext3'] = 'thriller';
 
$params['linkindex3'] = '0';
 
dashplayer_get_player($params);
?>

Now that's cool!!!

The Drupal - Dash Player Checklist

This page will go through the complete checklist that you need to get the Dash Player to work. Of course, I will not go into detail what each of these topics means, but you can get that information by walking through the step-by-step tutorial on how to install this player in your system.

  • Make sure you have the following modules installed
    • Dash Player
    • Services
    • AMFPHP (or XMLRPC if you prefer)
    • System Service
    • Node Service
    • User Service
    • Views Service
    • Voting Service (if you wish to use voting)
    • Some Media Module (like FlashVideo, Media Mover, etc).
    • Views (if you would like to have a playlist
    • Voting API (if you would like to have voting)
    • Statistics (if you would like to use the view counter)


  • Check the version of Services module that you are using... If you are using Drupal 6 and your version of Services is 0.9 or less... or if you are using Drupal 5 and your Services is 0.91 or less, you need to make sure that you provide the parameter of api and set it to 1, like this...
    $params['api'] = 1;

  • Make sure you enabled access services, load any node data, load own node data, and access all views for all user groups in the Permissions administrator section.

  • Make sure you created an API Key in the Services administrator section.

  • Make sure that you have specified your domain name along with the API key. The domain name that you have should include the www. For example, the API key domain for this website is www.tmtdigital.com. It is also VERY important that this value is aligned with what you have provided as the baseURL in your config XML file. For example, it would be a problem if you provided http://mysite.com as your baseURL, but then put www.mysite.com as the API Key.

  • Make sure that you have entered all the necessary data in your players configuration file. By default, this file is the dashconfig.xml file in your players config directory. Also please note, that if you do NOT have Clean URL's enabled, that you will need to add the ?q= to your gatewayURL. For example, your gateway URL would be http://{yoursite}/?q=services/amfphp.

  • Make sure you set the Dash Player Path within the Dash Player Settings in your Administrator section.

  • Check your configuration file dashconfig.xml. I have had many support requests when it was just a problem with the configuration file. Here are some common mistakes that have been made...
    • Make sure you remove the <!-- and --> from the opening and closing tags before putting the parameter in. If you put the parameter inside these special tags, it will not work.
    • Do not edit this file using a Rich Text editor. It will add other characters that make it an invalid XML file. Make sure you edit this file using a text editor like Notepad.

  • Make sure that you set up a view to show all your media that you would like to show in the playlist.

  • Make sure that when you add the player to your page that you provide the $params['playlist'] = {yourview}; where you would replace the {yourview} with the view that you set up to show your media.

  • Make sure you set the Input format to PHP Code when you try to use the Dash Player API to embed the player in your page.

  • Use the following format to embed the player in your page...

    <?php
       $params
    ['width'] = 652;
      
    $params['height'] = 432;
      
    $params['playlist'] = 'videos';
       print
    dashplayer_get_player($params);
    ?>