feat: Enable audio recording on web
This commit is contained in:
parent
ecd13b7efc
commit
299174c922
2 changed files with 5 additions and 9 deletions
|
|
@ -61,14 +61,10 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final codec = kIsWeb
|
final codec =
|
||||||
// Web seems to create webm instead of ogg when using opus encoder
|
!PlatformInfos
|
||||||
// which does not play on iOS right now. So we use wav for now:
|
.isIOS && // Blocked by https://github.com/llfbandit/record/issues/560
|
||||||
? AudioEncoder.wav
|
await audioRecorder.isEncoderSupported(AudioEncoder.opus)
|
||||||
// Everywhere else we use opus if supported by the platform:
|
|
||||||
: !PlatformInfos
|
|
||||||
.isIOS && // Blocked by https://github.com/llfbandit/record/issues/560
|
|
||||||
await audioRecorder.isEncoderSupported(AudioEncoder.opus)
|
|
||||||
? AudioEncoder.opus
|
? AudioEncoder.opus
|
||||||
: AudioEncoder.aacLc;
|
: AudioEncoder.aacLc;
|
||||||
fileName =
|
fileName =
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ abstract class PlatformInfos {
|
||||||
!PlatformInfos.isWindows && !PlatformInfos.isLinux;
|
!PlatformInfos.isWindows && !PlatformInfos.isLinux;
|
||||||
|
|
||||||
/// Web could also record in theory but currently only wav which is too large
|
/// Web could also record in theory but currently only wav which is too large
|
||||||
static bool get platformCanRecord => (isMobile || isMacOS);
|
static bool get platformCanRecord => (isMobile || isMacOS || isWeb);
|
||||||
|
|
||||||
static String get clientName =>
|
static String get clientName =>
|
||||||
'${AppSettings.applicationName.value} ${isWeb ? 'web' : Platform.operatingSystem}${kReleaseMode ? '' : 'Debug'}';
|
'${AppSettings.applicationName.value} ${isWeb ? 'web' : Platform.operatingSystem}${kReleaseMode ? '' : 'Debug'}';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue