flutterexodrmplayer 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new59

flutterexodrmplayer #

A new Flutter plugin.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Flutter-ExoPlayer- #

0.0.1 #

  • provide controllers
  • support dash drm encrypted content at the moment

0.0.2 #

  • add surface control support

example/lib/main.dart

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutterexodrmplayer_example/PlayerPage.dart';

import 'model/media.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final appTitle = 'Flutter Exoplayer (Beta)';

    return MaterialApp(
      title: appTitle,
      debugShowCheckedModeBanner: false,
      home: MyHomePage(title: appTitle),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

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

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

class _MyHomePageState extends State<MyHomePage> {
  bool dataReturned;
  List<Media> media;

  Future<List<Media>> loadMediaFiles() async {
    String jsonString =
        await rootBundle.loadString('assets/media.exolist.json');
    setState(() {
      dataReturned = true;
      media = Media.parseMediaLists(jsonString);
    });
    return Media.parseMediaLists(jsonString);
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    dataReturned = false;
    media = new List();
    loadMediaFiles();
  }

  @override
  Widget build(BuildContext context) {
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
    ]);

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: !dataReturned
          ? /* FutureBuilder<List<Media>>(
        future: loadMediaFiles(),
        builder: (context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);
          return snapshot.hasData
              ? PhotosList(medias: snapshot.data)
              : Center(child: CircularProgressIndicator());
        },
      )*/
          Container()
          : PhotosList(medias: media),
    );
  }
}

class PhotosList extends StatelessWidget {
  final List<Media> medias;

  PhotosList({Key key, this.medias}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      itemCount: medias.length,
      itemBuilder: (context, index) {
        return StuffInTiles(medias[index], index, medias);
      },
    );
  }
}

class StuffInTiles extends StatefulWidget {
  final Media myTile;
  final List<Media> medias;
  final int index;
  BuildContext _context;

  StuffInTiles(this.myTile, this.index, this.medias);

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

class _StuffInTilesState extends State<StuffInTiles> {
  Sample returnSample;
  Widget _buildSubTiles(Sample t) {
    return ListTile(
        dense: true,
        enabled: true,
        isThreeLine: false,
        onLongPress: () => print("long press"),
        onTap: () async {
          print("url ${t.uri ?? ""}");
          print("url ${t.drm_license_url ?? ""}");
          print("url ${t.playedLength ?? ""}");
          Sample result = await Navigator.push(
              widget._context,
              MaterialPageRoute(
                  builder: (_) =>
                      Player(
                        sampleVideo: returnSample != null ? returnSample.name == t.name ? returnSample : t : t,
                      )));
          if (result != null) {
//            SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
            print("back from player");
            setState(() {
              returnSample = result;
              print(t.playedLength);
              SystemChrome.setPreferredOrientations([
                DeviceOrientation.portraitUp,
              ]);
            });
          }
        },
        subtitle: Text(
          t.extension ?? "",
        ),
        selected: true,
        title: Text(t.name,
            style: TextStyle(fontSize: 18.0, color: Colors.black54)));
  }

  Widget _buildTiles(Media t) {
    return ExpansionTile(
      key: PageStorageKey<int>(3),
      title: Text(t.name),
      children: t.samples.map(_buildSubTiles).toList(),
    );
  }

  @override
  Widget build(BuildContext context) {
    widget._context = context;
    return _buildTiles(widget.myTile);
  }
}

//ChewieDemo(sampleVideo: t,)

Use this package as a library

1. Depend on it

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


dependencies:
  flutterexodrmplayer: ^0.0.2

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

We analyzed this package on Jul 2, 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:flutterexodrmplayer/flutterexodrmplayer.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

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

Package does not support Flutter platform web

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

Package does not support Flutter platform windows

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

Package not compatible with SDK dart

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

Health suggestions

Fix lib/flutterexodrmplayer.dart. (-1 points)

Analysis of lib/flutterexodrmplayer.dart reported 2 hints:

line 2 col 8: Unused import: 'dart:convert'.

line 3 col 8: Unused import: 'dart:io'.

Format lib/model/secured_video_content.dart.

Run flutter format to format lib/model/secured_video_content.dart.

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.

The package description is too short. (-1 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
flutter 0.0.0
http ^0.12.0+2 0.12.1
meta ^1.1.8 1.1.8
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http_parser 3.1.4
path 1.7.0
pedantic 1.9.0 1.9.1
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
Dev dependencies
flutter_test