I have the player imbedded into a block now i want it to play the audio/video that is attached to the node. How can I do that?

Comments

travist’s picture

Status: Active » Fixed

You can just use the arguments to get the node ID and then pass that to the player in the block... Like this....

<?php
$params['width'] = 500;
$params['height'] = 405;

if( arg(0) == 'node' && is_numeric( arg(1) ) && !arg(2) ) {
  $params['node'] = arg(1);
}

print dashplayer_get_player($params);
?>
pamshalligan’s picture

Hi and ty for the response

Is there a way to set up dash to do this dynamicaly?

I was hoping to use something similar to the [video] tag in flashvideo but cant get it to work

pamshalligan’s picture

I tryed this and had no luck. The player is still playing the latest vid to be added not the one attached to the node

pamshalligan’s picture

Status: Fixed » Active
jinitpatel’s picture

Status: Closed (fixed) » Active

Please add this code in CONTENT part of your node.tpl.php(under your theme) file.

	if($node->type=='test_audio')  // node type
	{
		print $content;
		$unode = node_load($nid);
		if ($user->uid == $unode->uid)
		{
			if((arg(0)=='audio') or (arg(0)=='node'))   // add your arguments here
			{
					$params['node'] = $node->nid;
					$params['width'] = 520;
					$params['height'] = 111;
					$params['skin'] = 'audiopro';
					$params['autostart'] = 'true';
					print dashplayer_get_player($params);
			}
			
		}
	}

	else{
		print $content;
		} 
rengomez’s picture

Hello

I am using the player with audiopro and have followed all the tutorials it works great.

Would it be possible to have the player in a block and then load mp3s to it by selecting from a list of nodes or a view of nodes? Is that what the code above does? I am not sure where you would add it.

The block is in a sidebar and the nodes are displayed on the front page.

Thanks. Brilliant player (-;

Cheers

jimmb’s picture

Great question rengomez!

I also want to put the dash player in a block on the homepage and let people stream music there. Would love to know to set this up....

Jim

travist’s picture

Status: Active » Fixed

jimmb,

There are several ways to do this... If you just wish to play the current node in the media player in the block, then you can add a new block with the media player, and then add this code.

<?php
  $params['node'] = arg(1);
  print dashplayer_get_player( $params );
?>

You just need to make sure that you set the Input Format to PHP Code, and then also make sure that this block is only visible on the paths that are node/*

Another way to do this, is to use the JavaScript interface for the player, and then send commands using JavaScript. Like this for jQuery...

$(".playbutton").click( function() {
   dashPlayerPlay("dashplayer", 'http://www.mysite.com/files/myfile.flv');
});

Hope this helps.

Travis.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status: Active » Closed (fixed)