Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue/2799 Remove redundant behaviour #229

Merged
merged 3 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 5 additions & 3 deletions js/mediaView.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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';
Expand Down Expand Up @@ -200,7 +202,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 +241,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 +401,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