PDA

View Full Version : um...embeding a media player



riptide
May 26th, 2007, 04:35 PM
I'm having a bit of a problem. I used the media player from combox script.

I'm trying to send the href value of a clicked link to a media player. also only the links from a class of my choice send their values to the media player.
the problem is the file always opends windows media player or takes you to the site and doesn't play the file as an embed/object. Does anyone have any idea whats wrong?

in the head

function song(){document.getElementById('MTVplayer').innerHTML='<object width="250" height="59"
id="Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">
<param name="URL" value="'+linkValue+'">
<param name="autoStart" VALUE="true">
<param name="uiMode" value="full">
<param name="currentPosition" vaule="1" >
<param name="ShowStatusBar" value="true" >
<embed type="application/x-mplayer2"
src="'+linkValue+'" ShowControls="0" width="250" height="50"></embed></object>';


}


body

<ul id="TT">
<li><a class="linksclass2" href="http://tesla.liketelevision.com/
liketelevision/vidsamples/toycom62.mpg" return false >
the end part one open misterio</a></li>
<li><a class="linksclass2" href="http://www.knallgrau.at/code/plugin_js
/demo/video-embeding/files/skifoan.mov" >the classes </a></li>
</ul>



<script type="text/javascript">
var action=new Object();
action.linksclass1=function(e){
var el=window.event&&window.event.srcElement?
window.event.srcElement : e&&e.target? e.target : null;
var linkValue = (el.target || el.srcElement).href;

if(el)
alert(el.innerHTML);
return false;
}
action.linksclass2=function(){
document.getElementById("misterioProgram").style.display="block";
linkValue=document.getElementById("mainP").value;
linkValue2=document.getElementById("theE").value;

return false;
}
var theas=document.getElementsByTagName('a');
for (var i_tem = 0; i_tem < theas.length; i_tem++)
theas[i_tem].onclick=action[theas[i_tem].className];
</script>


<div id="MTVplayer">
<object width="535" height="460"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject">
<param id="mainP" name="URL" value="'+linkValue+'">
<param name="AutoStart" VALUE="True">
<param name="uiMode" value="full">
<embed id="theE" type="application/x-mplayer2"
src="'+linkValue+'"
ShowControls="1"
width="235"
height="160">
</embed>
</object>
</div>

_Aerospace_Eng_
May 26th, 2007, 06:36 PM
Its onclick="return false" not just return false.

riptide
May 29th, 2007, 03:07 PM
okay I'll see if this works. Heay I've seen people use return false only and it's suppose to work

riptide
May 29th, 2007, 03:27 PM
ah onclick return false still dosen't work. it still takes you to a page. It looks like it should play in the embeded media player (it says ready) but it won't play.

_Aerospace_Eng_
May 29th, 2007, 06:36 PM
Then you either implemented it wrong or your javascript is erroring out causing the return false to not work. Can you post a link to your page? I have a feeling that you are getting errors but aren't even reading them.

riptide
May 30th, 2007, 01:29 AM
woe, wait I still need to make this all part of the object but I guess this still could work. But if this is a cross browser script why use the class id from WMP 6
Edit:
well it's not making windows media player open or sending me to another page. But it's not playing. by the way I tried to use alert to find out where things are going wrong but it wouldn't even make an alert but at the same time it wasn't throwing any errors.

riptide
May 30th, 2007, 11:39 PM
hum.....would this be more cross browser friendly if this was done with quicktime and not WMP.
here is what it looks like.
something is wrong here.



function playSong(nItem,nSong){

document.Player.fileName = nSong;
document.getElementById('currTrack')
.lastChild.data = nItem.lastChild.data;
}






<a href='#' class="linksclass2" onclick=
"playSong
(this,'music/http://www.knallgrau.at/code/plugin_js/demo/video-embeding/files/skifoan.mov');
return false;">1. I See You </a>
<br>
<a href='#' onclick="playSong(this,'music/02.mp3');return false;">the end part two </a>
<br>
<a href='#' onclick="playSong(this,'music/03.mp3');
return false;">3. Just For You </a>
<br>
<a href='#' onclick="playSong(this,'music/04.mp3');return false;">4. Wish You Were </a>
"http://tesla.liketelevision.com/liketelevision/vidsamples/toycom62.mpg"

"http://www.knallgrau.at/code/plugin_js/demo/video-embeding/files/skifoan.mov"

<script type="text/javascript">
var action=new Object();
action.linksclass1=function(e){
var el=window.event&&window.event.srcElement?
window.event.srcElement : e&&e.target? e.target : null;
var linkValue = el.href;

if(el)
alert(el.innerHTML);
return false;
}
action.linksclass2=function(){
document.getElementById("misterioProgram").style.display="block";
document.getElementById("mainP").value=linkValue.value
document.getElementById("theE").value=linkValue.value

return false;
}
var theas=document.getElementsByTagName('a');
for (var i_tem = 0; i_tem < theas.length; i_tem++)
theas[i_tem].onclick=action[theas[i_tem].className];
</script>




<div id="MTVplayer">
<object id="Player" WIDTH="170" HEIGHT="45"
CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
<PARAM NAME="BufferingTime" VALUE="10"/>
<PARAM NAME="AudioStream" VALUE="-1"/>
<PARAM NAME="Volume" VALUE="-400"/>
<PARAM NAME="EnableContextMenu" VALUE="0"/>
<embed id="theE" type="application/x-mplayer2"
src="'+linkValue+'"
ShowControls="1"
width="235"
height="160">
</embed>
</object>
</div>

tpeck
May 31st, 2007, 01:57 PM
I'm not an expert but I am a victim of QuickTime's latest update (v7.1.5+).

Just for the record if you go QT check out the new javascript security restrictions that Apple have implemented unannounced.

It won't necessarily affect what you want to do unless you use their original javascripting codings, but I wasted about a year and a half using their technology and now have to find an alternative if I am to keep selling what I do.

Big headache.

riptide
May 31st, 2007, 07:22 PM
so your saying I should not use QT. well the person who left a code down here removed it. so now i have to find another way to fix this.

riptide
Jun 1st, 2007, 03:20 PM
okay I think I should go back to my old code and see if I can fix it.

tpeck
Jun 1st, 2007, 05:00 PM
I'm not good enough to solve your problem directly, but if you search for "jukebox" in this forum you'll find a lot of stuff on embedded players. Some with playlists etc. Amazing stuff. I forget which post but one especially gives an amazing number of different working embedded players (wmp) with various options.

riptide
Jun 1st, 2007, 09:39 PM
okay I'll look here because I sure can't find the right stuff on the net.

riptide
Jun 3rd, 2007, 07:54 PM
I'm confused do I use filename or value for the object named player.