-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove js_bindings and use the built-in AudioContext for js inte…
…rop. (#342) * fix: remove js_bindings and use the built-in AudioContext for js interop. * import sorter. * remove eva_icons_flutter to fix web app compile. * update.
- Loading branch information
1 parent
2e8dd4e
commit a5a98ee
Showing
9 changed files
with
114 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2023 LiveKit, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import 'dart:js_util' as jsutil; | ||
|
||
import 'package:js/js.dart'; | ||
|
||
@JS() | ||
external dynamic get undefined; | ||
|
||
enum AudioContextState { | ||
suspended('suspended'), | ||
running('running'), | ||
closed('closed'); | ||
|
||
final String value; | ||
static AudioContextState fromValue(String value) => | ||
values.firstWhere((e) => e.value == value); | ||
static Iterable<AudioContextState> fromValues(Iterable<String> values) => | ||
values.map(fromValue); | ||
const AudioContextState(this.value); | ||
} | ||
|
||
@anonymous | ||
@JS() | ||
@staticInterop | ||
class AudioContextOptions { | ||
external factory AudioContextOptions( | ||
{dynamic latencyHint, double? sampleRate}); | ||
} | ||
|
||
@JS() | ||
@staticInterop | ||
class AudioContext { | ||
external factory AudioContext._([AudioContextOptions? contextOptions]); | ||
|
||
factory AudioContext([AudioContextOptions? contextOptions]) => | ||
AudioContext._(contextOptions ?? undefined); | ||
} | ||
|
||
extension PropsBaseAudioContext on AudioContext { | ||
AudioContextState get state => | ||
AudioContextState.fromValue(jsutil.getProperty(this, 'state')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.