flutter_video_player 0.0.1 copy "flutter_video_player: ^0.0.1" to clipboard
flutter_video_player: ^0.0.1 copied to clipboard

A Flutter plugin for integrating qiniu video player in iOS and Android applications.

example/lib/main.dart

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

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

//const String videoPath = 'rtmp://live.hkstv.hk.lxdns.com/live/hks1';
const String videoPath =
    'http://qn.isanye.cn/%E5%A5%87%E8%BF%B9%E7%9A%84%E5%B1%B1.mp4';

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

class _MyAppState extends State<MyApp> {
  VideoController _controller;
  double _aspectRatio = 4 / 3;

  _onVideoCreated(VideoController controller) {
    setState(() {
      _controller = controller;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter video player example'),
        ),
        body: Center(
          child: AspectRatio(
            aspectRatio: _aspectRatio,
            child: FlutterVideoPlayer(
              options: PlayerOptions(
                videoPath: videoPath,
              ),
              onVideoCreated: _onVideoCreated,
              onPrepare: () {
                _controller.start();
              },
              onVideoSizeChanged: (int width, int height) {
                setState(() {
                  _aspectRatio = width / height;
                });
              },
            ),
          ),
        ),
        persistentFooterButtons: <Widget>[
          FlatButton(
            child: Text('START'),
            onPressed: () {
              _controller.start();
              _controller.getMetaData();
            },
          ),
          FlatButton(
            child: Text('PAUSE'),
            onPressed: () {
              _controller.pause();
            },
          ),
        ],
      ),
    );
  }
}
0
likes
30
pub points
71%
popularity

Publisher

unverified uploader

A Flutter plugin for integrating qiniu video player in iOS and Android applications.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_video_player