Skip navigation
TezS56
Currently Being Moderated

Videio not displaying but audio can be heard

Sep 12, 2011 2:17 AM

I have been advised to post this problem here from the AS3 Forum as it is to do with OSMF but I think my problem is in the AS3 code. I have created a DefaultMediaFactory element and added it to the stage  but it is not showing. I am using three classes Main, LoadTextVariables and finaly the PayVideo class. I first set the stage width and height in a Main  Class then call a LoadTextVariables class which gets the name of the  video to play from an external text file. On loading the variables is  complete it calls a PlayVideo class which creates the  DefaultMediaFactory and loads the chosen video and displays it. All this works well  except I can't see the video. I can hear the audio so I know it is playing. There are no other objects on the stage to hide anything. This is the code for creating the DefaultMediaFactory in the PlayVideo class:

 

package
{
   
    import flash.display.Sprite;
    /*import flash.display.StageAlign;
    import flash.display.StageScaleMode;*/
   
    import org.osmf.containers.MediaContainer;
    import org.osmf.elements.VideoElement;
    import org.osmf.layout.LayoutMetadata;
    import org.osmf.media.DefaultMediaFactory;
    import org.osmf.media.MediaElement;
    import org.osmf.media.MediaFactory;
    import org.osmf.media.MediaPlayer;
    import org.osmf.media.MediaPlayerSprite;
    import org.osmf.media.URLResource;
   
    public class PlayVideo extends Sprite
    {
        public var videoToPlay:String;
        private var _layout:LayoutMetadata;
        private var _mediaContainer:MediaContainer;
        private var _mediaElement:MediaElement;
        private var _mediaFactory:MediaFactory;
        private var _mediaPlayer:MediaPlayer;
        public var isOK:Boolean=false;
       
       
        public function PlayVideo(video:String)
        {
            videoToPlay=video;
            trace("got to PlayVideo",videoToPlay);
            playVid();
        }
        public function playVid():void{
            trace("got to playVid",videoToPlay);
            _mediaPlayer = new MediaPlayer();
            _mediaPlayer.autoRewind = false ;
           
           
            // Assign the resource to play. DefaultMediaFactory generates the appropriate
            // MediaElement and passes it to the MediaPlayer.
            _mediaFactory=new DefaultMediaFactory();
            _layout = new LayoutMetadata();
            _layout.width=stage.stageWidth;
            _layout.height=stage.stageHeight;
            _layout.x=0
            _layout.y=0
            _mediaContainer = new MediaContainer();
            addChild(_mediaContainer);
            _mediaElement = _mediaFactory.createMediaElement(new URLResource(videoToPlay));
            _mediaElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, _layout);
            _mediaPlayer.media = _mediaElement;
            _mediaContainer.addMediaElement(_mediaElement);
           
            trace("I am now playing the video= ",videoToPlay);
           
        }
    }
}

 

Any help with this would be appreciated.

 
Replies
  • Currently Being Moderated
    Sep 14, 2011 1:31 AM   in reply to TezS56

    It seems that you encountered a Stage Video related problem.

     

    Please check to the latest OSMF version and check if you have wmode=direct.

     

    S.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 1, 2011 11:10 PM   in reply to TezS56

    If you can hear audio, but are not seeing the video, you've come to the right place. Please respond below with the following information...the more info you provide us the sooner we can help you:

     

    1) What do you see: (a black box, white box, a green line, weird colors -- please be specific)

    2) Your Operating System (Mac OSX, Windows 7, Windows XP, etc)

    3) Internet Browser and version (Safari, Chome 7, Internet Explorer 7, Opera, etc)

    4) Video Card if you know it

    5) Adobe Flash version if you know it

     

    As a temporary workaround, you can try one, or both, of the following:

     

    1) Right click on the player > click Settings > Disable Hardware Acceleration > Refresh your Internet Browser
    2) Try closing your browser and re-load the video.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2012 10:19 PM   in reply to ciciliu

    Hi Ciciliu, we are also facing same problem and details are below

     

    1) What do you see: (a black box, white box, a green line, weird colors -- please be specific) -  a black box

    2) Your Operating System (Mac OSX, Windows 7, Windows XP, etc) - Windows 7

    3) Internet Browser and version (Safari, Chome 7, Internet Explorer 7, Opera, etc) - IE 9

    4) Video Card if you know it - no idea

    5) Adobe Flash version if you know it - Adobe flash builder 4.5, player 10.3.181.34...

     

    Please help us.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points