public void Shared() { #if !MONOMAC if (!UIDevice.CurrentDevice.CheckSystemVersion(7, 1)) { Assert.Inconclusive("Requires 7.1+"); } #endif MPRemoteCommandCenter shared = MPRemoteCommandCenter.Shared; Assert.NotNull(shared.BookmarkCommand, "BookmarkCommand"); Assert.NotNull(shared.ChangePlaybackRateCommand, "ChangePlaybackRateCommand"); Assert.NotNull(shared.ChangeRepeatModeCommand, "ChangeRepeatModeCommand"); Assert.NotNull(shared.ChangeShuffleModeCommand, "ChangeShuffleModeCommand"); Assert.NotNull(shared.DislikeCommand, "DislikeCommand"); Assert.NotNull(shared.LikeCommand, "LikeCommand"); Assert.NotNull(shared.NextTrackCommand, "NextTrackCommand"); Assert.NotNull(shared.PauseCommand, "PauseCommand"); Assert.NotNull(shared.PlayCommand, "PlayCommand"); Assert.NotNull(shared.PreviousTrackCommand, "PreviousTrackCommand"); Assert.NotNull(shared.SeekBackwardCommand, "SeekBackwardCommand"); Assert.NotNull(shared.SeekForwardCommand, "SeekForwardCommand"); Assert.NotNull(shared.SkipBackwardCommand, "SkipBackwardCommand"); Assert.NotNull(shared.SkipForwardCommand, "SkipForwardCommand"); Assert.NotNull(shared.StopCommand, "StopCommand"); Assert.NotNull(shared.TogglePlayPauseCommand, "TogglePlayPauseCommand"); }
public override void ViewDidLoad() { base.ViewDidLoad(); var audioSession = AVAudioSession.SharedInstance(); audioSession.SetCategory(AVAudioSessionCategory.Playback); audioSession.OutputChannelsChanged += (sender, e) => Console.WriteLine("Output channels changed"); audioSession.SetActive(true); // This is not working... MPRemoteCommandCenter rcc = MPRemoteCommandCenter.Shared; rcc.SeekBackwardCommand.Enabled = false; rcc.SeekForwardCommand.Enabled = false; rcc.NextTrackCommand.Enabled = false; rcc.PreviousTrackCommand.Enabled = false; rcc.SkipBackwardCommand.Enabled = false; rcc.SkipForwardCommand.Enabled = false; // You must enable a command so that others can be disabled? // See http://stackoverflow.com/a/28925369. rcc.PlayCommand.Enabled = true; MPNowPlayingInfo nowPlayingInfo = new MPNowPlayingInfo(); nowPlayingInfo.AlbumTitle = "Vermont"; nowPlayingInfo.Artist = "Colchester"; nowPlayingInfo.Title = "VPR"; MPNowPlayingInfoCenter.DefaultCenter.NowPlaying = nowPlayingInfo; AVPlayer player = new AVPlayer(audioUrl); player.Play(); }
public Player() { s_Instance = this; m_CommandCenter = MPRemoteCommandCenter.Shared; m_CommandCenter.PauseCommand.Enabled = true; m_CommandCenter.PauseCommand.AddTarget(_Pause); m_CommandCenter.PlayCommand.Enabled = true; m_CommandCenter.PlayCommand.AddTarget(_Play); }
public void Shared_9() { TestRuntime.AssertSystemVersion(PlatformName.iOS, 9, 0, throwIfOtherPlatform: false); TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 12, 2, throwIfOtherPlatform: false); MPRemoteCommandCenter shared = MPRemoteCommandCenter.Shared; Assert.NotNull(shared.EnableLanguageOptionCommand, "EnableLanguageOptionCommand"); }
public void Shared_8() { TestRuntime.AssertSystemVersion(PlatformName.iOS, 8, 0, throwIfOtherPlatform: false); TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 12, 2, throwIfOtherPlatform: false); MPRemoteCommandCenter shared = MPRemoteCommandCenter.Shared; Assert.NotNull(shared.ChangeRepeatModeCommand, "ChangeRepeatModeCommand"); Assert.NotNull(shared.ChangeShuffleModeCommand, "ChangeShuffleModeCommand"); }
public void Shared() { TestRuntime.AssertSystemVersion(PlatformName.iOS, 7, 1, throwIfOtherPlatform: false); TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 12, 2, throwIfOtherPlatform: false); MPRemoteCommandCenter shared = MPRemoteCommandCenter.Shared; Assert.NotNull(shared.BookmarkCommand, "BookmarkCommand"); Assert.NotNull(shared.ChangePlaybackRateCommand, "ChangePlaybackRateCommand"); Assert.NotNull(shared.DislikeCommand, "DislikeCommand"); Assert.NotNull(shared.LikeCommand, "LikeCommand"); Assert.NotNull(shared.NextTrackCommand, "NextTrackCommand"); Assert.NotNull(shared.PauseCommand, "PauseCommand"); Assert.NotNull(shared.PlayCommand, "PlayCommand"); Assert.NotNull(shared.PreviousTrackCommand, "PreviousTrackCommand"); Assert.NotNull(shared.SeekBackwardCommand, "SeekBackwardCommand"); Assert.NotNull(shared.SeekForwardCommand, "SeekForwardCommand"); Assert.NotNull(shared.SkipBackwardCommand, "SkipBackwardCommand"); Assert.NotNull(shared.SkipForwardCommand, "SkipForwardCommand"); Assert.NotNull(shared.StopCommand, "StopCommand"); Assert.NotNull(shared.TogglePlayPauseCommand, "TogglePlayPauseCommand"); }
public void Intialize() { if (isInitialized) { throw new Exception("Bluetooth Manager has already been initialized, aborting re-initializations"); } audioPlayer = AppleAudioPlayer.SharedInstance; AVAudioSession.Notifications.ObserveInterruption(AudioInterruption); MPRemoteCommandCenter commandCenter = MPRemoteCommandCenter.Shared; commandCenter.ChangePlaybackPositionCommand.Enabled = true; commandCenter.ChangePlaybackPositionCommand.AddTarget(ChangePlaybackPositionCommandHandler); commandCenter.SeekForwardCommand.Enabled = true; commandCenter.SeekForwardCommand.AddTarget(FastForwardCommandHandler); commandCenter.SkipForwardCommand.Enabled = true; commandCenter.SkipForwardCommand.AddTarget(FastForwardCommandHandler); commandCenter.SkipBackwardCommand.Enabled = true; commandCenter.SkipBackwardCommand.AddTarget(RewindCommandHandler); commandCenter.SeekBackwardCommand.Enabled = true; commandCenter.SeekBackwardCommand.AddTarget(RewindCommandHandler); commandCenter.PauseCommand.Enabled = true; commandCenter.PauseCommand.AddTarget(PauseCommandHandler); commandCenter.PlayCommand.Enabled = true; commandCenter.PlayCommand.AddTarget(PlayCommandHandler); isInitialized = true; }