Git Product home page Git Product logo

Comments (2)

peaBerberian avatar peaBerberian commented on May 24, 2024

Hi,

We worked a lot on "end detection" since the v3.2.0 release.

The previous behavior of the player was to stop around 500ms before the true end of the content to avoid such cases.

However, as our company's needs grew, we wanted to be frame-accurate even at the end of the content, so we had to detect the true end of the content before stopping it.

We found some issue with this code which were fixed in v3.3.1.

However there is no more issue with it we know of now, can we test the content you're playing to perform further investigations?

Thanks,

from rx-player.

peaBerberian avatar peaBerberian commented on May 24, 2024

Notes for those who might read this issue:

We continued to investigate this issue through e-mail exchanges and found out that it was linked to an old version of Chrome (Chrome 54).

As our goal is to support multiple platforms, which often include old versions of embedded Chromes, we try to work around this browser bug directly in our code.

The technical issue is that Chrome does not emit any "ended" event when it reaches the end, despite us calling mediaSource.endOfStream() at the right time before that.

The resolution found was simply to check if we are at the end of the content when the player begins to stall.

We basically do (we do not actually have this code here, but we have the same principles):

/**
 * Returns true if the content has ended.
 * @param {HTMLMediaElement} videoElement
 * @param {boolean} isStalled
 * @returns {boolean}
 */
function hasEnded(videoElement, isStalled) {
  if (videoElement.ended) {
     return true;
  }
  if (isStalled) {
    return Math.abs(videoElement.duration - videoElement.currentTime) < SOME_THRESHOLD;
  }
  return false;
}

/**
 * Callback triggered when the content stalls.
 */
function whenStalled() {
  if (hasEnded(videoElement, true)) {
    console.log("The content has ended");
  }
}

For now, that threshold is in the order of 1 ms. It can be updated in the config (FORCED_ENDED_THRESHOLD in src/config.ts). This logic can also be deactivated by setting this threshold to null.

We're currently doing multiple regression tests to see if we can integrate this fix in the next release - v3.3.2.

from rx-player.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.