Video keeps playing if you close the small player window #1

Open
opened 5 years ago by ugrnm · 2 comments
ugrnm commented 5 years ago
Owner

Video keeps playing if you close the small player window.

It should stop if the user click on the 'X'.

Video keeps playing if you close the small player window. It should stop if the user click on the 'X'.
aaaa commented 5 years ago
Collaborator

Probably won't go without some javascript, due to the way the overlay is built :/

simple would be inline javascript, to stop all videos on click (in the upclose tags)

onclick="for(var i=0; i < document.getElementsByTagName('video').length; i++) document.getElementsByTagName('video')[i].pause();"

or more elaborate with eventListener (but more dependent on the structure of the html)
(maybe a closest('video-container') function would be more stable ... )

<script>

var upclose = document.getElementsByClassName("upclose");

var pauseVideo = function() {
    var wrap = this.parentElement
    if(wrap.getElementsByClassName('video-container').length>0){
      for(var i = 0; i < wrap.getElementsByClassName('video-container').length; i++){
        wrap.getElementsByClassName('video-container').firstElementChild.pause();
      }
    }
};

for (var i = 0; i < upclose.length; i++) {
    upclose[i].addEventListener('click', pauseVideo, false);
}

</script>

But maybe there is a simpler solution?
If you have any other suggestions let me know!

Probably won't go without some javascript, due to the way the overlay is built :/ simple would be inline javascript, to stop all videos on click (in the upclose tags) ```html onclick="for(var i=0; i < document.getElementsByTagName('video').length; i++) document.getElementsByTagName('video')[i].pause();" ``` or more elaborate with eventListener (but more dependent on the structure of the html) (maybe a closest('video-container') function would be more stable ... ) ```html <script> var upclose = document.getElementsByClassName("upclose"); var pauseVideo = function() { var wrap = this.parentElement if(wrap.getElementsByClassName('video-container').length>0){ for(var i = 0; i < wrap.getElementsByClassName('video-container').length; i++){ wrap.getElementsByClassName('video-container').firstElementChild.pause(); } } }; for (var i = 0; i < upclose.length; i++) { upclose[i].addEventListener('click', pauseVideo, false); } </script> ``` But maybe there is a simpler solution? If you have any other suggestions let me know!
ugrnm commented 5 years ago
Poster
Owner

testing email notifications, ignore.

testing email notifications, ignore.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: XPUB/project.xpub.nl#1
Loading…
There is no content yet.