-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
147 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 12 additions & 1 deletion
13
..._plugin/android/src/main/kotlin/live/hms/hms_video_plugin/extension/HMSResultExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
package live.hms.hms_video_plugin.extension | ||
package live.hms.hms_video_plugin | ||
|
||
class HMSResultExtension { | ||
companion object { | ||
fun toDictionary( | ||
success: Boolean, | ||
data: Any? = null, | ||
): HashMap<String, Any?> { | ||
val hashMap = HashMap<String, Any?>() | ||
hashMap["success"] = success | ||
hashMap["data"] = data | ||
return hashMap | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 46 additions & 9 deletions
55
packages/hmssdk_flutter/lib/src/model/hms_video_filter.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,72 @@ | ||
///Package imports | ||
Check notice on line 1 in packages/hmssdk_flutter/lib/src/model/hms_video_filter.dart GitHub Actions / check_buildDangling library doc comment.
|
||
import 'package:flutter/foundation.dart'; | ||
import 'package:hmssdk_flutter/hmssdk_flutter.dart'; | ||
|
||
///Project imports | ||
import 'package:hmssdk_flutter/src/common/platform_methods.dart'; | ||
import 'package:hmssdk_flutter/src/service/platform_service.dart'; | ||
|
||
///[HMSVideoFilter] is used to apply video effects like virtual background and blur | ||
abstract class HMSVideoFilter { | ||
static Future<void> enable({required Uint8List? image}) async { | ||
PlatformService.invokeMethod(PlatformMethod.enableVirtualBackground, | ||
static Future<HMSException?> enable({required Uint8List? image}) async { | ||
var result = await PlatformService.invokeMethod( | ||
PlatformMethod.enableVirtualBackground, | ||
arguments: {"image": image}); | ||
|
||
if (result != null) { | ||
return HMSException.fromMap(result["error"]); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
static Future<void> changeVirtualBackground( | ||
{required Uint8List? image}) async { | ||
PlatformService.invokeMethod(PlatformMethod.changeVirtualBackground, | ||
arguments: {"image": image}); | ||
return null; | ||
} | ||
|
||
static Future<bool> isSupported() async { | ||
var result = await PlatformService.invokeMethod( | ||
PlatformMethod.isVirtualBackgroundSupported); | ||
if (result["success"]) { | ||
return result["data"]; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
static Future<void> disable() async { | ||
PlatformService.invokeMethod(PlatformMethod.disableVirtualBackground); | ||
static Future<HMSException?> disable() async { | ||
var result = await PlatformService.invokeMethod( | ||
PlatformMethod.disableVirtualBackground); | ||
|
||
if (result != null) { | ||
return HMSException.fromMap(result["error"]); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
static Future<void> enableBlur({required int blurRadius}) async { | ||
static Future<HMSException?> enableBlur({required int blurRadius}) async { | ||
assert(blurRadius >= 0 && blurRadius <= 100, | ||
"blurRadius should be between 0 and 100, current value is $blurRadius"); | ||
PlatformService.invokeMethod(PlatformMethod.enableBlurBackground, | ||
var result = await PlatformService.invokeMethod( | ||
PlatformMethod.enableBlurBackground, | ||
arguments: {"blur_radius": blurRadius}); | ||
if (result != null) { | ||
return HMSException.fromMap(result["error"]); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
static Future<void> disableBlur() async { | ||
PlatformService.invokeMethod(PlatformMethod.disableBlurBackground); | ||
static Future<HMSException?> disableBlur() async { | ||
var result = await PlatformService.invokeMethod( | ||
PlatformMethod.disableBlurBackground); | ||
if (result != null) { | ||
return HMSException.fromMap(result["error"]); | ||
} else { | ||
return null; | ||
} | ||
} | ||
} |