...

View Full Version : maintaining FLV apsect ratio in fullscreen mode



tr_y2k
02-07-2008, 10:08 PM
Hello,

I have an flv file that i would also like to be viewed in fullscreen. I am not using the FLVplayback component in flash instead pure actionscript. I am hoping to find some alternative (or 'source code') for the maintainAspectRation parameter of FLVplayback. I have tried to use the flashvars "overstretch=false" in my HTML but to no avail... my video is still being stretched to the whole monitor. I have searched through the FLVplayback ActionScript source files (VideoPlayer.as and FLVPlayback.as) and googled this subject and from what i can see it is something to do with assigning the values of _video.width and _video.height; to the video when it goes into fullscreen but i cannot fathom how to do this. I would be grateful for any help :)...

this is my SWF AS code. The bit in red is the code i am using to go fullscreen.



controlBar._alpha = 0;

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.maintainAspectRatio = true;
ns.setBufferTime(5);

videoPlayer.attachVideo(ns);

ns.play("../video/osiris.flv");

ns.onStatus = function(info:Object) {
if(info.code == "NetStream.Buffer.Full"){
bufferClip._alpha = 0;
}
if(info.code == "NetStream.Buffer.Empty"){
bufferClip._alpha = 100;
}
if(info.code == "NetStream.Play.Stop"){
getURL("vid_main.htm","_self");
}
}

// Rewind button
controlBar.rewindButton.onRelease = function() {
ns.seek(0);
}

// Play button
controlBar.playButton.onRelease = function() {
ns.pause();
}

// Mute button
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth())
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);

so.setVolume(100);

controlBar.mute.onRollOver = function() {
if(so.getVolume() == 100) {
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver");
}
}

controlBar.mute.onRollOut = function() {
if(so.getVolume() == 100) {
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute");
}
}

controlBar.mute.onRelease = function() {
if(so.getVolume() == 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
}
else {
so.setVolume(100);
this.gotoAndStop("onOver");
}
}

// Fullscreen button
controlBar.fullScreen.onRelease = function(){
if(Stage.displayState == "fullScreen"){
Stage.displayState = "normal";
}
else{
Stage.displayState = "fullScreen"
}
}

// Scrub bar
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
duration = obj.duration;
}

function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
controlBar.loader.loadbar._width = amountLoaded * 539;
controlBar.loader.scrub._x = ns.time / duration * 539;
}

var scrubInterval;

controlBar.loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubIt,10);
this.startDrag(false,-6,this._y,539,this._y);
}

controlBar.loader.scrub.onRelease = controlBar.loader.scrub.onReleaseOutside = function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}

function scrubIt() {
ns.seek(Math.floor((controlBar.loader.scrub._x / 539) * duration));
}

// Custom context menu
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;

var i1:ContextMenuItem = new ContextMenuItem(":::: Vision Controls ::::",trace);
theMenu.customItems[0] = i1;

var i2:ContextMenuItem = new ContextMenuItem("Play / Pause Video",pauseVid,true);
theMenu.customItems[1] = i2;

var i3:ContextMenuItem = new ContextMenuItem("Replay Video",replayVid);
theMenu.customItems[2] = i3;

var i4:ContextMenuItem = new ContextMenuItem("The Animatrix CD",trace,true);
theMenu.customItems[3] = i4;

function pauseVid() {
ns.pause();
}

function replayVid() {
ns.seek(0);
}

// Show/Hide Controls

function checkOverlap():Void {
var overTestX = overTest._xmouse;
var overTestY = overTest._ymouse;

if (overTestY >= 0 && overTestY <= 316 && overTestX >= 0 && overTestX <= 616){
controlBar._alpha = 75;
}
else {
controlBar._alpha = 0;
}
}

var overlapInterval:Number = setInterval(checkOverlap, 100);

outseeker
02-08-2008, 09:19 AM
Well according to Adobe: scaleMode? Check out http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode_02.html and see if that helps you any champ. :)

Edit: Read the whole thing, but the title Scaling seems to have what u mentioned.

tr_y2k
02-09-2008, 03:23 AM
Outseeker, many thanks, after adding
Stage.scaleMode = showAll; to the top of my ActionScript it works great! :-)

outseeker
02-09-2008, 06:59 PM
woot I got a thank! :D I've never used ActionScript particularly either lol

Glad it did the trick. Happy coding! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum