Skip to content

Commit

Permalink
Add source remote control config
Browse files Browse the repository at this point in the history
  • Loading branch information
hawk23 committed Oct 19, 2023
1 parent 3e35399 commit 5d094a0
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/bitmovin_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export 'src/api/player/player_config.dart';
export 'src/api/player/seek_mode.dart';
export 'src/api/source/source_config.dart';
export 'src/api/source/source_options.dart';
export 'src/api/source/source_remote_control_config.dart';
export 'src/api/source/source_type.dart';
export 'src/api/source/timeline_reference_point.dart';
export 'src/api/ui/fullscreen_handler.dart';
Expand Down
30 changes: 30 additions & 0 deletions lib/src/api/source/source_remote_control_config.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:bitmovin_player/bitmovin_player.dart';
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';

part 'source_remote_control_config.g.dart';

/// The remote control config for a [Source].
/// Only available on iOS.
@JsonSerializable(explicitToJson: true)
class SourceRemoteControlConfig extends Equatable {
const SourceRemoteControlConfig({
required this.castSourceConfig,
});

/// Creates a [SourceRemoteControlConfig] from json.
factory SourceRemoteControlConfig.fromJson(Map<String, dynamic> json) =>
_$SourceRemoteControlConfigFromJson(json);

/// The [SourceConfig] for casting.
/// Enables to play different content when casting.
/// This can be useful when the remote playback device supports different
/// streaming formats, DRM systems, etc. than the local device.
/// If not set, the local source config will be used for casting.
final SourceConfig? castSourceConfig;

Map<String, dynamic> toJson() => _$SourceRemoteControlConfigToJson(this);

@override
List<Object?> get props => [castSourceConfig];
}
22 changes: 22 additions & 0 deletions lib/src/api/source/source_remote_control_config.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/src/source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Source extends Equatable {
const Source({
required this.sourceConfig,
this.id,
this.remoteControl,
});

factory Source.fromJson(Map<String, dynamic> json) {
Expand All @@ -28,8 +29,12 @@ class Source extends Equatable {
@JsonKey(name: 'sourceConfig', required: true)
final SourceConfig sourceConfig;

/// The remote control config for this source.
/// Only supported on iOS.
final SourceRemoteControlConfig? remoteControl;

@override
List<Object?> get props => [id, sourceConfig];
List<Object?> get props => [id, sourceConfig, remoteControl];

/// Converts this [Source] into a JSON friendly type of Map<String, dynamic>
///
Expand Down
5 changes: 5 additions & 0 deletions lib/src/source.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d094a0

Please sign in to comment.