5 Star 0 Fork 8

OpenHarmony-SIG/flutter_audio_session
Closed

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
audio_session_web.dart 1.10 KB
Copy Edit Raw Blame History
Ryan Heise authored 2021-01-22 22:18 +08:00 . Merge branch 'master' into nnbd
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}\'',
);
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony-sig/flutter_audio_session.git
git@gitee.com:openharmony-sig/flutter_audio_session.git
openharmony-sig
flutter_audio_session
flutter_audio_session
master

Search