meedu_player 0.1.0+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

meedu_player #

UI for video_player

Getting Started #

If you want to use urls with http:// you need a little configuration.

Android #

On Android go to your <project root>/android/app/src/main/AndroidManifest.xml:

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

And add android:usesCleartextTraffic="true" in your Application tag.


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>

Example (check the example folder to more demos) #

import 'package:meedu_player/meedu_player.dart';
.
.
.

final videos = [
  'http://clips.vorwaerts-gmbh.de/VfE_html5.mp4',
  'http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8',
  'https://content.jwplatform.com/manifests/yp34SRmf.m3u8',
  'https://html5videoformatconverter.com/data/images/happyfit2.mp4'
];


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

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with MeeduPlayerEventsMixin {
  final MeeduPlayerController _controller = MeeduPlayerController(
    backgroundColor: Color(0xff263238)
  );

  @override
  void initState() {
    super.initState();
    this._set(videos[0]);
    this._controller.events = this; // implement the mixin to listen the player events
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  Future<void> _set(String source) async {
    await _controller.setDataSource(
      src: source,
      type: DataSourceType.network,
      autoPlay: true, // optional
       aspectRatio: 16/9,//optional
       title: Text(
        source,
        style: TextStyle(
          color: Colors.white,
          fontWeight: FontWeight.w400,
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
     return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Column(
        children: <Widget>[
            // START PLAYER VIEW
          MeeduPlayer(
            controller: _controller,
          ),
            // END PLAYER VIEW
          Expanded(
            child: ListView.builder(
              itemBuilder: (_, index) {
                return ListTile(
                  onTap: () {
                    this._set(videos[index]);
                  },
                  title: Text("View video ${index + 1}"),
                );
              },
              itemCount: videos.length,
            ),
          )
        ],
      ),
    );
  }

  @override
  void onPlayerError(PlatformException e) {
    // TODO: implement onPlayerError
  }

  @override
  void onPlayerFinished() {
    // TODO: implement onPlayerFinished
  }

  @override
  void onPlayerFullScreen(bool isFullScreen) {
    // TODO: implement onPlayerFullScreen
  }

  @override
  void onPlayerLoaded(Duration duration) {
    // TODO: implement onPlayerLoaded
  }

  @override
  void onPlayerLoading() {
    // TODO: implement onPlayerLoading
  }

  @override
  void onPlayerPaused(Duration position) {
    // TODO: implement onPlayerPaused
  }

  @override
  void onPlayerPlaying() {
    // TODO: implement onPlayerPlaying
  }

  @override
  void onPlayerRepeat() {
    // TODO: implement onPlayerRepeat
  }

  @override
  void onPlayerResumed() {
    // TODO: implement onPlayerResumed
  }

  @override
  void onPlayerSeekTo(Duration position) {
    // TODO: implement onPlayerSeekTo
  }
}

[0.1.0+1] #

  • added license

[0.1.0] #

  • added launch as fullscreen

[0.0.4] #

  • removed unnecesary imports

[0.0.3+1] #

  • added exmaples

[0.0.3] #

  • added suport to subtitles (STR) and switch video resolution

[0.0.2] #

  • added Fullscreen support

[0.0.1] - initial version #

  • minimal version

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:meedu_player_example/pages/launch_as_full_screen_page.dart';
import 'package:meedu_player_example/pages/multi_resolution_page.dart';
import 'package:meedu_player_example/pages/network_page.dart';
import 'package:meedu_player_example/pages/network_with_subtitle_page.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    final routes = {
      "simple": (_) => NetworkPageDemo(),
      "multi": (_) => MultiResolutionPage(),
      "subtitles": (_) => NetworkWithSubtitlesPage(),
      "launch as fullscreen": (_) => LaunchAsFullScreenPage(),
    };
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      // home: NetworkWithSubtitlesPage(),
      // home: NetworkPageDemo(),
      // home: MultiResolutionPage(),
      home: HomePage(
        routes: routes,
      ),
      routes: routes,
    );
  }
}

class HomePage extends StatelessWidget {
  final Map<String, Widget Function(BuildContext)> routes;
  const HomePage({Key key, @required this.routes}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        width: double.infinity,
        height: double.infinity,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: routes.keys
              .map(
                (key) => FlatButton(
                  child: Text(key),
                  onPressed: () {
                    Navigator.pushNamed(context, key);
                  },
                ),
              )
              .toList(),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  meedu_player: ^0.1.0+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:meedu_player/meedu_player.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
54
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]
77
Learn more about scoring.

We analyzed this package on Jul 4, 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

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:meedu_player/meedu_player.dart, package:video_player/video_player.dart] that declares support for platforms: android, ios, web

Package does not support Flutter platform macos

Because of import path [package:meedu_player/meedu_player.dart, package:video_player/video_player.dart] that declares support for platforms: android, ios, web

Package does not support Flutter platform windows

Because of import path [package:meedu_player/meedu_player.dart, package:video_player/video_player.dart] that declares support for platforms: android, ios, web

Package not compatible with SDK dart

because of import path [meedu_player] that is in a package requiring null.

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:meedu_player/meedu_player.dartpackage:video_player/video_player.dartdart:io

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
flutter_spinkit >=4.0.0 <5.0.0 4.1.2+1
flutter_svg >=0.17.4 <1.0.0 0.17.4 0.18.0
meta ^1.1.8 1.1.8
video_player >=0.10.11 <2.0.0 0.10.11+2
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
flutter_web_plugins 0.0.0
path_drawing 0.4.1
path_parsing 0.1.4
petitparser 3.0.4
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
video_player_platform_interface 2.0.2
video_player_web 0.1.3+2
xml 3.7.0 4.2.0
Dev dependencies
flutter_test