I've embedded some Youtube videos in some of my content, which seem to work well. However, when you swipe horizontally, the video does not stop playing and can be heard while reading the next article.
is there something in the API that will tell me when the users are leaving the article so i can fire the js to stop the video?
thank you for your time!
One workaround you could do:
Using the gesture API, you can disable all gestures, and listen for the swipe yourself. Then stop the video, then hand it back to DPS to let the article change happen.
Last time i tried using the gesture api like this for swiping, though, it introduced some weird content refresh behavior. If you want to try it, you can do it like this:
[code to stop the media playing]
You'll need to include the gesture api found here: 20150706 Adobe DPS 2015 HTML Gesture API - Examples.zip
I used to use document.hasFocus() in the past to do this. However, this no longer works. Not only that, but it's broken differently on each platform.
Here's a post from a few days ago where I'm asking about it:
document.hasFocus() behavior inconsistencies