So my app uses MPVolumeView to help display the AirPlay workflow on the video player. I know that it has been deprecated in favor of AVRoutePickerView. I finally got around to doing the work and while there is little to no documentation or articles on the migration, i did find this little gem: https://jeroenscode.com/avroutepickerview-replaces-mpvolumeview/.
The article denotes that you also have to use AVRouteDetector to get some of the extra functionality (device detection and what not) working. Now i got the AVRoutePickerView to work and initialize in my code. However when i try to create an AVRouteDetector, I cannot as the default constructor doesnt work (var detector = new AVRouteDetector()
, i checked the bindings and it seems the default constructor is disabled). So my question is, has any gotten AVRouteDetector to work? And in conjuction AVRoutePickerView? Since they are both required to get everything working.
Answers
AVRouteDetector is used in notification , we do not need to initialize it .
Sample code
@ColeX So i tried that and didnt work for me. According to this SO post, you need to initialize the AVRouteDetector. There is a native app i was looking at that also runs
AVRoutePickerView
and they initializeAVRouteDetector
and maintain a reference to it, to then set a flag:routeDetector.isRouteDetectionEnabled = true
.I didn't find the docs/tutorial about how to use
AVRouteDetector
.Check the image , maybe helpful .
Yea ive tried to instantiate it and i couldnt. Nor could i find any documentation or tutorials with code examples in Xamarin.iOS like you noted. I see it works regularly in Xcode (Swift or Objective-C) but not sure if the Xamarin.iOS binding of it is working.
Consider raising issue on github : https://github.com/xamarin/Xamarin.Forms/issues .
Or Opening a new support ticket : https://support.serviceshub.microsoft.com/supportforbusiness/create?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6 .
@ColeX i opened this ticket in GitHub: https://github.com/xamarin/xamarin-macios/issues/10139
Thanks for your help.