Skip to content

Playing state inconsistent with remote video playing state #85

@markfejes

Description

@markfejes

Hello!

First of all, I would like to thank you react-player, it really helped me a lot in a project im currently working on.
Last week I encountered a bug, which is: (gif is from forked project)
animation

If you click fast enough, or just keep pressing space, the video will enter an infinite play-pause loop.
To reproduce this bug, i forked this project, placed some comment, and timeout for inner playing setState (https://github.com/Kisfejes/react-player/blob/master/src/demo/App.js#L98-L115)
With the timeout im emulating the redux slow down, which im using in the real applicaton.

I believe the root source of this bug is that, the inner playing state and the remote is not consistent. And after onPlay event from remote video api, you will initiate another play request toward to api. ((5) in the image). If you are in the middle of the setting state (500ms timeout in the example), and you got an another play or pause, the whole thing will end in an infinite loop.

Use case 1:
User clicked on youtube video to start (with native controls), the remote video API will fire onPlay event, you will change inner playing state to true, and because of this, react-player will call play() on the video (https://github.com/CookPete/react-player/blob/master/src/players/Base.js#L31-L34)
use-case-1-small

Can you suggest any solution to this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions