sky_player 0.1.1 copy "sky_player: ^0.1.1" to clipboard
sky_player: ^0.1.1 copied to clipboard

PlatformAndroid

A lightweight yet powerful video player plugin specializing in network streaming with fully customizable UI controls.

SkyPlayer #

Screenshot_20250818-191148_sky_player_example~2 Screenshot_20250818-191240_sky_player_example Screenshot_20250818-191359_sky_player_example

A lightweight, ExoPlayer-based video player plugin focused on network streaming with customizable UI controls, smart fullscreen behavior and a simple API.


Features ✅ #

  • 🌐 Network streaming — HLS (*.m3u8), MP4, WebM and other ExoPlayer-compatible sources.
  • 🎛️ Custom overlay UI — provide an overlayBuilder to fully control the controls/overlay.
  • 📱 Smart fullscreen / rotation — auto fullscreen on rotate and ability to open an external fullscreen player via controller.
  • 🔧 Runtime options — language, aspect mode and other player options available when creating the widget.
  • ⚙️ Controller API — helper methods like openFullScreenExternally and initLogger for runtime control and debugging.

Android Impeller note — if the player does not work on some Android devices, try disabling Impeller by adding to AndroidManifest.xml:

<meta-data
    android:name="io.flutter.embedding.android.EnableImpeller"
    android:value="false" />

Minimal usage #

1) Embedded inline player #

import 'package:sky_player/sky_player.dart';

Widget build(BuildContext context) {
  return AspectRatio(
    aspectRatio: 16 / 9,
    child: SkyPlayer.network(
      'https://example.com/video.m3u8',
      autoFullscreenOnRotate: true,
      language: SkyPlayerLanguages.en,
      aspectMode: SkyPlayerAspectMode.auto,
      // overlayBuilder: (context, state, controller) => yourCustomOverlay,
    ),
  );
}

Options shown

  • autoFullscreenOnRotate: true — tries to enter fullscreen when the device is rotated.
  • language: SkyPlayerLanguages.en — sets UI language of the player overlay.
  • aspectMode: SkyPlayerAspectMode.auto — controls how the video fits the widget.

2) Open external fullscreen from UI #

import 'package:flutter/material.dart';
import 'package:sky_player/sky_player.dart';

class FullscreenButton extends StatelessWidget {
  final String url;
  const FullscreenButton({required this.url, super.key});

  Future<void> _openFullScreen(BuildContext context) async {
    try {
      await SkyPlayerController().openFullScreenExternally(
        context,
        url: url,
      );
    } catch (e) {
      // Show a simple error to the user if fullscreen couldn't be opened
      if (context.mounted) {
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(content: Text('Failed to open fullscreen: $e')),
        );
      }
    }
  }

  @override
  Widget build(BuildContext context) {
    return ElevatedButton.icon(
      onPressed: () => _openFullScreen(context),
      icon: const Icon(Icons.fullscreen),
      label: const Text('Open fullscreen player'),
    );
  }
}

Notes

  • openFullScreenExternally is useful when you want the player to be presented by a route/hosted fullscreen UI outside your widget tree (mimics native fullscreen behavior).

API highlights #

SkyPlayer.network(String url, { ...options }) #

Create an inline player widget. Common options:

  • autoFullscreenOnRotate: bool — automatically enter fullscreen on device rotation.
  • language: SkyPlayerLanguages — UI language enum (e.g. SkyPlayerLanguages.en).
  • aspectMode: SkyPlayerAspectMode — aspect handling enum (e.g. auto, aspect_16_9).
  • overlayBuilder: Widget Function(BuildContext context, PlayerState state, SkyPlayerController controller)? — custom overlay builder for your own controls.
  • Other playback options (buffering hints, current position, etc.) available in the SkyPlayerController.

SkyPlayerController #

Controller utilities for runtime control:

  • SkyPlayerController.initLogger({bool isDebug = false}) Enable native logs for debugging (call in main() before runApp()).

  • SkyPlayerController().openFullScreenExternally(BuildContext context, { required String url }) Open a fullscreen player outside the current widget tree.

  • SkyPlayerController().closeFullscreenPlayerWithPop(BuildContext context) Close the fullscreen player.

0
likes
125
points
202
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight yet powerful video player plugin specializing in network streaming with fully customizable UI controls.

Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

audio_video_progress_bar, flutter, meta, plugin_platform_interface, rxdart

More

Packages that depend on sky_player

Packages that implement sky_player