Page 1 of 1
Automatic Resize of embebbed VLC...
Posted: 05 Feb 2008 19:32
by ABNormal
is there any parameter to obtain that when you resize your browser, an embedded vlc player (with heigth and width=100%) could automatically resize itself too, such as lot of other embedded players already do?
Re: Automatic Resize of embebbed VLC...
Posted: 13 Feb 2008 14:11
by sanjayb
I have tested resizing the embed object and it seems to work - so you could add a function to window.onresize and change the width and height of the embed player accordingly. best of luck.
(i think the params you'd need are window.innerHeight and window.innerWidth , but you might need to look it up)
Re: Automatic Resize of embebbed VLC...
Posted: 18 Feb 2008 17:04
by PhatBob
I've not had any success with this as vlc.video.width and vlc.video.height are read only
The only way that I've been able to get anything to change is to use the VLCobject script in the following way:
Create using:
Code: Select all
myvlc = new VLCObject("mymovie", "400", "200", "0.8.6");
myvlc.addParam("MRL","http://code.revolunet.com/VLCjs/rambo.mpg");
myvlc.write("vlccontent");
Then in your resize handler:
Code: Select all
myvlc.setAttribute("width", "1280");
myvlc.setAttribute("height", "768");
myvlc.write("vlccontent");
The trouble is that the video restarts and I've been wasting time trying to grab the current position, resizing using the above, and then resetting it to the position it was at before the resize took place. But thats messy and not at all good.
Rob
Re: Automatic Resize of embebbed VLC...
Posted: 19 Feb 2008 17:01
by PhatBob
And it turns out that the solution was far more simple than I imagined, use the style attribute of the vlc object.
This script below uses the up and down arrows to change the size of the video that is playing (we're developing a system that uses an Apple IR remote mapped to keyboard codes for video and menu control).
The only issue with this is that the keyboard events get routed to the vlc player if the mouse falls inside the vlc player. This may be due to the cursor policy we have on ubuntu, or the vlc player, currently we're not sure.
To resize the embedded vlc you'll need to look at the geometry and set the styles accordingly.
Code: Select all
<html>
<head>
<script src="VLCobject.js" type="text/javascript"></script>
<script type="text/javascript">
videoEventKey = { VOLUME_UP: 38, VOLUME_DOWN: 40 };
vlcPlayer = {
myvlc: null,
vlc_device: null,
container: null,
loadDefaultVideo:function() {
this.myvlc = new VLCObject("mymovie", "640", "480", "0.8.6");
this.myvlc.addParam("MRL","/usr/local/media/circuit_high_120.wmv");
this.myvlc.write("vlccontent");
this.vlc_device = document.getElementById(this.myvlc.getAttribute('id'));
this.container = document.getElementById("container");
this.container.focus();
},
maximiseVideo:function() {
if (this.myvlc != null) {
this.vlc_device.style.width = "1280px";
this.vlc_device.style.height = "768px";
this.container.focus();
}
},
minimiseVideo:function() {
if (this.myvlc != null) {
this.vlc_device.style.width = "640px";
this.vlc_device.style.height = "480px";
this.container.focus();
}
},
eventHandler:function(ev) {
switch (ev.type) {
case 'keydown':
switch (ev.keyCode) {
case videoEventKey.VOLUME_UP:
this.maximiseVideo();
break;
case videoEventKey.VOLUME_DOWN:
this.minimiseVideo();
break;
}
break;
}
ev.cancelBubble = true;
}
}
</script>
<style>
.vlccontent {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
}
.container {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: #000;
}
</style>
</head>
<body onload="vlcPlayer.loadDefaultVideo()" onKeyDown="vlcPlayer.eventHandler(event)">
<div id="container" class="container">
<div id="vlccontent">This text is replaced by the VLC player.</div>
</div>
</body>
</html>
Re: Automatic Resize of embebbed VLC...
Posted: 23 Feb 2009 18:18
by greenb
Thanks for posting your solution I'll give it a try.
Do you know how to get the size from the video (in my case it's a transport stream) and then set the plugin to the native size of the video?
I'd like the player to open at the resolution of the video which I don't know ahead of time.
Thanks.
Re: Automatic Resize of embebbed VLC...
Posted: 01 Sep 2010 12:37
by cctvcam
And it turns out that the solution was far more simple than I imagined, use the style attribute of the vlc object.
Did you actually get this to work once the video had started. I have found that if the video has started although the player resizes the video is still the same size and is stuck in the position on the screen even if the browser window is moved around. what I am trying to achieve is a video window that can be resized by the user by adjusting the browser window, while the video is playing.
Has anyone done this and can point me in the right direction please?
Re: Automatic Resize of embebbed VLC...
Posted: 01 Sep 2010 23:35
by TiagoDias
The easiest solution I found was:
vlc.width=70;vlc.style.width=70;vlc.height=57;vlc.style.height=57;vlc.playlist.play();
It's pretty good, the player resizes and the stream doesn't stop for a bit.
Re: Automatic Resize of embebbed VLC...
Posted: 28 Dec 2010 00:56
by rmhartman
Which browser are you using, and which operating system?
I have no problems resizing the plugin under IE, or even under Firefox-for-Windows, however when I am using Firefox-for-linux (Ubuntu) resize does not work. The window will resize, but the playing video will remain the original size. That is, if I start out at 640x480, then resize to 320x240 I will be looking at the upper-left corner of the original video. Adding the vlc.playlist.play(); does not help -- it actually restarts the video from the beginning.
Any other ideas?
(vlc plugin for firefox for linux is v1.1.4)