question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Behavior at the end of play

See original GitHub issue

Hi 😃, I have some trouble playing the last seconds of my video using rx-player library. After some research I found that there is a END_OF_PLAY constant :

  /**
   * Time before the end of a video (in seconds) at which the player should
   * automatically stop.
   * It happens often that the video gets stuck 100 to 300 ms before the end,
   * especially on IE11 and Edge
   * @type {Number}
   */
  END_OF_PLAY: 0.5,

that limit the playing time of the streams

  /**
   * End-Of-Play emit when the current timing is really close to the end.
   * @see END_OF_PLAY
   * @type {Observable}
   */
  const endOfPlay = timings$
    .filter(({ currentTime, duration }) => (
      duration > 0 && duration - currentTime < END_OF_PLAY
    ));

and later

  return createAndPlugMediaSource(
    url,
    videoElement,
    withMediaSource,
    sourceBufferMemory
  )
    .mergeMap(startStream)
    .takeUntil(endOfPlay);

I have a particular use-case that requires to read the very last frame of a video. Could you change END_OF_PLAY into a configurable variable ? I also noticed that a ENDED status automatically lead to a stop action. Is it possible to disable this behavior ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
peaBerberiancommented, Feb 23, 2018

It’s finally done and merged 🙌 !

With the release v3.2.0 you do not have to update END_OF_PLAY anymore (it does not even exist now) and we do end at the last frame of the last downloaded segment.


To be precize, we end at the minimum time between the end of the audio and the end of the video.

For example, if your audio ends at 10 seconds but your video ends at 11 seconds, your content will end at 10 seconds. This is a limitation of the browser, a workaround could be possible but would not be practical (at all). If that bothers you, you can still open a new issue.


To avoid stopping as the video ends, we had to add an option to the constructor. It is named stopAtEnd and its documentation can be found here.


One new thing to keep in mind however, is that we do not allow segments inferior to 200ms for various reasons. Those won’t be downloaded, won’t be pushed, and playback will happen without them (when encountered, we’ll automatically skip them).

If that is a problem for you, please open another issue.


Sorry for the delay, this was more complicated than expected 😞

Read more comments on GitHub >

github_iconTop Results From Across the Web

The power of play – Part 1: Stages of play - Early Childhood ...
Unoccupied play looks like babies or young children exploring materials around them without any sort of organization. This stage allows children ...
Read more >
The 6 Stages of How Kids Learn to Play | Child Development
Unoccupied Play (Birth-3 Months). At this stage baby is just making a lot of movements with their arms, legs, hands, feet, etc. ·...
Read more >
9 Things You Need to Know About Play (and Preventing ...
Typically we see children engaging in cooperative pretend play by the end of the preschool years. Pretend play is the hallmark of play ......
Read more >
Young Children Learn a Lot When They Play
Aggressive behavior is often not meant to be hostile or to hurt others. In fact, young children frequently get upset when another child...
Read more >
Behavior Expectations and Playground Rules
Examples of rough play include contact soccer, slap tag, wrestling, and “play” fighting. Examples of unsafe play include jumping from the top of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found