launchOnlineMediaPlayer static method

dynamic launchOnlineMediaPlayer(
  1. String title,
  2. String url,
  3. bool isLive,
  4. String? license,
)

title of the movie url of the movie isLive is live stream true : false license of the app

Implementation

static launchOnlineMediaPlayer(
    String title, String url, bool isLive, String? license) {
  if (Platform.isAndroid) {
    try {
      final intent = AndroidIntent(
        package: 'com.mediaplay.player',
        type: MIME.applicationXMpegURL,
        action: 'action_view',
        data: Uri.parse(url).toString(),
        arguments: {
          'title': title,
          'isLive': isLive ? 1 : 0,
          'license': license,
        },
        flags: <int>[
          Flag.FLAG_ACTIVITY_NEW_TASK,
          Flag.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
        ],
      );
      intent.launch();
    } catch (e) {
      throw Exception(e);
    }
  }
}