Adding our custom media player to Drupal

The first step we will need to take is to change our nodeid variable back to the FlashVars format so that we can compile our new media player for Drupal.

// Declare our variables var baseURL:String = "http://localhost/drupal6"; var gateway:String = baseURL + "/services/amfphp" var sessionId:String = "";

var nodeId:Number = root.loaderInfo.parameters.node;

After we run our media player with these changes (which compiles the SWF file), we can follow the steps from Chapter 4 and upload our new media player by navigating to Create Content | Flash. Once we have our Flash application submitted to Drupal, we can create a template for both the audio and video nodes using the Content Templates within the Drupal Administrator. Assuming that the node ID for our flash node application is 11, our body templates should look like the following for both the video and audio nodes:

// Get the Flash application.

$sql = "SELECT * FROM {node} WHERE nid=%d";

// Set the flashvars to the right node Id. $flash->flashnode["flashvars"] = 'node=' . $node->nid;

// Show the Flash application.

print theme('flashnode', $flash->flashnode, FALSE); ?>

Once we have our templates in place, we can navigate to any audio and video node within our Drupal website and see our new media player in action!


Crazy at the wheel Edit

Make Money Writing

Make Money Writing

This Report Will Show You How To Make Money By Providing Writing Services To Other Internet Marketers. Learn how to make money by writing the right way. Grab your copy of this report now and learn. Why writing is a great way to earn money. How to compete with cheap writers, even if you charge a lot more money.

Get My Free Ebook

Post a comment