flutter_youtube_player 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

flutter_youtube_player #

A new Flutter plugin for playing inline youtube videos. It is available only for Android and uses official android Youtube Player API. This plugin provides a FlutterYoutubePlayer widget which can be embedded in app like any other widget.

Supported

  • Android

How to Use #

dependencies:
  flutter_youtube_player: ^1.1.0

Imports #

import 'package:flutter_youtube_player/flutter_youtube_player.dart';

Code #


FlutterYoutubePlayer(
  apiKey: "<API_KEY>",
  videoId: "<Youtube Video ID>",
  autoPlay: false, //default true
)
KeyValueDefault
apiKeyString (Not Null)
videoIdString (Not Null)
autoPlayBoolean (Optional)true

Example #

Click here for complete example

1.1.0 #

Fixed a bug causing player to continue play while the app was in background.

1.0.0 #

Updated main dart file as per flutter suggestions.

0.0.3 #

Added GIT Repository

0.0.2 #

Added Documentation.

0.0.1 #

This is the very first release.

example/README.md

flutter_youtube_player_example #

Demonstrates how to use the flutter_youtube_player plugin.

Example #


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

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: <Widget>[
            Expanded(
              child: FlutterYoutubePlayer(
                apiKey: "api_key",
                videoId: "video_id",
              ),
            ),
            Expanded(
                child: Center(
              child: Text('Description of the Video'),
            )),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_youtube_player: ^1.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_youtube_player/flutter_youtube_player.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
59
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Health suggestions

Format lib/flutter_youtube_player.dart.

Run flutter format to format lib/flutter_youtube_player.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test