Page 1 of 1

Scripting mozilla plugin

Posted: 03 Jan 2006 22:30
by Schendstok
Hi,

I've got a problem scripting the mozilla plugin with Javascript.
I try to start my TV card using javascript with this code:

Code: Select all

function startKan() { document.video1.add_item('dshow:// :dshow-vdev="Hauppauge WinTV PVR PCI II Capture"'); document.video1.play(); }
but this doesn't work, it starts the first directshow device that is my webcam, so it does the same thing as if I would use:

Code: Select all

function startKan() { document.video1.add_item('dshow:// '); document.video1.play(); }

I thought it was a problem with escape charecters or something , but it doesn't seem to be. (tried a lot of things)
I also saw a post about using an "options" array because the vlc plug-in wouldn't parse the string or something (in IE by the way). But that also gives the same result.

Could somebody give me a working example code to start the TV card?
many thanks

BTW. I use 0.8.4a for windows 32 on WinXP of VLC

Posted: 04 Jan 2006 02:15
by Schendstok
I did some more testing, and I now have some code that works in internet explorer with the ActiveX plug-in:

Code: Select all

<html> <head> </head> <input type=button id="start" value=" Play " onClick='StartTV()'> <object classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" width="400" height="300" id="vlc" events="True"> <param name="Src" value="" /> <param name="ShowDisplay" value="True" /> <param name="Loop" value="False" /> <param name="AutoPlay" value="False" /> </object> <script> function StartTV() { var options = new Array(":dshow-vdev=Hauppauge WinTV PVR PCI II Capture"); document.vlc.addTarget("dshow://", options, 4+8, -666); }; </script> </body> </html>
The problem is that the ActiveX plug in isn't mentioned in the documentation on the website. Does anybody have a link to a little bit of documentation?
I would really like to know why I need to add the ", 4+8, -666" in the addTarget tag. I doesn't work without is, But I don't have a clue about what it does.


But back to my Problem: this doesn't work in firefox!
The equivalent in the code for the mozilla plug-in:

Code: Select all

<html> <head> </head> <input type=button id="start" value=" Play " onClick='StartTV()'> <embed type="application/x-vlc-plugin" name="vlc" autoplay="no" loop="no" width="400" height="300" /> </object> <script> <!-- function StartTV() { var options = new Array(":dshow-vdev=Hauppauge WinTV PVR PCI II Capture"); document.vlc.add_item("dshow://", options, 4+8, -666); document.vlc.play(); }; //--> </script> </body> </html>
But this does not work! the "add_item" method doesn't do anything with the added options array, so it just starts the first directshow device (a webcam in on my configuration)

does anybody have a solution?

Posted: 04 Jan 2006 03:39
by Schendstok
Another question I have about the ActiveX plug-in functions.

Can the video screen be resized using javascript?
If the videoscreen has an ID named "vlc"
You could change the attributes like this:

document.vlc.height = "480";
document.vlc.width = "640";

But this doesn't resize the screen when using the ActiveX plug-in. Are there other resize functions in this plug-in?

The above code does work perfectly with the Mozilla plug-in.

Also in both the Mozilla plug-in and the ActiveX plugin
document.vlc.fullscreen();
Works perfectly to fill the screen in both implementations.

I also noticed that the Mozilla plug-in can crash firefox of you open the plug-in multiple times. Is this a known bug?

Posted: 25 May 2006 15:59
by boban
for resize use:
document.vlc.style.height="100"

re

Posted: 03 Apr 2007 13:44
by ajithjames
use it as
add_item('string');
then it works well