insertVideo method

dynamic insertVideo(
  1. String url, {
  2. int? width,
  3. int? height,
  4. bool fromDevice = true,
})

Insert video from Youtube or Device might work with dailymotion but i've not tested that

Implementation

insertVideo(String url,
    {int? width, int? height, bool fromDevice = true}) async {
  bool? local;
  local = fromDevice ? true : null;
  if (width == null) width = 300;
  if (height == null) height = 220;
  // check if link is yt link
  if (url.contains('youtu')) {
    // Get Video id from link.
    String youtubeId = url.split(r'?v=')[1];
    url = 'https://www.youtube.com/embed/$youtubeId';
  }
  await executeJavascript(
    "insertVideo('$url', '$width', '$height', $local);",
  );
}