Add web HTTP-FLV playback path

This commit is contained in:
2026-04-01 11:30:52 +08:00
parent 01b25883e1
commit 48dc6c7b26
11 changed files with 455 additions and 93 deletions

View File

@@ -4,8 +4,9 @@ import 'package:flutter/foundation.dart';
class SettingsProvider with ChangeNotifier {
// Use 10.0.2.2 for Android emulator to access host's localhost
static String get _defaultUrl => (defaultTargetPlatform == TargetPlatform.android && !kIsWeb)
? "http://10.0.2.2:8080"
static String get _defaultUrl =>
(defaultTargetPlatform == TargetPlatform.android && !kIsWeb)
? "http://10.0.2.2:8080"
: "http://localhost:8080";
String _baseUrl = _defaultUrl;
@@ -47,4 +48,12 @@ class SettingsProvider with ChangeNotifier {
final uri = Uri.parse(_baseUrl);
return "rtmp://${uri.host}:1935/live";
}
String playbackUrl(String roomId) {
final uri = Uri.parse(_baseUrl);
if (kIsWeb) {
return uri.replace(path: '/live/$roomId').toString();
}
return "$rtmpUrl/$roomId";
}
}