mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-15 03:07:53 +02:00
feat: implement IPTV player screen for live, VOD, and series streams with integrated controls and state management.
This commit is contained in:
1 parent
bffef49554
commit
ee707d3cf9
5 files changed
+79
-104
No files matched your search
@@ -120,9 +120,14 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
||||
|
||||
final encodedUrl = Uri.encodeComponent(streamUrl);
|
||||
final streamTypeParam = widget.streamType == StreamType.live ? 'live' : 'vod';
|
||||
var playerSrc = playerSettings.playerType == PlayerType.lite
|
||||
? 'player_lite.html?url=$encodedUrl&type=$streamTypeParam'
|
||||
: 'player.html?url=$encodedUrl';
|
||||
|
||||
// Force player choice based on stream type:
|
||||
// - Live TV: Player Lite (simple TS playback with mpegts.js)
|
||||
// - VOD/Series: Player Standard (fuller controls, HLS support)
|
||||
final isLiveTV = widget.streamType == StreamType.live;
|
||||
var playerSrc = isLiveTV
|
||||
? 'player_lite.html?url=$encodedUrl&type=live'
|
||||
: 'player.html?url=$encodedUrl&type=vod';
|
||||
|
||||
if (startTimeOverride != null) {
|
||||
playerSrc += '&t=$startTimeOverride';
|
||||
@@ -271,10 +276,13 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
// Use stream type to determine player UI:
|
||||
// - Live TV: Lite player UI (minimal overlay)
|
||||
// - VOD/Series: Standard player UI (full controls)
|
||||
final isLiveTV = widget.streamType == StreamType.live;
|
||||
|
||||
// LITE PLAYER MODE: Simple iframe with native HTML5 controls, minimal Flutter overlay
|
||||
if (settings.playerType == PlayerType.lite) {
|
||||
// LITE PLAYER MODE for Live TV: Simple iframe with native HTML5 controls, minimal Flutter overlay
|
||||
if (isLiveTV) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: MouseRegion(
|
||||
|
||||
@@ -57,20 +57,18 @@ class XtreamService {
|
||||
_currentPlaylist = playlist;
|
||||
}
|
||||
|
||||
/// Generate stream URL for live TV via FFmpeg transcoding
|
||||
/// Generate stream URL for live TV
|
||||
///
|
||||
/// Returns the start URL for FFmpeg transcoding endpoint.
|
||||
/// The endpoint will start FFmpeg and return the local HLS URL.
|
||||
/// Returns the proxy URL for direct MPEG-TS streaming.
|
||||
/// Player will use mpegts.js for playback (no server-side transcoding).
|
||||
String getLiveStreamUrl(String streamId) {
|
||||
if (_currentPlaylist == null) throw Exception('No playlist configured');
|
||||
|
||||
// Use .ts format for direct MPEG-TS streaming (FFmpeg handles this better)
|
||||
// Direct .ts URL for MPEG-TS streaming
|
||||
final iptvUrl = '${_currentPlaylist!.dns}/live/${_currentPlaylist!.username}/${_currentPlaylist!.password}/$streamId.ts';
|
||||
|
||||
// Use FFmpeg transcoding endpoint
|
||||
final baseUrl = html.window.location.origin;
|
||||
final encodedUrl = Uri.encodeComponent(iptvUrl);
|
||||
return '$baseUrl/api/stream/$streamId?url=$encodedUrl';
|
||||
// Use proxy for direct streaming (no FFmpeg transcoding)
|
||||
return _wrapWithProxy(iptvUrl);
|
||||
}
|
||||
|
||||
/// Generate stream URL for VOD (movies)
|
||||
|
||||
@@ -34,26 +34,9 @@ class StreamingSettingsTab extends ConsumerWidget {
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Player Type Section
|
||||
_buildSectionCard(
|
||||
context: context,
|
||||
title: 'Lecteur Vidéo',
|
||||
icon: Icons.play_circle_outline,
|
||||
children: [
|
||||
_buildDropdownTile<PlayerType>(
|
||||
title: 'Type de lecteur',
|
||||
subtitle: 'Changer si vous rencontrez des problèmes de lecture',
|
||||
value: settings.playerType,
|
||||
items: PlayerType.values,
|
||||
onChanged: (v) => notifier.setPlayerType(v!),
|
||||
labelBuilder: (v) => switch (v) {
|
||||
PlayerType.standard => 'Standard (Avancé)',
|
||||
PlayerType.lite => 'Lite (Compatibilité max)',
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// Note: Player type is now automatically determined:
|
||||
// - Live TV uses Player Lite (MPEG-TS)
|
||||
// - Movies/Series use Player Standard
|
||||
|
||||
// Quality Section
|
||||
_buildSectionCard(
|
||||
|
||||
Reference in new issue
Block a user