Bug 94786 - MediaController play() doesn't work
Summary: MediaController play() doesn't work
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows 7
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-23 00:47 PDT by Changbin Shao
Modified: 2012-08-27 02:31 PDT (History)
2 users (show)

See Also:


Attachments
test file (599 bytes, text/html)
2012-08-23 00:51 PDT, Changbin Shao
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Changbin Shao 2012-08-23 00:47:58 PDT
reproduce step:
1. open attached file in safari/chrome
2. check if video is able to display.

result:
video is not able to play.
Comment 1 Changbin Shao 2012-08-23 00:51:10 PDT
Created attachment 160105 [details]
test file

test.html
Comment 2 Jer Noble 2012-08-23 10:32:03 PDT
Unfortunately, this code is working exactly as expected.  The spec says:

"A MediaController is a blocked media controller ... if all of its slaved media elements have their paused attribute set to true."

Since the test case has a MediaController with a single slaved media element, and that media element is paused, the MediaController is a blocked media controller, and play() will not cause playback to start until the slaved media element is unpaused.
Comment 3 Changbin Shao 2012-08-23 19:25:45 PDT
Thanks, it make sense for me now. While I still have questions here.
For instance, there are two video tags, with id vid1 & vid2.
     
var con = new MediaController();
vid1.controller = con;
vid2.controller = con;
con.play();//won't work since MediaController is blocked.
vid1.play();//won't work since MediaController is blocked(because MediaElement 2 is still paused) 
vid2.play(); //works, since MediaController is not blocked now.
con.pause();//MediaController is paused. How about its slaved elements, should be paused or not? 
con.play();//what the result should be? As the spec says: "A MediaController is a blocked media controller if the MediaController is a paused media controller...",so no video should play?
Comment 4 Jer Noble 2012-08-24 09:12:23 PDT
(In reply to comment #3)
> Thanks, it make sense for me now. While I still have questions here.
> For instance, there are two video tags, with id vid1 & vid2.
> 
> var con = new MediaController();
> vid1.controller = con;
> vid2.controller = con;
> con.play();//won't work since MediaController is blocked.
> vid1.play();//won't work since MediaController is blocked(because MediaElement 2 is still paused) 

Not quite.  The MediaController is only blocked if *all* of its slaved media elements are paused.  So at this point, the MediaController goes from a blocked media controller to a playing one.  Vid1 will begin playing.

> vid2.play(); //works, since MediaController is not blocked now.
> con.pause();//MediaController is paused. How about its slaved elements, should be paused or not? 

They are blocked on their MediaController.  They are still "playing" technically, but their timelines are stopped.

> con.play();//what the result should be? As the spec says: "A MediaController is a blocked media controller if the MediaController is a paused media controller...",so no video should play?

Once the MediaController goes from a paused media controller to a playing media controller, the slaved media elements should begin playing.  (Assuming the MediaController does not become blocked for some other reason, like one of the slaved media elements stalling, etc.)
Comment 5 Changbin Shao 2012-08-27 02:31:47 PDT
Thanks a lot for your explanation! 

(In reply to comment #4)
> (In reply to comment #3)
> > Thanks, it make sense for me now. While I still have questions here.
> > For instance, there are two video tags, with id vid1 & vid2.
> > 
> > var con = new MediaController();
> > vid1.controller = con;
> > vid2.controller = con;
> > con.play();//won't work since MediaController is blocked.
> > vid1.play();//won't work since MediaController is blocked(because MediaElement 2 is still paused) 
> 
> Not quite.  The MediaController is only blocked if *all* of its slaved media elements are paused.  So at this point, the MediaController goes from a blocked media controller to a playing one.  Vid1 will begin playing.

Just for your information. Spec says: "A MediaController is a blocked media controller...if any of its slaved media elements whose autoplaying flag is true still have their paused attribute set to true" && "All media elements have an autoplaying flag, which must begin in the true state", so I think vid2 still blocks mediaController, thus vid1 is still not able to play. Checked my idea on Chrome. 
 
> > vid2.play(); //works, since MediaController is not blocked now.
> > con.pause();//MediaController is paused. How about its slaved elements, should be paused or not? 
> 
> They are blocked on their MediaController.  They are still "playing" technically, but their timelines are stopped.
> 
> > con.play();//what the result should be? As the spec says: "A MediaController is a blocked media controller if the MediaController is a paused media controller...",so no video should play?
> 
> Once the MediaController goes from a paused media controller to a playing media controller, the slaved media elements should begin playing.  (Assuming the MediaController does not become blocked for some other reason, like one of the slaved media elements stalling, etc.)