搜索插件、代码仓与 APP 分类

iqplayer 封面
插件详情v0.4.1

iqplayer

简单而强大的视频播放器,支持字幕(可从资源、文件、网络或字符串加载)。

近 30 天下载
51
喜欢数
38
Pub 分数
60

安装插件

flutter pub add iqplayer

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

IQPlayer 是一个简单而强大的 Flutter 视频播放器,支持来自各种来源的字幕,包括资源、本地文件、网络和原始字符串。它提供直观的界面,具有流畅的播放和无缝的字幕集成,非常适合需要同步字幕的视频内容的应用程序。该包轻量且易于实现,专注于开发人员的便利性,同时不牺牲功能。

适合场景

  • 流式传输带字幕的视频
  • 离线视频播放与本地字幕
  • 在教育类应用程序中显示视频内容
  • 集成基于网络的视频并支持字幕
  • 在多媒体应用中嵌入视频

主要特点

  • 支持多种字幕源
  • 与 Flutter 的轻松集成
  • 流畅的视频播放
  • 可自定义的 UI 元素
  • 自动字幕同步
  • 轻便且快速

适合对象

  • 开发以视频为中心的应用程序的开发者
  • 教育或教程平台
  • 媒体流应用程序
  • 需要离线视频字幕的应用
  • 项目需要最少的设置即可播放视频

使用建议

  • 有限的平台特定自定义
  • 无内置视频缓存
  • 需要手动处理字幕文件格式
  • 未针对高分辨率4K播放进行优化
  • 依赖外部依赖项以实现高级功能

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

IQPlayer

Simple video player with subtitle wrote for Flutter.

GitHub release (latest by date) GitHub GitHub followers

This package as a gift for my teacher and my leader Mr. Muqtada Al-Sadr.

Proudly based on BLoC.

Screenshot_1589120660

Features

  1. [x] Play video from Assets, Files, Network by VideoPlayerController from video_player.
  2. [x] Parse subtitles from Assets, Files, Network SubtitleProvider class.
  3. [x] Custom theme you can use with IQTheme class.
  4. [x] Support Subtitles:
    1. [x] VTT format
    2. [ ] SRT format
    3. [ ] User define format
  5. [x] IQScreen: a video player scaffold screen.
  6. [ ] IQPlayer: a widget enable you to watch video implement with your screen.
  7. [x] IQParser: a subtitle package that view subtitles, included the widget and parser.
  8. [x] IQTheme: to make your customizations on player ui and make it more integrated with your own app.

Installation

1. Depends on

Go to pubspec.yaml and add it to the dependencies list like:

dependencies:
  iqplayer: <latest_version>

Install packages from the command line with Flutter:

flutter pub get

2. Install

Android

Ensure the following permission is presented in your Android Manifest file, located in /android/app/src/main/AndroidManifest.xml:

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

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

IOS

Warning: The video player is not functional on iOS simulators. An IOS device must be used during development/testing.

Add the following entry into your Info.plist file, located in /ios/Runner/Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

This entry allows your app to access video files by URL.

3. Import

Now in your Dart files, you can use:

import "package:iqplayer/iqplayer.dart";

Componets

  1. IQScreen:
IQScreen(
  videoPlayerController = VideoPlayerController.network(""),
  subtitleProvider: SubtitleProvider.fromNetwork(""),
  title: "Simple Video",
  description: "Simple Description",
);
  1. IQPlayer:

In development.

  1. IQParser:

Note: It is used automatically with IQScreen and you can use and display data with SubtitleProvider.

BlocProvider<SubtitleBloc>(
  create: (context) =>
    SubtitleBloc(
      SubtitleProvider.fromNetwork(""),
    )..add(FetchSubtitles()),
    child: MyParser(),
);
  1. IQTheme:

Note: You can customize your theme on IQScreen, IQPlayer or IQParser with this class.

You have +17 option to customize theme!

 IQScreen(
    ...
    iqTheme: IQTheme(
      ...
    ),
 );

Using

  1. Start using IQScreen with Navigator:
Navigator.push(
  context,
  MaterialPageRoute(
    builder: (BuildContext context) => IQScreen(
    title: "",
    description: "",
    videoPlayerController: VideoPlayerController.network(""),
    subtitleProvider: SubtitleProvider.fromNetwork(""),
   ),
  ),
);
  1. Using of IQParser:

You have to use BlocProvider with SubtitleProvider to configure subtitles.

// In Your widget
BlocProvider<SubtitleBloc>(
  create: (context) =>
    SubtitleBloc(
      SubtitleProvider.fromNetwork(""),
    )..add(FetchSubtitles()),
    child: MyParser(),
);

// new parser class, you can exclude `MyParser`
class MyParser extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return IQParser();
  }
}

Note: You can exclude "MyParser" and delete it!

Note: What is the reason for creating MyParser? see this

  1. You can use IQTheme to customize ui like:

You have +17 option to customize theme!

IQTheme(
    loadingProgress: SpinKitCircle(
      color: Colors.red,
    ),
    playButtonColor: Colors.transparent,
    videoPlayedColor: Colors.indigo,
    playButton: (bool isPlay) {
    if (isPlay)
        return Icon(
            Icons.pause_circle_filled,
            color: Colors.red,
            size: 50,
        );
    return Icon(
        Icons.play_circle_outline,
        color: Colors.red,
        size: 50,
        );
    },
);

Example

import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:iqplayer/iqplayer.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'IQPlayer Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'IQPlayer Demo'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: RaisedButton(
          child: Text('Open IQPlayer'),
          onPressed: () {
            Navigator.push(
              context,
              MaterialPageRoute(
                builder: (BuildContext context) => IQScreen(
                  title: title,
                  description: 'Simple video as a demo video',
                  videoPlayerController: VideoPlayerController.network(
                    'https://d11b76aq44vj33.cloudfront.net/media/720/video/5def7824adbbc.mp4',
                  ),
                  subtitleProvider: SubtitleProvider.fromNetwork(
                      'https://duoidi6ujfbv.cloudfront.net/media/0/subtitles/5675420c9d9a3.vtt'),
                  iqTheme: IQTheme(
                    loadingProgress: SpinKitCircle(
                      color: Colors.red,
                    ),
                    playButtonColor: Colors.transparent,
                    videoPlayedColor: Colors.indigo,
                    playButton: (bool isPlay) {
                      if (isPlay)
                        return Icon(
                          Icons.pause_circle_filled,
                          color: Colors.red,
                          size: 50,
                        );
                      return Icon(
                        Icons.play_circle_outline,
                        color: Colors.red,
                        size: 50,
                      );
                    },
                  ),
                ),
              ),
            );
          },
        ),
      ),
    );
  }
}

所属分类

依赖

依赖清单 6 项

源码仓库

使用此插件的项目

暂无相关数据。