Skip to content

Commit

Permalink
Merge branch 'minor' of https://github.com/MuradSh/audio_service into…
Browse files Browse the repository at this point in the history
… MuradSh-minor
  • Loading branch information
ryanheise committed Dec 14, 2024
2 parents 36c65cc + 990c862 commit c35422a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 3 deletions.
4 changes: 4 additions & 0 deletions audio_service/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.18.16

* Support for MPNowPlayingInfoPropertyIsLiveStream on IOS

## 0.18.15

* Add deep link support for FlutterFragmentActivity (@jan-milovanovic).
Expand Down
4 changes: 3 additions & 1 deletion audio_service/darwin/Classes/AudioServicePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ - (void) updateNowPlayingInfo {
if (@available(iOS 13.0, macOS 10.12.2, *)) {
center.playbackState = playing ? MPNowPlayingPlaybackStatePlaying : MPNowPlayingPlaybackStatePaused;
}
if (@available(iOS 10.0, macOS 10.12.2, *)) {
updated |= [self updateNowPlayingField:MPNowPlayingInfoPropertyIsLiveStream value:mediaItem[@"isLive"]];
}
if (updated) {
//NSLog(@"### updating nowPlayingInfo");
center.nowPlayingInfo = nowPlayingInfo;
Expand All @@ -308,7 +311,6 @@ - (void) updateNowPlayingInfo {
// * MPNowPlayingInfoPropertyCurrentPlaybackDate
// * MPNowPlayingInfoPropertyExternalContentIdentifier
// * MPNowPlayingInfoPropertyExternalUserProfileIdentifier
// * MPNowPlayingInfoPropertyIsLiveStream
// * MPNowPlayingInfoPropertyPlaybackProgress
// * MPNowPlayingInfoPropertyPlaybackQueueCount
// * MPNowPlayingInfoPropertyPlaybackQueueIndex
Expand Down
9 changes: 9 additions & 0 deletions audio_service/lib/audio_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,9 @@ class MediaItem {
/// The rating of the media item.
final Rating? rating;

/// Whether this is a live stream.
final bool? isLive;

/// A map of additional metadata for the media item.
///
/// The values must be of type `int`, `String`, `bool` or `double`.
Expand All @@ -649,6 +652,7 @@ class MediaItem {
this.displaySubtitle,
this.displayDescription,
this.rating,
this.isLive,
this.extras,
});

Expand Down Expand Up @@ -676,6 +680,7 @@ class MediaItem {
displaySubtitle: displaySubtitle,
displayDescription: displayDescription,
rating: rating?._toMessage(),
isLive: isLive,
extras: extras,
);

Expand All @@ -699,6 +704,7 @@ abstract class MediaItemCopyWith {
String? displaySubtitle,
String? displayDescription,
Rating? rating,
bool? isLive,
Map<String, dynamic>? extras,
});
}
Expand Down Expand Up @@ -727,6 +733,7 @@ class _MediaItemCopyWith extends MediaItemCopyWith {
Object? displaySubtitle = _fakeNull,
Object? displayDescription = _fakeNull,
Object? rating = _fakeNull,
Object? isLive = _fakeNull,
Object? extras = _fakeNull,
}) =>
MediaItem(
Expand All @@ -749,6 +756,7 @@ class _MediaItemCopyWith extends MediaItemCopyWith {
? value.displayDescription
: displayDescription as String?,
rating: rating == _fakeNull ? value.rating : rating as Rating?,
isLive: isLive == _fakeNull ? value.isLive : isLive as bool?,
extras: extras == _fakeNull
? value.extras
: extras as Map<String, dynamic>?,
Expand Down Expand Up @@ -3599,6 +3607,7 @@ extension _MediaItemMessageExtension on MediaItemMessage {
displaySubtitle: displaySubtitle,
displayDescription: displayDescription,
rating: rating?.toPlugin(),
isLive: isLive,
extras: extras,
);
}
Expand Down
2 changes: 1 addition & 1 deletion audio_service/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: audio_service
description: Flutter plugin to play audio in the background while the screen is off.
version: 0.18.15
version: 0.18.16
repository: https://github.com/ryanheise/audio_service/tree/minor/audio_service
issue_tracker: https://github.com/ryanheise/audio_service/issues
topics:
Expand Down
4 changes: 4 additions & 0 deletions audio_service_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.2

* Support for MPNowPlayingInfoPropertyIsLiveStream on IOS

## 0.1.1

* Add customAction to MediaControlMessage (@defsub)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ class MediaItemMessage {
/// The rating of the MediaItemMessage.
final RatingMessage? rating;

// Whether this is a livestream
final bool? isLive;

/// A map of additional metadata for the media item.
///
/// The values must be integers or strings.
Expand All @@ -642,6 +645,7 @@ class MediaItemMessage {
this.displaySubtitle,
this.displayDescription,
this.rating,
this.isLive,
this.extras,
});

Expand All @@ -667,6 +671,7 @@ class MediaItemMessage {
? RatingMessage.fromMap(
_castMap(raw['rating'] as Map<dynamic, dynamic>)!)
: null,
isLive: raw['isLive'] as bool?,
extras: _castMap(raw['extras'] as Map<dynamic, dynamic>?),
);

Expand All @@ -685,6 +690,7 @@ class MediaItemMessage {
'displaySubtitle': displaySubtitle,
'displayDescription': displayDescription,
'rating': rating?.toMap(),
'isLive': isLive,
'extras': extras,
};
}
Expand Down
2 changes: 1 addition & 1 deletion audio_service_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the audio_service plugin. Different
homepage: https://github.com/ryanheise/audio_service/tree/master/audio_service_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 0.1.1
version: 0.1.2

dependencies:
flutter:
Expand Down

0 comments on commit c35422a

Please sign in to comment.