Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
877 stars 573 forks source link

[BUG]: [WEB] example is not working #694

Open Fraa-124 opened 3 years ago

Fraa-124 commented 3 years ago

Flutter Sound Version : master branch


Severity

Crash


Platforms you faced the error

Flutter web, chrome on MacOS


Describe the bug When I go to 'Simple recorder' to test the mic, an error araise, and when I click 'Record', a popup is shown asking for permissions to use the mic, when I click Allow, the chrome instance closes

To Reproduce Steps to reproduce the behavior:

  1. Go to 'SimpleRecorder' the error araise
  2. Click 'Record'
  3. Allow permission
  4. App crash

Logs!!!!

flutter_sound_player_web.dart:218 Uncaught (in promise) TypeError: dart.global.newPlayerInstance is not a function at flutter_sound_player_web.FlutterSoundPlayerWeb.new.openPlayer (flutter_sound_player_web.dart:218) at openPlayer.next () at runBody (async_patch.dart:84) at Object._async [as async] (async_patch.dart:123) at flutter_sound_player_web.FlutterSoundPlayerWeb.new.openPlayer (flutter_sound_player_web.dart:205) at flutter_sound_player.FlutterSoundPlayer.new._openAudioSession (flutter_sound_player.dart:664) at _openAudioSession.next () at async_patch.dart:45 at _RootZone.runUnary (zone.dart:1613) at _FutureListener.thenAwait.handleValue (future_impl.dart:155) at handleValueCallback (future_impl.dart:707) at Function._propagateToListeners (future_impl.dart:736) at async._AsyncCallbackEntry.new.callback (future_impl.dart:406) at Object._microtaskLoop (schedule_microtask.dart:40) at _startMicrotaskLoop (schedule_microtask.dart:49) at async_patch.dart:166


koyinusa commented 3 years ago

Please can anyone help. The app keeps crashing after allowing permission. I have been testing with Chrome browser on desktop - [WEB]

koyinusa commented 3 years ago

@Fraa-124 Any luck getting this to work

Larpoux commented 3 years ago

Are you sure to have included the following lines in the header of your index.html ?

  <script src="https://cdn.jsdelivr.net/npm/tau_sound_core@8/js/flutter_sound/flutter_sound.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/tau_sound_core@8/js/flutter_sound/flutter_sound_player.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/tau_sound_core@8/js/flutter_sound/flutter_sound_recorder.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/howler@2/dist/howler.min.js"></script>

Your bug arrives when Javascript do not find the Flutter Sound code

Larpoux commented 3 years ago

I am currently working on Flutter Sound V9. I hope to improve Flutter Sound on web. I really want that Flutter Sound on Web to be as good as the iOS/Android version.

For example :

koyinusa commented 3 years ago

Yes, I have these added those.

Larpoux commented 3 years ago

Can you look to the Console tab of the Developer Tools on Chrome ?

Actually I get same error than you because :

Access to XMLHttpRequest at 'https://tau.canardoux.xyz/web_example/assets/extract/02-opus.webm' from origin 
'http://localhost:52829' has been blocked by CORS policy: 
No 'Access-Control-Allow-Origin' header is present on the requested resource.

The CORS policy is very painful !!!

koyinusa commented 3 years ago

Could it be CORS? This issue happened with the recorder. I am not trying to play the audio or anything like that.

Larpoux commented 3 years ago

No. If I understand correctly, CORS is a protection when we want to access an asset in another domain.

The recorder is supposed to record to a memory temporary URL. So, your problem is not CORS.

Actually, it seems that I have myself problems with the demo examples. I will post you something when I will have understood what is happening.

koyinusa commented 3 years ago

Thanks @Larpoux Please let me know if you find anything

Larpoux commented 3 years ago

I need the log that you get in the Console tab of your Developer Tools of Chrome.

Larpoux commented 3 years ago

OK @koyinusa , The demo example works fine on my machine, now. IT is black magic.

Please send the Chrome logs that you get in the Console tab.

github-actions[bot] commented 11 months ago

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.