surmon-china / videojs-player

@videojs player component for @vuejs(3) and React.
https://github.surmon.me/videojs-player
MIT License
5.25k stars 1.13k forks source link

Is it possible to stop/pause video when modal (where the video is located) is closed? #465

Open avpuchkova opened 3 months ago

avpuchkova commented 3 months ago

Describe the bug

Is it possible to stop/pause video when modal (where the video is located) is closed?

Looks like pause() methid does not work/

Reproduction

I tried to do it:

                    <video-player
                        src="src/video"
                        controls
                        :autoplay="false"
                        :loop="true"
                        :volume="0.6"
                        :id="`frame`"
                    />

                let myModal = document.getElementById(`modal`);
                let myFrame = document.getElementById(`frame`);

                myModal.addEventListener('hidden.bs.modal', () => {
                    myFrame.pause();
                });

System Info

Nuxt 3, Vue 3

Used Package Manager

npm

Validations