Skip to content

Commit ec74324

Browse files
committed
Fix autoplay and data-start-time issues
1 parent d872b04 commit ec74324

7 files changed

Lines changed: 19 additions & 22 deletions

File tree

build/ableplayer.dist.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@
443443
AblePlayer.nextIndex = 0;
444444

445445
AblePlayer.prototype.setup = function() {
446-
447446
var thisObj = this;
448447
this.reinitialize().then(function () {
449448
if (!thisObj.player) {
@@ -1009,7 +1008,6 @@
10091008

10101009
// Creates the appropriate player for the current source.
10111010
AblePlayer.prototype.recreatePlayer = function () {
1012-
10131011
var thisObj, prefsGroups, i;
10141012
thisObj = this;
10151013

@@ -1028,7 +1026,6 @@
10281026
this.injectPlayerCode();
10291027
this.initSignLanguage();
10301028
this.setupTracks().then(function() {
1031-
10321029
// moved this here; in its original location was not working in Safari 10
10331030
thisObj.setMediaAttributes();
10341031

@@ -1047,7 +1044,6 @@
10471044

10481045
thisObj.initPlayer().then(function() { // initPlayer success
10491046
thisObj.initializing = false;
1050-
10511047
// inject each of the hidden forms that will be accessed from the Preferences popup menu
10521048
prefsGroups = thisObj.getPreferencesGroups();
10531049
for (i = 0; i < prefsGroups.length; i++) {
@@ -1103,8 +1099,11 @@
11031099
thisObj.setVolume(thisObj.defaultVolume);
11041100
thisObj.refreshControls();
11051101

1106-
// After done messing with the player, this is necessary to fix playback on iOS
1107-
if (thisObj.player === 'html5' && thisObj.isIOS()) {
1102+
// Go ahead and load media, without user requesting it
1103+
// Normally, we wait until user clicks play, rather than unnecessarily consume their bandwidth
1104+
// Exceptions are if the video is intended to autostart or if running on iOS (a workaround for iOS issues)
1105+
// TODO: Confirm that this is still necessary with iOS (this would added early, & I don't remember what the issues were)
1106+
if (thisObj.player === 'html5' && (thisObj.isIOS() || thisObj.startTime > 0 || thisObj.autoplay)) {
11081107
thisObj.$media[0].load();
11091108
}
11101109
deferred.resolve();

build/ableplayer.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@
443443
AblePlayer.nextIndex = 0;
444444

445445
AblePlayer.prototype.setup = function() {
446-
447446
var thisObj = this;
448447
this.reinitialize().then(function () {
449448
if (!thisObj.player) {
@@ -1009,7 +1008,6 @@
10091008

10101009
// Creates the appropriate player for the current source.
10111010
AblePlayer.prototype.recreatePlayer = function () {
1012-
10131011
var thisObj, prefsGroups, i;
10141012
thisObj = this;
10151013

@@ -1028,7 +1026,6 @@
10281026
this.injectPlayerCode();
10291027
this.initSignLanguage();
10301028
this.setupTracks().then(function() {
1031-
10321029
// moved this here; in its original location was not working in Safari 10
10331030
thisObj.setMediaAttributes();
10341031

@@ -1047,7 +1044,6 @@
10471044

10481045
thisObj.initPlayer().then(function() { // initPlayer success
10491046
thisObj.initializing = false;
1050-
10511047
// inject each of the hidden forms that will be accessed from the Preferences popup menu
10521048
prefsGroups = thisObj.getPreferencesGroups();
10531049
for (i = 0; i < prefsGroups.length; i++) {
@@ -1103,8 +1099,11 @@
11031099
thisObj.setVolume(thisObj.defaultVolume);
11041100
thisObj.refreshControls();
11051101

1106-
// After done messing with the player, this is necessary to fix playback on iOS
1107-
if (thisObj.player === 'html5' && thisObj.isIOS()) {
1102+
// Go ahead and load media, without user requesting it
1103+
// Normally, we wait until user clicks play, rather than unnecessarily consume their bandwidth
1104+
// Exceptions are if the video is intended to autostart or if running on iOS (a workaround for iOS issues)
1105+
// TODO: Confirm that this is still necessary with iOS (this would added early, & I don't remember what the issues were)
1106+
if (thisObj.player === 'html5' && (thisObj.isIOS() || thisObj.startTime > 0 || thisObj.autoplay)) {
11081107
thisObj.$media[0].load();
11091108
}
11101109
deferred.resolve();

build/ableplayer.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ableplayer.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ableplayer",
3-
"version": "3.0.42",
3+
"version": "3.0.43",
44
"description": "fully accessible HTML5 media player",
55
"homepage": "http://ableplayer.github.io/ableplayer",
66
"bugs": "https://github.com/ableplayer/ableplayer/issues",

scripts/ableplayer-base.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@
443443
AblePlayer.nextIndex = 0;
444444

445445
AblePlayer.prototype.setup = function() {
446-
447446
var thisObj = this;
448447
this.reinitialize().then(function () {
449448
if (!thisObj.player) {

0 commit comments

Comments
 (0)