mightypants
06-05-2008, 01:08 PM
I'm trying to figure out how to embed a video player like they have at the following site:
http://blueroomnyc.com/work/Q3hLj98JKyh/history-refresh/
They have multiple videos opening in the same space. I previously posted a question about this and the following script was given to me as a response:
// Adds the event
function AddEventListener(element, eventType, handler, capture)
{
if(element.addEventListener)
{
element.addEventListener(eventType, handler, capture);
}
else if(element.attachEvent)
{
element.attachEvent("on" + eventType, handler);
}
}
// Called when the page loads
window.onload = function()
{
}
function showQT(movie, width, height)
{
writeToRelatedGroupDiv("moviecontainer", "<EMBED SRC='/movies/" + movie + "' width='" + width + "' height='" + height + "' SCALE='ToFit' AUTOPLAY='true' CONTROLLER='true' LOOP='false' HREF='/movies/" + movie + "' TARGET='myself' PLUGINSPAGE='http://www.apple.com/quicktime/'></EMBED>");
}
function showWMV(movie, width, height)
{
var wmvContent = "";
wmvContent += '<object id="MediaPlayer" width=' + width + ' height=' + height + ' classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">';
wmvContent += '<param name="filename" value="/movies/' + movie + '">';
wmvContent += '<param name="Showcontrols" value="True">';
wmvContent += '<param name="autoStart" value="True">';
wmvContent += '<embed type="application/x-mplayer2" src="/movies/' + movie + '" name="MediaPlayer" width=' + width + ' height=' + height + '></embed>';
wmvContent += '</object>';
writeToRelatedGroupDiv("moviecontainer", wmvContent);
}
// Write to div
function writeToRelatedGroupDiv(ID, htmlContent)
{
// Populate the HTML page
if (document.layers)
{
var oLayer;
oLayer = document.layers[ID].document;
oLayer.open();
oLayer.write(htmlContent);
oLayer.close();
}
else if(parseInt(navigator.appVersion)>=5&&navigator.appName=="Netscape")
{
document.getElementById(ID).innerHTML = htmlContent;
}
else if(document.all)
{
document.all[ID].innerHTML = htmlContent;
}
}
I'm pretty new to javascript, and while I understand many fragments of what is going on here, I don't fully get it. My main problem with javascript in general is that it's a bit difficult to distinguish elements that are built into javascript and those that are user-defined. Could someone point out to me exactly where I need to replace the given script with the names/locations of my videos? Thanks.
I tried changing the embed src to
"<EMBED SRC='/assets/videos/" + red_color_room.mov + "'
from the following portion of the script, but it didn't work.
writeToRelatedGroupDiv("moviecontainer", "<EMBED SRC='/movies/" + movie + "' width='" + width + "' height='" + height + "' SCALE='ToFit' AUTOPLAY='true' CONTROLLER='true' LOOP='false' HREF='/movies/" + movie + "' TARGET='myself' PLUGINSPAGE='http://www.apple.com/quicktime/'></EMBED>");
}
http://blueroomnyc.com/work/Q3hLj98JKyh/history-refresh/
They have multiple videos opening in the same space. I previously posted a question about this and the following script was given to me as a response:
// Adds the event
function AddEventListener(element, eventType, handler, capture)
{
if(element.addEventListener)
{
element.addEventListener(eventType, handler, capture);
}
else if(element.attachEvent)
{
element.attachEvent("on" + eventType, handler);
}
}
// Called when the page loads
window.onload = function()
{
}
function showQT(movie, width, height)
{
writeToRelatedGroupDiv("moviecontainer", "<EMBED SRC='/movies/" + movie + "' width='" + width + "' height='" + height + "' SCALE='ToFit' AUTOPLAY='true' CONTROLLER='true' LOOP='false' HREF='/movies/" + movie + "' TARGET='myself' PLUGINSPAGE='http://www.apple.com/quicktime/'></EMBED>");
}
function showWMV(movie, width, height)
{
var wmvContent = "";
wmvContent += '<object id="MediaPlayer" width=' + width + ' height=' + height + ' classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">';
wmvContent += '<param name="filename" value="/movies/' + movie + '">';
wmvContent += '<param name="Showcontrols" value="True">';
wmvContent += '<param name="autoStart" value="True">';
wmvContent += '<embed type="application/x-mplayer2" src="/movies/' + movie + '" name="MediaPlayer" width=' + width + ' height=' + height + '></embed>';
wmvContent += '</object>';
writeToRelatedGroupDiv("moviecontainer", wmvContent);
}
// Write to div
function writeToRelatedGroupDiv(ID, htmlContent)
{
// Populate the HTML page
if (document.layers)
{
var oLayer;
oLayer = document.layers[ID].document;
oLayer.open();
oLayer.write(htmlContent);
oLayer.close();
}
else if(parseInt(navigator.appVersion)>=5&&navigator.appName=="Netscape")
{
document.getElementById(ID).innerHTML = htmlContent;
}
else if(document.all)
{
document.all[ID].innerHTML = htmlContent;
}
}
I'm pretty new to javascript, and while I understand many fragments of what is going on here, I don't fully get it. My main problem with javascript in general is that it's a bit difficult to distinguish elements that are built into javascript and those that are user-defined. Could someone point out to me exactly where I need to replace the given script with the names/locations of my videos? Thanks.
I tried changing the embed src to
"<EMBED SRC='/assets/videos/" + red_color_room.mov + "'
from the following portion of the script, but it didn't work.
writeToRelatedGroupDiv("moviecontainer", "<EMBED SRC='/movies/" + movie + "' width='" + width + "' height='" + height + "' SCALE='ToFit' AUTOPLAY='true' CONTROLLER='true' LOOP='false' HREF='/movies/" + movie + "' TARGET='myself' PLUGINSPAGE='http://www.apple.com/quicktime/'></EMBED>");
}