Skip to content

Commit

Permalink
Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
martijn00 committed Aug 11, 2020
1 parent 1c13770 commit 004920c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions MediaManager/Library/IMediaItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,10 @@ public interface IMediaItem : IContentItem
/// Standard location is Default which will make a guess based on the URI.
/// </summary>
MediaLocation MediaLocation { get; set; }

/// <summary>
/// Indicates if the MediaItem is being live streamed
/// </summary>
bool IsLive { get; set; }
}
}
7 changes: 7 additions & 0 deletions MediaManager/Library/MediaItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,5 +328,12 @@ public bool IsMetadataExtracted
MetadataUpdated?.Invoke(this, new MetadataChangedEventArgs(this));
}
}

private bool _isLive = false;
public bool IsLive
{
get => _isLive;
set => SetProperty(ref _isLive, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ protected virtual void PrepareNotificationManager()
};
NotificationListener.OnNotificationCancelledImpl = (notificationId, dismissedByUser) =>
{
//TODO: in new exoplayer use StopForeground(false) or use dismissedByUser
StopForeground(true);
StopForeground(dismissedByUser);
//ServiceCompat.StopForeground(this, ServiceCompat.StopForegroundRemove);

StopSelf();
Expand Down
8 changes: 8 additions & 0 deletions MediaManager/Platforms/Android/Player/AndroidMediaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ protected virtual void Initialize()
{
if (isLoading)
MediaManager.Buffered = TimeSpan.FromMilliseconds(Player.BufferedPosition);
},
OnIsPlayingChangedImpl = (bool isPlaying) =>
{
//TODO: Maybe call playing changed event
},
OnPlaybackSuppressionReasonChangedImpl = (int playbackSuppressionReason) =>
{
//TODO: Maybe call event
}
};
Player.AddListener(PlayerEventListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ public override void UpdateNotification()
ElapsedPlaybackTime = MediaManager.Position.TotalSeconds,
PlaybackDuration = MediaManager.Duration.TotalSeconds,
PlaybackQueueIndex = MediaManager.Queue.CurrentIndex,
PlaybackQueueCount = MediaManager.Queue.Count
PlaybackQueueCount = MediaManager.Queue.Count,
IsLiveStream = mediaItem.IsLive
};

if (MediaManager.IsPlaying())
Expand Down

0 comments on commit 004920c

Please sign in to comment.