更新 AndroidManifest.xml 以启用明文流量;在 index.html 中替换 token 值
增强 WebviewPage 的清理和导航功能。
This commit is contained in:
@@ -4,8 +4,8 @@ import 'package:recording_tool/shared/widgets/app_bar.dart';
|
||||
|
||||
class PushSteamTestWidget extends StatefulWidget {
|
||||
const PushSteamTestWidget({super.key});
|
||||
|
||||
final String rtmpUrl = 'rtmp://192.168.1.245:19090/live/2026-07-07';
|
||||
final String steamKey = '20260708';
|
||||
final String rtmpUrl = 'rtmp://192.168.1.180:19090/live/';
|
||||
|
||||
@override
|
||||
State<PushSteamTestWidget> createState() => _PushSteamTestWidgetState();
|
||||
@@ -37,7 +37,11 @@ class _PushSteamTestWidgetState extends State<PushSteamTestWidget>
|
||||
setState(() => _isStreaming = false);
|
||||
debugPrint('推流失败: $reason');
|
||||
},
|
||||
onDisconnection: () => setState(() => _isStreaming = false),
|
||||
onDisconnection: () => {
|
||||
debugPrint('推流断开'),
|
||||
|
||||
setState(() => _isStreaming = false),
|
||||
},
|
||||
);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _initialize());
|
||||
}
|
||||
@@ -55,13 +59,17 @@ class _PushSteamTestWidgetState extends State<PushSteamTestWidget>
|
||||
|
||||
// 把服务端下发的完整 rtmp:// 地址拆成 "服务器地址" + "streamKey" 两部分
|
||||
Future<void> _startPush() async {
|
||||
final uri = Uri.parse(widget.rtmpUrl);
|
||||
final streamKey = uri.pathSegments.last;
|
||||
final baseUrl = widget.rtmpUrl.substring(
|
||||
0,
|
||||
widget.rtmpUrl.lastIndexOf(streamKey),
|
||||
);
|
||||
await _controller.startStreaming(streamKey: streamKey, url: baseUrl);
|
||||
// final uri = Uri.parse(widget.rtmpUrl);
|
||||
final streamKey = widget.steamKey;
|
||||
// final streamKey =
|
||||
// '${DateTime.timestamp()}-${Random(1000).nextInt(1000).toString()}';
|
||||
|
||||
// debugPrint('streamKey- $streamKey ');
|
||||
// final baseUrl = widget.rtmpUrl.substring(
|
||||
// 0,
|
||||
// widget.rtmpUrl.lastIndexOf(streamKey),
|
||||
// );
|
||||
await _controller.startStreaming(streamKey: streamKey, url: widget.rtmpUrl);
|
||||
}
|
||||
|
||||
Future<void> _stopPush() => _controller.stopStreaming();
|
||||
|
||||
@@ -39,10 +39,12 @@ class _AuthPageWidgetState extends State<ScanQrCodePage> {
|
||||
final result = await AppQrScannerDialog.show(context);
|
||||
if (result == null || result.isEmpty) return;
|
||||
debugPrint('扫码结果: $result');
|
||||
// AppNavigator.push(
|
||||
// const WebviewPage(url: 'https://www.dronex.cc/'),
|
||||
// );
|
||||
AppNavigator.push(const PushSteamTestWidget());
|
||||
Future.delayed(const Duration(milliseconds: 1)).then((_) {
|
||||
AppNavigator.push(PushSteamTestWidget());
|
||||
// AppNavigator.push(
|
||||
// const WebviewPage(url: 'https://www.dronex.cc/'),
|
||||
// );
|
||||
});
|
||||
},
|
||||
variant: AppButtonVariant.secondary,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user