diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 41cc7d8..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -## 0.0.1 - -* TODO: Describe initial release. diff --git a/implementation_complete.rst b/docs/implementation_complete.rst similarity index 100% rename from implementation_complete.rst rename to docs/implementation_complete.rst diff --git a/implementation_plan.rst b/docs/implementation_plan.rst similarity index 100% rename from implementation_plan.rst rename to docs/implementation_plan.rst diff --git a/troubleshooting.rst b/docs/troubleshooting.rst similarity index 100% rename from troubleshooting.rst rename to docs/troubleshooting.rst diff --git a/example/integration_test/plugin_integration_test.dart b/example/integration_test/plugin_integration_test.dart index ce10abc..15c0ce6 100644 --- a/example/integration_test/plugin_integration_test.dart +++ b/example/integration_test/plugin_integration_test.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/splash_video.dart b/lib/splash_video.dart index e5de5b4..315a35d 100644 --- a/lib/splash_video.dart +++ b/lib/splash_video.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/splash_video_controller.dart b/lib/splash_video_controller.dart index 45252ba..3ab5c45 100644 --- a/lib/splash_video_controller.dart +++ b/lib/splash_video_controller.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/utils.dart b/lib/utils.dart index 696921b..e173ffe 100644 --- a/lib/utils.dart +++ b/lib/utils.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/video_config.dart b/lib/video_config.dart index 8d3c4e7..3728273 100644 --- a/lib/video_config.dart +++ b/lib/video_config.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/video_source.dart b/lib/video_source.dart index 2d00f63..88676fc 100644 --- a/lib/video_source.dart +++ b/lib/video_source.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/widgets/splash_video_player_w.dart b/lib/widgets/splash_video_player_w.dart index d595912..a226fb4 100644 --- a/lib/widgets/splash_video_player_w.dart +++ b/lib/widgets/splash_video_player_w.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -98,9 +98,17 @@ class _SplashVideoPlayerState extends State { // Attach player to controller if provided widget.controller?.attach(player); - // Resolve hwdec: use provided value, or smart default for Windows - final resolvedHwdec = videoConfig.hwdec?.value - ?? (Platform.isWindows ? HwdecMode.autoSafe.value : null); + // Resolve hwdec: use provided value, or smart default per platform + final String? resolvedHwdec; + if (videoConfig.hwdec != null) { + resolvedHwdec = videoConfig.hwdec!.value; + } else if (Platform.isWindows) { + resolvedHwdec = HwdecMode.windowsAuto.value; + } else if (Platform.isLinux) { + resolvedHwdec = HwdecMode.linuxAuto.value; + } else { + resolvedHwdec = null; // Use platform default for macOS, iOS, Android + } // Create the VideoController with configuration controller = VideoController( diff --git a/readme.rst b/readme.rst deleted file mode 100644 index 0002892..0000000 --- a/readme.rst +++ /dev/null @@ -1,379 +0,0 @@ -============ -splash_video -============ - -A Flutter package for creating smooth video splash screens using media_kit. Provides seamless transitions from native splash screens to video playback with flexible overlay support and manual controls. - -Features -======== - -- ✨ **Smooth Transitions** - Defer first frame pattern prevents jank between native and video splash -- 🎬 **Media Kit Integration** - Cross-platform video playback with hardware acceleration -- 🎮 **Manual Controls** - Full controller access for play, pause, skip operations -- 🔄 **Looping Support** - Infinite video loops with user-controlled exit -- 📱 **Flexible Overlays** - Title, footer, and custom overlay widgets -- 🎯 **Auto-Navigation** - Automatic screen transitions or manual control -- 🎨 **Customizable** - Aspect ratio, fullscreen, volume, and more - -Installation -============ - -Add to your ``pubspec.yaml``: - -.. code-block:: yaml - - dependencies: - splash_video: ^0.0.1 - media_kit: ^1.2.6 - media_kit_video: ^2.0.1 - - # Platform-specific video libraries - media_kit_libs_android_video: any - media_kit_libs_ios_video: any - media_kit_libs_macos_video: any - media_kit_libs_windows_video: any - media_kit_libs_linux: any - -Quick Start -=========== - -1. Initialize in main() ------------------------ - -.. code-block:: dart - - import 'package:flutter/material.dart'; - import 'package:media_kit/media_kit.dart'; - import 'package:splash_video/splash_video.dart'; - - void main() { - WidgetsFlutterBinding.ensureInitialized(); - - // Initialize SplashVideo (handles MediaKit and defers first frame) - SplashVideo.initialize(); - - runApp(MyApp()); - } - -2. Basic Usage (Auto-Navigate) -------------------------------- - -.. code-block:: dart - - class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return MaterialApp( - home: SplashVideo( - source: AssetSource('assets/videos/splash.mp4'), - nextScreen: HomeScreen(), - backgroundColor: Colors.black, - ), - ); - } - } - -Usage Examples -============== - -Auto-Navigation ---------------- - -Video plays and automatically navigates to the next screen: - -.. code-block:: dart - - SplashVideo( - source: AssetSource('assets/videos/splash.mp4'), - nextScreen: HomeScreen(), - backgroundColor: Colors.black, - ) - -Manual Control --------------- - -Use a callback for custom logic after video completes: - -.. code-block:: dart - - SplashVideo( - source: AssetSource('assets/videos/splash.mp4'), - onVideoComplete: () { - // Custom logic - Navigator.pushReplacement( - context, - MaterialPageRoute(builder: (_) => HomeScreen()), - ); - }, - ) - -Looping Video with Controller ------------------------------- - -Create an infinite loop that the user can manually exit: - -.. code-block:: dart - - class MyScreen extends StatefulWidget { - @override - State createState() => _MyScreenState(); - } - - class _MyScreenState extends State { - late final SplashVideoController controller; - - @override - void initState() { - super.initState(); - controller = SplashVideoController(loopVideo: true); - } - - @override - void dispose() { - controller.dispose(); - super.dispose(); - } - - void _onSkip() { - controller.skip(); - Navigator.pushReplacement( - context, - MaterialPageRoute(builder: (_) => HomeScreen()), - ); - } - - @override - Widget build(BuildContext context) { - return SplashVideo( - source: AssetSource('assets/videos/splash.mp4'), - controller: controller, - footerWidget: ElevatedButton( - onPressed: _onSkip, - child: Text('Skip'), - ), - ); - } - } - -With Overlays -------------- - -Add title, footer, and custom overlays: - -.. code-block:: dart - - SplashVideo( - source: AssetSource('assets/videos/splash.mp4'), - nextScreen: HomeScreen(), - backgroundColor: Colors.black, - - // Title at top - titleWidget: Padding( - padding: EdgeInsets.all(20), - child: Text( - 'Welcome', - style: TextStyle(fontSize: 32, color: Colors.white), - ), - ), - - // Footer at bottom - footerWidget: CircularProgressIndicator(), - - // Custom overlay with full control - overlayBuilder: (context) => Positioned( - right: 20, - top: 100, - child: Text('v1.0.0', style: TextStyle(color: Colors.white)), - ), - ) - -Network Video -------------- - -Load video from URL: - -.. code-block:: dart - - SplashVideo( - source: NetworkFileSource('https://example.com/splash.mp4'), - nextScreen: HomeScreen(), - ) - -Custom Configuration --------------------- - -.. code-block:: dart - - SplashVideo( - source: AssetSource('assets/videos/splash.mp4'), - nextScreen: HomeScreen(), - videoConfig: VideoConfig( - playImmediately: true, - videoVisibilityEnum: VisibilityEnum.useAspectRatio, - useSafeArea: true, - volume: 50.0, - onPlayerInitialized: (player) { - print('Player ready: ${player.state.duration}'); - }, - ), - ) - -API Reference -============= - -SplashVideo ------------ - -Main widget for video splash screen. - -.. list-table:: - :header-rows: 1 - :widths: 20 25 10 45 - - * - Parameter - - Type - - Required - - Description - * - ``source`` - - ``Source`` - - ✅ - - Video source (Asset, Network, DeviceFile, Bytes) - * - ``controller`` - - ``SplashVideoController?`` - - ⚠️ - - Required when looping is enabled - * - ``videoConfig`` - - ``VideoConfig?`` - - ❌ - - Playback configuration - * - ``backgroundColor`` - - ``Color?`` - - ❌ - - Background color behind video - * - ``titleWidget`` - - ``Widget?`` - - ❌ - - Widget at top of screen - * - ``footerWidget`` - - ``Widget?`` - - ❌ - - Widget at bottom of screen - * - ``overlayBuilder`` - - ``Widget Function(BuildContext)?`` - - ❌ - - Custom overlay builder - * - ``nextScreen`` - - ``Widget?`` - - ❌ - - Screen to navigate to (auto-navigate) - * - ``onVideoComplete`` - - ``VoidCallback?`` - - ❌ - - Callback when video completes (manual control) - * - ``onSourceLoaded`` - - ``VoidCallback?`` - - ❌ - - Callback when video loads - -**Validation Rules:** - -- Cannot use both ``nextScreen`` and ``onVideoComplete`` -- Looping videos require ``controller`` and cannot use ``nextScreen`` or ``onVideoComplete`` - -SplashVideoController ---------------------- - -Controls video playback. - -.. code-block:: dart - - final controller = SplashVideoController(loopVideo: true); - - // Access media_kit Player - controller.player.play(); - controller.player.pause(); - controller.player.seek(Duration(seconds: 5)); - - // Controller methods - controller.play(); - controller.pause(); - controller.skip(); // Complete immediately - controller.dispose(); - -VideoConfig ------------ - -Configuration for video playback. - -.. code-block:: dart - - VideoConfig( - playImmediately: true, // Auto-play on load - videoVisibilityEnum: VisibilityEnum.useFullScreen, // Display mode - useSafeArea: false, // Wrap in SafeArea - volume: 100.0, // Volume (0-100) - onPlayerInitialized: (player) { }, // Player callback - ) - -Source Types ------------- - -.. code-block:: dart - - // Asset bundled with app - AssetSource('assets/videos/splash.mp4') - - // Network URL - NetworkFileSource('https://example.com/video.mp4') - - // Device file - DeviceFileSource('/path/to/video.mp4') - - // Raw bytes - BytesSource(videoBytes) - -VisibilityEnum --------------- - -.. code-block:: dart - - VisibilityEnum.useFullScreen // Fill entire screen - VisibilityEnum.useAspectRatio // Maintain aspect ratio - VisibilityEnum.none // No special sizing - -Lifecycle Methods -================= - -.. code-block:: dart - - // Defer first frame (prevents jank) - SplashVideo.initialize(); - - // Resume Flutter rendering - SplashVideo.resume(); - -Platform Support -================ - -.. list-table:: - :header-rows: 1 - - * - Platform - - Supported - * - Android - - ✅ - * - iOS - - ✅ - * - macOS - - ✅ - * - Windows - - ✅ - * - Linux - - ✅ - * - Web - - ✅ - -License -======= - -MIT License - see LICENSE file for details. diff --git a/test/splash_video_controller_test.dart b/test/splash_video_controller_test.dart index d8109a4..c119dee 100644 --- a/test/splash_video_controller_test.dart +++ b/test/splash_video_controller_test.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/test/splash_video_page_test.dart b/test/splash_video_page_test.dart index a94522c..2d4d082 100644 --- a/test/splash_video_page_test.dart +++ b/test/splash_video_page_test.dart @@ -1,7 +1,7 @@ // ignore_for_file: avoid_print /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/test/utils_test.dart b/test/utils_test.dart index 5ece79b..15a6a72 100644 --- a/test/utils_test.dart +++ b/test/utils_test.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/test/video_config_test.dart b/test/video_config_test.dart index af03460..0ad0968 100644 --- a/test/video_config_test.dart +++ b/test/video_config_test.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/test/video_source_test.dart b/test/video_source_test.dart index f315820..8b5bf10 100644 --- a/test/video_source_test.dart +++ b/test/video_source_test.dart @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 + * Copyright (c) 2026 Malloc LLC (malloc.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal