Fetch the repository succeeded.
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
/// A web implementation of the AudioSession plugin.
class AudioSessionWeb {
static void registerWith(Registrar registrar) {
AudioSessionWeb(registrar);
}
final MethodChannel _channel;
dynamic _configuration;
AudioSessionWeb(Registrar registrar)
: _channel = MethodChannel(
'com.ryanheise.audio_session',
const StandardMethodCodec(),
registrar,
) {
_channel.setMethodCallHandler(handleMethodCall);
}
Future<dynamic> handleMethodCall(MethodCall call) async {
final args = call.arguments;
switch (call.method) {
case 'setConfiguration':
_configuration = args[0];
_channel.invokeMethod('onConfigurationChanged', [_configuration]);
break;
case 'getConfiguration':
return _configuration;
default:
throw PlatformException(
code: 'Unimplemented',
details:
'audio_session for web doesn\'t implement \'${call.method}\'',
);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。