Audio composition using Windows Phone 8.1 media editing APIs - c#

I want to join multiple AAC audio files which are audio recording in real in a Windows Phone 8.1 app. Actually I want pause/resume feature in audio recording. In MP3 encoding I can simply join the buffer to have composition of audio files but in case of AAC it's not working. MP3 encoding profile is not available in Windows Phone 8.1. I thought MediaComposition will help me to stitch the audio recording, but I am getting exceptions it it.
I tried first to create MediaClip object from audio file but I am getting ArgumentException with message Source can not be audio file. Then I tried to create BackgroundAudioTrack object from audio file & added in MediaComposition. Then I tried to set source to MediaElement with these methods cvMediaElement.SetMediaStreamSource(comp.GenerateMediaStreamSource()); and cvMediaElement.SetMediaStreamSource(comp.GeneratePreviewMediaStreamSource(100, 100));, both throws ArgumentException with message The parameter is incorrect. Any one here to point me out to correct way?

I know this is an old question, but figured I would answer for you and others in case it is found during search.
As you noticed, audio clips are not supported directly in MediaComposition in Windows Phone 8.1. This has been fixed for Windows 10 (and MediaComposition itself is now part of the Universal Windows Platform so you can use it on many platforms).
For Windows Phone 8.1, the issue is likely tied to the fact that BackgroundAudioTracks don't dictate the length of "content" (per se) of the composition. To do this, you will likely need to add a blank MediaClip first. You can create a MediaClip from the color black for instance (MediaClip.CreateFromColor) and have it be as long as the total length of the background audio tracks. That should then let it work as expected on Windows Phone 8.1.
If you continue to run into any of these issues if you give it a whirl on Windows 10, please let me know and I can get some bugs filed :).

Related

Playing videos in background on Windows Phone 8.1

I'm creating a Windows Phone 8.1 app to play music and video from URIs. I first used a MediaElement control, to play media content.
However I can't play video or audio when my app is switched to background. I've implemented this (with BackgroundMediaPlayer) but this sample can only play audio, and I want my app to play video too.
I've searched a lot on the Internet, but I couldn't find the answer I'm looking for. So my question is : How can I play video in my app when it's switched to background?
If BackgroundMediaPlayer can't play video files in background I am almost sure there is no way to do it. That looks a little bit strange to play video in background.
But if your app is switched to the foreground, you can continue play video. Just save the last file in the mostRecentlyUsedList to have permissions to access this file the next time the app is opened.
Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList.Add(yourfile);
And later you can get it with:
String lastfilemruFirstToken = StorageApplicationPermissions.MostRecentlyUsedList.Entries.FirstOrDefault().Token;
StorageFile lastfile = await StorageApplicationPermissions.MostRecentlyUsedList.GetFileAsync(lastfilemruFirstToken);
The position you can get and set with the MediaElement.Position property

How to play a list of (online) video segments as a whole video for Windows phone 8.1

I need to play a list of videos using a player framework. When I play the first video, I need the second video to start loading in a different thread while the first is still playing, this way when the first video ends, the second video can start playing immediatly.
You can play media files on a Windows Phone using the MediaPlayerLauncher , or for a more customized experience, you can use the MediaElement class.
For more Reference Windows Phone Streaming Media Project would be Useful to You and this too How to play or stream a video file for Windows Phone 8.

Windows phone: Combine images and make a video file

I have a set of Images and i want to make a video with them.
I made a R&D over that and i found a lots of way like, FFmpeg. but there is nothing worked with windows phone 7.
My concept is just combine the set of images and prepare a video with any video format that you tube supports. and then i have to share this video on you tube.
I completed the share Functionality. but, i have a confusion in this generating video functionality.
Please suggest me any possible solution with windows phone 7. Waiting for your valuable feedback.
Thanks in advance.

playing .flv videos in windows store apps

I am developing a windows store app and I want to play .flv video from url.I used media element control but it is not giving any output.I also tried to load webpage which contain .flv videos in webview but it is not showing the video.I am new to windows store app development.If anyone can suggest something it will be of great help.
Thanks in advance.
the url of video is:http://video.co-learn.in/m1/flvplayer/flvplayer_test1.php?3tcode=3TAE1651&fname=3TAE1651_1L1A.flv&height=400&width=400
I think its not possible to play FLV video formats. You need to create your own decoder for it. Have a look at this official Microsoft answer: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/0b1d2d0d-f7ba-4a9e-80bb-d67059453c33/play-mpegflv-files-im-media-element
UPDATE
This thread might be useful to you in getting a hint about how to add codec packs in Metro Style app: http://answers.flyppdevportal.com/categories/metro/csharpvb.aspx?ID=054eca2f-4583-483b-8d46-ce7d6214e4f2
FLV is not one of the Supported audio and video formats (Windows Store apps) (Windows)‎ .
Your best chance would be to update the URL to provide a supported format.

Playing a ding in Windows 8?

I need to be able to play a "ding" sound in Windows 8 (a kind of beep that fades out gently), similar to what is seen here: http://tonematrix.audiotool.com/
Is it possible to somehow play this given a frequency? Or can I download sound files for this anywhere?
I noticed how the SoundPlayer no longer works, so the old code I used in my desktop program won't work anymore.
If you have a sound file of it, such as an mp3 or wav, use the MediaElement control. There are a few ways of doing this. For example, set the Source property to a URL (Uri class) or call SetSource() then the Play method.
Windows 8 does not include an easy way to generate a tone or pitch (assuming you mean metro/Windows Store apps). If you can generate the bytes needed to play the sound, place them in a buffer, create an IRandomAccessStream for it then pass it to SetSource. You can emulate the fade out by setting the Volume with a Timer.
It would be nice if there was a "fade out" audio effect that could be used with SetAudioEffect but Microsoft does not provide any audio effects at this time.

Categories

Resources