5 Replies Latest reply: Aug 22, 2012 10:19 PM by grace-glory RSS

    Videio not displaying but audio can be heard

    TezS56

      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.

        • 1. Re: Videio not displaying but audio can be heard
          Silviu Vergoti Adobe Employee

          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.

          • 2. Re: Videio not displaying but audio can be heard
            TezS56 Community Member

            Can you explain? I am using the latest OSMF.swc from http://www.opensourcemediaframework.com/

            • 3. Re: Videio not displaying but audio can be heard
              TezS56 Community Member

              I have just been looking at http://blogs.adobe.com/osmf/ and this makes no sense to me at all. I am not publishing to HTML only .exe but I have not got that far yet. I am only trying to test the movie in Flash. Oh!(exasperated) I thought OSMF was supposed to be an easy way to create video. Any help is apreciated.

               

              Now you are probably eager to test the performance of your video  player with the exploratory implementation of Stage Video support in  OSMF.

              For this you’ll need to get the Flex SDK that contains the latest  Stage Video APIs, you’ll need our source, and you’ll need to set up your  development environment.

              1. Get the source code from our Sourceforge SVN space: svn checkout http://svn.code.sf.net/adobe/smp/svn/trunk
              2. Import the OSMF and StrobeMediaPlayback projects.
              3. Download the Flex Hero SDK (Flex 4.5 SDK – build 4.5.0.19786+) here: http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+Hero
              4. Add the new Flex SDK to Flash Builder (right click on any project,  Properties, ActionScript Compiler, Configure Flex SDKs). Set the new SDK  as the default.
              5. Check that you can run the StrobeMediaPlayback project without any issues.
              6. Link your video player to the OSMF project that was imported in step 2.
              7. Go to the compiler properties (right click on it, Properties, ActionScript Compiler) and set “Use specific version” to 10.2.
              8. In additional compiler arguments add   -swf-version=11
              9. Go to your HTML page and add wmode=direct to your parameters. Your embed snippet should look like this:

              swfobject.embedSWF(
              “StrobeMediaPlayback.swf”
              , “StrobeMediaPlayback”
              , 640
              , 480
              , “10.1.0″
              , “expressInstall.swf”
              , parameters
              , {
              allowFullScreen: “true”,
              wmode: “direct”
              },
              ,{
              name: “StrobeMediaPlayback”
              }
              );

              At this point you are ready to run your video player.

              Normally, your video player should behave exactly as it did before switching to the exploratory version of OSMF.

              • 4. Re: Videio not displaying but audio can be heard
                ciciliu Community Member

                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.

                • 5. Re: Videio not displaying but audio can be heard
                  grace-glory

                  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.