Video streaming on windows phone gives "3100 An error has occurred" - windows-phone-7

Initial data:
windows phone 7.1 application;
video streaming (video: MPEG‐4 AVC (part 10) (H.264); audio: MPEG AAC Audio (mp4a));
not a smooth streaming;
opened in VLC with any problems;
all capabilities are included (ID_CAP_MEDIALIB, ID_CAP_MICROPHONE, ID_CAP_NETWORKING and other).
I am using a MediaElement for opening video stream with custom http url:
media.Source = new Uri("streaming url");
media.DownloadProgressChanged += this.media_DownloadProgressChanged;
media.MediaFailed += this.media_MediaFailed;
media.MediaEnded += this.media_MediaEnded;
media.Play();
MediaFailed gives "3100 An error has occurred" error without any additional description.
Seems like listed codecs are supported.
Also I tried this code:
var mediaPlayerLauncher = new MediaPlayerLauncher
{
Location = MediaLocationType.Install,
Media = new Uri("streaming url", UriKind.Absolute),
Controls = MediaPlaybackControls.All,
};
mediaPlayerLauncher.Show();
but media player was not able to play video.
What can cause a problem? How to test whether video stream is compatible with Windows Phone?
Thanks in advance.

Related

How do I extract and record audio in webRTC on Firefox?

I implemented one to one webRTC video chat (Both audio and video)
navigator.getUserMedia({
audio: true,
video:true
}, function (stream) {
}, function(err){
})
But i want to record only audio of the chat session. In chrome i am able to record by using RecordRTC, But in Firefox i am getting video+audio file (webM).
How do I extract audio in Firefox from audio+video stream?
you have one of two ways to do it, when you make new recording, you do new RecordRTC(stream, config):
currently the stream you are passing must be videostream, you can change it to audiostream as stream.getAudioTracks()[0], I have not tried this, but guessing that it should work.
or as part of config, add an attribute recorderType: window.StereoRecorder, now it would use StereoRecorder and not firefox's own MediaStreamRecorder.
p.s: have you tried recording remote stream in chrome, because chrome supports recording only stereo mode and webrtc provides audio in mono mode.

Convert mp3 to ogg via Paperclip (S3) on Heroku

I have a media attribute (from paperclip) that can be audio or image. I use an HTML5 audio player (jplayer) for an audio player on the front-end which works well in Chrome and Safari but Firefox has trouble with mp3 and needs a ogg format file. I see usage of ffmpeg but am unsure how to implement to also work on Heroku. I have tried using paperclip-ffmpeg like below but it hasn't been re-formatting the file (have tried format as 'ogv' and 'ogg'):
has_attached_file :media, styles: { ogg: { format: 'ogv' } }, processors: [:ffmpeg]
Any ideas?

How to get video thumbnail of a video file in windows phone 8?

I want to get thumbnail of a video file which uri or path is given. I have searched for api in windows phone developer site bt with no success. If anybody have does this please help me.
There is a method GetThumbnailAsync in class StorageFile which intended to retrieve thumbnail of image and video files. So despite the fact that MSDN states that this method throws exception and not supported for Windows Phone 8, actually this method works when invoked with parameter ThumbnailMode = ListView. But I seems that using this method requires ID_CAP_MEDIALIB_PHOTO_FULL.
var files = await KnownFolders.CameraRoll.GetFilesAsync(); // Throw UnauthorizedAccessException without ID_CAP_MEDIALIB_PHOTO_FULL
var storageFile = files.First();
var thumbnail = await storageFile.GetThumbnailAsync(ThumbnailMode.ListView);
Video Thumbnail code in c# windows phone
First we use capturesource.completed then after we create the thumbnail and use that thumbnail
and we use capturesource.Imageasync()
And this is the only way to generate the thumbnail image from video file.

How to reuse BackgroundAudioPlayer after Close method called

I’m using MediaElement for playing videos and BackgroundAudioPlayer for playing audio.
Here is a case.
I’m playing remote audio via BackgroundAudioPlayer.
Then I want to play video and before MediaElement begins playing video I’m calling BackgroundAudioPlayer.Close as suggested in BackgroundAudioPlayer best practices.
MediaElement and the BackgroundAudioPlayer
Care must be taken when mixing BackgroundAudioPlayer and MediaElement for audio playback.
1. Close() must be called before switching to MediaElement playback.
2. There is only one media queue. Your application cannot pause background audio, play something with MediaElement then resume the background audio stream.
But after video is playing I want to play audio again.
// Play audio result
BackgroundAudioPlayer.Instance.Track = new AudioTrack(new Uri(audioSearchResult.Url, UriKind.Absolute), audioSearchResult.Title, null, null, null,
AudioPlayer.TrackStateBuffering, EnabledPlayerControls.All);
BackgroundAudioPlayer.Instance.Play();
I’m getting InvalidOperationException on first line of code saying “The background audio resources are no longer available”.
So how can I reuse BackgroundAudioPlayer in my app after using MediaElement?
EDIT:
If use MediaPlayerLauncher instead of MediaElement it works second time audio being played cause app is being tombstoned when MediaPlayerLauncher launches. But is it possible to mix MediaElement and BackgroundAudioPlayer in one app!?!?!
Seems to be another nightmare from MS:(
It looks like for you to be able to continue using the background audio player after you used the MediaElement to play video you need to call BackgroundAudioPlayer.Instance.Close() again after the video end and before using any other BackgroundAudioPlayer methods.
Your example should look like that:
// Play audio result
BackgroundAudioPlayer.Instance.Close();
BackgroundAudioPlayer.Instance.Track = new AudioTrack(new Uri(audioSearchResult.Url, UriKind.Absolute), audioSearchResult.Title, null, null, null, AudioPlayer.TrackStateBuffering, EnabledPlayerControls.All);
BackgroundAudioPlayer.Instance.Play();
You must call BackgroundAudioPlayer.Instance.Close() BEFORE you start playing the media element. I've tried this in both WP7.1 and WP8 emulators with a simple Background Audio agent (not streaming). Without this call I consistently see InvalidOperationExceptions. With it things behave much better.
For instance:
private void ButtonPlayMediaElement(object sender, RoutedEventArgs e)
{
BackgroundAudioPlayer.Instance.Close();
mediaElement.Source = new Uri("http://wpdevpodcast.episodes.s3.amazonaws.com/Episode_093_Were_All_Stickmen.mp3", UriKind.Absolute);
mediaElement.Play();
}
Also:
You are adding a track from your UI, you should really do this in your GetNextTrack in the background audio agent.
If you want to use both audio and video media content in your application do not mix MediaElement with BackgroundAudioPlayer!
Use MediaLauncher with BackgroundAudioPlayer and of course do not forget to call BackgroundAudioPlayer.Instance.Close() before MediaLauncher.Show()

Is a .mp4 video file recorded in the WP Emulator ready for outside storage?

MS have released some code examples where a video is recorded in the WP Emulator and then saved in isolated storage. Is this .mp4 file ready to export away from the WP Emulator and play in other applications? Or is it needed to format it in some way or the other? If so, how to do it?
http://channel9.msdn.com/Shows/Inside+Windows+Phone/Inside-Windows-Phone-16-Mango-Camera-APIs
Source code for video recording is located in the WP project is called CameraUpload:
https://skydrive.live.com/?cid=bc58fec5c97e307a&sc=documents&id=BC58FEC5C97E307A%21295
http://msdn.microsoft.com/en-us/library/hh394041(v=vs.92).aspx
Edit:
I am trying to upload a video recorded in the WP Emulator to Azure blob.
A file does get uploaded, but I am not able to play that file in Zune.
I would like to be able to play the video file recorded in the WP Emulator on Zune, what to do to enable this?
The method in the Azure WCF service role, which saves the video looks like this:
(Please forgive if the method parameters have slightly misdirecting and confusing names.)
bool SaveImage(int salesItemId, string contentType, byte[] photo);
The video is saved to a blob container named "firstmay".
The code in the phone client saving the video looks like this:
client.SaveImageAsync(77, "mp4", GetPhotoBytes(m_capturedFileName));
public byte[] GetPhotoBytes(string fileName)
{
using (var appStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
IsolatedStorageFileStream isoStream = appStorage.OpenFile(m_capturedFileName, FileMode.Open);
byte[] buffer = new byte[isoStream.Length];
isoStream.Read(buffer, 0, (int)isoStream.Length); isoStream.Close();
return buffer;
}
}
When uploading a video from the WP client application, one first records a video and then uploads it by clicing "Save", it all goes on in the MainPage.
The client and server application can be downloaded from skydrive:
https://skydrive.live.com/redir?resid=159250F5CE7FE134!118
That'll all depend on what you want to be able to play back the content on. PCs with Zune would be fine, and I'd expect other video capable mobiles to be fine, but older mobiles, or standard Vista installs would require additional software, or transcoding of the video to be playable.

Resources