restart static method
Restarts the local proxy server and recreates the download manager.
When the app returns from background, the OS may have killed TCP connections between the download manager (Dio) and the CDN. Simply restarting the server socket is not enough — the download manager's in-flight tasks and HTTP client hold stale connection state that can cause requests to hang. This method disposes the old download manager and creates a fresh one so that all subsequent requests use new connections.
Throws StateError if init has not been called yet.
Implementation
static Future<void> restart() async {
if (!_initialized) {
throw StateError('VideoProxy.init() must be called before restart()');
}
// Dispose stale download state (dead TCP connections, in-flight tasks)
// and recreate with a fresh Dio client.
downloadManager.dispose();
downloadManager = DownloadManager(_maxConcurrentDownloads);
await _localProxyServer.restart();
}