Browse Source
* pulling the text track outside of the audio element so its not hidden * do not set default in the template, because its an attribute that can be set in the track configpull/837/head
Eli Zoller
4 years ago
committed by
GitHub
3 changed files with 54 additions and 1 deletions
@ -0,0 +1,7 @@
|
||||
audio: |
||||
version: 1.x |
||||
js: |
||||
js/audio.js: {preprocess: false} |
||||
dependencies: |
||||
- core/drupal |
||||
- core/drupalSettings |
@ -0,0 +1,43 @@
|
||||
/*jslint browser: true*/ |
||||
/*global Audio, Drupal*/ |
||||
/** |
||||
* @file |
||||
* Displays Audio viewer. |
||||
*/ |
||||
(function ($, Drupal) { |
||||
'use strict'; |
||||
|
||||
/** |
||||
* If initialized. |
||||
* @type {boolean} |
||||
*/ |
||||
var initialized; |
||||
/** |
||||
* Unique HTML id. |
||||
* @type {string} |
||||
*/ |
||||
var base; |
||||
|
||||
function init(context,settings){ |
||||
if (!initialized){ |
||||
initialized = true; |
||||
$('audio')[0].textTracks[0].oncuechange = function() { |
||||
var currentCue = this.activeCues[0].text; |
||||
$('#audioTrack').html(currentCue); |
||||
} |
||||
} |
||||
} |
||||
Drupal.Audio = Drupal.Audio || {}; |
||||
|
||||
/** |
||||
* Initialize the Audio Viewer. |
||||
*/ |
||||
Drupal.behaviors.Audio = { |
||||
attach: function (context, settings) { |
||||
init(context,settings); |
||||
}, |
||||
detach: function () { |
||||
} |
||||
}; |
||||
|
||||
})(jQuery, Drupal); |
Loading…
Reference in new issue