flutter_youtube

Flutter Plugin to play youtube Videos using youtube player api (android)

Supported

  • Android
  • iOS

How to Use

dependencies:
  flutter_youtube: "^1.1.2"

###Imports

import 'package:flutter_youtube/flutter_youtube.dart';

###Code

var youtube = new FlutterYoutube();

youtube.playYoutubeVideoByUrl(
  apiKey: "<API_KEY>",
  videoUrl: "<Youtube Video URL>",
  autoPlay: true, //default falase
  fullScreen: true //default false
);
FlutterYoutube.playYoutubeVideoById(
  apiKey: "<API_KEY>",
  videoId: "<Youtube Video ID>",
  autoPlay: true, //default falase
  fullScreen: true //default false
);

Video End Listener

*Note Right now only supported in android

youtube.onVideoEnded.listen((onData) {
  //perform your action when video playing is done
});
KeyValue
apiKeyString (Not Null)
videoUrlString (Not Null)
videoIdString (Not Null)
autoPlayBoolean (Optional)(Default = false)
fullScreenBoolean (Optional)(Default = false)

Libraries

flutter_youtube