pushCustomVideo method

Future<void> pushCustomVideo(
  1. Uint8List bytes,
  2. VideoPixelFormat videoPixelFormat,
  3. double width,
  4. double height, {
  5. 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で指定した形式で配信されます。

映像のサイズはwidthheightで指定します。

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);
}