From 5d2ab45fff4e823e36ff37501b17002e981253f1 Mon Sep 17 00:00:00 2001 From: Tariq Rasheed Date: Thu, 21 Sep 2017 19:34:05 +0500 Subject: [PATCH 1/7] Custom audio player with scrollable transcript (#1) - Customized audio player with custom style. - Scrollable transcript - Author will put two source links of media file, first (.ogg) for play and second (.mp3) for download. - To display transcript, author will put source of transcript. - User can download transcript file (.txt / .srt ) and media file (.mp3). --- README.md | 8 +- audio/audio.py | 29 ++- audio/static/css/audio.css | 9 - audio/static/css/audio.scss | 379 ++++++++++++++++++++++++++++++ audio/static/html/audio.html | 58 ++++- audio/static/html/audio_edit.html | 16 +- audio/static/js/src/audio.js | 178 ++++++++++++++ audio/static/js/src/audio_edit.js | 4 +- 8 files changed, 652 insertions(+), 29 deletions(-) delete mode 100644 audio/static/css/audio.css create mode 100644 audio/static/css/audio.scss diff --git a/README.md b/README.md index 91b79cb..946c6da 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,12 @@ AudioXBlock =========== This is a simple XBlock which will play audio files as an HTML5 audio -element. If unavailable, it will fall back to an embed element. +element and render the transcript as plain text. If unavailable, it will fall back to an embed element. Usage: - + transcript_src="sdrfserf.txt" + downloadable_src="fasdf.mp3"> """), ] diff --git a/audio/static/html/audio.html b/audio/static/html/audio.html index 61cc4fb..f5caef4 100644 --- a/audio/static/html/audio.html +++ b/audio/static/html/audio.html @@ -1,6 +1,7 @@
-

No playable audio source found.

+

* No playable audio source found.

+

* Invalid transcript source.

@@ -47,12 +48,11 @@

No playable audio source fo

Downloads:

-

No transcript source found.

- +
diff --git a/audio/static/js/src/audio.js b/audio/static/js/src/audio.js index f1ca4b4..57491dc 100644 --- a/audio/static/js/src/audio.js +++ b/audio/static/js/src/audio.js @@ -70,10 +70,10 @@ function AudioXBlock(runtime, element) { audioPlayerDiv.addClass('col-12'); } - - if(transcript.attr('src') === 'error'){ + if(transcript.attr('is-transcript-url-valid') === "False"){ noAudioTranscriptMessage.show(); transcript.hide(); + transcriptDownloadableLink.show(); } // loading the meta data for audio file, e.g. audio length, and playing automatically