pushCustomVideo method
Future<void>
pushCustomVideo(
- Uint8List bytes,
- VideoPixelFormat videoPixelFormat,
- double width,
- double height, {
- DateTime? timestamp,
Push the video to be delivered.
The video is delivered in the format specified by videoPixelFormat
.
The video size is specified by width
and height
.
If timestamp
is not specified, the current time is used.
配信する映像をプッシュします。
映像はvideoPixelFormat
で指定した形式で配信されます。
映像のサイズはwidth
とheight
で指定します。
timestamp
が指定されない場合は現在時刻が利用されます。
Implementation
Future<void> pushCustomVideo(Uint8List bytes,
VideoPixelFormat videoPixelFormat, double width, double height,
{DateTime? timestamp}) async {
if (!enableCustomVideoSource) {
return;
}
if (!connected) {
throw Exception("Not connected.");
}
final agoraFrame = ExternalVideoFrame(
type: VideoBufferType.videoBufferRawData,
format: videoPixelFormat,
buffer: bytes,
stride: width.toInt(),
height: height.toInt(),
timestamp: timestamp?.millisecondsSinceEpoch ??
DateTime.now().millisecondsSinceEpoch,
);
await _engine!.getMediaEngine().pushVideoFrame(frame: agoraFrame);
}