LonnyGomes / vjs-video

An angular js directive for video.js
http://lonnygomes.github.io/vjs-video/
MIT License
75 stars 33 forks source link

How to dispose audio of video #49

Closed phuongdev89 closed 8 years ago

phuongdev89 commented 8 years ago

I try dispose the video when click SKIP button, the player has been destroyed, but the audio still play to end

        $scope.$on('vjsVideoReady', function(evt, videoData) {
            $document.on("click", ".intro-ctrl a.btn-skip", function() {
                videoData.player.dispose();
                $log.info('Disposed background video');
            });
        });

Can you help me?

ghost commented 8 years ago

@phuong17889 I'll see if I can replicate this as well. It seems like after you depose the video should stop.

ghost commented 8 years ago

@phuong17889 It appears that I'm not able to replicate your issue. Here is a code pen example where a video is removed after a button is clicked.

Do you by chance happen to have multiple videos on a page?

phuongdev89 commented 8 years ago

@LonnyGomes tks for quick reply. I see this error only happened when autoplay is trigged. see my codepen http://codepen.io/phuong17889/pen/GNWgXx

ghost commented 8 years ago

Thanks for updating the CodePen! This definitely appears to be a bug! I'll take a look.

phuongdev89 commented 8 years ago

tks, but any ideas? :) My project must be released on Nov 24. I have to used videojs without directive, but it's still working

ghost commented 8 years ago

I think I have a workaround for your issue. Take a look at my updated code pen example.

The solution was to remove the autoplay from the element and add it as a setup option. It appears that things get weird when you put autoplay right on the DOM element. Let me know if that makes sense/works for you.

phuongdev89 commented 8 years ago

It's worked

remove the autoplay from the element and add it as a setup option.

I never thought it. any way thank you very much

ghost commented 8 years ago

Great, I'll close this issue out.