3.x, one video works fine, another is unskinned for some reason?

neek's Avatar

neek

21 Feb, 2012 11:16 AM via web

I have a header video that's playing fine, and is skinned properly:

http://www.premierrange.co.uk/TEST-SITE/?force_header_video=1
(the video should appear in the large header area)

Now we're sticking a second video in a button, with almost identical markup to the header video, but I find it's not themed at all, it's just a basic <video> tag:

http://www.premierrange.co.uk/TEST-SITE/?force_clicknpick_video=1
(the video should appear inside the "Bundle Discounts" button in the sidebar)

I don't know much about how 3.x applies the skin .. 2.x used to use the parseAllWhenReady function to trigger all that stuff, but now I'm stumped.

My header video markup, the one that works, actually looks like this:

<div id="headerVideo">
    <video id="headerVideoJS" class="video-js vjs-default-skin" width="564" height="190" controls preload autoplay poster="promo-videos/banners/index.png">

When rendered, if I inspect the elements, I find that the DOM structure has been re-arranged, presumably by videojs:

<div id="headerVideoJS" class="video-js vjs-default-skin vjs-paused" width="564" height="190" style="width: 564px; height: 190px; ">
    <video id="headerVideoJS_html5_api" class="vjs-tech" preload="" autoplay="">
    </video>

So the video-js class definitions have been moved to a new enclosing <div>.

The sidebar video, the one that doesn't work, does not have this trickery applied to it. So, something's broken with the way videojs recognises my sidebar video as one that needs theming. Here's the markup:

<a class='button' href='some_url_here' title='Click Here to start building your product selection'>
    <video id="clicknpickVideoJS" class="video-js vjs-default-skin" width="179" height="101" controls preload autoplay poster="promo-videos/banners/click_n_pick_intro_smaller.png">
        <source src="http://www.ourserver.com/promo-videos/banners/click_n_pick_intro_smaller.mp4" type='video/mp4' />
        <source src="http://www.ourserver.com/promo-videos/banners/click_n_pick_intro_smaller.webm" type='video/webm' />
        <source src="http://www.ourserver.com/promo-videos/banners/click_n_pick_intro_smaller.ogv" type='video/ogg' />
    </video>
</a>

Is there some problem with a <video> tag inside an <a> tag, perhaps?

  1. 2 Posted by neek on 23 Feb, 2012 03:46 AM

    neek's Avatar

    Putting data-setup="{}" in the second <video> tag seems to 'fix' this issue. Looking into the videojs source, it seems to hunt the document for elements with data-setup and set them up automatically. Are we actually required to include data-setup, even if it's empty and serves no other purpose? Seems a bit whack.

    I've ended up putting all attributes (autoplay, preload etc) into the data-setup attribute on the <video> tag.

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.