CDR - Details: Display call recording playback/waveform, if allowed.

This commit is contained in:
fusionate
2025-06-23 13:24:14 -06:00
parent c53ee8c503
commit 17be5f51a3
3 changed files with 91 additions and 24 deletions

View File

@@ -715,37 +715,55 @@
{literal}
var recording_audio, audio_clock, recording_id_playing;
function recording_play(player_id, data, audio_type) {
function recording_load(player_id, data, audio_type) {
{/literal}
//create and load waveform image
{if $settings.theme.audio_player_waveform_enabled == 'true'}
{literal}
//list playback
if (document.getElementById('playback_progress_bar_background_' + player_id)) {
// alert("waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : ''));
document.getElementById('playback_progress_bar_background_' + player_id).style.backgroundImage = "linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 20%), url('waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : '') + "')";
}
//form playback
else if (document.getElementById('recording_progress_bar_' + player_id)) {
// alert("waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : ''));
document.getElementById('recording_progress_bar_' + player_id).style.backgroundImage = "linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 20%), url('waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : '') + "')";
}
{/literal}
{else}
{literal}
//list playback
if (document.getElementById('playback_progress_bar_background_' + player_id)) {
document.getElementById('playback_progress_bar_background_' + player_id).style.backgroundImage = "linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 100%)";
}
//form playback
else if (document.getElementById('recording_progress_bar_' + player_id)) {
document.getElementById('recording_progress_bar_' + player_id).style.backgroundImage = "linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 100%)";
}
{/literal}
{/if}
{literal}
}
function recording_play(player_id, data, audio_type, label) {
if (document.getElementById('recording_progress_bar_' + player_id)) {
document.getElementById('recording_progress_bar_' + player_id).style.display='';
}
recording_audio = document.getElementById('recording_audio_' + player_id);
var label_play = "{/literal}{if $php_self == 'xml_cdr_details.php'}{literal}<span class='button-label pad'>{/literal}{$text.label_play}{literal}</span>{/literal}{/if}{literal}";
var label_pause = "{/literal}{if $php_self == 'xml_cdr_details.php'}{literal}<span class='button-label pad'>{/literal}{$text.label_pause}{literal}</span>{/literal}{/if}{literal}";
if (recording_audio.paused) {
{/literal}
//create and load waveform image
{if $settings.theme.audio_player_waveform_enabled == 'true'}
{literal}
//list playback
if (document.getElementById('playback_progress_bar_background_' + player_id)) {
// alert("waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : ''));
document.getElementById('playback_progress_bar_background_' + player_id).style.backgroundImage = "linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 20%), url('waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : '') + "')";
}
//form playback
else if (document.getElementById('recording_progress_bar_' + player_id)) {
// alert("waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : ''));
document.getElementById('recording_progress_bar_' + player_id).style.backgroundImage = "linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 20%), url('waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : '') + "')";
}
{/literal}
{/if}
{literal}
recording_load(player_id, data, audio_type);
recording_audio.volume = 1;
recording_audio.play();
recording_id_playing = player_id;
document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_pause}{literal} fa-fw'></span>";
document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_pause}{literal} fa-fw'></span>" + (label_pause ?? '');
audio_clock = setInterval(function () { update_progress(player_id); }, 20);
$('[id*=recording_button]').not('[id*=recording_button_' + player_id + ']').html("<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>");
$('[id*=recording_button]').not('[id*=recording_button_' + player_id + ']').html("<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>" + (label_play ?? ''));
$('[id*=recording_button_intro]').not('[id*=recording_button_' + player_id + ']').html("<span class='{/literal}{$settings.theme.button_icon_comment}{literal} fa-fw'></span>");
$('[id*=recording_progress_bar]').not('[id*=recording_progress_bar_' + player_id + ']').css('display', 'none');
@@ -763,7 +781,7 @@
document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_comment}{literal} fa-fw'></span>";
}
else {
document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>";
document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>" + (label_play ?? '');
}
clearInterval(audio_clock);
}
@@ -778,9 +796,15 @@
recording_audio = document.getElementById('recording_audio_' + player_id);
recording_audio.pause();
recording_audio.currentTime = 0;
if (document.getElementById('recording_progress_bar_' + player_id)) {
document.getElementById('recording_progress_bar_' + player_id).style.display='none';
}
{/literal}
{if $php_self <> 'xml_cdr_details.php'}
{literal}
if (document.getElementById('recording_progress_bar_' + player_id)) {
document.getElementById('recording_progress_bar_' + player_id).style.display='none';
}
{/literal}
{/if}
{literal}
if (player_id.substring(0,6) == 'intro_') {
document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_comment}{literal} fa-fw'></span>";
}