Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
juliantenney committed Jan 3, 2012
1 parent b721d6b commit 4a28fe8
Showing 1 changed file with 1 addition and 231 deletions.
232 changes: 1 addition & 231 deletions modules/xerte/parent_templates/Nottingham/models/youtube.rlm
@@ -1,231 +1 @@
<PG title="enter page title" name="youtube">
<SCR id="ic" name="getPageID"><![CDATA[pageIcon = icon.parentNode.clip();

if (extXML == undefined){
// Page Wizard
pageIcon.templateData = pageIcon.extXML.toObject();
pageIcon.templateData = pageIcon.templateData.pageWizard[0];
} else {
// Toolkits
myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]);
pageIcon.templateData = myXML.toObject();
rootIcon.setTitleText(templateData.learningObject[0].name);
}

xml = new XML(pageIcon.templateData.youtube[0]);
embedObj = xml.toObject();


//new iframe code...
if (pageIcon.templateData.youtube[0].indexOf('iframe') != -1){
//find the ID
str = pageIcon.templateData.youtube[0].split("rel=0").join('');
s = str.indexOf('src') + 5;
f = str.indexOf('"', s);
src = str.substr(s, f-s);
vidID = src.substr(src.lastIndexOf('/') + 1);

//any params being passed in?
vidID = vidID.split('?')[0];

} else {
//two types of object embed code...
if (embedObj.object[0].embed[0].src.split('/')[4].indexOf('?') != -1){
vidID = embedObj.object[0].embed[0].src.split('/')[4].split('?')[0];
} else {
vidID = embedObj.object[0].embed[0].src.split('/')[4].split('&')[0];
}
}

align = pageIcon.templateData.youtube[0].align;

if (pageIcon.templateData.youtube[0].videoSize != undefined){
ytWidth = Number(pageIcon.templateData.youtube[0].videoSize.split(',')[0]);
ytHeight = Number(pageIcon.templateData.youtube[0].videoSize.split(',')[1]);
} else {
ytWidth = 320;
ytHeight = 240;
}

d = new Date();
ytID = 'yt' + d.getTime();
icon.parentNode.getChildByName('youtube').attributes.id = ytID;
]]></SCR>
<DIS h="ytHeight + 50" w="ytWidth + 20" tabIndex="-1" id="panel" name="panel" x="align == 'Left' ? 800 - 40 - ytWidth : 20" y="20" type="ext" url="templatePath + 'common/whitePanel.swf'"><![CDATA[]]></DIS>
<DIS textColour="#999999" textSize="10" id="status" name="status" x="panel._x + 62" y="panel._y + ytHeight + 22" w="240" h="10" type="text"><![CDATA[Player Loading...]]></DIS>
<DIS scrolling="auto" id="txt" name="text" x="align == 'Left' ? 20 : ytWidth + 60" y="20" w="800 - ytWidth - 80" h="484" type="text"><![CDATA[{pageIcon.templateData.youtube[0].text}]]></DIS>
<COM id="coded" y="panel._y + 10" x="panel._x+ 10" name="youtube" url="templatePath + 'common/youtube.swf?' + yt" initObject="{ id: vidID}" />
<SCR name="setup"><![CDATA[status.txt.selectable = false;
status.lineStyle(0,0x999999,100);
status.drawRect(0,0,ytWidth - 80,18);

if (pageIcon.templateData.youtube[0].narration != undefined){
narration = pageIcon.templateData.youtube[0].narration;
rootIcon.broadcast('showAudio');
}






]]></SCR>
<INT name="controls" perpetual="0">
<RES name="onPlayerLoad" type="event" eventName="onPlayerLoad" icon="engine[ytID]" erase="1" exit="0">
<SCR name="handler"><![CDATA[btnToggle.setEnabled(true);
btnPlay.setEnabled(true);
status.setText("Press Play");

rootIcon.enableControls(true, 100);
debug("loaded");
if (pageIcon.templateData.youtube[0].toggle == "true"){

ytTog = true;
engine[ytID].setSize(800,515);
engine[ytID]._x = 0;
engine[ytID]._y = 0;

btnStop._x = 10;
btnStop._y = 484;
btnPlay._x = 35;
btnPlay._y = 484;
btnPause._x = 35;
btnPause._y = 484;
btnToggle._x = 60;
btnToggle._y = 484;

} else {

ytTog = false;
engine[ytID].setSize(ytWidth,ytHeight);
engine[ytID]._x = panel._x + 10;
engine[ytID]._y = panel._y + 10;

btnStop._x = panel._x + 10;
btnStop._y = ytHeight + 40;
btnPlay._x = panel._x + 35;
btnPlay._y = ytHeight + 40;
btnPause._x = panel._x + 35;
btnPause._y = ytHeight + 40;
btnToggle._x = panel._x + ytWidth - 10;
btnToggle._y = ytHeight + 40;
}

if (pageIcon.templateData.youtube[0].autoplay == "true"){
if (engine[ytID].playerLoaded != true){
engine[ytID].loadVideoById(vidID);
btnPlay.setEnabled(false);
status.setText("Loading and will autoplay...");
} else {
engine[ytID].playVideo();
}
}]]></SCR>
</RES>
<RES name="onPlayerStateChange" type="event" eventName="onPlayerStateChange" icon="engine[ytID]" erase="1" exit="0">
<SCR name="handler"><![CDATA[if (engine[ytID].state == 1){ //playing

btnStop.setEnabled(true);
btnPause.setEnabled(true);

btnPlay._visible = false;
btnPause._visible = true;

} else if (engine[ytID].state == 2){ //paused

btnPlay.setEnabled(true);
btnPlay._visible = true;
btnPause._visible = false;

}
]]></SCR>
</RES>
<RES name="onProgress" type="event" eventName="onProgress" icon="engine[ytID]" erase="1" exit="0">
<SCR name="handler"><![CDATA[engine[ytID].playerLoaded = true;
status.setText(engine[ytID].statusStr);

status.clear();
status.lineStyle(0,0x999999,100);
status.drawRect(0,0,ytWidth - 80,18);

status.lineStyle();
status.beginFill(STYLES.fillColour,50);
status.drawRect(0,0,engine[ytID].bytesPercent*((ytWidth - 80) / 100),18);

status.lineStyle(0,0x999999,100);
status.beginFill(STYLES.fillColour,100);
status.drawRect(0,0,engine[ytID].percent*((ytWidth - 80) / 100),18);
]]></SCR>
</RES>
<RES name="onRelease" type="event" eventName="onRelease" icon="status" erase="1" exit="0">
<SCR name="seek"><![CDATA[nt = Math.floor(status._xmouse / (ytWidth - 80) * engine[ytID].duration);
engine[ytID].seekTo(nt ,true);]]></SCR>
</RES>
<RES toolTip="Stop Video" enabled="0" rs="btnStop" swf="templatePath + 'common/stopMedia.swf'" name="stop" type="button" x="panel._x + 10" y="ytHeight + 40" label="Stop" erase="1" exit="0">
<SCR name="stop"><![CDATA[engine[ytID].pauseVideo();
engine[ytID].seekTo(0,true);

//reset the status information
status.setText('0:00 / ' + engine[ytID].durationStr);
status.clear();
status.lineStyle(0,0x999999,100);
status.drawRect(0,0,ytHeight,18);


]]></SCR>
</RES>
<RES enabled="0" toolTip="Pause Video" rs="btnPause" swf="templatePath + 'common/pauseMedia.swf'" name="pause" type="button" x="panel._x + 35" y="ytHeight + 40" label="Pause" erase="1" exit="0">
<SCR name="play"><![CDATA[engine[ytID].pauseVideo();
]]></SCR>
</RES>
<RES enabled="0" toolTip="Play Video" rs="btnPlay" swf="templatePath + 'common/playMedia.swf'" name="play" type="button" x="panel._x + 35" y="ytHeight + 40" label="Play" erase="1" exit="0">
<SCR name="play"><![CDATA[if (engine[ytID].playerLoaded != true){
engine[ytID].loadVideoById(vidID);
btnPlay.setEnabled(false);
status.setText("Loading...");
} else {
engine[ytID].playVideo();
}



]]></SCR>
</RES>
<RES toolTip="Toggle Fullscreen" enabled="0" rs="btnToggle" swf="templatePath + 'common/zoomMedia.swf'" name="toggle" type="button" x="panel._x + ytWidth - 10" y="ytHeight + 40" label="Resize" erase="1" exit="0">
<SCR name="resize"><![CDATA[if (ytTog != true){
ytTog = true;
engine[ytID].setSize(800,515);
engine[ytID]._x = 0;
engine[ytID]._y = 0;

btnStop._x = 10;
btnStop._y = 484;
btnPlay._x = 35;
btnPlay._y = 484;
btnPause._x = 35;
btnPause._y = 484;
btnToggle._x = 60;
btnToggle._y = 484;

} else {
ytTog = false;
engine[ytID].setSize(ytWidth,ytHeight);
engine[ytID]._x = panel._x + 10;
engine[ytID]._y = panel._y + 10;

btnStop._x = panel._x + 10;
btnStop._y = ytHeight + 40;
btnPlay._x = panel._x + 35;
btnPlay._y = ytHeight + 40;
btnPause._x = panel._x + 35;
btnPause._y = ytHeight + 40;
btnToggle._x = panel._x + ytWidth - 10;
btnToggle._y = ytHeight + 40;
}




]]></SCR>
</RES>
</INT>
</PG>
<PG title="enter page title" name="youtube"> <SCR id="ic" name="getPageID"><![CDATA[pageIcon = icon.parentNode.clip();if (extXML == undefined){ // Page Wizard pageIcon.templateData = pageIcon.extXML.toObject(); pageIcon.templateData = pageIcon.templateData.pageWizard[0];} else { // Toolkits myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]); pageIcon.templateData = myXML.toObject(); rootIcon.setTitleText(templateData.learningObject[0].name);}xml = new XML(pageIcon.templateData.youtube[0]);embedObj = xml.toObject();//new iframe code...if (pageIcon.templateData.youtube[0].indexOf('iframe') != -1){ //find the ID str = pageIcon.templateData.youtube[0].split("rel=0").join(''); s = str.indexOf('src') + 5; f = str.indexOf('"', s); src = str.substr(s, f-s); vidID = src.substr(src.lastIndexOf('/') + 1); //any params being passed in? vidID = vidID.split('?')[0]; } else { //two types of object embed code... if (embedObj.object[0].embed[0].src.split('/')[4].indexOf('?') != -1){ vidID = embedObj.object[0].embed[0].src.split('/')[4].split('?')[0]; } else { vidID = embedObj.object[0].embed[0].src.split('/')[4].split('&')[0]; }}align = pageIcon.templateData.youtube[0].align;if (pageIcon.templateData.youtube[0].videoSize != undefined){ ytWidth = Number(pageIcon.templateData.youtube[0].videoSize.split(',')[0]); ytHeight = Number(pageIcon.templateData.youtube[0].videoSize.split(',')[1]);} else { ytWidth = 320; ytHeight = 240;}d = new Date();ytID = 'yt' + d.getTime();icon.parentNode.getChildByName('youtube').attributes.id = ytID;]]></SCR> <DIS h="ytHeight + 50" w="ytWidth + 20" tabIndex="-1" id="panel" name="panel" x="align == 'Left' ? 800 - 40 - ytWidth : 20" y="20" type="ext" url="templatePath + 'common/whitePanel.swf'"><![CDATA[]]></DIS> <DIS textColour="#999999" textSize="10" id="status" name="status" x="panel._x + 62" y="panel._y + ytHeight + 22" w="240" h="10" type="text"><![CDATA[Player Loading...]]></DIS> <DIS scrolling="auto" id="txt" name="text" x="align == 'Left' ? 20 : ytWidth + 60" y="20" w="800 - ytWidth - 80" h="484" type="text"><![CDATA[{pageIcon.templateData.youtube[0].text}]]></DIS> <COM id="coded" y="panel._y + 10" x="panel._x+ 1000" name="youtube" url="templatePath + 'common/youtube.swf?' + yt" initObject="{ id: vidID}" /> <SCR name="setup"><![CDATA[//the player is hidden to begin with... then repositioned in onPlayerLoadstatus.txt.selectable = false;status.lineStyle(0,0x999999,100);status.drawRect(0,0,ytWidth - 80,18);icon.previousSibling.clip()._visible = false;if (pageIcon.templateData.youtube[0].narration != undefined){ narration = pageIcon.templateData.youtube[0].narration; rootIcon.broadcast('showAudio');} ]]></SCR> <INT name="controls" perpetual="0"> <RES name="onPlayerLoad" type="event" eventName="onPlayerLoad" icon="engine[ytID]" erase="1" exit="0"> <SCR name="handler"><![CDATA[btnToggle.setEnabled(true);btnPlay.setEnabled(true);status.setText("Press Play");rootIcon.enableControls(true, 100);if (pageIcon.templateData.youtube[0].toggle == "true"){ ytTog = true; engine[ytID].setSize(800,515); engine[ytID]._x = 0; engine[ytID]._y = 0; btnStop._x = 10; btnStop._y = 484; btnPlay._x = 35; btnPlay._y = 484; btnPause._x = 35; btnPause._y = 484; btnToggle._x = 60; btnToggle._y = 484; } else { ytTog = false; engine[ytID].setSize(ytWidth,ytHeight); engine[ytID]._x = panel._x + 10; engine[ytID]._y = panel._y + 10; btnStop._x = panel._x + 10; btnStop._y = ytHeight + 40; btnPlay._x = panel._x + 35; btnPlay._y = ytHeight + 40; btnPause._x = panel._x + 35; btnPause._y = ytHeight + 40; btnToggle._x = panel._x + ytWidth - 10; btnToggle._y = ytHeight + 40;}if (pageIcon.templateData.youtube[0].autoplay == "true"){ if (engine[ytID].playerLoaded != true){ engine[ytID].loadVideoById(vidID); btnPlay.setEnabled(false); status.setText("Loading and will autoplay..."); } else { engine[ytID].playVideo(); }}]]></SCR> </RES> <RES name="onPlayerStateChange" type="event" eventName="onPlayerStateChange" icon="engine[ytID]" erase="1" exit="0"> <SCR name="handler"><![CDATA[if (engine[ytID].state == 1){ //playing btnStop.setEnabled(true); btnPause.setEnabled(true); btnPlay._visible = false; btnPause._visible = true;} else if (engine[ytID].state == 2){ //paused btnPlay.setEnabled(true); btnPlay._visible = true; btnPause._visible = false; }]]></SCR> </RES> <RES name="onProgress" type="event" eventName="onProgress" icon="engine[ytID]" erase="1" exit="0"> <SCR name="handler"><![CDATA[engine[ytID].playerLoaded = true;status.setText(engine[ytID].statusStr);status.clear();status.lineStyle(0,0x999999,100);status.drawRect(0,0,ytWidth - 80,18);status.lineStyle();status.beginFill(STYLES.fillColour,50);status.drawRect(0,0,engine[ytID].bytesPercent*((ytWidth - 80) / 100),18);status.lineStyle(0,0x999999,100);status.beginFill(STYLES.fillColour,100);status.drawRect(0,0,engine[ytID].percent*((ytWidth - 80) / 100),18);]]></SCR> </RES> <RES name="onRelease" type="event" eventName="onRelease" icon="status" erase="1" exit="0"> <SCR name="seek"><![CDATA[nt = Math.floor(status._xmouse / (ytWidth - 80) * engine[ytID].duration);engine[ytID].seekTo(nt ,true);]]></SCR> </RES> <RES toolTip="Stop Video" enabled="0" rs="btnStop" swf="templatePath + 'common/stopMedia.swf'" name="stop" type="button" x="panel._x + 10" y="ytHeight + 40" label="Stop" erase="1" exit="0"> <SCR name="stop"><![CDATA[engine[ytID].pauseVideo();engine[ytID].seekTo(0,true);//reset the status informationstatus.setText('0:00 / ' + engine[ytID].durationStr);status.clear();status.lineStyle(0,0x999999,100);status.drawRect(0,0,ytHeight,18);]]></SCR> </RES> <RES enabled="0" toolTip="Pause Video" rs="btnPause" swf="templatePath + 'common/pauseMedia.swf'" name="pause" type="button" x="panel._x + 35" y="ytHeight + 40" label="Pause" erase="1" exit="0"> <SCR name="play"><![CDATA[engine[ytID].pauseVideo();]]></SCR> </RES> <RES enabled="0" toolTip="Play Video" rs="btnPlay" swf="templatePath + 'common/playMedia.swf'" name="play" type="button" x="panel._x + 35" y="ytHeight + 40" label="Play" erase="1" exit="0"> <SCR name="play"><![CDATA[if (engine[ytID].playerLoaded != true){ engine[ytID].loadVideoById(vidID); btnPlay.setEnabled(false); status.setText("Loading...");} else { engine[ytID].playVideo();}]]></SCR> </RES> <RES toolTip="Toggle Fullscreen" enabled="0" rs="btnToggle" swf="templatePath + 'common/zoomMedia.swf'" name="toggle" type="button" x="panel._x + ytWidth - 10" y="ytHeight + 40" label="Resize" erase="1" exit="0"> <SCR name="resize"><![CDATA[if (ytTog != true){ ytTog = true; engine[ytID].setSize(800,515); engine[ytID]._x = 0; engine[ytID]._y = 0; btnStop._x = 10; btnStop._y = 484; btnPlay._x = 35; btnPlay._y = 484; btnPause._x = 35; btnPause._y = 484; btnToggle._x = 60; btnToggle._y = 484; } else { ytTog = false; engine[ytID].setSize(ytWidth,ytHeight); engine[ytID]._x = panel._x + 10; engine[ytID]._y = panel._y + 10; btnStop._x = panel._x + 10; btnStop._y = ytHeight + 40; btnPlay._x = panel._x + 35; btnPlay._y = ytHeight + 40; btnPause._x = panel._x + 35; btnPause._y = ytHeight + 40; btnToggle._x = panel._x + ytWidth - 10; btnToggle._y = ytHeight + 40;}]]></SCR> </RES> </INT> </PG>
Expand Down

0 comments on commit 4a28fe8

Please sign in to comment.