ERM Channel Audio playback implemented
parent
c1d89ae5e7
commit
1ebcbd1079
File diff suppressed because one or more lines are too long
@ -0,0 +1,21 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
|
||||
class MyCustomStream extends StreamAudioSource {
|
||||
final Uint8List bytes;
|
||||
|
||||
MyCustomStream(this.bytes);
|
||||
|
||||
@override
|
||||
Future<StreamAudioResponse> request([int? start, int? end]) async {
|
||||
start ??= 0;
|
||||
end ??= bytes.length;
|
||||
return StreamAudioResponse(
|
||||
sourceLength: bytes.length,
|
||||
contentLength: end - start,
|
||||
offset: start,
|
||||
stream: Stream.value(bytes.sublist(start, end)),
|
||||
contentType: 'audio/aac',
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue