SkyPlayer
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
overlayBuilderto 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
openFullScreenExternallyandinitLoggerfor 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
openFullScreenExternallyis 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 inmain()beforerunApp()). -
SkyPlayerController().openFullScreenExternally(BuildContext context, { required String url })Open a fullscreen player outside the current widget tree. -
SkyPlayerController().closeFullscreenPlayerWithPop(BuildContext context)Close the fullscreen player.