diff --git a/src/amp-story-player/README.md b/src/amp-story-player/README.md new file mode 100644 index 000000000000..1935b4a7dd53 --- /dev/null +++ b/src/amp-story-player/README.md @@ -0,0 +1,447 @@ +# Web Story Player November 2020 Update + +
+ | + | + |
1. Opt-in to the “skip-next-button” using the “controls” API (more on that below on the “Customizing position & visibility of story UI controls” section). | ++ |
2. Use the Javascript APIs to implement your own navigational buttons. If you want to use the Javascript APIs, you can use the go() method (see documentation for more details) as shown in the following example: | ++ +```javascript +const player = document.querySelector("amp-story-player"); + +// Waits for when player API is ready to be used. +player.addEventListener("ready", () => { + initializeNavigationalButtons(); +}); + +// Synchronous check to avoid race conditions where event was dispatched before // we started listening. +if (player.isReady) { + initializeNavigationalButtons(); +} + +function initializeNavigationalButtons() { + const nextButton = document.body.querySelector(".my-next-button"); + + nextButton.addEventListener('click', () => { + // Advances one story when ".my-next-button" is clicked. + player.go(1); + }); +} + +``` + + | + +
Carousel with circle avatars In this codepen, we provide an example of how to create a carousel entry point and how to link it to your player. https://codepen.io/maenrique/pen/wvWjNYr Demo This demo showcases a more complex implementation with a horizontally scrollable carousel and the player being opened in a lightbox. https://web-player-cards-carousel.web.app/examples/amp-story/player-entry-point-circular.html |
+ + |
Carousel with cards In this codepen, we provide an example of how to create a simple card carousel entry point and how to link it to your player. https://codepen.io/maenrique/pen/MWeGxqY Demo This demo showcases a more complex implementation with a horizontally scrollable carousel and the player being opened in a lightbox. https://web-player-cards-carousel.web.app/examples/amp-story/player-entry-point-cards.html |
+ + |
Embedding directly into some text The simplest way to use the player is to directly embed the player in your platform. Demo |
+ + |
+ | + | + |
+
+
+ |
+ + |
+
+
+ |
+ + |
+
+
+ |
+ + |