VideoViewController
The controller for AgoraVideoView, used to render local and remote video.
class VideoViewController
with VideoViewControllerBaseMixin
implements VideoViewControllerBase {
VideoViewController({
required this.rtcEngine,
required this.canvas,
this.useFlutterTexture = false,
this.useAndroidSurfaceView = false,
}) : connection = const RtcConnection();
VideoViewController.remote({
required this.rtcEngine,
required this.canvas,
required this.connection,
this.useFlutterTexture = false,
this.useAndroidSurfaceView = false,
}) : assert(connection.channelId != null);
@override
final RtcEngine rtcEngine;
@override
final VideoCanvas canvas;
@override
final RtcConnection connection;
@override
final bool useFlutterTexture;
@override
final bool useAndroidSurfaceView;
@protected
@override
int getVideoSourceType() {
return canvas.uid! == 0
? VideoSourceType.videoSourceCamera.value()
: VideoSourceType.videoSourceRemote.value();
}
}
On different platforms, the default view corresponding to this class varies:
- Android: https://developer.android.com/reference/android/view/TextureView. If you want to use SurfaceView, set the
useAndroidSurfaceViewproperty to true. - iOS: UIView. If you want to use FlutterTexture, set the
useFlutterTextureproperty to true. - macOS and Windows: FlutterTexture.
Properties
- rtcEngine
- RtcEngine.
- canvas
- Local video display properties. See VideoCanvas.
- connection
- Connection information. See RtcConnection.
- useFlutterTexture
-
Note:Whether to use
FlutterTextureis only available on iOS, macOS, and Windows platforms.FlutterTextureto render video:- true: Use
FlutterTextureto render video. - false: Do not use
FlutterTextureto render video.
- true: Use
- useAndroidSurfaceView
-
Note: AndroidWhether to use Android
SurfaceViewis only available on Android platform.SurfaceViewto render video:- true: Use Android
SurfaceViewto render video. - false: Do not use Android
SurfaceViewto render video.
- true: Use Android