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

视频播放器(IJKplayer、ExoPlayer、MediaPlayer,AliPlayer)

gsy_video_player[developing] #

A new Flutter plugin project.

Getting Started #

this is a new flutter plugin project. gsy_video_player is a video player plugin for flutter.

Usage #

To use this plugin, add gsy_video_player as a dependency in your pubspec.yaml file.

dependencies:
  gsy_video_player: ^0.0.1

Example #

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:gsy_video_player/gsy_video_player.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  GsyVideoPlayerController gsyVideoPlayerController = GsyVideoPlayerController();

  @override
  void initState() {
    super.initState();
    initPlayer();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlayer() async {
    gsyVideoPlayerController.setLogLevel(LogLevel.logError);
    gsyVideoPlayerController
        .setNetWorkBuilder('https://cloud.video.taobao.com//play/u/27349687/p/1/e/6/t/1/239880949246.mp4');
    gsyVideoPlayerController.addEventsListener((VideoEventType event) {
      if (gsyVideoPlayerController.value.initialized) {
        if (event == VideoEventType.onListenerError) {
          print('gsyVideoPlayerController: ${gsyVideoPlayerController.value.toString()}');
          print('gsyVideoPlayerController: ${gsyVideoPlayerController.value.what}');
          print('gsyVideoPlayerController: ${gsyVideoPlayerController.value.extra}');
          print(mediaErrorCategoryForInt(gsyVideoPlayerController.value.what!));
        }
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            Container(
              color: Colors.black,
              width: double.infinity,
              height: 300,
              child: Container(
                color: Colors.blue,
                child: GsyVideoPlayer(
                  controller: gsyVideoPlayerController,
                ),
              ),
            ),
            Wrap(
              children: [
                ElevatedButton(
                    onPressed: () {
                      gsyVideoPlayerController.startPlayLogic();
                    },
                    child: const Text('play')),
                ElevatedButton(
                    onPressed: () {
                      gsyVideoPlayerController.resume();
                    },
                    child: const Text('resume')),
                ElevatedButton(
                    onPressed: () {
                      gsyVideoPlayerController.pause();
                    },
                    child: const Text('pause')),
                ElevatedButton(
                    onPressed: () {
                      gsyVideoPlayerController.setLogLevel(LogLevel.logSilent);
                    },
                    child: const Text('LogLevel')),
                ElevatedButton(
                    onPressed: () {
                      gsyVideoPlayerController.seekTo(const Duration(seconds: 11));
                    },
                    child: const Text('seekTo 10s')),
              ],
            )
          ],
        ),
      ),
    );
  }
}


灵感 #

https://github.com/CarGuo/GSYVideoPlayer

11
likes
0
points
102
downloads

Publisher

unverified uploader

Weekly Downloads

视频播放器(IJKplayer、ExoPlayer、MediaPlayer,AliPlayer)

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on gsy_video_player

Packages that implement gsy_video_player