user1913028
user1913028

Reputation:

How to show video ( in external player) inside a div by javascript?

I am using an external player to display a video. but when i append it in a div it just shows [object Object] I have extracted the video by this function in javascript:

<script type="text/javascript">function loadArchiveInPlayer(vdo) {
var s12 = new SWFObject('http://jetpitch.com/hdflvplayer/hdplayer.swf','player','513','285','9');
    s12.addParam('allowfullscreen','true');
    s12.addParam('allowscriptaccess','always');
    s12.addParam('wmode','transparent');
    s12.addVariable('file',vdo);    enter code here
    s12.addVariable('Preview','<?php echo SITEROOT; ?>/images/video-load-img.jpg');
    s12.write('mediaspace');

    //document.getElementById("newimg1").appendChild(s12);

    return s12;
} </script>

After returning the video it is displayed by this:

<script type="text/javascript"> var s22 = loadArchiveInPlayer(vdo);
document.getElementById('newimg1').innerHTML = s22; </script>

But the div "newimg1" dosent displays the video. Please Help.

Upvotes: 1

Views: 187

Answers (1)

Philipp
Philipp

Reputation: 69703

The line

s12.write('mediaspace');

does the embedding of the flash player into your websites DOM. It adds the flash object into a HTML element with id="mediaspace". Just make sure that you have a div with such an ID in your document.

Upvotes: 2

Related Questions