How do I get the link in the embedded player (for instance Windows Mediaplayer)? Guess I have to make a new node-type.tpl.php but how do I put the link in it?

Perhaps some default code or examples? Thanks!

Comments

ardas’s picture

Try http://drupal.org/project/coolfilter module which should be able to embed a player into your web page and stream any media file including files uploaded by audio and video CCK fields.

maastrix’s picture

thanks for your reply but I ment some default code for cck's node-type.tpl.php.. that's also possible isn't it? I'd rather not install an extra module. I allready had to install 20 modules to get what I want..

ardas’s picture

My project consists of 107 modules at the moment :)

It is not a good approach to dublicate such code and try to do it on your own. Unfortunatly, I don't know how to embed media content and I won't be able to help you. I hope, people who know the answer worked a lot to put it into a module for guys like me and you to use it. This is a power of community:)

If you still want to put your own piece of code, download coolfilter and take something from its source.

maastrix’s picture

I think I'm being misunderstood. This is the code needed in a templatefile to make the movie play in Windows Mediaplayer.

<OBJECT id="VIDEO" width="320" height="240" 
	style="position:absolute; left:0;top:0;"
	CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
	type="application/x-oleobject">
	
<PARAM NAME="URL" VALUE="your file or url">
	
<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
	<PARAM NAME="AutoStart" VALUE="True">
	<PARAM name="uiMode" value="none">
	<PARAM name="PlayCount" value="9999">
</OBJECT>

Where it says <PARAM NAME="URL" VALUE="your file or url"> it needs an URL. That url is outputed by the mediafield module but just as a direct link to the file. I want to implement this code in a node-type.tpl.php file and output that direct link to the file on the place where is says PARAM NAME = URL. Should be easy but I can't find the line of code that does that..

Or is that not possible and do I really have to use that extra module?

ardas’s picture

Status: Active » Closed (won't fix)

I don't know is it possible to make this piece of code work correctly in all browsers. You should try it. I've never do it before. If it fits your needs you can of course leave it and don't use any other module. This is your choice anyway.

As for file information, you should investigate the structure on $node variable which is used within node.tpl.php template. You will find all CCK fields there and your video field will be also there with some information including file path.

maastrix’s picture

Please don't be offended but what is the use of a audio or videofield if you can't theme it? You might as well upload a file using the filefield cck module.. wouldn't it be great if you can actually show the video on your website?

In this topic they are changing the way imagefield behaves: http://drupal.org/node/101710. Would be nice if I knew how to use the code of mediafield to get single variables out of it. Like:
<?php foreach((array)$field_videofield as $item){print $item['url]} or something like that.

if you use an FLV player using flash, it will work on every platform.. check out this demo of the video module:
http://www.varesano.net/video-demo/?q=node/12/play
and more: http://www.varesano.net/video-demo/

ardas’s picture

I didn't say that it can't be themed. Of course it can, there are several modules which do this and coolfilter is one of them. There id no need to duplicate video streaming logic because it is already done in other module. Video field information is populated into $node object just like all other CCK fields. You can get it from there.

Video.module you mentioned is an alternative solution. Feel free to use it if you want.

maastrix’s picture

allright, thanks for the info so far. You say: "Video field information is populated into $node object just like all other CCK fields. You can get it from there.". How can I do that? What's the magic line to output the url? :)

ardas’s picture

echo "

";
print_r($node);
echo "

";

fax8’s picture

@impahz

ARDAS is trying to explain that he does not suggest you to add your code to embed
because there are already different modules which can do this for you.

Then the correct approach for a programmer should reuse what is already available
and use it.

I suggest you to install my video module which already has embedding functions available.

So... you should have the video path stored somewhere in your CKK $node
(a print_r($node); should let you show where...)

You should pass this to theme_video_play_X where X is the type of video available with also
the width ($node->videox) and height ($node->videoy).

Then print the output of the theme_video_play function.

Hope this helps.

maastrix’s picture

Both thanks.. I have something working now. Since I'm only allowing one type of video, I only have to make one template with the code in it. At the moment I have it like this:

<?php
if ($page == 0): //if node is being displayed as a teaser
//Anything here will show up when the teaser of the post is viewed in your taxonomies or front page
?>
<div class="<?php print $node_classes ?>" id="node-<?php print $node->nid; ?>">
  <?php if ($page == 0): ?>
    <h2 class="title">
      <a href="<?php print $node_url ?>"></a>
    </h2>
  <?php endif; ?>

 <div class="field field-type-image field-field-thumbnail-photo">
  <div class="field-items">
    <?php foreach ((array)$field_icon as $item) { ?>
      <div class="field-item"><a href="<?php print $path;?>"><?php print $item['view'] ?></a></div>
    <?php } ?>
  </div>
</div>
</div>

<?php endif;
if ($page == 1): //if node is being displayed as a full node
//Anything here will show up when viewing only your post

//read variables from field_video to $item
foreach ((array)$field_video as $item) { }

?>

<OBJECT ID="MediaPlayer" WIDTH="<?php echo $item['videox']; ?>" HEIGHT="<?php echo $item['videoy']; ?>" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="../<?php echo $item['filepath']; ?>">
<PARAM name="autostart" VALUE="true">
<PARAM name="ShowControls" VALUE="true">
<param name="ShowStatusBar" value="false">
<PARAM name="ShowDisplay" VALUE="false">
<EMBED TYPE="application/x-mplayer2" SRC="../<?php echo $item['filepath']; ?>" NAME="MediaPlayer"
WIDTH="<?php echo $item['videox']; ?>" HEIGHT="<?php echo $item['videoy']; ?>" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="1"> </EMBED>
</OBJECT>

<?php endif; ?>