Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Question maintaining FLV apsect ratio in fullscreen mode

    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.

    Code:
    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);

  • #2
    Regular Coder
    Join Date
    Feb 2008
    Location
    Australia baby!
    Posts
    143
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Well according to Adobe: scaleMode? Check out http://www.adobe.com/devnet/flashpla...n_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.
    Last edited by outseeker; 02-08-2008 at 09:21 AM. Reason: Better info
    outseeker - http://outer.reaches.dyndns.org/index.php
    I hope this helped someone. Due to this forums lame rep system penalising me for nothing, and admins inability to do anything about it, I'm sorry to say I will no longer be online here. Pride is important. Good Luck All.

  • Users who have thanked outseeker for this post:

    tr_y2k (02-09-2008)

  • #3
    New Coder
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Outseeker, many thanks, after adding
    Code:
    Stage.scaleMode = showAll;
    to the top of my ActionScript it works great! :-)

  • #4
    Regular Coder
    Join Date
    Feb 2008
    Location
    Australia baby!
    Posts
    143
    Thanks
    6
    Thanked 3 Times in 3 Posts
    woot I got a thank! I've never used ActionScript particularly either lol

    Glad it did the trick. Happy coding!
    outseeker - http://outer.reaches.dyndns.org/index.php
    I hope this helped someone. Due to this forums lame rep system penalising me for nothing, and admins inability to do anything about it, I'm sorry to say I will no longer be online here. Pride is important. Good Luck All.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •