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

插件详情v0.1.2

ext_video_player

用于在 Android 和 iOS 上与其他 Flutter widget 内联显示的 Flutter 插件。此插件还支持播放 YouTube 视频和 RTMP 流。

AndroidiOSWeb
近 30 天下载
66
喜欢数
88
Pub 分数
110

安装插件

flutter pub add ext_video_player

插件介绍

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

一个 Flutter 插件,可在 Android、iOS 和 Web 上的 Flutter 小部件中实现内联视频播放。它支持直接在应用界面中播放 YouTube 视频和 RTMP 流。专为无缝集成而设计,使开发者能够在不离开 Flutter UI 的情况下嵌入视频。该插件非常适合需要丰富媒体内容且设置简单的应用程序。它利用原生视频播放器,同时保持跨平台的一致外观。

适合场景

  • 在Flutter应用中嵌入YouTube视频
  • 实时播放RTMP流
  • 在可滚动布局中集成视频内容
  • 创建多媒体丰富的教育应用程序
  • 构建实时流媒体应用

主要特点

  • 支持YouTube视频链接
  • 处理 RTMP 流播放
  • 使用 Flutter 小部件内联视频渲染
  • 跨平台兼容性(Android、iOS、Web)
  • 视频控制的简单 API

适合对象

  • 开发媒体密集型应用的开发者
  • 需要实时或按需视频的应用程序
  • 教育或娱乐平台
  • 需要 YouTube 集成的项目
  • 带有视频内容的网页和移动应用

使用建议

  • 需要互联网连接以播放在线视频
  • RTMP 支持可能因平台而异
  • YouTube 播放需要有效的 API 密钥
  • 与原生播放器相比,自定义功能有限
  • Web 支持可能具有浏览器特定的限制

原始 README

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

ext_video_player

Clone of video_player plugin with support for Youtube & RTMP

pub package

NOTICE

This Plugin uses all its code from video_player plugins which is the official video_player plugin Only few part of the code are modified.

Note

RTMP is only supported in Android (Working for iOS)

Installation

First, add ext_video_player as a dependency in your pubspec.yaml file.

iOS

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

Add the following entry to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

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

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

Android

Ensure the following permission is present in your Android Manifest file, located in <project root>/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.

Web

Please check readme file of video_player

Example

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

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

class VideoApp extends StatefulWidget {
  @override
  _VideoAppState createState() => _VideoAppState();
}

class _VideoAppState extends State<VideoApp> {
  VideoPlayerController _controller;

  @override
  void initState() {
    super.initState();
    _controller = VideoPlayerController.network(
        'http://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4')
      ..initialize().then((_) {
        // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
        setState(() {});
      });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Video Demo',
      home: Scaffold(
        body: Center(
          child: _controller.value.initialized
              ? AspectRatio(
                  aspectRatio: _controller.value.aspectRatio,
                  child: VideoPlayer(_controller),
                )
              : Container(),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {
              _controller.value.isPlaying
                  ? _controller.pause()
                  : _controller.play();
            });
          },
          child: Icon(
            _controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
          ),
        ),
      ),
    );
  }

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

For more code please check example project

Buy Me a Coffee

Buy Me A Coffee

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。