Exposing play, pause, mute, unmute actions and making integration tests run on iOS 10#7171
Exposing play, pause, mute, unmute actions and making integration tests run on iOS 10#7171aghassemi merged 18 commits intoampproject:masterfrom
Conversation
| ``` | ||
|
|
||
| ## Element Specific Events | ||
| ### form |
There was a problem hiding this comment.
@bpaduch for review. I changed the layout of this page (now each component gets its own table rather than all in one table) also added actions and their description for amp-video, amp-youtube.
There was a problem hiding this comment.
It seems good. I would recommend putting the elements in alphabetical order (just move sidebar before user-notification).
There was a problem hiding this comment.
Also, please add ending punctuation to each description (ie., just needs a period if the sentence doesn't already have one).
| return ViewportType.NATURAL_IOS_EMBED; | ||
| } | ||
|
|
||
| // Enable iOS Embedded mode for iframed tests (e.g. integration tests). |
There was a problem hiding this comment.
@dvoytenko When running integration tests in iOS 10, I was getting the Natural instead of Embed iOS viewport. That was causing certain parts of the test (around scrolling and viewability) to get the wrong values. I think this change makes sense, please confirm.
There was a problem hiding this comment.
@aghassemi This is a bit tricky and confusing. We emulate standalone in tests as an iframe. This is because the only way we can run a test is in an iframe. Ideally, we need to be able to indicate whether (while always an iframe) we want to test an iframing viewer case vs standalone case (vs even in-a-box) case. I'm not sure how to communicate all that here... If all tests are ok in this way - we can use this mode and then we can delay accommodating other use cases when we run into them.
There was a problem hiding this comment.
Discussed offline. Tests pass with this.
| </table> | ||
|
|
||
| ### amp-sidebar | ||
| <table> |
|
/to @mkhatib and @chenshay for review |
spec/amp-actions-and-events.md
Outdated
| </tr> | ||
| <tr> | ||
| <td width="30%">amp-image-lightbox</td> | ||
| <td>(default)</td> |
There was a problem hiding this comment.
Shouldn't this row be specific to the amp-image-lightbox element? Also, should the action be named as open (default) instead of (default)?
There was a problem hiding this comment.
good catch. done.
mkhatib
left a comment
There was a problem hiding this comment.
LGTM - please make sure to test in /pwa/ and /a4a/ manually as mentioned.
| installVideoManagerForDoc(this.getAmpDoc()); | ||
| const ampdoc = this.getAmpDoc(); | ||
| installVideoManagerForDoc(ampdoc); | ||
| videoManagerForDoc(this.win.document).register(this); |
There was a problem hiding this comment.
Any reason why videoManagerForDoc is using this.win.document instead of ampdoc? Using win.document might break YouTube inside shadow-doc/embedded use cases. You can test these manually by using the /pwa/ and /a4a/ prefixes before any example to see how it works. For example to test the amp-youtube.amp.max.html example this would be the URLs:
http://localhost:8000/pwa/examples/amp-youtube.amp.max.html
http://localhost:8000/a4a/examples/amp-youtube.amp.max.html
The only gotcha for the pwa example you'd probably need to make sure the service worker installed so it doesn't redirect you to the actual example instead of embedding it into shadow-doc
You could also possibly use this.element for any _ForDoc service call.
cc/ @dvoytenko for any mis-info I am spreading 😄
There was a problem hiding this comment.
I'd just recommend using installVideoManagerForDoc(this.element). And, yes, this should definitely not be win.document. Is something not working? Maybe this is just a incorrect rebase?
There was a problem hiding this comment.
done (including other cases in video players)
There was a problem hiding this comment.
Still seeing it. Did it get pushed?
There was a problem hiding this comment.
ugh, made the change on laptop, forgot to push. should be in now
| ampdoc.win.addEventListener( | ||
|
|
||
|
|
||
| this.win.addEventListener( |
There was a problem hiding this comment.
I think this is accurate but please test the /pwa/ and /a4a/ cases and make sure it is behaving as expected.
There was a problem hiding this comment.
ack. looks fine in both
| const ampdoc = this.getAmpDoc(); | ||
| ampdoc.win.addEventListener( | ||
|
|
||
|
|
There was a problem hiding this comment.
to self: use iframe messaging helpers
There was a problem hiding this comment.
will have a separate PR for this.
|
@mkhatib @dvoytenko PTAL. Thanks. |
| ``` | ||
|
|
||
| ## Element Specific Events | ||
| ### amp-carousel |
There was a problem hiding this comment.
@choumx I moved things around here a bit. Please take a quick look to make sure I did not mess up your recent changes to this file.
dvoytenko
left a comment
There was a problem hiding this comment.
LGTM on my side as soon as the changes to viewerManager lookup are done.
This CL:
play,pause,mute,unmuteAMP actions for any player that implements the video-interface #6198