matthojo / videojs-Background

Allows for videos to be displayed as a full background to any element.
MIT License
77 stars 41 forks source link

Add ability to pass an element as container #5

Closed Maximilianos closed 9 years ago

Maximilianos commented 9 years ago

What do you think of this change? I have a situation where I have id-less containers and would like to pass an already selected element in as container. Something like:

module.exports = function (videos) {
    videos.each(function () {
        var video     = $(this);
        var container = video.parent();

        new window.videojs(this, {
            techOrder: ['youtube'],
            src: video.data('video-url'),
            controls: false,
            autoplay: true,
            preload: 'auto',
            loop: true
        }).Background({
            mediaType: 'youtube',
            container: container[0]  // <===
        });
    });
};
matthojo commented 9 years ago

Looks good to me :+1: thanks!