kidd_video_player 0.0.12

  • Readme
  • Changelog
  • Example
  • Installing
  • new65

kidd_video_player package #

Summary #

The main goal in this project is to add a video player to a flutter application in the simplest and most customizable possible way as possible. Taking as input a source file or url, the player loads the video and plays it.

Installation #

Dependencies: #

In order to make it work, you need to add video_player package to your dependencies:

Step 1 #

In your pubspec.yml, add:

dependencies:
   flutter:
	sdk:
   ...
   video_player:
   kidd_video_player: 

Step 2 #

Open your terminal and run:

flutter pub get

Step 3 #

Import the script into the dart file that will contain the widget that uses the video player as a child:

import  'package:kidd_video_player/kidd_video_player.dart';

Step 4 #

Let's code a simple example. Put the KiddVideoPlayer() class as a child of some widget with the following parameters:

...
child: Container(
    width: MediaQuery.of(context).size.width,
    height: 500,
    child: KiddVideoPlayer(
	    fromUrl: true,
	    videoUrl: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
	),
),
...

Considerations #

For Android: #

Be sure that the following line appears in the <application ...> tag located in <project root>/android/app/src/main/Mainfest.xml:

<application 
    ...
    android:usesCleartextTraffic="true"
    ...

And the line below outside the <application ...> tag:

<uses-permission android:name="android.permission.INTERNET"/>
...
<application 
...

This entry allows your app to access video files by URL.

For iOS #

Warning: The video player is not functional on iOS simulators. An iOS device must be used during development/testing.

Add the following entry to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

This entry allows your app to access video files by URL.

Usage #

Complete example #

...
child: Container(
    width: MediaQuery.of(context).size.width,
    height: 500,
    child: KiddVideoPlayer(
	    videoFile: _videoFile,
	    fromUrl: false,
	    layoutConfigs: KiddLayoutConfigs(
		    backgroundColor: Colors.black,
		    backgroundSliderColor: Colors.grey,
		    iconsColor: Colors.white,
		    inLoop: false,
		    loaderColor: Colors.blue,
		    pauseIcon: Icons.pause_circle_filled,
		    playIcon: Icons.play_circle_filled,
		    showFullScreenButton: true,
		    showVideoControl: true,
		    showVolumeControl: true,
		    sliderColor: Colors.blue,
		    ),
	  ),
...

Parameters #

  • videoFile (File)
  • videoUrl (String)
  • fromUrl (bool)
  • layoutConfigs (LayoutConfigs)
    • backgroundColor(Color)
    • backgroundSliderColor(Color)
    • iconsColor(Color)
    • inLoop(bool)
    • loaderColor(Color)
    • pauseIcon(IconData)
    • playIcon:(IconData)
    • showFullScreenButton(bool)
    • showVideoControl(bool)
    • showVolumeControl(bool)
    • sliderColor(Color)

Screenshots #

Licence #

BSD 3-Clause License

Copyright (c) 2020, Marcos Carlomagno All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

[0.0.1] - 22/06 #

  • TODO: Describe initial release.

[0.0.11] - 24/06 #

  • Example added
  • Flutter format to dart source files
  • Some issues fixed

[0.0.12] - 25/06 #

  • Example fixed
  • Readme fixed (url images)
  • gesture detector fixed
  • example fixed

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Some awesome app',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
        // This makes the visual density adapt to the platform that you run
        // the app on. For desktop platforms, the controls will be smaller and
        // closer together (more dense) than on mobile platforms.
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Some awesome app'),
        ),
        body: Center(
          child: Container(
            height: 400,
            child: KiddVideoPlayer(
              fromUrl: true,
              videoUrl:
                  'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  kidd_video_player: ^0.0.12

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:kidd_video_player/kidd_video_player.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
35
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:kidd_video_player/kidd_video_player.dart that imports:
  • package:video_player/video_player.dart that declares support for platforms: android, ios, web

Package does not support Flutter platform macos

Because:

  • package:kidd_video_player/kidd_video_player.dart that imports:
  • package:video_player/video_player.dart that declares support for platforms: android, ios, web

Package does not support Flutter platform windows

Because:

  • package:kidd_video_player/kidd_video_player.dart that imports:
  • package:video_player/video_player.dart that declares support for platforms: android, ios, web

Package not compatible with SDK dart

Because:

  • kidd_video_player that is a package requiring null.

Package not compatible with runtime flutter-web on web

Because:

  • package:kidd_video_player/kidd_video_player.dart that imports:
  • package:video_player/video_player.dart that imports:
  • dart:io

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
video_player ^0.10.11+1 0.10.11+2
Transitive dependencies
collection 1.14.12 1.14.13
flutter_web_plugins 0.0.0
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
video_player_platform_interface 2.0.2
video_player_web 0.1.3+2
Dev dependencies
flutter_test