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