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

Tags: Adobe Open Source

Similar Questions

  • 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.

  • a fusion drive is good for audio recording?

    I think buy a 27-inch iMac for audio recording on Logic Pro X, but is not sure a merger player performance, because some say that the part of the HARD of it on only 5400 RPM drive, if I hold with an iMac HARD 7200 RPM drive?

    You will likely get different opinions, but personally I would not use the fusion drive and recommend an SSD.

    Quite significant speed difference.

  • Digital Coaxial output for audio/video receiver - does not

    I connected my LCD TV to my office from HP (9340f) using the S-video output on a Nvidia 9800GT video card.  The video is awesome, but I can't get the sound to work on my Harmon Kardon AVR146 receiver.  I plugged the exit at the back of the HP to the coaxial digital input at the back of the digital coaxial receiver.

    When I open the properties for audio devices and test the audio from Realtek, I can hear the sounds (piano?) of the speakers connected to the receiver, however, when I play video through windows media, or play a video game there is no noise at all.

    Any suggestions?

    have you gone to control panel-> Sound, then verify that the digital output is enabled.  No speaker ouput.

    (If you are using Vista, you should see a green check mark next to it)

    It is always useful if you tell us what operating system is installed. In this way without guesswork... I think maybe required ESP.

  • Where can we post requests for features for TVs?

    Anyone know where can post us requests for features for TVs?

    For example, it would be nice to access usb connected to the TV via network.

    You can post it here hoping that someone from Toshiba read this.

  • How to drag the apps? to force no click trackpad... I think they remove this features for elcapitan

    How to drag the apps? for a force not click trackpad...
    I think that they remove this features for elcapitan

    Select the application, and then hold down the trackpad (click), pressed with the left hand, while you use your right hand to drag the app.

    Note: This creates an alias to the place where you drag where you want to move , you also need the CMD key at the same time.

  • 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

  • How fees are there for audio conferencing in microsoft live meeting

    how much should I pay for audio conferencing in microsoft live meeting. Waiting for your response.

    Concerning
    Shonan systems

    Hello

    I suggest you contact Windows Live Meeting customer support, see the support below link:

    https://support.live.com/default.aspx?ProductKey=mocplmhome&brand=MOCP&&mkt=en-us&scrx=1

  • What Sansa is better for Audio books?

    Hi - I'm new on the forum 'Hello' to everyone and I hope you can help me!

    Not only am I back on the forum I'm new in the world of MP3 players - I never thought I want one, but I decided that I do - not particularly for music but for audio books.

    After having narrowed down my choice of a Sandisk player, I'd be happy to have some tips about what is the best of a Clip + and Fuze + for audio books?

    TIA

    Just my opinion. If I were you, however, I would travel even if the jury Fuze + and perhaps use the search box on the two cards to "audiobooks" and see what happens; I know there have been lots of discussions. This way you can get valuable insights into others and an idea of what to expect from these two players.

  • Output HDMI on IDT driver version 6.10.6087.0 can only be used for audio?

    my audio receiver has an hdmi output. the driver idt can be used to control the output of the receiver?  I am currently connected to speakers & headset jack, and the only purpose that is to serve the receiver is to amplify the output of the laptop. is it possible to stream the audio output of the receiver through the audio driver of the laptop?

    original title: I am running vista with a driver for version 6.10.6087.0 idt. the hdmi output on this driver can only be used for audio?

    Hello

    ·         What is the brand and model of the laptop?

    ·         Your laptop supports HDMI components?

    I suggest you to contact the manufacturer of your laptop on HDMI audio settings for more information

  • Prefetch is just a feature for Windows programs, or work for 3rd party too?

    My understanding of Prefetch is that it monitors the use of programs and try to anticipate when they could be used and so loaded them in memory, ready to go.

    It is just a feature for Windows programs, or work for 3rd party too?

    For example, I use OpenOffice and the first time I open it, it takes several seconds to open. If I close and open the program via a session then always opens almost instantly (about two or three seconds) so it must be in RAM somewhere. Yet every day the initial aperture is slow.

    Is - not what Prefetch is supposed to address?

    Hi Mooly,

    You can read the following article and check:

    What is the prefetch folder?

    If you are concerned about the start time, you can consult the following link:

    Optimize Windows Vista for better performance

    Hope this information is useful.

  • T400 adding 2nd HD for audio files, any PERSON using Ultrabay Adapter II successfully?

    I use my T400 to record the audio in my project studio. I would add a second HD for audio files and the content of the programmes.

    After some searching of web and because of my current installation, would like to know what additional HD system would work well. I'm happy with my system, but see some stuttering and dropping out of school. I run a MOTU light Ultra in the 4 pin F / w.

    1. I can use the Ultrabay, with SATA adapt II to drop in Seagate Momentus 7200, SATA300, 320GB, which hopefully will be compatible. I saw a post that this works like SATA300.   2 I could use a glyph Portagig 7200 RPM 320 GB, 800 F/W or USB as an external hard drive. I need Garland who at the MOTU F/W400 to connect, I'd be from ports. I don't know if USB would be as good on transfers.  NOTE: My Card/Bus Express slot is in use for other attachments.

    Is someone using a second HD with any one of these methods successfully?  I would go on the road II Ultrabay adapter, to be able to use my other attachments when editing.  CD/w could come back when I need to burn a finished product.

    No matter who sees all conflicts, I, as a beginner, do not see?

    Thank you

    Thanks to all who responded.  I was out of town, without my password.

    Bill wrote:

    I have several IIs adapter Ultrabay and they work very well with a variety of SATA 2.5 "drives for my purposes

    *********

    Dr. Khan wrote:

    Yes. It will work with no problems atall.

    I personally use one. So far so good...

    **********

    I started to pick up after a previous thread by Dr. Khan, stating that its SATA 300 disc had worked. So thanks to both for the

    conformation.

    Kawika says:

    But, seriously, I recently returned to the field / natural records, particularly indigenous and endangered forest birds. I am quite amazed at what I can get out of this PCM recorder (Oly LS-10 w / depth of 24-bit 96 kHz, AudioTechnica and Sennheiser microphones, Sony flat). Workstation is with WavePad for a function I use, noise reduction and then Raven for sonogram analysis and noculars. I looking for something that compress the "echo" the file and did not find something suitable. The Oly came with Cubase LE 4 of Steinberg, and I get a little, um, stunned, when I look at that too long. Newbing all over again, so maybe you have suggestions? The long-awaited T400 replaces my current T41 which, well, gets a little upset at times.

    *******

    Yes, I the Oly LS-10, a very good hand unit.  I also received the Cubase LE 4, but for me, its got a steep learning curve.

    Much more easy DAW is all on a single page of Mackie Tracktion 2 or 3. Very easy to learn and your final product will be just as

    professional such as Cubase. If you learn Tracktion, you will have an easier time with the more complex Cubase.

    http://www.Mackie.com/products/tracktion3/ check it out.

    ***********

    Zilla wrote:

    So, to be on the safe side with the T400 Ultrabay, you could buy the new disk of 320 GB at 7200 RPM Lenovo announced in January.

    I didn't know that Lenovo made a great and fast.  An option, if it is near the level of Seagate.

  • "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.

  • no matching feature for call to 'bb::cascades::QmlDocument::createRootObject().

    -The application written for 10.0.6

    -Installed 10.0.9 SDK

    -Read:

    https://developer.BlackBerry.com/Cascades/documentation/dev/upgrading/applicationchanges.html

    -Now:

       Model *model = new Model();
    
        QmlDocument *qml = QmlDocument::create("asset:///main.qml")
           .property("cs", this)
           .property("model", model);
    
           if (!qml->hasErrors()) {
               Page *page= qml->createRootObject();
               if (page) {
                   setScene(page);
               }
           }
    

    "BlackBerry 10 SDK native 10.0.9.386" is selected in my toolbar.

    The line:

    Page * page = qml->() createRootObject;

    ... is highlighted in red with the error:

    no matching feature for call to 'bb::cascades::QmlDocument::createRootObject().

    Before that, there was a line highlighted in red in one of my dealing with .h files who complained about a SQL question, but the line had nothing to do with SQL. I did a cleanup in the IDE and which fortunately went.

    You use the right namespace? BB::Cascades and make sure you import

  • Windows 7 Enterprise N - cannot install the Media feature for 64 - bit Pack

    I tried to install the package of multimedia features for Windows 7 N, but it keeps saying that it is not applicable to your computer.  Why?  I search high and low and cannot find an answer.  I tried to download windows media player, but I can't find a version for Windows 7.  More something what I don't have IIS 7.0.  Whatever it may be.

    Can anyone provide steps to help me install the 7 business N Windows Media feature pack?  Service Pack 1 is already installed and updates are all up to date.

    Download x 86 Edition-> Windows6. 1 - KB968211 - x 86 - RefreshPkg.msu
    Download x 64 Edition-> Windows6. 1 - KB968211 - x 64 - RefreshPkg.msu

    Make sure you try to download and install the version appropriate for your operating system.

Maybe you are looking for