2020-04-20 11:24:40 +00:00
|
|
|
import 'package:comunic/helpers/websocket_helper.dart';
|
2020-04-20 11:43:17 +00:00
|
|
|
import 'package:comunic/models/call_config.dart';
|
2020-04-20 11:24:40 +00:00
|
|
|
|
|
|
|
/// Calls helper
|
|
|
|
///
|
|
|
|
/// @author Pierre Hubert
|
|
|
|
|
|
|
|
class CallsHelper {
|
|
|
|
/// Join a call
|
|
|
|
static Future<void> join(int convID) async =>
|
2020-04-20 11:43:17 +00:00
|
|
|
await ws("calls/join", {"convID": convID});
|
2020-04-20 11:24:40 +00:00
|
|
|
|
|
|
|
/// Leave a call
|
|
|
|
static Future<void> leave(int convID) async =>
|
2020-04-20 11:43:17 +00:00
|
|
|
await ws("calls/leave", {"convID": convID});
|
|
|
|
|
|
|
|
/// Get calls configuration
|
|
|
|
static Future<CallConfig> getConfig() async {
|
|
|
|
final response = await ws("calls/config", {});
|
|
|
|
return CallConfig(
|
|
|
|
iceServers: response["iceServers"].cast<String>(),
|
|
|
|
);
|
|
|
|
}
|
2020-04-20 11:24:40 +00:00
|
|
|
}
|