iqplayer 0.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

IQPlayer #

Simple video player with subtitle wrote for flutter.

GitHub release (latest by date) GitHub GitHub followers

This package as a Gift for my teacher and my leader Mr. Muqtada Al-Sadr.

Proudly made by BLoC.

Screenshot_1588590912

Features #

  1. [x] Play video from Assets, Files, Network by VideoPlayerController from video_player.
  2. [x] Parse subtitles from Assets, Files, Network SubtitleProvider class.
  3. [ ] Custom theme you can use with IQTheme class.
  4. [x] Support Subtitles:
    1. [x] VTT format
    2. [ ] SRT format
    3. [ ] User define format
  5. [x] IQScreen: a video player scaffold screen.
  6. [ ] IQPlayer: a widget enable you to watch video implement with your screen.
  7. [x] IQParser: a subtitle package that view subtitles, included the widget and parser

Installation #

1. Depend on #

Go to pubspec.yaml and set the dependencies like:

dependencies:
  iqplayer: <latest_version>

Install packages from the command line with Flutter:

flutter pub get

2. Install #

Android #

Ensure the following permission is present in your Android Manifest file, located in

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

The Flutter project template adds it, so it may already be there.

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

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

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

3. Import #

Now in your Dart code, you can use:

import "package:iqplayer/iqplayer.dart";

Componets #

  1. IQScreen:
IQScreen(
  videoPlayerController = VideoPlayerController.network(""),
  subtitleProvider: SubtitleProvider.fromNetwork(""),
  title: "Simple Video",
  description: "Simple Description",
);
  1. IQPlayer:

In development.

  1. IQParser:

Note: It is used automatically with IQScreen and you can use and display data with SubtitleProvider.

BlocProvider<SubtitleBloc>(
  create: (context) =>
    SubtitleBloc(
      SubtitleProvider.fromNetwork(""),
    )..add(FetchSubtitles()),
    child: MyParser(),
);

Using #

  1. Start use IQScreen with Navigator:
Navigator.push(
  context,
  MaterialPageRoute(
    builder: (BuildContext context) => IQScreen(
    title: "",
    description: "",
    videoPlayerController: VideoPlayerController.network(""),
    subtitleProvider: SubtitleProvider.fromNetwork(""),
   ),
  ),
);
  1. Using of IQParser:

You have to use BlocProvider with SubtitleProvider to configure subtitles.

// In Your widget
BlocProvider<SubtitleBloc>(
  create: (context) =>
    SubtitleBloc(
      SubtitleProvider.fromNetwork(""),
    )..add(FetchSubtitles()),
    child: MyParser(),
);

// new parser class, you can exclude `MyParser`
class MyParser extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return IQParser();
  }
}

Note: You can exclude "MyParser" and delete it!

Note: What is the reason for creating MyParser? see this

Example #

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'IQPlayer Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'IQPlayer Demo'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: RaisedButton(
          child: Text('Open IQPlayer'),
          onPressed: () {
            Navigator.push(
              context,
              MaterialPageRoute(
                builder: (BuildContext context) => IQScreen(
                  title: title,
                  description: 'Simple video as a demo video',
                  videoPlayerController: VideoPlayerController.network(
                    'https://d11b76aq44vj33.cloudfront.net/media/720/video/5def7824adbbc.mp4',
                  ),
                  subtitleProvider: SubtitleProvider.fromNetwork(
                    'https://duoidi6ujfbv.cloudfront.net/media/0/subtitles/5675420c9d9a3.vtt'
                  ),
                ),
              ),
            );
          },
        ),
      ),
    );
  }
}

[0.1.0] - Spring. #

  • Added IQScreen class that enable user to use a plyer as a screen.

[0.2.0] - Storm. #

  • Added SubtitleProvider class that enable user to use a subtitle from files, assets, network, string.
  • Added IQParser class to display subtitle data.
  • Added SubtitleBloc class to use with IQParser.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'IQPlayer Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'IQPlayer Demo'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: RaisedButton(
          child: Text('Open IQPlayer'),
          onPressed: () {
            Navigator.push(
              context,
              MaterialPageRoute(
                builder: (BuildContext context) => IQScreen(
                  title: title,
                  description: 'Simple video as a demo video',
                  videoPlayerController: VideoPlayerController.network(
                    'https://d11b76aq44vj33.cloudfront.net/media/720/video/5def7824adbbc.mp4',
                  ),
                  subtitleProvider: SubtitleProvider.fromNetwork(
                      'https://duoidi6ujfbv.cloudfront.net/media/0/subtitles/5675420c9d9a3.vtt'
                  ),
                ),
              ),
            );
          },
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  iqplayer: ^0.2.1

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

We analyzed this package on Jul 9, 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:iqplayer/iqplayer.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:iqplayer/iqplayer.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:iqplayer/iqplayer.dart that imports:
  • package:video_player/video_player.dart that declares support for platforms: android, ios, web

Package not compatible with SDK dart

Because:

  • iqplayer that is a package requiring null.

Package not compatible with runtime flutter-web on web

Because:

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

Health suggestions

Format lib/src/blocs/subtitle/subtitle_state.dart.

Run flutter format to format lib/src/blocs/subtitle/subtitle_state.dart.

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (bloc, flutter_bloc).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
bloc ^4.0.0 4.0.0 5.0.1
equatable ^1.1.1 1.2.0
flutter 0.0.0
flutter_bloc ^4.0.0 4.0.1 5.0.1
http ^0.12.1 0.12.1
meta ^1.1.8 1.1.8 1.2.1
screen ^0.0.5 0.0.5
video_player ^0.10.9+1 0.10.11+2
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
flutter_web_plugins 0.0.0
http_parser 3.1.4
nested 0.0.4
path 1.7.0
pedantic 1.9.0 1.9.1
provider 4.3.0
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
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
bloc_test ^5.0.0
flutter_test