From 76b81f812925b4d4f744159bbd02502776941314 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 27 Jan 2014 20:00:39 +0100 Subject: [PATCH] Disabling webrtc + using nanogong and then wami for record audio see BT#7339 The wav file is transformed in mp3 if the binary ffmpeg is installed. --- main/document/record_audio.php | 1 + main/document/showinframes.php | 11 +- main/inc/lib/display.lib.php | 15 +- main/inc/lib/document.lib.php | 138 +++++++- main/inc/lib/fileUpload.lib.php | 46 ++- .../inc/lib/nanogong/upload_nanogong_file.php | 56 ++++ .../inc/lib/wami-recorder/record_document.php | 81 ++--- main/newscorm/learnpath.class.php | 39 ++- main/newscorm/lp_add_audio.php | 26 +- .../default/learnpath/record_voice.tpl | 310 +++++++++++------- 10 files changed, 522 insertions(+), 201 deletions(-) create mode 100644 main/inc/lib/nanogong/upload_nanogong_file.php diff --git a/main/document/record_audio.php b/main/document/record_audio.php index 1b87d9b429..0b09ad64c8 100644 --- a/main/document/record_audio.php +++ b/main/document/record_audio.php @@ -168,6 +168,7 @@ function submitVoice() { // var applet = document.getElementById("nanogong"); var ret = applet.sendGongRequest( "PostToForm", urlnanogong, "voicefile", cookie, "temp");//'PostToForm', postURL, inputname, cookie, filename + if (ret == null) { alert(lang_failled_to_submit); } else { diff --git a/main/document/showinframes.php b/main/document/showinframes.php index 427a1c1ab3..0e316fb318 100644 --- a/main/document/showinframes.php +++ b/main/document/showinframes.php @@ -402,19 +402,14 @@ if ($is_nanogong_available) { } //get file from tmp directory - $to_url=api_get_path(WEB_ARCHIVE_PATH).'temp/audio/'.$file_crip; + $to_url = api_get_path(WEB_ARCHIVE_PATH).'temp/audio/'.$file_crip; echo '
'; echo ''.get_lang('Download').''; echo '
'; echo '
'; - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + + echo DocumentManager::readNanogongFile($to_url); //erase temp file in tmp directory when return to documents $_SESSION['temp_audio_nanogong']=$to_sys; diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index e8b072d2d2..6dee48321b 100644 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -1571,11 +1571,21 @@ class Display { return $html; } + /** + * @param string $file + * @param array $params + * @return null|string + */ public static function getMediaPlayer($file, $params = array()) { $fileInfo = pathinfo($file); switch ($fileInfo['extension']) { + case 'wav': + if (isset($params['url'])) { + return DocumentManager::readNanogongFile($params['url']); + } + break; case 'mp3': case 'webm': $autoplay = null; @@ -1587,14 +1597,13 @@ class Display { $class = isset($params['class']) ? ' class="'.$params['class'].'"' : null; $html = '