Trying to read raw NAL packets on network stream using appendBuffer, the stream outputs but starts 20-30 seconds late runs for ~10 seconds and then freezes at a frame
I have the pts but I don't know where to input it (If PTS is an issue here)
import 'dart:typed_data';
import 'package:fvp/mdk.dart';
class Streamer {
late final Player player;
Streamer() : player = Player() {
player.setProperty('format', 'h264');
player.setProperty('codec', 'h264');
_setupErrorLogging();
player.media = 'stream:';
player.state = PlaybackState.playing;
player.updateTexture();
}
void setSurface(int w, int h) {
log('setVideoSurfaceSize($w, $h) textureId=${player.textureId.value}');
player.setVideoSurfaceSize(w, h);
}
void pushPacket(Uint8List data, int pts) {
final success = player.appendBuffer(data, data.length);
if (!success) {
log('appendBuffer rejected packet (${data.length} bytes)');
}
}
void _setupErrorLogging() {
player.onMediaStatus.listen((event) {
log('[fvp] mediaStatus: ${event.oldValue} → ${event.newValue}');
if (event.newValue == MediaStatus.invalid) {
log('[fvp] ERROR: invalid media — wrong format or bad stream URI');
}
});
player.onEvent.listen((event) {
log('[fvp] event: ${event.category} | ${event.detail}');
});
}
void dispose() => player.dispose();
}
Trying to read raw NAL packets on network stream using appendBuffer, the stream outputs but starts 20-30 seconds late runs for ~10 seconds and then freezes at a frame
I have the pts but I don't know where to input it (If PTS is an issue here)