Skip to content

Commit f706b82

Browse files
committed
Extend HTML5 player support to iOS 8 & higher
1 parent bf2f2d8 commit f706b82

4 files changed

Lines changed: 14 additions & 28 deletions

File tree

build/ableplayer.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
this.fallback = fallback;
143143
}
144144
}
145-
145+
146146
if ($(media).data('test-fallback') !== undefined && $(media).data('test-fallback') !== "false") {
147147
this.testFallback = true;
148148
}
@@ -571,7 +571,6 @@
571571
if (this.debug && this.player) {
572572
console.log ('Using the ' + this.player + ' media player');
573573
}
574-
575574
// First run player specific initialization.
576575
if (this.player === 'html5') {
577576
playerPromise = this.initHtml5Player();
@@ -627,6 +626,8 @@
627626
};
628627

629628
AblePlayer.prototype.initJwPlayer = function () {
629+
630+
var jwHeight;
630631
var thisObj = this;
631632
var deferred = new $.Deferred();
632633
var promise = deferred.promise();
@@ -794,7 +795,6 @@
794795
AblePlayer.prototype.getPlayer = function() {
795796
// Determine which player to use, if any
796797
// return 'html5', 'jw' or null
797-
798798
var i, sourceType, $newItem;
799799
if (this.youtubeId) {
800800
if (this.mediaType !== 'video') {
@@ -806,12 +806,11 @@
806806
}
807807
else if (this.testFallback ||
808808
((this.isUserAgent('msie 7') || this.isUserAgent('msie 8') || this.isUserAgent('msie 9')) && this.mediaType === 'video') ||
809-
(this.isIOS() && !this.isIOS(7))) {
809+
(this.isIOS() && (this.isIOS(4) || this.isIOS(5) || this.isIOS(6)))
810+
) {
810811
// the user wants to test the fallback player, or
811-
// the user is using IE9, which has buggy implementation of HTML5 video
812-
// e.g., plays only a few seconds of MP4 than stops and resets to 0
813-
// even in native HTML player with no JavaScript
814-
// Couldn't figure out a solution to this problem - IE10 fixes it. Meanwhile, use JW for IE9 video
812+
// the user is using an older version of IE or IOS,
813+
// both of which had buggy implementation of HTML5 video
815814
if (this.fallback === 'jw') {
816815
if (this.$sources.length > 0) { // this media has one or more <source> elements
817816
for (i = 0; i < this.$sources.length; i++) {
@@ -5695,17 +5694,12 @@
56955694
// add listeners for JW Player events
56965695
this.jwPlayer
56975696
.onTime(function() {
5698-
console.log('a');
56995697
thisObj.onMediaUpdateTime();
5700-
console.log('b');
57015698
})
57025699
.onComplete(function() {
5703-
console.log('c');
57045700
thisObj.onMediaComplete();
5705-
console.log('d');
57065701
})
57075702
.onReady(function() {
5708-
console.log('e');
57095703
if (thisObj.debug) {
57105704
console.log('JW Player onReady event fired');
57115705
}
@@ -5732,7 +5726,6 @@
57325726
}
57335727

57345728
thisObj.refreshControls();
5735-
console.log('f');
57365729
})
57375730
.onSeek(function(event) {
57385731
// this is called when user scrubs ahead or back

scripts/ableplayer-base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
this.fallback = fallback;
143143
}
144144
}
145-
145+
146146
if ($(media).data('test-fallback') !== undefined && $(media).data('test-fallback') !== "false") {
147147
this.testFallback = true;
148148
}

scripts/event.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,17 +374,12 @@
374374
// add listeners for JW Player events
375375
this.jwPlayer
376376
.onTime(function() {
377-
console.log('a');
378377
thisObj.onMediaUpdateTime();
379-
console.log('b');
380378
})
381379
.onComplete(function() {
382-
console.log('c');
383380
thisObj.onMediaComplete();
384-
console.log('d');
385381
})
386382
.onReady(function() {
387-
console.log('e');
388383
if (thisObj.debug) {
389384
console.log('JW Player onReady event fired');
390385
}
@@ -411,7 +406,6 @@
411406
}
412407

413408
thisObj.refreshControls();
414-
console.log('f');
415409
})
416410
.onSeek(function(event) {
417411
// this is called when user scrubs ahead or back

scripts/initialize.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@
309309
if (this.debug && this.player) {
310310
console.log ('Using the ' + this.player + ' media player');
311311
}
312-
313312
// First run player specific initialization.
314313
if (this.player === 'html5') {
315314
playerPromise = this.initHtml5Player();
@@ -365,6 +364,8 @@
365364
};
366365

367366
AblePlayer.prototype.initJwPlayer = function () {
367+
368+
var jwHeight;
368369
var thisObj = this;
369370
var deferred = new $.Deferred();
370371
var promise = deferred.promise();
@@ -532,7 +533,6 @@
532533
AblePlayer.prototype.getPlayer = function() {
533534
// Determine which player to use, if any
534535
// return 'html5', 'jw' or null
535-
536536
var i, sourceType, $newItem;
537537
if (this.youtubeId) {
538538
if (this.mediaType !== 'video') {
@@ -544,12 +544,11 @@
544544
}
545545
else if (this.testFallback ||
546546
((this.isUserAgent('msie 7') || this.isUserAgent('msie 8') || this.isUserAgent('msie 9')) && this.mediaType === 'video') ||
547-
(this.isIOS() && !this.isIOS(7))) {
547+
(this.isIOS() && (this.isIOS(4) || this.isIOS(5) || this.isIOS(6)))
548+
) {
548549
// the user wants to test the fallback player, or
549-
// the user is using IE9, which has buggy implementation of HTML5 video
550-
// e.g., plays only a few seconds of MP4 than stops and resets to 0
551-
// even in native HTML player with no JavaScript
552-
// Couldn't figure out a solution to this problem - IE10 fixes it. Meanwhile, use JW for IE9 video
550+
// the user is using an older version of IE or IOS,
551+
// both of which had buggy implementation of HTML5 video
553552
if (this.fallback === 'jw') {
554553
if (this.$sources.length > 0) { // this media has one or more <source> elements
555554
for (i = 0; i < this.$sources.length; i++) {

0 commit comments

Comments
 (0)