digitalutsc / ableplayer

Extending Drupal's AblePlayer integration to provide simultaneous transcript player.
GNU General Public License v3.0
0 stars 0 forks source link

Seperating the changes out of Able player library. #3

Open kylehuynh205 opened 1 year ago

kylehuynh205 commented 1 year ago

Scenario:

Since the changes were made directly into the library in Able Player module. we have to use our version at https://github.com/digitalutsc/ableplayer/tree/islandra-lite instead of the main repository in Drupal.org (https://www.drupal.org/project/ableplayer). Which can result to our version being out of date compared to the main repository.

TODO:

Move development work (from screenshots) from the branch(https://github.com/digitalutsc/ableplayer/tree/islandra-lite) to a custom javascript or a patch, or find a better way to integrate those changes without overwrite the original Able player library

Screenshot 2023-01-24 at 10 30 56 AM

amym-li commented 1 year ago

Temporary Solution using JS Asset Injector

Display Ableplayer transcript window by default

Navigate to /admin/config/development/asset-injector/js/add and copy-paste the code below. Check 'Requires jQuery' under advanced options and save.

var observer = new MutationObserver(function(mutations, observer) {
  // check if transcript toggle exists
  if (jQuery("div.able-button-handler-transcript").length) {
    var toggle = jQuery("div.able-button-handler-transcript");
    if (toggle.hasClass('buttonOff')) {
        toggle.click();
    }
    observer.disconnect();
  }
});

// Start observing
observer.observe(document.body, {
  childList: true,
  subtree: true
});
amym-li commented 1 year ago

Encountered Issues with Ableplayer release 3.0.0-alpha5

In islandora_lite, the caption and transcript buttons are missing from the video player controls. The audio player does not have this issue, and the controls display and function normally.

In Islandora-Devops/isle-dc starter_dev, the caption and transcript buttons are missing from the audio player but are present in the video player.

amym-li commented 1 year ago

Interacting with the Ableplayer through the browser console

To see a full list of available functions, run:

Ableplayer.prototype

To toggle the transcript button:

AblePlayerInstances[0].handleTranscriptToggle()

To check if transcript is turned on (0 = off, 1 = on):

AblePlayerInstances[0].prefTranscript