wp7 mediaelement stops when unplugging the headset - windows-phone-7

I am using a mediaelement and when the headset is unplugged I get a mediafailed event with NullReferenceException. Since the media element stream is not working anymore, I want to be able to distinguish this case and to handle it properly.

It is in the windows phone 7 design that when you unplug a headset or your headphones that the music player or other apps using the mediaelement should pause.
You can have a look at the CurrentStateChanged event to see if the state of the MediaElement is changed.
docs:
http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.currentstatechanged%28VS.95%29.aspx

Related

Android TV Chromecast: detect if a phone(sender) is video casting to Android TV (receiver)

I would like to detect if Android TV is being video casting (connected from phone (sender) ).
Android TV has the system app (Chromecast build-in) pre-installed. I would like to know if there is events that a phone is connected or just disconnected for video casting.
Or do I need to develop custom Chromecast receiver app just in order to catch those events?
Found this https://stackoverflow.com/a/58655387/1099884, but it is not what I needed. I would like the opposite usage. (My device is receiver while the others are sender)

Recording screen audio in UWP

I want to record game playing screen audio using UWP in windows 10, not record audio from web camera.
I tried NAudio, But it doesn’t work in UWP.
I have checked MediaCapture, I assume it can record audio or video from something like camera, not screen audio.
Although I found ScreenCapture.AudioSource property in official document, On windows 10 , This api is not supported.
Is there any way to record screen audio in UWP?

Detect whether a Bluetooth headset is connected to Apple Watch

I was recently trying to make a WatchKit App play a background sound effect from the Apple Watch’s speakers.
From what I experienced (correct me if I’m wrong!) this is not possible as I either need to connect a Bluetooth headset to use WKAudioFilePlayer or work with additional interface elements to play the sound (WKInterfaceMovie or presentMediaPlayerControllerWithURL:options:completion).
Now, instead, I would like to use WKAudioFilePlayer to have the audio played only if a Bluetooth headset is connected in order to avoid getting a „Pair a Bluetooth headset to listen to music“-alert every time no headset is available.
Is there any way to find out whether a Bluetooth Headset is connected, so I could make the audio playback conditional on that?
Still now there is no api available to check whether bluetooth headset is paired with apple watch or not

Windows Phone How to listen to volume/muisc control events

Is it possible to listen to system's volume and music control events (Next/Prev)? I am playing a song from MediaLibrary using MediaPlayer but how to capture Next\Prev button press event? Thanks!
Volume Events
It's not possible to listen for (or subscribe to) the system volume events. You cannot find out the current system volume or know when the volume keys on the phone are pressed.
If your app is playing music using a MediaElement, for example, you simply play the sounds or music blindly not knowing what the system volume is.
Developers have voted to improve this API which will hopefully happen in a future release.
Music Events
If your app is playing music using the BackgroundAudioPlayer, you can subscribe to the PlayStateChanged event. You can detect if music is playing using the MediaPlayer class. Although this is an XNA library, it works in WP7 and WP8.
If the user starts music in your app, it will stop whatever music the system is playing and take over. The opposite is also true. If your app is playing music, and the user goes to another music app, your BackgroundAudioPlayer will receive PlayState.Stopped.

WP7:LivesmoothStreaming is not working with device

We're building a LIVE Smooth Streaming WP7 App.It works perfectly on the emulator, but not on device (shows up blank).
We are also trying smf player for streaming on WP7 but every time we are getting a blank screen on player. Its only work on Emulator.
Though there is no error being thrown.
How i can apply live streaming on my windows phone not on emulator.
looking for your responce
Does your streaming source contain multi-resolution tracks?
This kind of problem may appear when testing on a WP8 Emulator and then deploying the app to a WP7 device. Specially if the WP7 device is a first-generation device, like HTC HD7.
Basically this happens because the WP8 emulator and Wp8 devices do support multi-resolution, but old devices do not support multi-resolution tracks. You can read more here: http://blog.supaywasi.com/2013/01/smooth-streaming-multi-resolution-support-for-windows-phone/
So, basically you have to handle the ManifestReady event on your WP7 app and RestrictTracks to only tracks of the same resolution.
For WP8 devices you will not need to this.

Resources