Files
Testing/mailservices/js/youtube.js
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

88 lines
1.6 KiB
JavaScript

// JavaScript Document
var playerready=0;
var mymusic=new Array(); // regular array (add an optional integer
mymusic[0]="-TuHjEaTYCQ"; // argument to control array's size)
mymusic[1]="bRN6d-QUa5c";
mymusic[2]="0lUQFT4zVWk";
mymusic[3]="_viF_u6uQ_o";
mymusic[4]="td12fHUWuMw";
mymusic[5]="P0LSlgm_VDA";
var ytplayer = "";
var musicid=0;
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("myytplayer");
playerready=1;
if (ytplayer) {
// ytplayer.playVideo();
ytplayer.setVolume(80);
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
}
}
function onytplayerStateChange(newState) {
//alert("Player's new state: " + newState);
var ytarraylength=mymusic.length;
if(newState==0)
{
if(musicid==ytarraylength-1)
{
musicid=0;
}
else
{
musicid=musicid+1;
}
//alert(musicid);
//player.loadVideoById(videoId:String, startSeconds:Number, suggestedQuality:String):Void
//player.seekTo(seconds:Number, allowSeekAhead:Boolean)
//ytplayer.loadVideoById(mymusic[musicid],50);
//ytplayer.loadVideoByUrl(mymusic[musicid]);
}
}
function music_volume(vol)
{
if(playerready)
{
if (ytplayer)
{
ytplayer.setVolume(vol);
}
}
}
function ytplay(ytid){
document.getElementById('youtube').style.zIndex=thez;
thez=thez+1;
ytplayer.stopVideo();
ytplayer.clearVideo();
ytplayer.loadVideoById(ytid,0);
ytplayer.playVideo();
}
function ytplayclose(ytid){
ytplayer.stopVideo();
ytplayer.clearVideo();
document.getElementById('youtube').style.zIndex=-1;
//thez=thez+1;
//ytplayer.loadVideoById(ytid,0);
//ytplayer.playVideo();
}