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

iOS bug cannot set currentTime(0) inside loadedmetadata event #1148

Open
dioramayuanito opened this issue Jun 28, 2024 · 0 comments
Open

iOS bug cannot set currentTime(0) inside loadedmetadata event #1148

dioramayuanito opened this issue Jun 28, 2024 · 0 comments

Comments

@dioramayuanito
Copy link

/**
 * Changes the player source.
 * @param {?string} contentSrc The URI for the content to be played. Leave
 *     blank to use the existing content.
 */
PlayerWrapper.prototype.changeSource = function (contentSrc) {
  // Only try to pause the player when initialised with a source already
  if (this.vjsPlayer.currentSrc()) {
    this.vjsPlayer.currentTime(0);
    this.vjsPlayer.pause();
  }
  if (contentSrc) {
    this.vjsPlayer.src(contentSrc);
  }
  this.vjsPlayer.one('loadedmetadata', this.seekContentToZero.bind(this));
};

/**
 * Seeks content to 00:00:00. This is used as an event handler for the
 * loadedmetadata event, since seeking is not possible until that event has
 * fired.
 */
PlayerWrapper.prototype.seekContentToZero = function () {
  this.vjsPlayer.currentTime(0);
};

this.vjsPlayer.one('loadedmetadata', this.seekContentToZero.bind(this)); sometimes will be failed because of iOS bug

https://stackoverflow.com/questions/18266437/html5-video-currenttime-not-setting-properly-on-iphon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant