views:

50

answers:

1

I'm trying to append VLC player in an html page via jquery. I can do this with $("body").append(html), but not $("#VideoPlayer").append(html)...Is this html too complex?

jQuery:

    $("body").append("<object classid=\"clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921\" codebase=\"http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab\" width=\"1280\" height=\"720\" id=\"vlc\" events=\"true\">" +
        "<param name=\"src\" value=\"rtsp://myStreamingStuff\"/>" +
        "<param name=\"showdisplay\" value=\"true\"/>" +
        "<param name=\"autoloop\" value=\"no\"/>" +
        "<param name=\"autoplay\" value=\"true\"/>" +
        "<embed type=\"application/x-google-vlc-plugin\" name=\"vlcfirefox\" autoplay=\"true\" loop=\"no\" width=\"1280\" height=\"720\" src=\"rtsp://myStreamingStuff\"></embed></object>"
    );

Html

<body>
    <div id="VideoPlayer">

    </div>
</body>

I've also tried $("#VideoPlayer").html(html) and $("#VideoPlayer").add(html) as well with no luck.

+1  A: 

Ahh I found my problem.

I needed to wrap my .append(html) call in the jquery onload function like so:

$(function () {
$("#VideoPlayer").append("<object classid=\"clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921\" codebase=\"http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab\" width=\"1280\" height=\"720\" id=\"vlc\" events=\"true\">" +
    "<param name=\"src\" value=\"rtsp://myStreamingStuff\"/>" +
    "<param name=\"showdisplay\" value=\"true\"/>" +
    "<param name=\"autoloop\" value=\"no\"/>" +
    "<param name=\"autoplay\" value=\"true\"/>" +
    "<embed type=\"application/x-google-vlc-plugin\" name=\"vlcfirefox\" autoplay=\"true\" loop=\"no\" width=\"1280\" height=\"720\" src=\"rtsp://myStreamingStuff\"></embed></object>"
);
});
Darcy