MediaPlayerController

The AgoraVideoView controller used to render the video for the media player.

abstract class MediaPlayerController
    implements MediaPlayer, VideoViewControllerBase {

  factory MediaPlayerController(
          {required RtcEngine rtcEngine,
          required VideoCanvas canvas,
          RtcConnection? connection,
          bool useFlutterTexture = false,
          bool useAndroidSurfaceView = false}) =>
      MediaPlayerControllerImpl(
        rtcEngine,
        canvas,
        connection,
        useFlutterTexture,
        useAndroidSurfaceView,
      );

  Future<void> initialize();
}

Attributes

rtcEngine
RtcEngine.
canvas
Local video display properties. See VideoCanvas.
useFlutterTexture
Whether to use FlutterTexture to render video:
  • true: Use FlutterTexture to render video.
  • false: Do not use FlutterTexture to render video.
Note: FlutterTexture applies to iOS, macOS and Windows platforms.
useAndroidSurfaceView
Whether to use Android SurfaceView to render video:
  • true: Use Android SurfaceView to render video.
  • false: Do not use Android SurfaceView to render video.
Note: Android SurfaceView applies to Android platform only.

initialize

Creates a MediaPlayerController.

Future<void> initialize();

Details

Note:
  • Make sure the RtcEngine is initialized before you call this method.
  • Make sure to call this method before calling other APIs in MediaPlayer.