VD Flutter Player SDK

Configurable Flutter video player SDK ported from the Swift iOS player package.

Recommended production toolchain: Flutter stable 3.41.5 or newer. This package was scaffolded and verified locally with Flutter 3.22.2, so it keeps a compatible lower bound while allowing newer stable SDKs.

Features

  • HLS playback with configurable request headers and playback User-Agent.
  • Manifest parsing for quality variants, subtitles, audio tracks, key moments, and thumbnail VTT references.
  • WebVTT subtitles with auto-select policy and optional persisted language preference.
  • Seek-bar thumbnail previews from sprite VTT files.
  • Custom player controls: play/pause, rewind/forward, seek, fullscreen orientation, speed, captions, quality, key moments.
  • Analytics events and host callbacks for playback, seeking, buffering, quality, subtitles, speed, errors, watch history, and dismissal.
  • Feature flags for Chromecast, AirPlay, Picture in Picture, screen-capture protection, thumbnails, key moments, fullscreen, wakelock, and selections.
  • Native method-channel hooks for Android secure screen, Android PiP, orientation requests, and no-crash iOS placeholders where Flutter/video_player owns the native player layer.

Usage

import 'package:vd_flutter_player_sdk/vd_flutter_player_sdk.dart';

VdPlayerView(
  configuration: VdPlayerConfiguration(
    title: 'Course Video',
    videoUrl: Uri.parse('https://example.com/master.m3u8'),
    videoId: 'course-001',
    headersProvider: () => {'Authorization': 'Bearer token'},
    subtitlePreferenceKey: 'last_subtitle_language',
    analyticsHandler: (event) {
      debugPrint('${event.name}: ${event.parameters}');
    },
    callbacks: VdPlayerCallbacks(
      onWatchPosition: (position) {
        // Persist watch history.
      },
      onQualityChanged: (quality) {
        // Track quality change.
      },
    ),
  ),
)

See /Users/ragavendra/Documents/flutter_workplace/vd-flutter-player-example for a standalone app that consumes this package by local path.

Platform Notes

  • Android screen-capture protection uses FLAG_SECURE.
  • Android Picture-in-Picture requires every host app to add android:supportsPictureInPicture="true" and android:resizeableActivity="true" to its launcher Activity.
  • iOS has no public app-wide FLAG_SECURE equivalent. Use screenCaptureBuilder for host-provided masking, matching the Swift SDK's configurable factory pattern.
  • The package exposes Chromecast/AirPlay/PiP feature flags and method-channel hooks. Full Chromecast device discovery/session UI should be completed with the receiver app ID and Google Cast native SDK integration for each target app.