0

I am trying to get a a preview system for my videos before users release the video now for this i need to be able to retrieve multiple files from database and create videos accordingly. i have a button

<a class="btnGray clickable floatRight" style="position:relative;" onclick="startVideo('<?=$content[ReleaseSystem::contentID]?>','<?=$video['filename']?>');"><?=$lang[109]?></a>

This button links to the following function

function startVideo(id,link) {
    $("#"+id).fadeIn("slow", function() {
        $f("player", {src: "players/nobranding.swf", wmode: 'opaque'},
            {
                clip: { autoPlay: true },
                playlist: ['videos/IMPORTS/'+link,],
                plugins: { controls: { playlist: true }}
            }
        ).ipad();
    });
}

Now the odd thing is that the video player loads when i DONT pass through a link on my button but when I try to send it a link the whole function breaksdown. Im not sure why that would be happening.

also here is my html code for the player

<div id="videoFlyout<?=$content[ReleaseSystem::contentID]?>" class="popUpWrapper" style="display:none;position:absolute;top:10px;left:auto;">
    <div class="firstPopupDiv" style="left:center;height:425px;width:620px;">
        <div class="popupDivInner" style="display:block;" class="hideSteps">
            <div id="<?=$content[ReleaseSystem::contentID]?>">
                <center><a id="player" style="display:block; height:365px; width:620px;"></a></center>
            </div>
            <a class="btnRed clickable floatRight" style="position:relative;" onclick="closeVideo(<?=$content[ReleaseSystem::contentID]?>);"><?=$lang[109]?></a>
            <a class="btnGray clickable floatRight" style="position:relative;" onclick="startVideo('<?=$content[ReleaseSystem::contentID]?>','<?=$video['filename']?>');"><?=$lang[109]?></a>
        </div>
    </div>
</div>

Here is my rendered HTM

<div id="videoFlyout280" class="popUpWrapper" style="position: absolute; top: 10px; left: auto; display: none;">
    <div class="firstPopupDiv" style="left:center;height:425px;width:620px;">
        <div class="popupDivInner" style="display:block;">
            <div id="280" style="">
            <center>
            <a id="player" style="display:block; height:365px; width:620px;">
                <object id="player_api" width="100%" height="100%" type="application/x-shockwave-flash" data="players/nobranding.swf">
                    <param value="true" name="allowfullscreen">
                    <param value="always" name="allowscriptaccess">
                    <param value="high" name="quality">
                    <param value="false" name="cachebusting">
                    <param value="#000000" name="bgcolor">
                    <param value="opaque" name="wmode">
                    <param value="config={"clip":{"autoPlay":true},"playlist":[{"url":"videos/IMPORTS/video_1011_281_1337198589_VID_20120511_00000.3GP","autoPlay":true}],"plugins":{"controls":{"playlist":true}},"playerId":"player"}" name="flashvars">
                </object>
            </a>
            </center>
        </div>
        <a class="btnRed clickable floatRight" onclick="closeVideo(280);" style="position:relative;">Cancel</a>
        <a class="btnGray clickable floatRight" onclick="startVideo('280','video_1011_280_1337183112_testCat.mp4');" style="position:relative;">Cancel</a>
        </div>
    </div>
</div>
<div id="videoFlyout281" class="popUpWrapper" style="position: absolute; top: 10px; left: auto;">
    <div class="firstPopupDiv" style="left:center;height:425px;width:620px;">
        <div class="popupDivInner" style="display:block;">
            <div id="281" style="">
            <center>
                <a id="player" style="display:block; height:365px; width:620px;"> </a>
            </center>
            </div>
            <a class="btnRed clickable floatRight" onclick="closeVideo(281);" style="position:relative;">Cancel</a>
            <a class="btnGray clickable floatRight" onclick="startVideo('281','video_1011_281_1337198589_VID_20120511_00000.3GP');" style="position:relative;">Cancel</a>
        </div>
    </div>
</div>
MDInzee
  • 35
  • 4
  • Side note: perhaps reconsider using [PHP short tags](http://stackoverflow.com/a/200666/633656), be sure to read all the comments too as it's not a simple answer of just "turn it of". More of a "turn it off if..." – Recognizer May 17 '12 at 15:15

1 Answers1

0

Its hard to tell exactly what is happening without the error messages and rendered HTML, but one thing that sticks out is startVideo(<?=$video['filename']?>); should be startVideo('<?=$video['filename']?>');, It looks like you mean to pass in a string and you are passing what JavaScript interprets as an undefined global variable.

If that solves your issue great! Otherwise post the aforementionned items for further investigation.

marteljn
  • 6,446
  • 3
  • 30
  • 43
  • Ok so I took your advice now I have the last video loading on one of the popups on page load and when I click my load button it loads the correct video for only the first slide hmm. Cause before I had it imbedded using html it worked but I had an issue with IE where it wouldn't close the players so I had to change it to this format. BTW there are no error messages that I receive which makes it even more confusing. – MDInzee May 17 '12 at 15:02
  • As a side note you need to do the same as above with the `closeVideo` JS function. Can you post the pertinent rendered HTML, that is to say the HTML from when you do a view source? – marteljn May 17 '12 at 15:06
  • Is your close function expecting a number or a string? The way you are passing it, JS will interpret it as a number, unless you place it in quotes like you did with the start function. – marteljn May 17 '12 at 15:21
  • i still have to complete my close function since i was testing on ie it auto closed it for me. – MDInzee May 17 '12 at 15:25