I am using CrossMediaManager to Mp3 files from device library. I am looking to allow users to perform next, previous, and play operations from playback / media controls. In content page everything works as expected. What I am looking is when my app is not in foreground and user presses play/previous/next button from media buttons / transport control. Is there any options/events to listen to those events perform desired next/previous/play operation?
Asked
Active
Viewed 167 times
0
-
First of all, if plugin is play or stop in the background, You can use the `CrossMediaManager.Current.StateChanged += Current_StateChanged;` event to monitor it, Then I do not know reason about minitor next/previous operation, if you just want to check the current MediaItem or next/previous MediaItem, you can use `CrossMediaManager.Current.MediaItemChanged += Current_MediaItemChanged;` event to get the current MediaItem info, if you put the items in the List, you can judge the next item or previous item by current mediaItem. – Leon May 27 '20 at 02:54
-
Thanks, The user will play one file only so I am loading a file for playing. The user has setting to repeat the same mp3 file, so i want to perform repeat operation when media is finished. Similarity, if the user decides to perform next operation from playback buttons - I am loading another mp3 file and perform desired operation. This was possible in UWP, but don't know about Xamarin. (If I could get access to playback button, I can perform desired operation based on those buttons). – ARH May 27 '20 at 06:48
-
If you want to repeat this media, you can use `CrossMediaManager.Current.RepeatMode = MediaManager.Playback.RepeatMode.One;` to set it. If users want to repeat next media, just click the next button. – Leon May 28 '20 at 06:01