You'll need to integrate some third-party video player, for example http://mediaelementjs.com/
I'd recommend to use inline type of popup, as it allows you to open in popup any HTML code. http://dimsemenov.com/plugins/magnific-popup/documentation.html#inline-type
Related example: http://codepen.io/dimsemenov/pen/GtjBb
Answer from Dmytro Semenov on Stack OverflowYou'll need to integrate some third-party video player, for example http://mediaelementjs.com/
I'd recommend to use inline type of popup, as it allows you to open in popup any HTML code. http://dimsemenov.com/plugins/magnific-popup/documentation.html#inline-type
Related example: http://codepen.io/dimsemenov/pen/GtjBb
You can use the type of content - iframe to open MP4 video:
<a class="mfp-iframe" href="MP4_VIDEO_PATH">Open MP4 video in iframe</a>
I have got this to work using the following as a link to open the video:
<a class="popup-player" href="/static/video/bunny.mp4">
video link
</a>
and then used the Iframe type to display it:
$('.popup-player').magnificPopup({
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false,
iframe: {
markup: '<div class="mfp-iframe-scaler">'+
'<div class="mfp-close"></div>'+
'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
'</div>',
srcAction: 'iframe_src',
}
});
This is a very basic version, it opens the video in an iframe but I have yet to work out how to change the things like the height and width. I'm still learning this stuff so I dont know how it works I just know it puts a video up on the screen. If you get it working and build a more complex version please let me know so I can improve my version.
This worked great for me. Uses "Inline" type with auto-starting HTML5 video.
Javascript:
$('.openVideo').magnificPopup({ type: 'inline', callbacks: { open: function() { $('html').css('margin-right', 0); // Play video on open: $(this.content).find('video')[0].play(); }, close: function() { // Reset video on close: $(this.content).find('video')[0].load(); } } });HTML:
<a href="#video-01" class="openVideo"> <div id="video-01" class="video-popup mfp-hide"> <video preload="false" poster="/videos/01.png"> <source src="/videos/01.mp4" type="video/mp4"> </video> </div>
Original source: https://github.com/dimsemenov/Magnific-Popup/issues/626