Add web HTTP-FLV playback path
This commit is contained in:
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user