Skip to content

Repository files navigation

flutter_ezplayer

A new flutter plugin project.

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_ezplayer

License

EZPlayer component for flutter apps

预览

EZPlayerFlutterBaseEZPlayerFlutterList

介绍

基于EZPlayer封装的视频播放器,功能丰富,快速集成,可定制性强。

要求

  • iOS 9.0+
  • Xcode 12.0+
  • Swift 5.0+
  • Flutter 1.22.2+

特性

使用

可以参考example项目,

flutter_ezplayer 文件:

FlutterEZPlayerPlugin.h & FlutterEZPlayerPlugin.m : oc桥接

SwiftFlutterEZPlayerPlugin.swift:继承自FlutterPlugin对象,该对象主要是用来向flutter注册我们的plugin

EZPlayerFactory.swift:工厂的核心就是这个createWithFrame方法了,这个方法是由dart侧来驱动的

EZPlayerController.swift:controller继承自FlutterPlatformView协议,工厂调用Controller对象来创建真正的view实例。

flutter_ezplayer.dart : EZPlayer封装的入口文件

player.dart: player widget

player_controller.dart: EZPlayer通知交互,播放器的基础动作

utils.dart: lib的辅助方法

属性

keydescriptionvalue
url视频数据源String
autoPlay设置数据源后自动播放bool
useDefaultUI使用EZPlayer自带皮肤bool
videoGravity视频画面比例VideoGravity
fullScreenMode全屏模式是竖屏还是横屏FullScreenMode
floatMode浮动模式支持系统PIP和window浮层FloatMode
onPlayerHeartbeat播放器声明周期心跳EZPlayerNotificationCallback
onPlayerPlaybackTimeDidChangeaddPeriodicTimeObserver方法的触发EZPlayerNotificationCallback
onPlayerStatusDidChange播放器状态改变EZPlayerNotificationCallback
onPlayerPlaybackDidFinish视频结束EZPlayerNotificationCallback
onPlayerLoadingDidChangeloading状态改变EZPlayerNotificationCallback
onPlayerControlsHiddenDidChange播放器控制条隐藏显示EZPlayerNotificationCallback
onPlayerDisplayModeDidChange播放器显示模式改变了(全屏,嵌入屏,浮动)PropTypes.object
onPlayerDisplayModeChangedWillAppear播放器显示模式动画开始EZPlayerNotificationCallback
onPlayerDisplayModeChangedDidAppear播放器显示模式动画结束EZPlayerNotificationCallback
onPlayerTapGestureRecognizer点击播放器手势通知EZPlayerNotificationCallback
onPlayerDidPersistContentKeyFairPlay DRMEZPlayerNotificationCallback
onPlayerPIPControllerWillStart即将开启画中画EZPlayerNotificationCallback
onPlayerPIPControllerDidStart已经开启画中画EZPlayerNotificationCallback
onPlayerPIPFailedToStart开启画中画失败EZPlayerNotificationCallback
onPlayerPIPControllerWillEnd即将关闭画中画EZPlayerNotificationCallback
onPlayerPIPControllerDidEnd已经关闭画中画EZPlayerNotificationCallback
onPlayerPIPRestoreUserInterfaceForStop关闭画中画且恢复播放界面EZPlayerNotificationCallback

方法

functiondescription
Future play(String url, [String title]) async播放
Future start() async播放
Future pause() async暂停
Future stop() async结束
Future seek(double time) async设置播放进度,单位秒
Future replaceToPlay(String url, [String title]) async替换播放源
Future rate(double rate) async设置播放速率
Future autoPlay(bool autoPlay) async设置自动播放,autoPlay是PropTypes.bool
Future videoGravity(VideoGravity videoGravity) async设置视频画面比例,videoGravity:aspect,aspectFill,scaleFill
Future toEmbedded([bool animated = true]) async进入嵌入屏模式
Future toFloat([bool animated = true]) async进入悬浮屏模式
Future toFull(
 [bool animated = true,
landscapeOrientation = LandscapeOrientation.left]) async | 进入全屏模式,orientation: landscapeLeft , landscapeRight | 

| Future fullScreenMode(FullScreenMode fullScreenMode) async | 设置全屏的模式,fullScreenMode:portrait , landscape |

demo文件:

main.dart: 入口

home_page.dart : EZPlayer的基础功能演示

list_page.dart :EZPlayer 在列表中的演示

License

EZPlayer遵守MIT协议,具体请参考MIT

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages