Skip to content

Commit

Permalink
issue/2799 Remove redundant behaviour (#229)
Browse files Browse the repository at this point in the history
* issue/2799 Remove redundant behaviour

* issue/2799 Removed duplicate lines
  • Loading branch information
oliverfoster authored Apr 29, 2022
1 parent 9507c21 commit b6b6aef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions js/adapt-contrib-media.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Adapt from 'core/js/adapt';
import components from 'core/js/components';
import MediaView from './mediaView';
import ComponentModel from 'core/js/models/componentModel';

export default Adapt.register('media', {
export default components.register('media', {
// create a new class in the inheritance chain so it can be extended per component type if necessary later
model: ComponentModel.extend({}),
view: MediaView
Expand Down
10 changes: 5 additions & 5 deletions js/mediaView.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Adapt from 'core/js/adapt';
import offlineStorage from 'core/js/offlineStorage';
import a11y from 'core/js/a11y';
import logging from 'core/js/logging';
import ComponentView from 'core/js/views/componentView';
import 'libraries/mediaelement-and-player';
import 'libraries/mediaelement-fullscreen-hook';
import log from 'core/js/logging';
import offlineStorage from 'core/js/offlineStorage';

/*
* Default shortcut keys trap a screen reader user inside the player once in focus. These keys are unnecessary
Expand Down Expand Up @@ -200,7 +200,7 @@ class MediaView extends ComponentView {
const _media = this.model.get('_media');
// if no media is selected - set ready now, as success won't be called
if (!_media.mp3 && !_media.mp4 && !_media.ogv && !_media.webm && !_media.source) {
log.warn('ERROR! No media is selected in components.json for component ' + this.model.get('_id'));
logging.warn('ERROR! No media is selected in components.json for component ' + this.model.get('_id'));
this.setReadyStatus();
return;
}
Expand Down Expand Up @@ -239,7 +239,7 @@ class MediaView extends ComponentView {
})
.fail(() => {
MediaView.froogaloopAdded = false;
log.error('Could not load froogaloop.js');
logging.error('Could not load froogaloop.js');
});
break;
default:
Expand Down Expand Up @@ -399,7 +399,7 @@ class MediaView extends ComponentView {
const player = this.mediaElement.player;

if (!player) {
log.warn('MediaView.setupPlayPauseToggle: OOPS! there is no player reference.');
logging.warn('MediaView.setupPlayPauseToggle: OOPS! there is no player reference.');
return;
}

Expand Down
9 changes: 5 additions & 4 deletions libraries/mediaelement-fullscreen-hook.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
define([
'core/js/adapt',
'core/js/device',
'libraries/mediaelement-and-player'
], function(Adapt) {
var mepPrototype = $.extend({}, mejs.MediaElementPlayer.prototype);
], function(Adapt, device) {
var mepPrototype = $.extend({}, window.mejs.MediaElementPlayer.prototype);

$.extend(mejs.MediaElementPlayer.prototype, {
$.extend(window.mejs.MediaElementPlayer.prototype, {
/**
* fixes a bug (adaptlearning/adapt_framework#1478)
* where the media player going into/coming out of full-screen mode would trigger inview on
Expand Down Expand Up @@ -36,7 +37,7 @@ define([
* because the fullscreen events and properties are still vendor-prefixed in some browsers...
*/
getVendorPrefix: function() {
var browser = Adapt.device.browser;
var browser = device.browser;

if (browser === 'internet explorer') {
return 'ms';
Expand Down
6 changes: 3 additions & 3 deletions templates/media.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<audio src="{{_media.ogg}}" type="audio/ogg" style="width: 100%; height: 100%;"/>
{{else}}
<video aria-hidden="true" preload="none"
{{#if_value_equals _aspectRatio "square"}} width="640" height="640"
{{else if_value_equals _aspectRatio "portrait"}} width="540" height="960"
{{#equals _aspectRatio "square"}} width="640" height="640"
{{else equals _aspectRatio "portrait"}} width="540" height="960"
{{else}} width="640" height="360"
{{/if_value_equals}}
{{/equals}}
{{#if _playsinline}} playsinline{{/if}} {{#equals _media.type "video/vimeo"}}{{else}}poster="{{_media.poster}}"{{/equals}} style="width:100%; height:100%;" controls="controls">
{{#if _media.source}}
<source src="{{_media.source}}" type="{{_media.type}}"/>
Expand Down

0 comments on commit b6b6aef

Please sign in to comment.