Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
martijn00 committed Mar 5, 2020
1 parent be0cec9 commit c8e86e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion MediaManager/Platforms/Android/Player/AndroidMediaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ protected virtual void Initialize()
.Build();

Player.SetAudioAttributes(audioAttributes, true);
Player.SetHandleAudioBecomingNoisy(true);
Player.SetHandleWakeLock(true);

PlayerEventListener = new PlayerEventListener()
{
Expand Down Expand Up @@ -280,6 +282,7 @@ public virtual void ConnectMediaSession()

PlaybackPreparer = new MediaSessionConnectorPlaybackPreparer(Player, MediaSource);
MediaSessionConnector.SetPlayer(Player);
MediaSessionConnector.SetPlaybackPreparer(PlaybackPreparer);
}

public override async Task Play(IMediaItem mediaItem)
Expand Down Expand Up @@ -338,7 +341,7 @@ public override Task SeekTo(TimeSpan position)

public override Task Stop()
{
Player.Stop();
Player.Stop(true);
return Task.CompletedTask;
}

Expand Down
10 changes: 9 additions & 1 deletion MediaManager/Platforms/Android/Player/PlaybackPreparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ protected MediaSessionConnectorPlaybackPreparer(IntPtr handle, JniHandleOwnershi
{
}

public long SupportedPrepareActions => MediaSessionConnector.IPlaybackPreparer.Actions;
//public long SupportedPrepareActions => MediaSessionConnector.IPlaybackPreparer.Actions;
public long SupportedPrepareActions =>
PlaybackStateCompat.ActionPrepare |
PlaybackStateCompat.ActionPrepareFromMediaId |
PlaybackStateCompat.ActionPrepareFromSearch |
PlaybackStateCompat.ActionPrepareFromUri |
PlaybackStateCompat.ActionPlayFromMediaId |
PlaybackStateCompat.ActionPlayFromSearch |
PlaybackStateCompat.ActionPlayFromUri;

public bool OnCommand(IPlayer p0, IControlDispatcher p1, string p2, Bundle p3, ResultReceiver p4)
{
Expand Down

0 comments on commit c8e86e3

Please sign in to comment.