支持现场服务器地址配置
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/env/env_config.dart';
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
@@ -89,11 +90,11 @@ class _WebRTCMapPlayerState extends State<WebRTCMapPlayer> {
|
||||
await _peerConnection!.setLocalDescription(offer);
|
||||
|
||||
final uri = Uri.parse(widget.streamUrl.replaceFirst('webrtc://', 'http://'));
|
||||
final apiUrl = "http://${uri.host}:1985/rtc/v1/play/";
|
||||
final apiUrl = EnvConfig.webRtcPlayAddress(uri);
|
||||
final response = await http.post(
|
||||
Uri.parse(apiUrl),
|
||||
apiUrl,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: jsonEncode({"api": apiUrl, "streamurl": widget.streamUrl, "clientip": null, "sdp": offer.sdp}),
|
||||
body: jsonEncode({"api": apiUrl.toString(), "streamurl": widget.streamUrl, "clientip": null, "sdp": offer.sdp}),
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
|
||||
Reference in New Issue
Block a user