platformCallHandler method

Future platformCallHandler(
  1. MethodCall call
)

Implementation

Future platformCallHandler(MethodCall call) async {
  switch (call.method) {
    case 'onPosition':
      Map<String, dynamic> res = json.decode(call.arguments);
      int _pos = res['currPos'];
      int _dur = res['duration'];
      if (positionHandler != null) {
        positionHandler(new Duration(milliseconds: _pos));
      } else {
        print("positionHandler为空");
      }
      if (durationHandler != null) {

        durationHandler(new Duration(milliseconds: _dur));
      }
      break;
    case 'completePlay':
      Map<String, dynamic> res = json.decode(call.arguments);
      String status = res['status'];

      if(playerHandler!= null){
        playerHandler(status);
      }else{
        print("playerHandler为空");
      }
      break;
    default:
      print('Unknowm method ${call.method} ');
  }
}