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");
Code: Select all
myvlc.setAttribute("width", "1280");
myvlc.setAttribute("height", "768");
myvlc.write("vlccontent");
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>
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.And it turns out that the solution was far more simple than I imagined, use the style attribute of the vlc object.
Users browsing this forum: No registered users and 7 guests