Youtube Player Plugin

pub package

A flutter plugin to play Youtube Videos "inline" without API Key in ranges of Quality(240p, 360p, 480p, 720p and 1080p).

Salient Features

  • Inline playback
  • Supports HD and Full HD quality
  • No need for API Key and no Limitations
  • Thumbnail Support
  • Playable through
  • Picture in Picture for Android SDK > 24
  • Customizable Controls

DEMO

Usage

1. Depend

Add this to you package's pubspec.yaml file:

dependencies:
  youtube_player: ^0.6.1

2. Install

Run command:

$ flutter packages get

3. Import

Import in Dart code:

import 'package:youtube_player/youtube_player.dart';

4. Using Youtube Player

///
/// LOW = 240p
/// MEDIUM = 360p
/// HIGH = 480p
/// HD = 720p
/// FHD = 1080p
/// "source" can be either youtube video ID or link.
/// "showThumbnail" Default is true.
/// "acpectRatio" Default is 16/9
///
YoutubePlayer(
          source: "nPt8bK2gbaU",
          quality: YoutubeQuality.HD,
          aspectRatio: 16/9,
          showThumbnail: true,
),

Example

Example sources

Limitation

  • Only Available for Android (Currently)

Future

  • Support for ios
  • Adaptive playback as per the internet bandwidth
  • High level of customization

Credit

This plugin is a fork of video_player which supports youtube playback. The controls used in the plugin is derived from chewie.

Cheers to @Flutter Team and @Brian Egan for developing such useful plugin and packages.

License

Copyright 2019 Sarbagya Dhaubanjar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Libraries

chewie
youtube_player

Dart

dart:ui
Built-in types and core primitives for a Flutter application. [...]

Core

dart:async
Support for asynchronous programming, with classes such as Future and Stream. [...]
dart:collection
Classes and utilities that supplement the collection support in dart:core. [...]
dart:convert
Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
dart:core
Built-in types, collections, and other core functionality for every Dart program. [...]
dart:developer
Interact with developer tools such as the debugger and inspector. [...]
dart:math
Mathematical constants and functions, plus a random number generator. [...]
dart:typed_data
Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]

VM

dart:io
File, socket, HTTP, and other I/O support for non-web applications. [...]
dart:isolate
Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]