FLV not pulling MediaPlayerStateChangeEvent (was: features for audio?)

I'm testing this very basic player with different types of items; MP3 and JPG work perfectly, but the FLV file does nothing. The MediaPlayerStateChangeEvent never fires. Is this a bug, or is there a problem with my application? I am sure that I use sprint 10.

Current code, with comments...

package
{
import flash.display.Sprite;

Import org.osmf.containers.MediaContainer;
Import org.osmf.media.DefaultMediaFactory;
Import org.osmf.media.MediaElement;
Import org.osmf.media.MediaPlayer;
Import org.osmf.media.URLResource;
Import org.osmf.utils.URL;
Org.osmf.traits import. *;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.MouseEvent;

Org.osmf.containers import. *;
Org.osmf.elements import. *;
Org.osmf.events import. *;
Org.osmf.layout import. *;
Org.osmf.media import. *;
Org.osmf.metadata import. *;
Org.osmf.net import. *;
Org.osmf.net.dvr import. *;
Org.osmf.net.httpstreaming import. *;
Org.osmf.net.rtmpstreaming import. *;
Org.osmf.traits import. *;
Org.osmf.utils import. *;

/**
* Metadata sets the size of the SWF must match the video.
**/
[SWF (width = "640" height = "480")]
SerializableAttribute public class HelloPlayButton extends Sprite {}

public void HelloPlayButton() {}
Create the container class that displays the media.
var container: MediaContainer = new MediaContainer();
addChild (container);

Create URLS
var mediaURL:URL = new URL("..) ("/ videos/S0004_VP6_1Mbps.flv");
var mediaURL:URL = new URL("..) (' / images/swing.jpg ");
var mediaURL:URL = new URL("..) ("/ audio / train_1500.mp3");
* THE DOCS SAY TO ASSIGN THE STRING INSTEAD OF THE URL, BUT IT GENERATES AN ERROR, URL ABOVE DOES NOT WORK
var mediaURL:String = "... / videos/S0004_VP6_1Mbps.flv";

Create the resource to play
var resource: URLResource = new URLResource (mediaURL);

Create an instance of mediafactory
var mediaFactory:DefaultMediaFactory = new DefaultMediaFactory();

Create the MediaElement object and add it to the container class.
var myMediaElement:MediaElement = mediaFactory.createMediaElement (resource);
container.addMediaElement (myMediaElement);

Create a media player
var mediaPlayer:MediaPlayer = new MediaPlayer();
Stop AutoPlay
mediaPlayer.autoPlay = false;
Then assign media

mediaPlayer.media = myMediaElement;

var playButton:Sprite = constructPlayButton();
addChild (playButton);
playButton.visible = false;

Add event listeners
playButton.addEventListener (MouseEvent.CLICK, function (): void {mediaPlayer.play () ;});)
mediaPlayer.addEventListener (PlayEvent.PLAY_STATE_CHANGE, function (): void {playButton.visible =! mediaPlayer.playing; ;})})

mediaPlayer.addEventListener (MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE, mediaPlayerStateChanged);

function mediaPlayerStateChanged(evt:MediaPlayerStateChangeEvent):void {}
IT'S NOT FIRE FOR FLV, MP3 AND JPG
If {(evt.state is MediaPlayerState.READY)
trace ("MediaPlayerState - READY!");
registerTraits();
}
}

function registerTraits() {}
trace ('characters register');
If (myMediaElement.hasTrait (MediaTraitType.LOAD)) {}
var loadable: LoadTrait = myMediaElement.getTrait (MediaTraitType.LOAD) as a LoadTrait.
trace ("this mediaElement is loadable!");
}
If (myMediaElement.hasTrait (MediaTraitType.PLAY)) {}
playable var: = myMediaElement.getTrait (MediaTraitType.PLAY) PlayTrait as PlayTrait.
trace ("this mediaElement is playable!");
addChild (playButton);
playButton.visible = true;
}
If (myMediaElement.hasTrait (MediaTraitType.AUDIO)) {}
var audio: AudioTrait = myMediaElement.getTrait (MediaTraitType.AUDIO) as AudioTrait;
trace ("this mediaElement has an audio track!");
addChild (playButton);
playButton.visible = true;
}
* IF I USE THIS SWITCH STATEMENT INSTEAD OF BASED ON THE TRAITS (SEE ABOVE)
* I GET A COMPILER ERROR
* Error #1065: Variable org.osmf.elements::VideoElement is not defined.

/ * {switch (true)
myMediaElement case is VideoElement:
trace ("this is a VideoElement");
playButton.visible = true;
break;
case mediaPlayer.media is ImageElement:
break;
case mediaPlayer.media's support:
playButton.visible = true;
break;
SWFElement is case mediaPlayer.media:
playButton.visible = true;
break;
}*/
};

function constructPlayButton (): Sprite {}
var size = 100;
var x = 330;
var y = 225;
var f = 1.2;
var result: Sprite = new Sprite();
var buttonArt:Graphics = result.graphics;
buttonArt.lineStyle (1, 0, 0.5);
buttonArt.beginFill (0xA0A0A0, 0.5);
buttonArt.moveTo (x - size/f, y - size);
buttonArt.lineTo (size + x, f, y);
buttonArt.lineTo (x - size/f, y + size);
buttonArt.lineTo (x - size/f, y - size);
buttonArt.endFill ();
return the result;
}

}
}
}

TIA,

Lisa

Looks like that you add your headset according to the MediaPlayer.media definition.  If the state change fires immediately (as it will be for a progressive video), you will miss the event.  Try to add all your listeners before setting the property of the media.

Tags: Adobe Open Source

Similar Questions

  • Hello. I warned to creative cloud, but not what I was looking for. I want to cancel, but I can't find where I can do.  I need help please. Thank you

    Hello. I warned to creative cloud, but not what I was looking for. I want to cancel, but I can't find where I can do. I need help please. Thank you

    Hello

    Please see: -.

    In order to cancel the order, please contact customer service

    You can check: http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

    For more information on cancellation: cancel your creative cloud membership

  • Features for audio?

    I am trying to create an example of very simple player that meets the type of media being loaded.

    I can get to see a play button for video and not display it to a JPG. However, I can't seem to make it work for audio; None of the features you'd expect are detected on the element when I specify a MP3 file (game, character, audio, characteristic of the time).

    Here is my code for the player. I thought that maybe the file was not completely loaded before that I was trying to get his features so I tried an if statement - is not the case for other types of media, but the statement does not make a difference. You see a problem with my code below? Am I missing a step here?

    TIA,

    Lisa

    package
    {
    import flash.display.Sprite;

    Import org.osmf.containers.MediaContainer;
    Import org.osmf.media.DefaultMediaFactory;
    Import org.osmf.media.MediaElement;
    Import org.osmf.media.MediaPlayer;
    Import org.osmf.media.URLResource;
    Import org.osmf.utils.URL;
    Org.osmf.traits import. *;
    import flash.display.Graphics;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    Import org.osmf.events.PlayEvent;
    Import org.osmf.layout.LayoutUtils;

    /**
    * Metadata sets the size of the SWF must match the video.
    **/
    [SWF (width = "640" height = "480")]
    SerializableAttribute public class HelloPlayButton extends Sprite
    {
    public void HelloPlayButton()
    {
    Create the container class that displays the media.
    var container: MediaContainer = new MediaContainer();
    addChild (container);

    Create URLS
    var mediaURL:URL = new URL("..) (' / images/swing.jpg ");
    var mediaURL:URL = new URL("..) ("/ audio / train_1500.mp3");
    var mediaURL:URL = new URL("..) ("/ videos/S0004_VP6_1Mbps.flv");

    Create the resource to play
    var resource: URLResource = new URLResource (mediaURL);

    Create an instance of mediafactory
    var mediaFactory:DefaultMediaFactory = new DefaultMediaFactory();

    Create the MediaElement object and add it to the container class.
    var myMediaElement:MediaElement = mediaFactory.createMediaElement (resource);
    container.addMediaElement (myMediaElement);

    Create a media player
    var mediaPlayer:MediaPlayer = new MediaPlayer();
    Stop AutoPlay
    mediaPlayer.autoPlay = false;
    Then assign media
    mediaPlayer.media = myMediaElement;


    var playButton:Sprite = constructPlayButton();

    Add event listeners
    playButton.addEventListener (MouseEvent.CLICK, function (): void {})

    mediaPlayer.play ();
    });
    mediaPlayer.addEventListener (PlayEvent.PLAY_STATE_CHANGE, function (): void {})
    playButton.visible =! mediaPlayer.playing;
    });


    tried this...
    If (myMediaElement.hasTrait (MediaTraitType.AUDIO)) {}
    var audio: AudioTrait = myMediaElement.getTrait (MediaTraitType.AUDIO) as AudioTrait;
    trace ("related audio");
    }

    and also that...
    var loadable: LoadTrait = myMediaElement.getTrait (MediaTraitType.LOAD) as a LoadTrait.
    playable var: = myMediaElement.getTrait (MediaTraitType.PLAY) PlayTrait as PlayTrait.
    If (loadable! = null) {}
    trace ("this mediaElement is loadable!");
    }
    If (playable! = null) {}
    trace ("this mediaElement is playable!");
    addChild (playButton);
    }
    If (audio! = null) {}
    trace ("this mediaElement has an audio track!");
    addChild (playButton);
    }

    function constructPlayButton (): Sprite {}
    var size = 100;
    var x = 330;
    var y = 225;
    var f = 1.2;
    var result: Sprite = new Sprite();
    var buttonArt:Graphics = result.graphics;
    buttonArt.lineStyle (1, 0, 0.5);
    buttonArt.beginFill (0xA0A0A0, 0.5);
    buttonArt.moveTo (x - size/f, y - size);
    buttonArt.lineTo (size + x, f, y);
    buttonArt.lineTo (x - size/f, y + size);

    buttonArt.lineTo (x - size/f, y - size);
    buttonArt.endFill ();
    return the result;
    }

    }
    }
    }

    Lisa,

    Look at your code, you have the import duplicate instructions

    Delete them:

    Import org.osmf.containers.MediaContainer;
    Import org.osmf.media.DefaultMediaFactory;

    Import org.osmf.media.MediaElement;
    Import org.osmf.media.MediaPlayer;
    Import org.osmf.media.URLResource;
    Import org.osmf.utils.URL;  (this isn't in Sprint 10 API)
    Org.osmf.traits import. *;

    http://help.Adobe.com/en_US/OSMF/1.0/AS3LR/org/OSMF/utils/package-detail.html

  • DriverMax update drivers. Among the updates was for audio and subsequently did not sound. Soundcard (?) is Realtek AC97 Audio, XP Pro 32 bit SP3

    original title: no sound

    I used drivermax (for the first time) to update the drivers. Among the updates was for audio and subsequently did not sound. I tried to restore to a date backup earlier, but without success. My soundcard (?) is Realtek AC97 Audio, XP Pro 32 bit SP3

    Bad move!

    PC manufacturers sometimes 'tie' in the drivers for their machines so that the only reliable method to update either directly through their Web sites. DriverMax will detect your audio device and go to Realtek to obtain the driver. Not the solution, unfortunately

    MS Update also not as he says, is up to date...

    Go to the website of the manufacturer of the PC/laptop and find the support page for your machine. Download the audio drivers from here and install it.

    If it is a machine that you have built yourself, go to the website of the manufacturer of the motherboard and do the same thing from there.

    See you soon,.
    Jerry

  • "For Audio/video on the Internet" does not open

    Hi all

    As the title suggests when I click on "for Audio/video on the Internet" nothing happens.  It seems that the icon has also changed.  I tried to look around this problem without success.  I would appreciate any assistance.

    Plaase excuse my ignorance, but it is "for Audio/video on the Internet", a program or command in a browser (maybe an add-on)?  What is doing?  Have you checked that the http://www.microsoft.com/windows/compatibility/windows-vista/Default.aspx Vista Compatibility Center to ensure that the program / module is compatible with Vista and/or Internet Explorer? If so, please provide the web site of the program (link) so we can search more far - I couldn't find using Bing (which is unusual).  The fact that it has an icon indicates it is a program.

    What was the program installed and when its last function properly (and have the correct icon)?  Do you know when this problem started?  Try a system restore to a point in time BEFORE the problem started.  Here is the procedure: http://www.howtogeek.com/howto/windows-vista/using-windows-vista-system-restore/.  Don't forget to check the box to show more than 5 days of restore points.  If the first attempt fails, then try an earlier point or two.  NOTE: You will need to re - install any software and updates that you have installed between now and the restore point, but you can use Windows Update for updates.

    Right-click on the icon and click Properties.  On the general tab, it's a file with a path - what is this parth?  Go to this path in Windows Explorer and check to see if it exists and if it contains all of the files/programs. If it is there, so we know at least that the program is on the system even if the icon does not work.  Go to the executable main real within the program and create a new shortcut icon and move whenever the icon currently exists and see if this new icon works and it solved the problem.  If this is not the case, try to do a right-click on the icon and click on run as administrator to see if you have a better chance.

    If she isn't here or the procedures above will not work (and it is a program or an add-on), then I suggest you uninstall with Revo http://www.snapfiles.com/reviews/revo-uninstaller/revouninstaller.html and then restart and try reinstalling it.  He may have developed some corrupted files (espcially if the icon has changed) and this may clear up the problem.

    If I'm away from base here, please tell me.  I've never heard of this product before and as I said, I don't find it with Bing, and it is very rare that the programs available.  Please explain what it is and more to hold and, if possible, provide the link of web site (I can download it me to test it and see if I have also the problem - if I have Vista Business, which does not come with Media Center and I suspect that it is associated with, if it's a program).

    I hope this helps and please get back to us with more information so that we can help you better.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I was charged for my coffee game update, which I wasn't aware of. I do not accept to pay about $ 8 for only an update, this game in the first place was free. I want to ask for a return and I will delete the game

    I was charged for my coffee game update, which I wasn't aware of. I do not accept to pay about $ 8 for only an update, this game in the first place was free. I want to ask for a return and I will delete the game

    Apple or App developers read this forum. If you want a refund, contact the developer to the email address. It is to them that they will refund your or not.

  • I was charged for an application that was not mean to buy how I get my money back?

    I was charged for an application that was not mean to buy how I get my money back?

    Purchases are considered final, but you can try the page 'report a problem' to contact iTunes Support and see if they will refund or credit you: http://reportaproblem.apple.com

    Or you can try to contact iTunes Support via: https://support.apple.com/contact or https://www.apple.com/emea/support/itunes/contact.html

  • I sent 2 SMS to the iPhone even from the same location 1 hour out. Why I was charged for the second message, but not the first?

    I sent 2 SMS on the phone even in the same place 1 hour apart. I was charged for the second message, but not the first. Why charge me? I was under the impression that the messages sent between iPhones are free?

    I was under the impression that the messages sent between iPhones are free?

    It's a little more complicated than that.

    If the message is sent as an iMessage (blue) uses the data that could be part of your cellular data allowance or WiFi depending on what you are connected to. If it is sent as SMS (green) it takes however your carrier charges you for SMS.

    For a message to be sent in an iMessage, both parties need to have a device capable of iMessage (e.g., iPhone, iPad, Mac), iMessages allowed to have (settings > Messages > iMessage > on) and be connected to the data (Wifi or cellular).

  • Windows Media Player does not open and I'm not find 'Turn windows features turn on or off' when I'm looking for the beginning. I need quick help.

    Windows media player not open yet

    Regarding "I'm not find 'Turn windows features turn on or off' when I'm looking for the start." ...

    Start > Control Panel > column to the left, choose Classic view > programs and features > column to the left, you will see turn windows features turn on or off the option. For the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • My computer was fine for a while, but recently I got this alert pop up saying that my version of windows is not genuine.

    Original title: windows not genuine

    I bought my pc second hand about 5 months ago and it was fine for some time but recently iv had this alert pop up saying my version of windows is not genuine, I entered the product key that is on my pc and it says that it is wrong. How is it that all of a sudden it is not authentic, and why my product key is not help check. I don't understand very well about all this, but I thought that a pc came with a version of windows already there. Can I do otherwise than to pay for a new version of windows because I paid for a pc already which is supposed to have anyway... Thank you very much.

    To analyze and solve problems for Activation and Validation, we need to see a full copy of the diagnostic report produced by the MGADiag tool (download and save to the desktop -http://go.microsoft.com/fwlink/?linkid=52012 )
    Once downloaded, run the tool.
    Click on the button continue, after a short time, continue button will change to a copy button.
    Click the copy button in the tool (ignore the error at this stage) and then paste (with r-click and paste or Ctrl + V) in your message.
  • Will not download my pictures I was charged for pictures that won't open - I get this message: the file 'AdobeStock_81619923.ai' could not be opened.

    I was charged for pictures that won't open - I get this message: the file 'AdobeStock_81619923.ai' could not be opened. Help, please?

    Hi Joanne,

    I just downloaded the file without problem. Not sure that it is an EPS file? You will need to open it in an application that supports files .ai (Illustrator, Photoshop, etc.). Let us know if you're still having problems.

    Thank you

    Gordon

  • Worst ever customer service! Took a month to solve my request for an account that was signed for fraud with my bank details, and would not deliver even a refund of $1 for fraudulent use of the account. If they treat their employees the way cu

    Worst ever customer service! Took a month to solve my request for an account that was signed for fraud with my bank details, and would not deliver even a refund of $1 for fraudulent use of the account. If they treat their employees the way of customer service treats its customers, not surprising that the service is the worst I've ever met.  Bad form Adobe.  What a month subscription pay you? Adobe Community

    If your card has been used fraudulently to subscribe, you should be able to get the charges reversed with your credit card company. Not to defend the whole Adobe Customer Service, but in this case Adobe has no way to tell if it is a fraudulent use.

  • My Abobe photoshop 4.0 is not compatible with my Windows 7 a mild wear. It was, but for some reason any won't work now. I thought it was time to try a new version of photoshop and somehow ended up with a cloud, and apparently will have to pay for access t

    My Abobe photoshop 4.0 is not compatible with my Windows 7 a mild wear. It was, but for some reason any won't work now. I thought it was time to try a new version of photoshop and some sort finished with a cloud, and apparently will have to pay for access to Photoshop elements, which is everything I wanted in the first place. Is there a way I can get out of this oblogation to $120.00 and go to Staples and buy Photoshop elements 14?

    You may have to wait until Monday because of the long holiday weekend in the United States

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Cancel https://helpx.adobe.com/creative-cloud/help/cancel-membership.html

    -or https://helpx.adobe.com/contact.html?step=ZNA_account-payment-orders_stillNeedHelp

    > finished with a cloud and apparently will have to pay to access Photoshop elements

    I don't know what you bought, but Photoshop Elements only not part of the cloud

    Also, to install or run version 4 with Win7, did you do a RIGHT click on the program and select a compatibility mode from the option list?

  • went to use creative cloud and it won't let me open photoshop, says need to renew the subscription, but says page not found, I was paying £15 a month for it, hope you can help as soon as possible because I need to use it for my United work

    went to use creative cloud and it won't let me open photoshop, says need to renew the subscription, but says page not found, I was paying £15 a month for it, hope you can help as soon as possible because I need to use it for my United work

    Hello

    Maybe it's an activation issue, please see the link https://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

    Kind regards

    Gag

  • Hi, what is the red/green arrows for audio that will not play on my calendar?

    Hi, what is the red/green arrows for audio that will not play on my calendar?

    This icon means that the media is offline. There should be a little 'offline' next to it.

    This ARTICLE goes into detail on what can cause media offline and give some advice on fixing things.

    Here's a look at the project Panel, showing that the icon and the "Offline."

    Good luck

    Hunt

Maybe you are looking for