0 Replies Latest reply on Jun 29, 2010 11:12 PM by coolvinu1980

    Video Fullscreen problem

    coolvinu1980

      Hi,
      I will explain in detail.Please go through this link http://www.clients.iscripts.com/jude_videochat/index.html and click Start Video Chat  Button. Please provide a username and roomname and then click login. On login you will enter in Chat. There video component is shown. On mouse over there is afullscreen button.On clicking the fullscreen button The application will be in fullscreen mode not the video.I want the video to be in fullscreen mode.

       


      This is the code i am using

       


      In my Videopod component i have given like this

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="com.*"
           width="100%" height="100%" xmlns:view="com.view.*"
           creationComplete="init()" horizontalScrollPolicy="off"
           verticalScrollPolicy="off" paddingTop="30" paddingLeft="10">
          <mx:Script>
              <![CDATA[
                  import mx.controls.Alert;
                  import com.model.DataManager;
                  import flash.media.Video;
                  import flash.system.*;
                  import mx.events.SliderEvent;
                  import mx.controls.Alert;

       

                  private var microphone:Microphone;
                  private var camera:Camera;
                  private var video:Video;
                  public var nc:NetConnection;
                  private var ns:NetStream;
                  public var index = 0;
                  public var sound:SoundTransform;
                 
                  [Bindable]
                  public var userItem:Object;
                  [Bindable]
                  private var dataManager : DataManager = DataManager.getInstance();
                  [Bindable]
                  public var isSender:Boolean;
                  [Bindable]
                  private var chat:Chat;
             
                  private function init():void
                  {
                      ns = new NetStream( nc );
                      video = new Video( 160, 120 );
                 
                      if( isSender )
                      {
                          for ( var i=0 ; i < Camera.names.length; i++ )
                          {
                              if ( Camera.names[i] == "USB Video Class Video" )
                              {
                                  index = i;
                              }
                              else
                              {
                              }
                          }
                          camera = Camera.getCamera(index);
                          camera.setLoopback( true );           
                          video.attachCamera( camera );
                          ns.attachCamera( camera );
                          microphone = Microphone.getMicrophone();
                          ns.attachAudio( microphone );
                          ns.publish( userItem.username );   
                      }
                      else
                      {
                          try
                          {
                              video.attachNetStream( ns );
                              if(userItem)
                              {   
                                  trace( userItem.username );
                                  ns.play( userItem.username );
                              }
                              else
                              {
                                  trace("Unable to Stream Video");
                              }
                          }
                          catch(e:Error)
                          {
                              trace("ns.play error "+ e.toString());
                          }                   
                      }
                      videoDisplay.video = video;
                      broadcastUserName.text = userItem.username;
                      broadcastUserName.visible = true;
                      sound = ns.soundTransform;
                      sound.volume = 50;
                      ns.soundTransform = sound;   
                  }
                 
                  public function updateVolume(event:SliderEvent):void
                  {
                     
                       sound = ns.soundTransform;
                       sound.volume = event.value;
                       ns.soundTransform = sound;   
                  }
                 
                  private function formatVolumeToolTip(value:int):String
                  {
                        var result:String = (value % 100).toString();
                        if ( result.length == 1 )
                        {
                              result = Math.floor(value).toString();
                        }
                        else
                        {
                              result = Math.floor(value).toString() ;
                        }
                        return result;
                   }
                  
                   private function toggleSound():void
                   {               
                      if ( muteButton.selected )
                      {
                          muteButton.toolTip = "Sound";
                          sound = ns.soundTransform;
                          sound.volume = 0;
                          ns.soundTransform = sound;   
                          volumeSlider.value = 0;
                      }
                      else
                      {
                          muteButton.toolTip =  "Mute";
                          sound = ns.soundTransform;
                          sound.volume = 50;
                          ns.soundTransform = sound;
                          volumeSlider.value = 50;
                      }
                   }
                 
                   private function showControls():void
                   {
                       fadeIn.play([controls]);
                   }

                   private function hideControls():void
                   {
                       fadeOut.play([controls]);
                   }
                  
                   public function stopStream():void
                   {
                       ns.close();
                       //ns.play(false);
                   }
              ]]>
          </mx:Script>
      <mx:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" />  
      <mx:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" />
          <mx:Canvas rollOver="showControls()" rollOut="hideControls()">
              <view:VideoContainer id="videoDisplay" width="200" height="170"/>
              <mx:HBox  x="0" y="0" width="100%">
                  <mx:Label id="broadcastUserName"  color="#E8F4F6" fontSize="15" fontWeight="bold" visible="false"/>
              </mx:HBox>
              <mx:HBox id="controls" horizontalAlign="right" styleName="controllerStyle"  width="100%" alpha="0.0" y="144" paddingRight="5">
                  <mx:HSlider id="volumeSlider" x="59" y="142" width="103"
                      snapInterval="1" value="50" maximum="100"
                       thumbDrag="updateVolume(event);" dataTipFormatFunction="formatVolumeToolTip"
                      liveDragging="true" toolTip="Volume"/>
                  <mx:Button id="muteButton" toolTip="Mute" height="20" width="20" styleName="mute" toggle="true"  click="toggleSound()" x="170" y="142"/>
              </mx:HBox>
          </mx:Canvas>
         
      </mx:Canvas>

       

       

       

      And in the main file i gave like this,

       

      private function fullScreen() :void
      {
      Application. application. stage.addEventLi stener( FullScreenEvent. FULL_SCREEN, fullScreenHandler );
      //screenMode = Application. application. stage.displaySta te;
      }

       

      private function fullScreenHandler( e:FullScreenEvent ):void
      {
      //screenMode = Application. application. stage.displaySta te + " ( fullScreen=" + e.fullScreen. toString( ) + ")";
      if (e.fullScreen) {
      // do stuff for full screen mode

       

      } else {
      // do stuff for normal screen mode
      }
      }