Last active
October 5, 2018 00:04
-
-
Save iKlotho/91ad1fcb9400f702db2aa7d1b9efdbee to your computer and use it in GitHub Desktop.
play_recording.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var OldMedia = 0; | |
var AudioBarTimer; | |
function Audio_Set_Players(id,t,r,c,md) { // | |
/* | |
var RBT = ''; | |
if (r == 1) { //RBT is present | |
RBT = '<li><a href=\"http://repo.i-test.net/au/call-'+id+'-r.mp3\">RBT Audio</a></li>'; | |
ndisp('Audio_Player_RBT_Display','/','direct/d.php?p=d&','','t=162&id='+id+'&type=RBT'); | |
if (t == 'RBT') { window.sm2BarPlayers[0].actions.play(); } //Start Playing Audio | |
} | |
document.getElementById('Audio_Player_RBT_Playlist').innerHTML = RBT; | |
document.getElementById('Audio_Player_RBT_Start').innerHTML = '0:00'; | |
document.getElementById('Audio_Player_RBT_Duration').innerHTML = '0:00'; | |
*/ | |
/* | |
Store the old selected id | |
When selected, change from itest green to orange | |
When playing only the one that is playing should be pointing down (but both should change color to orange | |
*/ | |
var Audio_Bar = document.getElementById('Audio_Bar'); | |
if (Audio_Bar.style.height == '0px') { | |
Audio_Bar.style.height = '47px'; | |
Audio_Bar.style.visibility = 'visible'; | |
} | |
clearTimeout(AudioBarTimer); | |
if (OldMedia > 0) { | |
var Old_RTP = document.getElementById('RBT_Audio_'+OldMedia); | |
if (Old_RTP) { Old_RTP.className = 'sm2_button'; } | |
var Old_Audio = document.getElementById('Call_Audio_'+OldMedia); | |
if (Old_Audio) { Old_Audio.className = 'sm2_button'; } | |
} | |
var RBT_Playlist = document.getElementById('Audio_Player_RBT_Playlist'); | |
if (r > 0) { //Ring is present | |
if (OldMedia != id) { | |
ndisp('Audio_Player_RBT_Display','https://portal2.i-test.net/direct/','direct/d.php?p=d&',id,'RBT'); //Update Equiliser | |
} | |
var RBT_Content; | |
//if (r == 1) { RBT_Content = '<li><a href=\"http://repo.i-test.net/au/call-'+id+'-r.mp3\">RBT Audio '+id+'</a></li>'; } //Old file location | |
//else { | |
var Ring_Prefix = id.substr(0,8); | |
RBT_Content = '<li><a href=\"https://repo.i-test.net/au/'+Ring_Prefix+'/call-'+id+'-r.mp3\">RBT Audio '+id+'</a></li>'; | |
//} | |
if (RBT_Playlist.innerHTML.length > 10) { //Is not empty | |
RBT_Playlist.innerHTML = RBT_Content; | |
window.sm2BarPlayers[0].actions.playnew(); //Does not play, just loads | |
if (t == 'RBT') { //Play if selected | |
setTimeout(function(){ window.sm2BarPlayers[0].actions.play(); },30 ); | |
} | |
} else { //is empty, add new bit and go | |
RBT_Playlist.innerHTML = RBT_Content; | |
if (t == 'RBT') { | |
window.sm2BarPlayers[0].actions.play(); | |
} | |
} | |
var Tmp_RBT = document.getElementById('RBT_Audio_'+id); | |
if (Tmp_RBT) { | |
if (t == 'RBT') { | |
Tmp_RBT.className = 'sm2_button sm2_playing'; | |
setTimeout(function(){ Tmp_RBT.className = 'sm2_button sm2_selected'; },300 ); | |
} //RBT was clicked | |
else { Tmp_RBT.className = 'sm2_button sm2_selected'; } //Not | |
} | |
} else { //Call not present | |
RBT_Playlist.innerHTML = ''; | |
document.getElementById('Audio_Player_RBT_Display').innerHTML = ''; | |
} | |
//document.getElementById('Audio_Player_Call_Playlist').innerHTML = Call; | |
document.getElementById('Audio_Player_RBT_Start').innerHTML = '0:00'; | |
document.getElementById('Audio_Player_RBT_Duration').innerHTML = '0:00'; | |
var Call_Playlist = document.getElementById('Audio_Player_Call_Playlist'); | |
if (c > 0) { //Call is present | |
if (OldMedia != id) { | |
ndisp('Audio_Player_Call_Display','https://portal2.i-test.net/direct/','direct/d.php?p=d&',id,'Call'); //Update Equiliser | |
} | |
var Call_Content; | |
//if (c == 1) { Call_Content = '<li><a href=\"http://repo.i-test.net/au/call-'+id+'.mp3\">Call Audio '+id+'</a></li>'; } //Old File location | |
//else { | |
var Call_Prefix = id.substr(0,8); | |
Call_Content = '<li><a href=\"https://repo.i-test.net/au/'+Call_Prefix+'/call-'+id+'.mp3\">Call Audio '+id+'</a></li>'; | |
//} | |
if (Call_Playlist.innerHTML.length > 10) { //Is not empty | |
Call_Playlist.innerHTML = Call_Content; | |
window.sm2BarPlayers[1].actions.playnew(); //Does not play, just loads | |
if (t == 'Call') { setTimeout(function(){ window.sm2BarPlayers[1].actions.play(); },30); } //Play if selected | |
} else { //is empty, add new bit and go | |
Call_Playlist.innerHTML = Call_Content; | |
if (t == 'Call') { window.sm2BarPlayers[1].actions.play(); } | |
} | |
var Tmp_Ring = document.getElementById('Call_Audio_'+id); | |
if (Tmp_Ring) { | |
if (t == 'Call') { //RBT was clicked | |
Tmp_Ring.className = 'sm2_button sm2_playing'; | |
setTimeout(function(){ Tmp_Ring.className = 'sm2_button sm2_selected'; },300 ); | |
} | |
else { Tmp_Ring.className = 'sm2_button sm2_selected'; } //Not | |
} | |
} else { //Call not present | |
Call_Playlist.innerHTML = ''; | |
document.getElementById('Audio_Player_Call_Display').innerHTML = ''; | |
} | |
//document.getElementById('Audio_Player_Call_Playlist').innerHTML = Call; | |
document.getElementById('Audio_Player_Call_Start').innerHTML = '0:00'; | |
document.getElementById('Audio_Player_Call_Duration').innerHTML = '0:00'; | |
OldMedia = id; | |
//AudioBarTimer = setTimeout(function(){ Close_Audio_Bar(); }, 2000); | |
//AudioBarTimer = setTimeout(Close_Audio_Bar();, 2000); | |
return false; | |
} | |
function Close_Audio_Bar() { | |
var Audio_Bar = document.getElementById('Audio_Bar'); | |
Audio_Bar.style.height = '0px'; | |
Audio_Bar.style.visibility = 'hidden'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment