drm_video 0.0.1
drm_video: ^0.0.1

Flutter Android iOS

Flutter Plugin to Play DRM Content - with every functionality provided by video_player

drm_video #

Video Player for DRM and non DRM content with every functionality provided official video_player #

pub package

NOTICE #

This Plugin uses some code from video_player plugins which is the official video_player plugin

Installation #

First, add drm_video as a dependency in your pubspec.yaml file.

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.

Android #

Ensure the following permission is present in your Android Manifest file, located in <project root>/android/app/src/main/AndroidManifest.xml:

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

Example #

import 'package:flutter/material.dart';
import 'package:drm_video/drm_video.dart';
import 'package:drm_video/video_controller.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  VideoController _videoController;
  String dashUrl = "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd";
  String licenseUrl = "https://proxy.staging.widevine.com/proxy";

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {
              _videoController.value.isPlaying
                  ? _videoController.pause()
                  : _videoController.play();
            });
          },
          child: Icon(
            ( _videoController?.value?.isPlaying  ?? false)? Icons.pause : Icons.play_arrow,
          ),
        ),
        body: Center(
          child: Column(
            children: [
              AspectRatio(
                aspectRatio: _videoController?.value?.aspectRatio ?? 16 / 9,
                child: Stack(
                  alignment: Alignment.bottomCenter,
                  children: <Widget>[
                    Container(
                      child: DrmVideoPlayer(
                        videoUrl: dashUrl,
                        autoPlay: false,
                        drmLicenseUrl: licenseUrl,
                        onVideoControls: (VideoController controller) {
                          print("onVideoControls $controller");
                          _videoController = controller;
                          _videoController.addListener(() {
                            setState(() {});
                          });
                          setState(() {});
                        },
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Working On #

  • DRM Support for iOS
  • RTMP Support for Android

For more code please check example project

Buy Me a Coffee #

Buy Me A Coffee

4
likes
100
pub points
26%
popularity

Publisher

karthikponnam.dev

Flutter Plugin to Play DRM Content - with every functionality provided by video_player

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on drm_video