--no-autoscale has no effect

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
truth
Blank Cone
Blank Cone
Posts: 14
Joined: 06 Apr 2017 09:55

--no-autoscale has no effect

Postby truth » 01 May 2017 09:17

The AxVLC apparently does not respect the --no-autoscale (neither :no-autoscale) switch. As far a my tests can confirm, the AxVLC *always* resizes the video display to fit maximally in the container window while maintaining aspect ratio.

Here is the VB6 code I use to reproduce the issue:

Code: Select all

Public Sub Play(Optional lngID As Long = 0) vlc.Playlist.Play lngID End Sub Public Sub PlaylistPlay(strURL As String) Play PlaylistAdd(strURL) End Sub Public Function PlaylistAdd(strURL As String) As Long PlaylistAdd = vmpPreview.Playlist.Add("file:///" + strURL, , ":no-autoscale") End Function
I do not have the expertise to make an HTML example. If someone can and can prove ":no-autoscale" is working, please provide the working HTML as it may shed light on why my code is not.

truth
Blank Cone
Blank Cone
Posts: 14
Joined: 06 Apr 2017 09:55

Re: --no-autoscale has no effect

Postby truth » 05 May 2017 10:01

The following code proves my claim. The video in question is 480x270 but it renders at 1280x720.

Code: Select all

<!DOCTYPE html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>Vids</title> </head> <body onload='player("http://images.videolan.org/images/vlc-player.mp4");'> <div id="player"> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" id="vlcplayer" width="1280" height="720"/> <param name="Volume" value="100"/> <param name="AutoPlay" value="true"/> <param name="AutoLoop" value="false"/> </div> <div id="controls"> <input type="button" onclick="play();" value="Play"/> <input type="button" onclick="pause();" value="Pause"/> <input type="button" onclick="stop();" value="Stop"/> <input type="button" onclick="mute();" value="Mute"/> </div> <script type="text/javascript" language="javascript"> var vlc = document.getElementById("vlcplayer"); function player(vid) { try { var options = new Array(":no-autoscale", ":no-video-title-show"); var id = vlc.playlist.add(vid, 'Video', options); vlc.playlist.playItem(id); //vlc.video.fullscreen = true; //vlc.video.toggleFullscreen(); } catch (ex) { alert(ex); } } function mute() { vlc.audio.toggleMute(); } function play() { vlc.playlist.play(); } function stop() { vlc.playlist.stop(); } function pause() { vlc.playlist.togglePause(); } function fullscreen() { vlc.video.toggleFullscreen(); } </script> </body> </html>

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

Re: --no-autoscale has no effect

Postby da2424 » 05 May 2017 17:25

You're right, it's not possible to use :no-autoscale for web plugins, because the video output uses the dimensions of the <embed> object.
As workaround, you could resize your <embed> object:

Code: Select all

<!-- ActiveX plugin events are not working on IE11, so use IE10 mode --> <meta http-equiv="X-UA-Compatible" content="IE=10"/> ... ... function player(vid){ //Add event handler for resizing vlc.attachEvent("MediaPlayerTimeChanged", resizeVideo); //Firefox needs addEventListener instead! var id = vlc.playlist.add(vid); vlc.playlist.playItem(id); } function resizeVideo(){ if(vlc.input.hasVout){ //Resize plugin window vlc.style.width = vlc.video.width + "px"; vlc.style.height = vlc.video.height + "px"; } //Remove event handler to avoid endless calls vlc.detachEvent("MediaPlayerTimeChanged", testsize); }

truth
Blank Cone
Blank Cone
Posts: 14
Joined: 06 Apr 2017 09:55

Re: --no-autoscale has no effect

Postby truth » 06 May 2017 09:41

Hmmm...this looks promising but even though I've copy/pasted your code into my test page, it doesn't seem to work. No resizing is performed. Can you please test and post a complete working example?

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

Re: --no-autoscale has no effect

Postby da2424 » 06 May 2017 21:24

No problem, here is the full code:

Code: Select all

<!DOCTYPE html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <!-- ActiveX plugin events are not working on IE11, so use IE10 mode --> <meta http-equiv="X-UA-Compatible" content="IE=10"/> <title>Vids</title> </head> <body onload='player("http://images.videolan.org/images/vlc-player.mp4");'> <div id="player"> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" id="vlcplayer" width="1280" height="720" Volume="100" AutoPlay="true" AutoLoop="false" /> </div> <div id="controls"> <input type="button" onclick="play();" value="Play"/> <input type="button" onclick="pause();" value="Pause"/> <input type="button" onclick="stop();" value="Stop"/> <input type="button" onclick="mute();" value="Mute"/> </div> <script type="text/javascript" language="javascript"> var vlc = document.getElementById("vlcplayer"); function player(vid) { //Add event handler for resizing if(vlc.attachEvent) vlc.attachEvent("MediaPlayerTimeChanged", resizeVideo); //IE else vlc.addEventListener("MediaPlayerTimeChanged", resizeVideo, false); //Other browsers var id = vlc.playlist.add(vid); vlc.playlist.playItem(id); } function resizeVideo() { if(vlc.input.hasVout){ //Resize plugin window vlc.style.width = vlc.video.width + "px"; vlc.style.height = vlc.video.height + "px"; } //Remove event handler to avoid endless calls if(vlc.detachEvent) vlc.detachEvent("MediaPlayerTimeChanged", resizeVideo); //IE else vlc.removeEventListener("MediaPlayerTimeChanged", resizeVideo, false); //Other browsers } function mute() { vlc.audio.toggleMute(); } function play() { vlc.playlist.play(); } function stop() { vlc.playlist.stop(); } function pause() { vlc.playlist.togglePause(); } function fullscreen() { vlc.video.toggleFullscreen(); } </script> </body> </html>
I have tested it with Internet Explorer and Firefox ESR with several files (local and http), it will work fine. But somtimes it will fail with http streams like your example address, because sometimes, vlc.input.hasVout returns false for the first try. If you want to use http streams, you could fix it with the following code, which will call vlc.input.hasVout two times, if needed:

Code: Select all

var eventCount = 0; function resizeVideo() { if(vlc.input.hasVout){ //Resize plugin window vlc.style.width = vlc.video.width + "px"; vlc.style.height = vlc.video.height + "px"; } eventCount++; if(vlc.input.hasVout || eventCount == 2){ //Remove event handler to avoid endless calls if(vlc.detachEvent) vlc.detachEvent("MediaPlayerTimeChanged", resizeVideo); //IE else vlc.removeEventListener("MediaPlayerTimeChanged", resizeVideo, false); //Other browsers eventCount = 0; } }

truth
Blank Cone
Blank Cone
Posts: 14
Joined: 06 Apr 2017 09:55

Re: --no-autoscale has no effect

Postby truth » 12 May 2017 19:12

Thank you for the help.

I'm not sure why my first attempt didn't work - I wasn't even getting event firing even though the event was registered.

The above code works and I've been able to adapt it to my VB6 code also. It is a more elegant way to get the native video size information than what I had previously which was based on a while loop.

However, this begs a couple of very crucial questions:

1) Why isn't --autoscale implemented in the AxVLC? I would think it would be an extremely useful property of this object.
2) Why aren't the implemented options documented? It is left to the developer to guess and test by trial and error as to which options are actually implemented in the AxVLC and when an option doesn't work we don't know if it is broken or simply not there as there is no error messaging. It would save *everybody* lots of time if the comprehensive list of supported options were documented somewhere.

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

Re: --no-autoscale has no effect

Postby da2424 » 15 May 2017 18:51

1) Because the plugin cannot resize itself (I think). In the main GUI, --autoscale will be processed by the Qt UI, and not by the core (libVLC).
2) That's true, it's not always easy to identify the options which are part of libVLC and are marked as safe for plugins. A full list of options is available on https://wiki.videolan.org/VLC_command-line_help/.
Things like "Window properties" and "Qt interface" aren't part of libVLC. Mostly, options which will access to the file system (like --sout) aren't marked as safe and will be blocked for security reasons.
If a option was blocked, it will be logged to the debug output (visible with programs like DebugView)


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 3 guests