working media player on android
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:just_audio_background/just_audio_background.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
|
||||
class StreamingAudioBusinessObject extends ChangeNotifier {
|
||||
@@ -28,7 +29,16 @@ class StreamingAudioBusinessObject extends ChangeNotifier {
|
||||
|
||||
Future<void> play() async {
|
||||
if (!_isSourceLoaded) {
|
||||
await _player.setUrl(streamUrl);
|
||||
await _player.setAudioSource(
|
||||
AudioSource.uri(
|
||||
Uri.parse(streamUrl),
|
||||
tag: const MediaItem(
|
||||
id: 'kryz-live-stream',
|
||||
title: 'KRYZ Live Stream',
|
||||
artist: 'KRYZ Radio',
|
||||
),
|
||||
),
|
||||
);
|
||||
_isSourceLoaded = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user