Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…just_audio into PrecisionReporters-setWebSinkId
  • Loading branch information
ryanheise committed Feb 1, 2025
2 parents 1b47c6e + 0db04ed commit 2d50f59
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions just_audio/lib/just_audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,11 @@ class AudioPlayer {
return durationCompleter.future;
}

/// Sets a specific device output id, null for default
Future<void> setWebSinkId(String? sinkId) async {
await (await _platform).setWebSinkId(sinkId);
}

/// Dispose of the given platform.
Future<void> _disposePlatform(AudioPlayerPlatform platform) async {
if (platform is _IdleAudioPlayer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ abstract class AudioPlayerPlatform {
Stream<PlayerDataMessage> get playerDataMessageStream =>
const Stream<PlayerDataMessage>.empty();

/// Sets a specific device output id, null for default
Future<void> setWebSinkId(String? sinkId) {
throw UnimplementedError("setWebSinkId() has not been implemented.");
}

/// Loads an audio source.
Future<LoadResponse> load(LoadRequest request) {
throw UnimplementedError("load() has not been implemented.");
Expand Down
5 changes: 5 additions & 0 deletions just_audio_web/lib/just_audio_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ class Html5AudioPlayer extends JustAudioPlayer {
return orderInv;
}

/// Sets a specific device output id, null for default
Future<void> setWebSinkId(String? sinkId) async {
await _audioElement.setSinkId(sinkId ?? '').toDart;
}

/// Called when playback reaches the end of an item.
Future<void> onEnded() async {
if (_loopMode == LoopModeMessage.one) {
Expand Down

0 comments on commit 2d50f59

Please sign in to comment.