Skip to content
pubscout

video_player_web_hls

1.3.0, released 2 years ago by an unverified publisher

Web platform implementation of video_player with HLS support.

WASM-ready
$ flutter pub add video_player_web_hls
Source repository

What it does

Provides web support for the video_player plugin, enabling HLS (HTTP Live Streaming) playback on Chrome and other web browsers using hls.js.

AI-written summary of version 1.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to play HLS (.m3u8) video streams on Flutter Web
  • You are using the standard video_player package and targeting the web platform

Skip it when

  • You are targeting non-web platforms
  • You want to load videos from local files on the web (dart:io is not supported)

Strengths

  • Brings HLS stream playback capability to Flutter web
  • Falls back to hls.js when native player fails

Weaknesses

  • Does not support dart:io on the web (VideoPlayerController.file throws UnimplementedError)
  • Requires manual script addition to index.html

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
3

Requires adding the hls.js script tag to index.html before main.dart.js.

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((_) {
        setState(() {});
      });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: _controller.value.initialized
              ? AspectRatio(
                  aspectRatio: _controller.value.aspectRatio,
                  child: VideoPlayer(_controller),
                )
              : Container(),
        ),
      ),
    );
  }

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

Alternatives

Packages that do the same job and could replace video_player_web_hls.

Works with

Packages commonly used together with video_player_web_hls: ones it builds on, ones built on it, and its own family.