youtube_web_player 0.1.6
youtube_web_player: ^0.1.6 copied to clipboard
A Flutter package for seamless integration of YouTube videos in a native WebView, providing a smooth playback experience. Ideal for multimedia applications.
youtube_web_player #
A Flutter package for seamless integration of YouTube videos in a native WebView, providing a smooth playback experience. Ideal for multimedia applications.
Getting Started #
To use this package, add it to your pubspec.yaml
:
dependencies:
youtube_web_player: ^0.1.6
or run the command
flutter pub add youtube_web_player
Using the player #
import
import 'package:youtube_web_player/youtube_web_player.dart';
Full screen disable mode
YoutubeWebPlayer(videoId: 'NsJLhRGPv-M')
Full screen mode
YoutubeWebPlayer(
videoId: 'NsJLhRGPv-M',
isIframeAllowFullscreen: true,
isAllowsInlineMediaPlayback: false,
)
Controller
YoutubeWebPlayerController? _controller = YoutubeWebPlayerController.getController("NsJLhRGPv-M");
Duration movieDuration = _controller?.value.duration;
Duration position = _controller?.value.duration;
YoutubeWebPlayer(
videoId: 'NsJLhRGPv-M',
controller: _controller
),
TextButton(
onPressed: () {
_controller?.play?.call();
//_controller?.pause?.call();
},
child: Text("Play"),
),
TextButton(
onPressed: () {
_controller!.seekTo!(position + Duration(seconds: 5))?.call();
},
child: Text(">>>"),
),
TextButton(
onPressed: () {
_controller!.seekTo!(position - Duration(seconds: 5))?.call();
},
child: Text("<<<"),
),
Examples #
![]() |
![]() |
![]() |
![]() |