ADDON: Play recording right inside the "User Stats" page
Posted: Tue Dec 31, 2013 2:19 pm
No need to download the file and then play the audio recording
now you can play the file direct from the page, with the ability to move the slider to any position, play, pause, and volume control on screen.
This is all based on HTML5, so you will HAVE to have new browser
Go here to test if your browser has the <AUDIO> function built in: http://html5test.com/ (on the right hand side under AUDIO, make sure the "audio element" shows YES)
here is the code changes:
vicidial/user_stats.php
FIND
REPLACE WITH
My vicidial is setup to transfer the recording from the main server to our offsite server every 5mins, so i placed if statement, that says if the call was started less then 6 mins ago, show "Saving to server, check back", otherwise it will show a link to click, which popsup a window for you to hear the call right away.
Let me know what you think, here are a few screen shots:
now you can play the file direct from the page, with the ability to move the slider to any position, play, pause, and volume control on screen.
This is all based on HTML5, so you will HAVE to have new browser
Go here to test if your browser has the <AUDIO> function built in: http://html5test.com/ (on the right hand side under AUDIO, make sure the "audio element" shows YES)
here is the code changes:
vicidial/user_stats.php
FIND
- Code: Select all
$MAIN.="<td align=right><font size=2> $location </td>\n";
REPLACE WITH
- Code: Select all
$daten = date("Y-m-d H:i:s");
$currentDate = strtotime($daten);
$futureDate = $currentDate-(60*6);
$row4date = strtotime($row[4]);
if ($row4date < $futureDate){
?>
<script type="text/javascript">
function init(url, w, h, lid)
{
// Fixes dual-screen position Most browsers Firefox
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
popupWin = window.open('','popupWin','height='+h+',width='+w+',left='+left+',top='+top+',resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no');
var p1="Leadid: "+lid+"<br><audio controls><source src="+url+" type=audio/ogg>Your browser does not support the audio element.</audio>";
popupWin.document.writeln(p1);
popupWin.document.close();
}
</script>
<?php
$MAIN.="<td><font color=\"blue\"><a onclick=\"init('$row[11]','340','75','$row[12]');\"><small>Listen to [$row[12]]</small></a></font></td>";
$MAIN.="<td align=center><a href=$row[11]><small>Download File</small></a></td>\n";
} else {
$MAIN.="<td>Saving to server </td>";
$MAIN.="<td>- check back</td>";
}
My vicidial is setup to transfer the recording from the main server to our offsite server every 5mins, so i placed if statement, that says if the call was started less then 6 mins ago, show "Saving to server, check back", otherwise it will show a link to click, which popsup a window for you to hear the call right away.
Let me know what you think, here are a few screen shots: