패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.3.0

video_player_web_hls

video_player의 웹 플랫폼 구현으로 크롬 및 기타 브라우저에서 HLS를 지원합니다.

Web
30일 다운로드
3.3만
좋아요
79
Pub 점수
150

패키지 설치

flutter pub add video_player_web_hls

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Chrome 및 기타 현대 브라우저용으로 HLS(HTTP Live Streaming) 지원을 추가하는 video_player 패키지의 웹 플랫폼 구현입니다. Flutter 웹 애플리케이션에서 HLS 스트림을 원활하게 재생할 수 있게 하며, 핵심 video_player 기능을 확장하여 적응형 스트리밍 프로토콜을 처리할 수 있도록 합니다. 이 패키지는 네이티브 HLS 지원이 제한적이거나 일관되지 않을 수 있는 웹 환경을 위해 특별히 설계되었습니다.

사용 사례

  • Flutter 웹 앱에서 HLS 스트림 재생하기
  • 실시간 비디오 콘텐츠 스트리밍
  • 적응형 비트레이트 스트리밍 지원
  • 기존 video_player 워크플로우와의 통합
  • 크로스 브라우저 HLS 호환성 활성화

주요 기능

  • 웹에서의 HLS 스트리밍 지원
  • Chrome 및 최신 브라우저 호환성
  • video_player와의 원활한 통합
  • 적응형 비트레이트 재생
  • 경량이고 집중적인 구현

적합한 대상

  • 웹 플랫폼을 대상으로 하는 Flutter 개발자
  • HLS 비디오 재생이 필요한 앱
  • 적응형 스트리밍을 사용하는 프로젝트
  • 비디오 중심 웹 경험을 구축하는 개발자
  • 웹에서 신뢰할 수 있는 HLS 지원이 필요한 팀

고려 사항

  • 웹 플랫폼에만 제한됨
  • 호환 브라우저 필요 (예: Chrome)
  • 외부의 HLS.js 라이브러리에 의존합니다
  • 복잡한 스트리밍 설정을 위해 추가 구성이 필요할 수 있습니다
  • 모바일 또는 데스크톱 플랫폼에 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

video_player_web_hls

Version

Supports hls on chrome and other browsers.

Usage

...
dependencies:
  ...
  video_player_web_hls: ^0.1.1
  video_player: ^0.10.10

  ...

Add

 <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"  type="application/javascript"></script>

in index.html above

 <script src="main.dart.js" type="application/javascript"></script>

dart:io

The Web platform does not suppport dart:io, so attempts to create a VideoPlayerController.file will throw an UnimplementedError.

Autoplay

Playing videos without prior interaction with the site might be prohibited by the browser and lead to runtime errors. See also: https://goo.gl/xX8pDD.

Supported Formats

Different web browsers support different sets of video codecs.

Video codecs?

Check MDN's Web video codec guide to learn more about the pros and cons of each video codec.

What codecs are supported?

Visit caniuse.com: 'video format' for a breakdown of which browsers support what codecs. You can customize charts there for the users of your particular website(s).

Here's an abridged version of the data from caniuse, for a Global audience:

MPEG-4/H.264

Data on Global support for the MPEG-4/H.264 video format

WebM

Data on Global support for the WebM video format

Ogg/Theora

Data on Global support for the Ogg/Theora video format

AV1

Data on Global support for the AV1 video format

HEVC/H.265

Data on Global support for the HEVC/H.265 video format

Example

import 'package:video_player/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(
        'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8')
      ..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();
  }
}

카테고리

의존성

의존성 목록 3 개

  • http^1.0.0
  • video_player_platform_interface^6.2.0
  • web>=1.0.0 <2.0.0

소스 저장소

이 패키지를 사용하는 프로젝트