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

原始碼儲存庫

使用此套件的專案

暫無相關資料。