itsky365 / flt_video_player

基于腾讯云点播播放器的Flutter插件

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flt_video_player

A Video Player Flutter plugin based on TXVodPlayer

Note: This plugin is still under development, and some APIs might not be available yet. Feedback welcome and Pull Requests are most welcome!

English | 中文文档

Installation

//pub
dependencies:
  flt_video_player: ^0.0.4

//import
dependencies:
  flt_video_player:
    git:
      url: git://github.com/RandyWei/flt_video_player.git

Android

Ensure the following permission and tools:replace="android:label" is present in your Android Manifest file, located in `/android/app/src/main/AndroidManifest.xml:

<manifest
    ...
    xmlns:tools="http://schemas.android.com/tools" >

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

    <application
        ...
        tools:replace="android:label">
        ...
    </application>
</manifest>

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

Supported Formats

The backing player is TxVodPlayer, please refer here for list of supported formats.

Screenshot

screenshot

Example

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

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

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

class _MyAppState extends State<MyApp> {
  VideoPlayerController _controller;

  @override
  void initState() {
    super.initState();
    _controller = VideoPlayerController.path(
        "https://github.com/RandyWei/flt_video_player/blob/master/example/SampleVideo_1280x720_30mb.mp4?raw=true")
      ..initialize();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Simple Demo",
      home: Scaffold(
        appBar: AppBar(
          title: Text("Simple Demo"),
        ),
        body: AspectRatio(
          aspectRatio: 1.8,
          child: VideoPlayer(_controller),
        ),
      ),
    );
  }

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

About

基于腾讯云点播播放器的Flutter插件

License:MIT License


Languages

Language:Objective-C 37.7%Language:Dart 32.6%Language:Kotlin 25.6%Language:Ruby 4.2%