Phase 3 completed: Flutter MVP with live streaming and auto-refresh

This commit is contained in:
2026-03-18 11:07:21 +08:00
parent 1ca24b61a8
commit 8b0cdd4744
55 changed files with 3015 additions and 98 deletions

View File

@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
class SettingsProvider with ChangeNotifier {
// Default server address for local development.
// Using 10.0.2.2 for Android emulator or localhost for Desktop.
String _baseUrl = "http://localhost:8080";
String get baseUrl => _baseUrl;
SettingsProvider() {
_loadSettings();
}
void _loadSettings() async {
final prefs = await SharedPreferences.getInstance();
_baseUrl = prefs.getString('baseUrl') ?? _baseUrl;
notifyListeners();
}
void setBaseUrl(String url) async {
_baseUrl = url;
final prefs = await SharedPreferences.getInstance();
await prefs.setString('baseUrl', url);
notifyListeners();
}
// Also provide the RTMP URL based on the same hostname
String get rtmpUrl {
final uri = Uri.parse(_baseUrl);
return "rtmp://${uri.host}:1935/live";
}
}