Forum Discussion
Can you pause a video in a marker with trigger?
I understand you have two markers, each holding a video. Nathanial has set up a perfect example of how it's done with JavaScript, and I don't think there is any other way to execute what you asked for. Alternatively, since you have two videos, you can Execute JavaScript when the timeline starts on this slide:
let videos = document.querySelectorAll('[data-video-id*="video"]');
window.video0 = videos[0];
window.video1 = videos[1];
window.video0.onplaying = function() {
setVar('videoPlayed', '0')
}
window.video1.onplaying = function() {
setVar('videoPlayed', '1')
}
Then Execute JavaScript when the user presses something (ex. space)
if (getVar('videoPlayed') === 0) {
if (!video0.paused) {
video0.pause();
video1.pause();
} else {
video0.play();
}
}
if (getVar('videoPlayed') === 1) {
if (!video1.paused) {
video1.pause();
video0.pause();
} else {
video1.play();
}
}
Assuming you have a number variable named 'videoPlayed' created in Storyline. This way, each video can be paused and played without interfering with each other. Please refer to the attached Storyline file for reference.
Related Content
- 12 months ago
- 9 months ago
- 10 months ago