Skip to content

Commit a8aaeb6

Browse files
committed
Merge branch 'minor_interface' into minor
2 parents 36c65cc + 54fbaad commit a8aaeb6

File tree

7 files changed

+48
-12
lines changed

7 files changed

+48
-12
lines changed

audio_service/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.18.16
2+
3+
* Support MPNowPlayingInfoPropertyIsLiveStream on IOS (@MuradSh, @celsoft).
4+
15
## 0.18.15
26

37
* Add deep link support for FlutterFragmentActivity (@jan-milovanovic).

audio_service/darwin/Classes/AudioServicePlugin.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ - (void) updateNowPlayingInfo {
291291
if (@available(iOS 13.0, macOS 10.12.2, *)) {
292292
center.playbackState = playing ? MPNowPlayingPlaybackStatePlaying : MPNowPlayingPlaybackStatePaused;
293293
}
294+
if (@available(iOS 10.0, macOS 10.12.2, *)) {
295+
updated |= [self updateNowPlayingField:MPNowPlayingInfoPropertyIsLiveStream value:mediaItem[@"isLive"]];
296+
}
294297
if (updated) {
295298
//NSLog(@"### updating nowPlayingInfo");
296299
center.nowPlayingInfo = nowPlayingInfo;
@@ -308,7 +311,6 @@ - (void) updateNowPlayingInfo {
308311
// * MPNowPlayingInfoPropertyCurrentPlaybackDate
309312
// * MPNowPlayingInfoPropertyExternalContentIdentifier
310313
// * MPNowPlayingInfoPropertyExternalUserProfileIdentifier
311-
// * MPNowPlayingInfoPropertyIsLiveStream
312314
// * MPNowPlayingInfoPropertyPlaybackProgress
313315
// * MPNowPlayingInfoPropertyPlaybackQueueCount
314316
// * MPNowPlayingInfoPropertyPlaybackQueueIndex

audio_service/lib/audio_service.dart

+9
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,9 @@ class MediaItem {
627627
/// The rating of the media item.
628628
final Rating? rating;
629629

630+
/// Whether this is a live stream.
631+
final bool? isLive;
632+
630633
/// A map of additional metadata for the media item.
631634
///
632635
/// The values must be of type `int`, `String`, `bool` or `double`.
@@ -649,6 +652,7 @@ class MediaItem {
649652
this.displaySubtitle,
650653
this.displayDescription,
651654
this.rating,
655+
this.isLive,
652656
this.extras,
653657
});
654658

@@ -676,6 +680,7 @@ class MediaItem {
676680
displaySubtitle: displaySubtitle,
677681
displayDescription: displayDescription,
678682
rating: rating?._toMessage(),
683+
isLive: isLive,
679684
extras: extras,
680685
);
681686

@@ -699,6 +704,7 @@ abstract class MediaItemCopyWith {
699704
String? displaySubtitle,
700705
String? displayDescription,
701706
Rating? rating,
707+
bool? isLive,
702708
Map<String, dynamic>? extras,
703709
});
704710
}
@@ -727,6 +733,7 @@ class _MediaItemCopyWith extends MediaItemCopyWith {
727733
Object? displaySubtitle = _fakeNull,
728734
Object? displayDescription = _fakeNull,
729735
Object? rating = _fakeNull,
736+
Object? isLive = _fakeNull,
730737
Object? extras = _fakeNull,
731738
}) =>
732739
MediaItem(
@@ -749,6 +756,7 @@ class _MediaItemCopyWith extends MediaItemCopyWith {
749756
? value.displayDescription
750757
: displayDescription as String?,
751758
rating: rating == _fakeNull ? value.rating : rating as Rating?,
759+
isLive: isLive == _fakeNull ? value.isLive : isLive as bool?,
752760
extras: extras == _fakeNull
753761
? value.extras
754762
: extras as Map<String, dynamic>?,
@@ -3599,6 +3607,7 @@ extension _MediaItemMessageExtension on MediaItemMessage {
35993607
displaySubtitle: displaySubtitle,
36003608
displayDescription: displayDescription,
36013609
rating: rating?.toPlugin(),
3610+
isLive: isLive,
36023611
extras: extras,
36033612
);
36043613
}

audio_service/pubspec.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: audio_service
22
description: Flutter plugin to play audio in the background while the screen is off.
3-
version: 0.18.15
3+
version: 0.18.16
44
repository: https://github.com/ryanheise/audio_service/tree/minor/audio_service
55
issue_tracker: https://github.com/ryanheise/audio_service/issues
66
topics:
@@ -13,10 +13,10 @@ environment:
1313

1414
dependencies:
1515
# Use these deps for local development
16-
#audio_service_platform_interface:
17-
# path: ../audio_service_platform_interface
18-
#audio_service_web:
19-
# path: ../audio_service_web
16+
# audio_service_platform_interface:
17+
# path: ../audio_service_platform_interface
18+
# audio_service_web:
19+
# path: ../audio_service_web
2020

2121
# Use these deps when pushing to origin (for the benefit of testers)
2222
# audio_service_platform_interface:
@@ -31,7 +31,7 @@ dependencies:
3131
# path: audio_service_web
3232

3333
# Use these deps when publishing.
34-
audio_service_platform_interface: ^0.1.1
34+
audio_service_platform_interface: ^0.1.2
3535
audio_service_web: ^0.1.3
3636

3737
audio_session: ^0.1.20

audio_service_platform_interface/CHANGELOG.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
## 0.1.2
2+
3+
* Support MPNowPlayingInfoPropertyIsLiveStream on IOS (@MuradSh, @celsoft).
4+
15
## 0.1.1
26

3-
* Add customAction to MediaControlMessage (@defsub)
7+
* Add customAction to MediaControlMessage (@defsub).
48

59
## 0.1.0
610

7-
* Remove unused androidEnableQueue option
8-
* Add setSpeed to MediaActionMessage enum (@nt4f04uNd)
11+
* Remove unused androidEnableQueue option.
12+
* Add setSpeed to MediaActionMessage enum (@nt4f04uNd).
913

1014
## 0.0.1
1115

audio_service_platform_interface/lib/audio_service_platform_interface.dart

+18-1
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,9 @@ class MediaItemMessage {
620620
/// The rating of the MediaItemMessage.
621621
final RatingMessage? rating;
622622

623+
// Whether this is a livestream
624+
final bool? isLive;
625+
623626
/// A map of additional metadata for the media item.
624627
///
625628
/// The values must be integers or strings.
@@ -642,6 +645,7 @@ class MediaItemMessage {
642645
this.displaySubtitle,
643646
this.displayDescription,
644647
this.rating,
648+
this.isLive,
645649
this.extras,
646650
});
647651

@@ -667,6 +671,7 @@ class MediaItemMessage {
667671
? RatingMessage.fromMap(
668672
_castMap(raw['rating'] as Map<dynamic, dynamic>)!)
669673
: null,
674+
isLive: raw['isLive'] as bool?,
670675
extras: _castMap(raw['extras'] as Map<dynamic, dynamic>?),
671676
);
672677

@@ -685,6 +690,7 @@ class MediaItemMessage {
685690
'displaySubtitle': displaySubtitle,
686691
'displayDescription': displayDescription,
687692
'rating': rating?.toMap(),
693+
'isLive': isLive,
688694
'extras': extras,
689695
};
690696
}
@@ -1415,7 +1421,7 @@ class AudioServiceConfigMessage {
14151421
'androidNotificationChannelName': androidNotificationChannelName,
14161422
'androidNotificationChannelDescription':
14171423
androidNotificationChannelDescription,
1418-
'notificationColor': notificationColor?.value,
1424+
'notificationColor': notificationColor?._colorValue,
14191425
'androidNotificationIcon': androidNotificationIcon,
14201426
'androidShowNotificationBadge': androidShowNotificationBadge,
14211427
'androidNotificationClickStartsActivity':
@@ -1438,3 +1444,14 @@ class AudioServiceConfigMessage {
14381444
@pragma('vm:prefer-inline')
14391445
Map<String, dynamic>? _castMap(Map<dynamic, dynamic>? map) =>
14401446
map?.cast<String, dynamic>();
1447+
1448+
/// Reimplements deprecated Color.value.
1449+
extension _ColorExtension on Color {
1450+
int get _colorValue =>
1451+
_floatToInt8(a) << 24 |
1452+
_floatToInt8(r) << 16 |
1453+
_floatToInt8(g) << 8 |
1454+
_floatToInt8(b) << 0;
1455+
1456+
int _floatToInt8(double x) => (x * 255.0).round() & 0xff;
1457+
}

audio_service_platform_interface/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A common platform interface for the audio_service plugin. Different
33
homepage: https://github.com/ryanheise/audio_service/tree/master/audio_service_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 0.1.1
6+
version: 0.1.2
77

88
dependencies:
99
flutter:

0 commit comments

Comments
 (0)