Can not pass options to playlist.add()

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
optimist_259
New Cone
New Cone
Posts: 3
Joined: 08 Feb 2017 17:04

Can not pass options to playlist.add()

Postby optimist_259 » 08 Feb 2017 17:25

I need to embed vlc in my webpage to receive and play an udp audio stream.
This stream is a raw audio so some audio options need to be set.
However, function vlc.playlist.add(mrl, name, options) seems to ignore all options which is passed

Here is the code I use

Code: Select all

<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" width="640" height="480" id="vlc"> </embed> <script type="text/javascript"> var options = new Array(" :demux=rawaud :rawaud-channels=2 :rawaud-samplerate=44100 :rawaud-fourcc=s16b"); vlc = document.getElementById("vlc"); var id = vlc.playlist.add("udp://@:2912/", "", options); vlc.playlist.playItem(id); </script>
With command line, audio is played correctly but it does nothing on my webpage.

If I use: vlc.playlist.add("udp/rawaud://@:2912/") I can hear something but it's not correctly decoded since other options can not be set.
Can someone help me?

vlc version: 2.2.2
browser-plugin-vlc version: 2.0.6-4
firefox version: 51.0.1

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Can not pass options to playlist.add()

Postby da2424 » 09 Feb 2017 11:19

The syntax of the options array is incorrect. This should work:

Code: Select all

var options = new Array(":demux=rawaud", ":rawaud-channels=2", ":rawaud-samplerate=44100", ":rawaud-fourcc=s16b");

kodela
Big Cone-huna
Big Cone-huna
Posts: 632
Joined: 25 Sep 2012 19:40
VLC version: 2.2.4
Operating System: Windows 10
Location: Germany

Re: Can not pass options to playlist.add()

Postby kodela » 09 Feb 2017 12:48

In my experience, both forms are possible. The VLC parsing the code as it needs it.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Can not pass options to playlist.add()

Postby da2424 » 09 Feb 2017 14:09

In my experience, both forms are possible. The VLC parsing the code as it needs it.
Yes, it's also possible to use a string with all the options included:

Code: Select all

var options = ":demux=rawaud :rawaud-channels=2 :rawaud-samplerate=44100 :rawaud-fourcc=s16b";
But if you use this in an array, VLC will not split the string into the options. (In ActiveX, this sample will currently work, because there is currently a bug, which will only parse the first array index)

kodela
Big Cone-huna
Big Cone-huna
Posts: 632
Joined: 25 Sep 2012 19:40
VLC version: 2.2.4
Operating System: Windows 10
Location: Germany

Re: Can not pass options to playlist.add()

Postby kodela » 09 Feb 2017 15:10

But if you use this in an array, VLC will not split the string into the options. (In ActiveX, this sample will currently work, because there is currently a bug, which will only parse the first array index)
Thank you for the information!

optimist_259
New Cone
New Cone
Posts: 3
Joined: 08 Feb 2017 17:04

Re: Can not pass options to playlist.add()

Postby optimist_259 » 09 Feb 2017 15:50

The syntax of the options array is incorrect. This should work:

Code: Select all

var options = new Array(":demux=rawaud", ":rawaud-channels=2", ":rawaud-samplerate=44100", ":rawaud-fourcc=s16b");
I tried as you suggest but it does not work either.
I have also tried to pass only demux option

Code: Select all

var options = new Array(":demux=rawaud")
And I expect to have the same thing with

Code: Select all

vlc.playlist.add(udp/rawaud://@:2912)
but it does nothing. (above code give me some noise as vlc understands the demux is rawaud)
vlc plugin seems to ignore every options (my options) when it is passed in function playlist.add()

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Can not pass options to playlist.add()

Postby da2424 » 09 Feb 2017 21:41

I have now tested it.
The script is correct, but the options are blocked. A part of the logs:

Code: Select all

core input error: unsafe option "demux" has been ignored for security reasons core input error: unsafe option "rawaud-channels" has been ignored for security reasons core input error: unsafe option "rawaud-samplerate" has been ignored for security reasons core input error: unsafe option "rawaud-fourcc" has been ignored for security reasons
I don't know when an option is declared as safe in the plugins, respectively libvlc.

But if you use this in an array, VLC will not split the string into the options. (In ActiveX, this sample will currently work, because there is currently a bug, which will only parse the first array index)
Thank you for the information!
No problem ;)
I have added a code example in the documentation to show both possibilities of use.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Can not pass options to playlist.add()

Postby Jean-Baptiste Kempf » 09 Feb 2017 22:46

Hmm, that's not good, indeed
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Can not pass options to playlist.add()

Postby da2424 » 10 Feb 2017 08:11

Hmm, that's not good, indeed
You mean that "rawaud-channels", "rawaud-samplerate" and "rawaud-fourcc" should be safe?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Can not pass options to playlist.add()

Postby Jean-Baptiste Kempf » 10 Feb 2017 14:11

Hmm, that's not good, indeed
You mean that "rawaud-channels", "rawaud-samplerate" and "rawaud-fourcc" should be safe?
Maybe, yes.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Can not pass options to playlist.add()

Postby Jean-Baptiste Kempf » 12 Feb 2017 14:27

This will be fixed for 3.0
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

optimist_259
New Cone
New Cone
Posts: 3
Joined: 08 Feb 2017 17:04

Re: Can not pass options to playlist.add()

Postby optimist_259 » 16 Feb 2017 17:56

So it's indeed an issue in plugin vlc.
Anyway, to avoid issue, I convert audio source to wav format so that I can launch plugin vlc without arguments

Thank everybody.

zirote69
New Cone
New Cone
Posts: 3
Joined: 29 Dec 2017 19:24
VLC version: 2.2.8
Operating System: Windows

Re: Can not pass options to playlist.add()

Postby zirote69 » 15 Feb 2018 19:11

This will be fixed for 3.0
I installed VLC v3.0.0 and activex inside still not working parameter options on Visual Studio 2010.

Anybody knows a sample code to record RTSP streaming to local file using ActiveX?

Here is my code:

Code: Select all

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim idVideo As Long 'ID para controlar qué posición en la lista ocupa el stream de video seleccionado. Dim Voptions As Object Voptions = Split("--sout=#duplicate{dst=display,dst=std{access=file,mux=ps,dst=""d:\\video.mpg""}}|", "|") With Me.AxVLCPlugin21 '.video.aspectRatio = "16:9" '.video.deinterlace.enable ("yadif") .Toolbar = False .playlist.items.clear() idVideo = .playlist.add("rtsp://192.168.10.171:554/stream2", "", Voptions(0)) .playlist.playItem(idVideo) End With End Sub
Thanks

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Can not pass options to playlist.add()

Postby Jean-Baptiste Kempf » 20 Feb 2018 14:20

This will be fixed for 3.0
I installed VLC v3.0.0 and activex inside still not working parameter options on Visual Studio 2010.

Anybody knows a sample code to record RTSP streaming to local file using ActiveX?

Here is my code:

Code: Select all

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim idVideo As Long 'ID para controlar qué posición en la lista ocupa el stream de video seleccionado. Dim Voptions As Object Voptions = Split("--sout=#duplicate{dst=display,dst=std{access=file,mux=ps,dst=""d:\\video.mpg""}}|", "|") With Me.AxVLCPlugin21 '.video.aspectRatio = "16:9" '.video.deinterlace.enable ("yadif") .Toolbar = False .playlist.items.clear() idVideo = .playlist.add("rtsp://192.168.10.171:554/stream2", "", Voptions(0)) .playlist.playItem(idVideo) End With End Sub
Thanks
Sout is not supported in ActiveX, of course.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 13 guests