swfobjectflashvars

SWFobject flashvars embedding issue


Implementing EasyCaptions on my WordPress blog and I’ve hit a brick wall. Any help would be appreciated. I’m using SWFobject to embed videos. I’ve pasted this code: http://pastebin.com/0ZMSr0Bz into my header.php and this embed code in my posts:

<video id="video-html5" width="480" height="320" controls="controls"
        source src="[url to video]" />
</video>

The problem is the implementation only works for the video defined here:

var flashvars = { file:'[video url]', ...

All other videos embeds do not work. I've tried using a playlist but that did not solve the problem. How do I solve this? Do I need additional JS or PHP code to add to the file parameter?


Solution

  • The solution lies in NOT hard-cording the video url in the header.php. Here is what worked to solve this. I first created a custom field in wordpress, named it thinema, and then set the value of the custom field to be the embedded video url in the post. Then edited this code into my header.php

    flashvars = { file: '<?php echo get_post_meta(get_the_ID(), thinema, true); ?>'...
    

    I've updated the code in pastebin. Hope this is of use to someone! You can view the implementation here.