XamarinMediaManager icon indicating copy to clipboard operation
XamarinMediaManager copied to clipboard

IOS, previous next controls

Open virk0009 opened this issue 4 years ago • 16 comments

Hi Martijn this is wonderful work you guys have done. Here is the same problem, I am facing. When the iphne is locked, I cant see the next previous controls. I am attaching two pics, one from one app i am building using mediamanager and second is some idownload app. You can clearly see it doesnt display the next prvious controls, and also few other controls like playlist. This is how I have set the queue.

        List<Video> list = new List<Video>();
        list.Add(new Video
        {
            DisplayName = "ElephantsDream",
            VideoSource = "https://archive.org/download/ElephantsDream/ed_hd_512kb.mp4"
        });
        list.Add(new Video
        {
            DisplayName = "BigBuckBunny",
            VideoSource = "https://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4"
        });
        list.Add(new Video
        {
            DisplayName = "Sintel",
            VideoSource = "https://archive.org/download/Sintel/sintel-2048-stereo_512kb.mp4"
        });
        list.Add(new Video
        {
            DisplayName = "Sintel2",
            VideoSource = "https://archive.org/download/Sintel/sintel-2048-stereo_512kb.mp4"
        });

        list.Add(new Video
        {
            DisplayName = "Mp3",
            VideoSource = "https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3"
        });

       await  CrossMediaManager.Current.Play(list.Select(a => a.VideoSource).ToList());

Thanks without-control with controls

virk0009 avatar Aug 23 '20 09:08 virk0009

https://github.com/Baseflow/XamarinMediaManager/issues/735

martijn00 avatar Aug 23 '20 10:08 martijn00

I think it might not get set automatically at the moment: https://github.com/Baseflow/XamarinMediaManager/blob/develop/MediaManager/Platforms/Apple/Notifications/NotificationManager.cs#L66

Please make a PR to fix that.

martijn00 avatar Aug 23 '20 10:08 martijn00

Thanks Martinjn but honestly speaking, I have no idea how to fix it, or what to do make it work manually.

Thanks

virk0009 avatar Aug 23 '20 11:08 virk0009

Call ShowNavigationControls = true to make it work manually i guess. The fix would be to set the property first time as well.

martijn00 avatar Aug 23 '20 16:08 martijn00

Thanks I am trying, but dont i need to implement MPRemoteCommandCenter CommandCenter = MPRemoteCommandCenter.Shared; defining all these commands. Otherwise how would it know what to do.

Thanks

virk0009 avatar Aug 23 '20 22:08 virk0009

Mate It doesnt work, with everything changed, it still doent show the next previous controls.

Thanks

virk0009 avatar Aug 25 '20 12:08 virk0009

First screenshot is from lockscreen notification. Second screenshot is from inside some app? You can't expect that the controls on a lock screen notification matches the controls inside an app. When that's said, the lock screen does support more actions than what is used by MediaManager. MediaManager doesn't support those actions, so you'd have to implement it yourself (possibly in MediaManager and make a PR).

Inrego avatar Sep 09 '20 20:09 Inrego

Rene Even the locked screen doesn’t give you next previous buttons. That screenshot was given just to give the idea.

Thanks

On Thu, 10 Sep 2020 at 6:35 am, René Simonsen [email protected] wrote:

First screenshot is from lockscreen notification. Second screenshot is from inside some app? You can't expect that the controls on a lock screen notification matches the controls inside an app. When that's said, the lock screen does support more actions than what is used by MediaManager. MediaManager doesn't support those actions, so you'd have to implement it yourself (possibly in MediaManager and make a PR).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Baseflow/XamarinMediaManager/issues/751#issuecomment-689806933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA3FKJCZJORTGG553LAETLSE7RH5ANCNFSM4QISJBAA .

-- Regards Paraminder Singh 0405054000

virk0009 avatar Sep 09 '20 22:09 virk0009

@virk0009 I have achieved this by subclassing the NotificationManager class on my Xamarin iOS project, and overriding the ShowNavigationControls. I wanted to show the next and previous buttons in the control center. Inside the setter, I call base.ShowNavigationControls, but also set the properties of the buttons that I don't want to show, to false. That worked for me.

janwiebe-jump avatar Mar 12 '21 14:03 janwiebe-jump

Hi Janwiebe I also managed to make it work. Setting the properties to false works.

Thanks

virk0009 avatar Apr 12 '21 14:04 virk0009

@janwiebe-jump @virk0009 can you guys give me some example code to control the NotificationManager on ios xamarin to show the next and prev buttons on notifications? Thanks.

thanoue avatar Jul 30 '21 08:07 thanoue

@thanoue This is my Custon NotificationManager

class NotificationManager : MediaManager.Platforms.Apple.Notifications.NotificationManager
{
	public override bool ShowNavigationControls
	{
		get => base.ShowNavigationControls;
		set
		{
			base.ShowNavigationControls = value;
			// The base class attaches the commands.

			// Just override the settings here (the seeks, and skips, so the next en prev are shown)
			CommandCenter.SeekBackwardCommand.Enabled = false;
			CommandCenter.SeekForwardCommand.Enabled = false;
			CommandCenter.SkipBackwardCommand.Enabled = false;
			CommandCenter.SkipForwardCommand.Enabled = false;
			// Enable shuffle and repeat.
			CommandCenter.ChangeRepeatModeCommand.Enabled = true;
			CommandCenter.ChangeShuffleModeCommand.Enabled = true;
		}
	}
}

And set it like this in your AppDelegate:

CrossMediaManager.Apple.Notification = new NotificationManager();

janwiebe-jump avatar Jul 30 '21 09:07 janwiebe-jump

@thanoue This is my Custon NotificationManager

class NotificationManager : MediaManager.Platforms.Apple.Notifications.NotificationManager
{
	public override bool ShowNavigationControls
	{
		get => base.ShowNavigationControls;
		set
		{
			base.ShowNavigationControls = value;
			// The base class attaches the commands.

			// Just override the settings here (the seeks, and skips, so the next en prev are shown)
			CommandCenter.SeekBackwardCommand.Enabled = false;
			CommandCenter.SeekForwardCommand.Enabled = false;
			CommandCenter.SkipBackwardCommand.Enabled = false;
			CommandCenter.SkipForwardCommand.Enabled = false;
			// Enable shuffle and repeat.
			CommandCenter.ChangeRepeatModeCommand.Enabled = true;
			CommandCenter.ChangeShuffleModeCommand.Enabled = true;
		}
	}
}

And set it like this in your AppDelegate:

CrossMediaManager.Apple.Notification = new NotificationManager();

you mean that there are limit button can be shown on the notification bar right?

thanoue avatar Jul 30 '21 13:07 thanoue

According to my findings, yes.

janwiebe-jump avatar Jul 30 '21 13:07 janwiebe-jump

So stupid right LOL? btw, I tried with your code and it works, finally. Thanks so much.

thanoue avatar Jul 31 '21 01:07 thanoue

@janwiebe-jump Could you please send me a sample app to customization of notification bar using the media manager plugin?

Thanks in advance.

chinni-nag avatar May 24 '23 10:05 chinni-nag