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

插件详情v0.0.11

video_360

简单的360度视频播放器(Android - Exoplayer,iOS - Swifty360Player)

AndroidiOS
近 30 天下载
755
喜欢数
26
Pub 分数
150

安装插件

flutter pub add video_360

插件介绍

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

一个简单的 Flutter 360 度视频播放器,Android 上利用 ExoPlayer,iOS 上使用 Swifty360Player。它支持沉浸式视频播放和完整的球形观看功能,非常适合 VR 内容。该包抽象了平台特定的实现,为开发者提供统一的 API。支持标准视频格式,并可轻松集成到 Flutter 应用中,设置简单。专为需要基本 360° 视频功能且无需复杂自定义的轻量级使用场景设计。

适合场景

  • 沉浸式VR视频体验
  • 教育类360°全景游览
  • 虚拟房地产看房
  • 互动产品预览
  • 旅行和旅游内容

主要特点

  • 跨平台360°视频播放
  • Android(ExoPlayer)和 iOS(Swifty360Player)支持
  • 与 Flutter 的简单集成
  • 支持标准视频格式
  • 所需最小配置

适合对象

  • 开发VR内容应用的开发者
  • 需要交互式360°视频的应用程序
  • 轻量级360°视频解决方案
  • 以移动设备为先的沉浸式体验
  • 原型设计360°视频功能

使用建议

  • 仅限 Android 和 iOS 平台
  • 无网页或桌面支持
  • 依赖原生库
  • 高级控件可能需要自定义实现
  • 性能因设备和视频分辨率而异

原始 README

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

video_360

Simple 360 video player plugin (Android, iOS support)

Notice

The minimum-supported Flutter version has been updated to 3.24. If you are using an earlier version of Flutter, please refer to the previous version of the library.

Flutter Version <= 2.10.5 used this plugin version 0.0.6

Getting Started

The Android uses the open source AndroidX Media3

AndroidX Media3 : 1.10.1

The iOS uses the open source Swifty360Player

Swifty360Player Version: 0.2.7

Requirements

  • Flutter >=3.24.0
  • Dart >=3.5.0

Installation

Add pubspec.yaml dependencies.

dependencies:
  video_360: ^1.0.0

Android Requirements

Minimum SDK Target : 19

iOS Requirements

Minimum iOS Target : 12.0
Swift Version : 5.x

How to use

importing the library:

import 'package:video_360/video_360.dart';

Add Video360View:

Video360View(
    onVideo360ViewCreated: _onVideo360ViewCreated,
    url: YOUR_360_VIDEO_URL,    
    isRepeat: true, // default : false
    onPlayInfo: (Video360PlayInfo info) {
        // Play info Callback
    },
)

Video360Controller Method

play() : video play
stop() : video stop
reset() : video reset
jumpTo() : video jump, parameter is millisecond
seekTo() : video seek, parameter is plus, minus millisecond

sample code:

import 'package:material_ui/material_ui.dart';
import 'package:video_360/video_360.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MaterialApp(home: MyApp()));
}

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

class _MyAppState extends State<MyApp> {

  Video360Controller? controller;

  String durationText = '';
  String totalText = '';

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

  @override
  Widget build(BuildContext context) {

    var statusBar = MediaQuery.of(context).padding.top;

    var width = MediaQuery.of(context).size.width;
    var height = MediaQuery.of(context).size.height;

    return Scaffold(
      appBar: AppBar(
        title: const Text('Video 360 Plugin example app'),
      ),
      body: Stack(
        children: [
          Center(
            child: Container(
              width: width,
              height: height,
              child: Video360View(
                onVideo360ViewCreated: _onVideo360ViewCreated,
                url: 'https://cdn.bitmovin.com/content/assets/playhouse-vr/m3u8s/105560.m3u8',
                onPlayInfo: (Video360PlayInfo info) {
                  setState(() {
                    durationText = info.duration.toString();
                    totalText = info.total.toString();
                  });
                },
              ),
            ),
          ),
          Column(
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  MaterialButton(
                    onPressed: () {
                      controller?.play();
                    },
                    color: Colors.grey[100],
                    child: Text('Play'),
                  ),
                  MaterialButton(
                    onPressed: () {
                      controller?.stop();
                    },
                    color: Colors.grey[100],
                    child: Text('Stop'),
                  ),
                  MaterialButton(
                    onPressed: () {
                      controller?.reset();
                    },
                    color: Colors.grey[100],
                    child: Text('Reset'),
                  ),
                  MaterialButton(
                    onPressed: () {
                      controller?.jumpTo(80000);
                    },
                    color: Colors.grey[100],
                    child: Text('1:20'),
                  ),
                ],
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  MaterialButton(
                    onPressed: () {
                      controller?.seekTo(-2000);
                    },
                    color: Colors.grey[100],
                    child: Text('<<'),
                  ),
                  MaterialButton(
                    onPressed: () {
                      controller?.seekTo(2000);
                    },
                    color: Colors.grey[100],
                    child: Text('>>'),
                  ),
                  Flexible(
                    child: MaterialButton(
                      onPressed: () {
                      },
                      color: Colors.grey[100],
                      child: Text(durationText + ' / ' + totalText),
                    ),
                  ),
                ],
              )
            ],
          )
        ],
      ),
    );
  }

  _onVideo360ViewCreated(Video360Controller? controller) {
    this.controller = controller;
    this.controller.play();
  }
}

所属分类

依赖

依赖清单 1 项

  • plugin_platform_interface^2.0.2

源码仓库

使用此插件的项目

暂无相关数据。