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

[2.0] Playing when autoplay is false does not work #1027

Closed
nickygerritsen opened this issue Jan 17, 2016 · 3 comments
Closed

[2.0] Playing when autoplay is false does not work #1027

nickygerritsen opened this issue Jan 17, 2016 · 3 comments
Assignees
Milestone

Comments

@nickygerritsen
Copy link

When autoplay is set to false, the player does not play when play() is called on the <video> element. It might be that #999 broke it.

For example, take the following code:

<!doctype html>
<html>
    <head>
        <title>Dash.js Rocks</title>
    </head>
    <body>
        <div>
            <video id="videoPlayer" controls="true"></video>
        </div>
        <script src="dash.all.min.js"></script>
        <script>
            var url = "http://rdmedia.bbc.co.uk/dash/ondemand/testcard/1/client_manifest-events.mpd";
            var vp = document.querySelector("#videoPlayer");
            var player = MediaPlayer().create(); 
            player.initialize(document.querySelector("#videoPlayer"), url, false);
        </script>
    </body>
</html>

Now calling player.play() does load the video in the element, but not play it. Calling it again, or calling vp.play() will start playing.

The following combinations work:

  • vp.play(); player.play();
  • player.play(); vp.play();
  • player.play();setTimeout(function() { player.play(); }, 1000);

What does not work:

  • vp.play();
  • player.play();
  • player.play(); player.play();
  • vp.play(); vp.play();

It seems that the MediaPlayer.play() method does something (async) but does not play afterwards.

If autoplay is true, the HTML5 video element will play as soon as data is loaded and the MediaPlayer will call play internally, so it does work.

@nickygerritsen nickygerritsen changed the title Playing when autoplay is false does not work [2.0] Playing when autoplay is false does not work Jan 17, 2016
@dsparacio dsparacio added this to the 2.0.0 milestone Jan 25, 2016
@dsparacio dsparacio self-assigned this Jan 25, 2016
@dsparacio
Copy link
Contributor

Thanks for catching this. I will fix asap.

@dsparacio
Copy link
Contributor

Small update this works for me in chrome
player = MediaPlayer().create();
player.initialize(document.getElementById("video"), url, false);
player.play();

But when I do not have player.play and use default controls noting is calling playing.play just element.play and it fails. will fix this now.

dsparacio pushed a commit to dsparacio/dash.js that referenced this issue Jan 30, 2016
… tested with auto-load-multi-video.html

Changed fix for Dash-Industry-Forum#1018 but maintained code in different place. Fix still works for Dash-Industry-Forum#1018
@dsparacio
Copy link
Contributor

Fixed with PR #1097. Thanks for reporting this @nickygerritsen . Please reopen if you need something else.

dsparacio pushed a commit that referenced this issue Feb 1, 2016
Fix for #1027 and fix #1072 for tested with auto-load-multi-video.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants