搜尋套件、儲存庫與 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

原始碼儲存庫

使用此套件的專案

暫無相關資料。