manager.dart 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. part of '../ijkplayer.dart';
  2. /// create 2019/3/18 by cai
  3. ///
  4. class IjkManager {
  5. /// For the hot reload/ hot restart to release last texture resource. Release version does not have hot reload, so you can not call it.
  6. ///
  7. /// release版本可不调用, 主要是为了释放hot restart/hot reload的资源,因为原生资源不参与热重载
  8. ///
  9. ///
  10. /// If this method is not invoked in the debug version, the sound before the hot reload will continue to play.
  11. static Future<void> initIJKPlayer() async {
  12. await _globalChannel.invokeMethod("init");
  13. }
  14. /// set system volume
  15. static Future<void> setSystemVolume(int volume) async {
  16. await _globalChannel.invokeMethod("setSystemVolume", {
  17. "volume": volume,
  18. });
  19. }
  20. /// get system volume
  21. static Future<int> getSystemVolume() async {
  22. return _globalChannel.invokeMethod("getSystemVolume");
  23. }
  24. static Future<int> systemVolumeUp() async {
  25. return _globalChannel.invokeMethod("volumeUp");
  26. }
  27. static Future<int> systemVolumeDown() async {
  28. return _globalChannel.invokeMethod("volumeDown");
  29. }
  30. static Future<void> hideSystemVolumeBar() async {
  31. if (Platform.isIOS) {
  32. return _globalChannel.invokeMethod("hideSystemVolumeBar");
  33. }
  34. }
  35. static Future<void> setSystemBrightness(double brightness) async {
  36. await _globalChannel.invokeMethod("setSystemBrightness", <String, dynamic>{
  37. "brightness": brightness,
  38. });
  39. }
  40. static Future<double> getSystemBrightness() async {
  41. return _globalChannel.invokeMethod("getSystemBrightness");
  42. }
  43. static Future<void> resetBrightness() async {
  44. await _globalChannel.invokeMethod("resetBrightness");
  45. }
  46. }