import 'dart:io'; import 'package:flutter/services.dart'; class ScreenStreamPlugin { static const _channel = MethodChannel('screen_stream'); static Future start(String playerInfoId, {String dialogMessage}) async { try { await _channel.invokeMethod('start', {'playerInfoId': playerInfoId, 'dialogMessage': dialogMessage}); return true; } catch (e) { return false; } } static Future stop() async { try { await _channel.invokeMethod('stop', []); return true; } catch (e) { return false; } } static Future checkPermission() async { if (Platform.isAndroid) { try { bool success = await _channel.invokeMethod('checkPermission', []); return success; } catch (e) { return false; } } else { return true; } } static Future requestPermission() async { if (Platform.isAndroid) { try { bool success = await _channel.invokeMethod('requestPermission', []); return success; } catch (e) { return false; } } else { return true; } } static Future processVideo(String path) async { try { Map result = await _channel.invokeMethod('processVideo', {'path': path}); if (result != null) { return result; } } catch (e) {} return null; } static Future getVideo(String playerInfoId) async { try { String result = await _channel.invokeMethod('getVideo', {'playerInfoId': playerInfoId}); return result; } catch (e) {} return null; } }