We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I wrote this method to get media time in Flutter, everything is fine on the web, but it gives me this error on other platforms.
code: Future<double> getWebDuration(Uint8List bytes, MediaType mediaType) async { final blob = Blob([bytes]); final url = Url.createObjectUrlFromBlob(blob); final audio = (mediaType == MediaType.video ? VideoElement() : AudioElement()) ..src = url ..autoplay = false; document.body?.append(audio); final duration = await Future(() { final completer = Completer<double>(); audio.onLoadedData.listen((event) { late final duration; if (isWeb) { duration = audio.duration; } Url.revokeObjectUrl(url); audio.remove(); completer.complete(duration.toDouble()); }); return completer.future; }); return duration; }
Future<double> getWebDuration(Uint8List bytes, MediaType mediaType) async { final blob = Blob([bytes]); final url = Url.createObjectUrlFromBlob(blob); final audio = (mediaType == MediaType.video ? VideoElement() : AudioElement()) ..src = url ..autoplay = false; document.body?.append(audio); final duration = await Future(() { final completer = Completer<double>(); audio.onLoadedData.listen((event) { late final duration; if (isWeb) { duration = audio.duration; } Url.revokeObjectUrl(url); audio.remove(); completer.complete(duration.toDouble()); }); return completer.future; }); return duration; }
lib/utils/file/media_duration.dart(25,26): error G4127D1E8: The getter 'duration' isn't defined for the class 'MediaElement'.
The text was updated successfully, but these errors were encountered:
Is that similar to this #86
Sorry, something went wrong.
No branches or pull requests
I wrote this method to get media time in Flutter, everything is fine on the web, but it gives me this error on other platforms.
code:
Future<double> getWebDuration(Uint8List bytes, MediaType mediaType) async { final blob = Blob([bytes]); final url = Url.createObjectUrlFromBlob(blob); final audio = (mediaType == MediaType.video ? VideoElement() : AudioElement()) ..src = url ..autoplay = false; document.body?.append(audio); final duration = await Future(() { final completer = Completer<double>(); audio.onLoadedData.listen((event) { late final duration; if (isWeb) { duration = audio.duration; } Url.revokeObjectUrl(url); audio.remove(); completer.complete(duration.toDouble()); }); return completer.future; }); return duration; }
lib/utils/file/media_duration.dart(25,26): error G4127D1E8: The getter 'duration' isn't defined for the class 'MediaElement'.
The text was updated successfully, but these errors were encountered: