I'm creating a mini game. It has music background and gun sound. But I can not play them at the same time.
How can I do it ???
You can't - as MSDN says:
When a MediaElement control plays audio or video content, any background sounds or media already playing are halted. The app launches the playback experience when the user taps the control. Only one MediaElement control can operate at a time.
Instead you can try to use SoundEffect from XNA to play your gun sound.
Related
I use NetConnection, NetStream and Video classes to show video in actionscript 3 (AIR SDK 31.0.0.96) and I can play/stop/pause video, but I don't know how can I add any audio effects (speed changing, distortion, waves or something else).
In my game user has to guess video by deformated sound and for some reasons deformated effect should to be applied in runtime.
I hope, that you will can advice me some library for process audio track in runtime or show me simple code example to access to audio from actionscript.
Thank you.
I'm using JW Player to live stream content onto a web page. The player is backed by an open-source library called cine.io.
My issue is that the player falls back to an HTML 5 video element for all mobile web, both on iPhone and Android. There are some differences between the flash solution of JW Player and HTML5 - notably that if a live stream starts, then stops, then restarts, the video element will not pick up the restarted stream.
This is a problem since streams often drop in and out - and the flash solution does pick up the restarted stream.
I tested a bunch of listener methods on the video and the only one that signalled that the stream had ended was a "time update" listener:
$video.on('timeupdate', function(){
//Do something
});
However none of my attempts to re-open the stream have been effective.
Is this even possible? Can anyone provide pointers?
Would an example like this work?
http://support.jwplayer.com/customer/portal/articles/1442607-example-a-custom-error-message
I stuck in a big problem I am playing audio in background using BackgroundAudioPlayer working fine while I am playing another audio file using MediaElement on foreground the background sound is stopped.I want to play both sound simultaneously background and foreground please let me how it will be done.
MediaElement and BackgroundAudioPlayer are exclusive - you can only use one of these at a time.
You are able to play additional sounds using the XNA SoundEffect APIs however. For example of these APIs see this blog entry.
Developing an AIR for iOS app that involves video playback. Are there any best practices for optimizing video content for use in AIR applications?
Best route for video through AIR on iOS is to use an h.264 encoded video. These will be hardware accelerated and be better on battery than FLV (the other usual type for Flash).
The problem, of course, is that most h.264 videos cannot be played back using standard Flash video players on iOS. To get around that, you'll want to try one of two things:
Use StageWebView. This will open the video in the standard iOS video player, which is purpose-built to play h.264 videos. The downside here is you have absolutely no control over the video other than unloading the StageWebView. You also have no control over the GUI and the video will display over the entire application and can be difficult to position in Flex.
Use StageVideo which will allow for hardware accelerated h.264 videos and use the built in video playback mechanisms. It works fantastically, you have full control over your video, and it is just the video, so you can skin it as you see fit. The only downside is this displays the exact opposite of StageWebView and displays under your app. You will have to create a mask to see the video.
It's unfortunate that the two best options for playing video on iOS do not reside in the Display List, but that is what we have to deal with.
Hopefully that helps.
You can use component FPVideoPlayer from ane library FPNativeUI, which displays video over display list: http://www.youtube.com/watch?v=G5IdHnms2Dc. http://flashpress.ru/blog/ane/native-ui/?lang=en
I've noticed the sneakiest behavior playing video with NetStream. If the video has an audio track, and the headphones are plugged in to my machine or removed, the video pauses for a second, and then the audio starts playing from the new output.
However, there's no way to listen for this happening that I can find! Flash certainly doesn't allow access to the client machine's sound card, so we can't talk directly to the system about this. Also, I've tried listening for NetStatus events from the NetStream that could inform me that the stream is pausing and then resuming, but no events are dispatched.
Does anyone know of an event I can listen for to capture this input switch? I was thinking of using an Event.ENTER_FRAME event to check the fps of the video every frame, or the time property of NetStream, but that seems pretty hackish.
Any better ideas?
It's not netstream and not Flash Player, it's the device (sound card) pausing the sound during switching from headphones to speakers or vice-versa.