channelMethodCallHandler method
Implementation
Future<dynamic>? channelMethodCallHandler(MethodCall call)
{
TauPlayerCallback aPlayer = getSession(call.arguments!['slotNo'] as int);
Map arg = call.arguments ;
bool success = call.arguments['success'] != null ? call.arguments['success'] as bool : false;
if (arg['state'] != null)
aPlayer.updatePlaybackState(arg['state']);
switch (call.method)
{
case "updateProgress":
{
aPlayer.updateProgress(duration: arg['duration'], position: arg['position']);
}
break;
case "needSomeFood":
{
aPlayer.needSomeFood(arg['arg']);
}
break;
case "audioPlayerFinishedPlaying":
{
aPlayer.audioPlayerFinished(arg['arg']);
}
break;
case 'pause': // Pause/Resume
{
aPlayer.pauseCallback(arg['arg']);
}
break;
case 'resume': // Pause/Resume
{
aPlayer.resumeCallback(arg['arg']);
}
break;
case 'skipForward':
{
aPlayer.skipForward(arg['arg']);
}
break;
case 'skipBackward':
{
aPlayer.skipBackward(arg['arg']);
}
break;
case 'updatePlaybackState':
{
aPlayer.updatePlaybackState(arg['arg']);
}
break;
case 'openPlayerCompleted':
{
aPlayer.openPlayerCompleted(call.arguments['state'] , success);
}
break;
case 'startPlayerCompleted':
{
int duration = arg['duration'] as int;
aPlayer.startPlayerCompleted(call.arguments['state'], success, duration);
}
break;
case "stopPlayerCompleted":
{
aPlayer.stopPlayerCompleted(call.arguments['state'] , success);
}
break;
case "pausePlayerCompleted":
{
aPlayer.pausePlayerCompleted(call.arguments['state'] , success);
}
break;
case "resumePlayerCompleted":
{
aPlayer.resumePlayerCompleted(call.arguments['state'] , success);
}
break;
case "closePlayerCompleted":
{
aPlayer.closePlayerCompleted(call.arguments['state'], success );
}
break;
case "log":
{
aPlayer.log(Level.values[call.arguments['level']], call.arguments['msg']);
}
break;
default:
throw ArgumentError('Unknown method ${call.method}');
}
return null;
}