Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
103 changes: 93 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"exports-loader": "0.6.4",
"file-loader": "^6.2.0",
"font-awesome": "4.7.0",
"hls.js": "^1.6.15",
"hls.js": "0.14.17",
"imports-loader": "0.8.0",
"jest-environment-jsdom": "^29.0.0",
"jquery": "2.2.4",
Expand Down
8 changes: 4 additions & 4 deletions xmodule/js/spec/video/video_player_spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* global YT */

// eslint-disable-next-line no-shadow-restricted-names
(function() {
(function(require, define, undefined) {
'use strict';

require(
['video/03_video_player.js', 'hls', 'underscore'],
function(VideoPlayer, Hls, _) {
function(VideoPlayer, HLS, _) {
describe('VideoPlayer', function() {
var STATUS = window.STATUS,
state,
Expand Down Expand Up @@ -982,7 +982,7 @@

describe('on safari', function() {
beforeEach(function() {
spyOn(Hls, 'isSupported').and.returnValue(false);
spyOn(HLS, 'isSupported').and.returnValue(false);
state = jasmine.initializeHLSPlayer();
state.canPlayHLS = true;
state.browserIsSafari = true;
Expand All @@ -996,7 +996,7 @@

describe('HLS Video Errors', function() {
beforeEach(function() {
spyOn(Hls, 'isSupported').and.returnValue(false);
spyOn(HLS, 'isSupported').and.returnValue(false);
state = jasmine.initializeHLSPlayer({sources: ['/base/fixtures/hls/hls.m3u8']});
});

Expand Down
16 changes: 8 additions & 8 deletions xmodule/js/src/video/02_html5_hls_video.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'use strict';

define('video/02_html5_hls_video.js', ['underscore', 'video/02_html5_video.js', 'hls'],
function(_, HTML5Video, Hls) {
function(_, HTML5Video, HLS) {
var HLSVideo = {};

HLSVideo.Player = (function() {
Expand Down Expand Up @@ -45,16 +45,16 @@
} else {
// load auto start if auto_advance is enabled
if (config.state.auto_advance) {
this.hls = new Hls({autoStartLoad: true});
this.hls = new HLS({autoStartLoad: true});
} else {
this.hls = new Hls({autoStartLoad: false});
this.hls = new HLS({autoStartLoad: false});
}
this.hls.loadSource(config.videoSources[0]);
this.hls.attachMedia(this.video);

this.hls.on(Hls.Events.ERROR, this.onError.bind(this));
this.hls.on(HLS.Events.ERROR, this.onError.bind(this));

this.hls.on(Hls.Events.MANIFEST_PARSED, function(event, data) {
this.hls.on(HLS.Events.MANIFEST_PARSED, function(event, data) {
console.log(
'[HLS Video]: MANIFEST_PARSED, qualityLevelsInfo: ',
data.levels.map(function(level) {
Expand All @@ -66,7 +66,7 @@
);
self.config.onReadyHLS();
});
this.hls.on(Hls.Events.LEVEL_SWITCHED, function(event, data) {
this.hls.on(HLS.Events.LEVEL_SWITCHED, function(event, data) {
var level = self.hls.levels[data.level];
console.log(
'[HLS Video]: LEVEL_SWITCHED, qualityLevelInfo: ',
Expand Down Expand Up @@ -114,14 +114,14 @@
Player.prototype.onError = function(event, data) {
if (data.fatal) {
switch (data.type) {
case Hls.ErrorTypes.NETWORK_ERROR:
case HLS.ErrorTypes.NETWORK_ERROR:
console.error(
'[HLS Video]: Fatal network error encountered, try to recover. Details: %s',
data.details
);
this.hls.startLoad();
break;
case Hls.ErrorTypes.MEDIA_ERROR:
case HLS.ErrorTypes.MEDIA_ERROR:
console.error(
'[HLS Video]: Fatal media error encountered, try to recover. Details: %s',
data.details
Expand Down
4 changes: 2 additions & 2 deletions xmodule/js/src/video/03_video_player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
define(
'video/03_video_player.js',
['video/02_html5_video.js', 'video/02_html5_hls_video.js', 'video/00_resizer.js', 'hls', 'underscore', '../time.js'],
function(HTML5Video, HTML5HLSVideo, Resizer, Hls, _, Time) {
function(HTML5Video, HTML5HLSVideo, Resizer, HLS, _, Time) {
var dfd = $.Deferred(),
VideoPlayer = function(state) {
state.videoPlayer = {};
Expand Down Expand Up @@ -157,7 +157,7 @@

// Browser can play HLS videos if either `Media Source Extensions`
// feature is supported or browser is safari (native HLS support)
state.canPlayHLS = state.HLSVideoSources.length > 0 && (Hls.isSupported() || state.browserIsSafari);
state.canPlayHLS = state.HLSVideoSources.length > 0 && (HLS.isSupported() || state.browserIsSafari);
state.HLSOnlySources = state.config.sources.length > 0
&& state.config.sources.length === state.HLSVideoSources.length;

Expand Down
Loading