import 'package:flutter/foundation.dart'; import 'package:just_audio/just_audio.dart'; class MyCustomStream extends StreamAudioSource { final Uint8List bytes; MyCustomStream(this.bytes); @override Future 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', ); } }