youtube_video_webview 1.0.2
youtube_video_webview: ^1.0.2 copied to clipboard
A customizable YouTube video player for Flutter, supporting embedded playback, fullscreen mode, sharing, captions, and seamless redirection to YouTube inside a webview.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:youtube_video_webview/youtube_video_webview.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Youtube Video Webview Example')),
body: SafeArea(
maintainBottomViewPadding: true,
child: Center(
child: YoutubeVideoWebview(
videoId: 'LoheCz4t2xc',
referrerHeader: 'https://www.google.com',
externalBrowserSettings: YoutubePageWebViewSettings(
// dragToDismiss: true
// appBar: YoutubeVideoWebviewAppBarDefault(),
appBar: YoutubeVideoWebviewAppBarShare(videoId: 'jqKtxmf8x7A', shareText: "Check out this video!"),
// appBar: YoutubeVideoWebviewAppBarCustom(appBar: AppBar(
// title: const Text('Custom App Bar'),
// backgroundColor: Colors.green,
// ),),
),
), // your widget here
),
),
),
);
}
}