youtube_video_player 0.0.3 copy "youtube_video_player: ^0.0.3" to clipboard
youtube_video_player: ^0.0.3 copied to clipboard

A versatile Flutter package that allows you to easily integrate a YouTube player into your Flutter applications.

Flutter YouTube Player #

A Flutter package for embedding a YouTube player with customizable controls and features.

Installation #

Add the following line to your pubspec.yaml file:

dependencies:
  flutter_youtube_player: ^1.0.0

Then run:

flutter pub get

Usage #

Import the package in your Dart code:

import 'package:flutter_youtube_player/flutter_youtube_player.dart';

Use the PotraitPlayer widget to embed a YouTube player in your app:

PotraitPlayer(
  link: 'YOUR_YOUTUBE_VIDEO_URL',
  aspectRatio: 16 / 9, // Adjust the aspect ratio as needed
  kColorWhite: Colors.white, // Optional: Customize color themes
  kColorPrimary: Colors.orange,
  kColorBlack: Colors.black,
);

Parameters #

  • link: The YouTube video URL.
  • aspectRatio: The aspect ratio of the player.
  • kColorWhite: (Optional) Color for elements with a white background.
  • kColorPrimary: (Optional) Primary color for buttons and progress bars.
  • kColorBlack: (Optional) Color for elements with a black background.

Features #

  • Play/Pause Controls: Tap on the video to toggle play/pause. Additional play/pause button available.
  • Brightness Control: Swipe vertically on the left side of the video to adjust brightness.
  • Volume Control: Swipe vertically on the right side of the video to adjust volume.
  • Seek Controls: Seek forward and backward by tapping on the respective buttons.
  • Fullscreen: Tap on the fullscreen button to switch to landscape mode.
  • Settings Popup: Tap on the settings button to access additional settings.

Example #

import 'package:flutter/material.dart';
import 'package:flutter_youtube_player/flutter_youtube_player.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('YouTube Player Example'),
        ),
        body: PotraitPlayer(
          link: 'YOUR_YOUTUBE_VIDEO_URL',
          aspectRatio: 16 / 9,
        ),
      ),
    );
  }
}

License #

This project is licensed under the MIT License - see the LICENSE file for details.


Replace YOUR_YOUTUBE_VIDEO_URL with the actual YouTube video URL you want to play. Additionally, consider adding more sections to the README, such as "Contributing," "Issues," and "Changelog," based on your project's needs.

21
likes
0
pub points
81%
popularity

Publisher

unverified uploader

A versatile Flutter package that allows you to easily integrate a YouTube player into your Flutter applications.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

audio_video_progress_bar, flutter, flutter_screenutil, flutter_svg, get, http, screen_brightness, subtitle, video_player, wakelock, youtube_explode_dart

More

Packages that depend on youtube_video_player