flutter_youtube_player 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 52

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/lib/main.dart

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 pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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]
40
Health:
Code health derived from static analysis. [more]
53
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
52
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Health issues and suggestions

Fix lib/flutter_youtube_player.dart. (-46.56 points)

Analysis of lib/flutter_youtube_player.dart failed with 2 errors, 1 warning:

line 62 col 12: Case expressions must be constant.

line 62 col 30: There is no constant named 'suspending' in 'AppLifecycleState'.

line 48 col 5: Missing case clause for 'detached'.

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Dependencies

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