Skip to content
New issue

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

1.24-dev.6.8: No sound in Pop, Pop, Win #29810

Closed
ksdboasit opened this issue Jun 7, 2017 · 24 comments

Comments

@ksdboasit
Copy link

commented Jun 7, 2017

Summary:
In this build and every build in the 1.24-dev.6.x series. I get no sound when running Pop, Pop, Win! sample. This has been the case on Mac as well as Windows.

What steps will reproduce the problem?

  1. Download Pop, Pop, Win! from https://github.com/dart-lang/sample-pop_pop_win
  2. Open with WebStorm/IntelliJ
  3. Enable Dart support at set sdk and Dartium paths for your 1.24-dev.6.x version (and get dependancies)
  4. Run index.html

What is the expected output? What do you see instead?
Expected:
Pop, Pop, Win! runs normaly (with sounds).

Actual:
Pop, Pop, Win! runs, but without sound.

What version of the product are you using?
WebStorm 2017.1.3
Dart/Dartium 1.24-dev.6.0, 1.24-dev.6.5, 1.24-dev.6.8

On what operating system?
Windows 10 (64bit)
macOS Sierra

Please provide any additional information below.
Tried various combinations of old and new versions of the sdk and Dartium. The only relevant factor seems to be Dartium.

@mit-mit mit-mit added this to the 1.24 milestone Jun 7, 2017

@mit-mit

This comment has been minimized.

Copy link
Member

commented Jun 7, 2017

Tagging as potential 1.24 issue.

@mit-mit

This comment has been minimized.

Copy link
Member

commented Jun 7, 2017

@kevmoo @terrylucas regression?

@mit-mit mit-mit added the area-dartium label Jun 7, 2017

@kevmoo

This comment has been minimized.

Copy link
Member

commented Jun 7, 2017

"Sounds" like it... 🤣

@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 7, 2017

I'm using Dartium on Mac Sierra 10.12.5 and the sound is playing fine.

chrome://version is:

Chromium	50.0.2661.108 (Developer Build) (64-bit)
Revision	df716be7058f7fb88209c97cb8bbc55f2e6fbd75
OS	Mac OS X 
Blink	537.36 (@6a12f6f6f604ccd599cbbb875efaa640ef2ce68d)
JavaScript	V8 5.0.71.54
Dart	1.24.0-dev.6.8

Pulled down latest pop-pop-win and I'm hearing sound.

@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 7, 2017

I'll try it with WebStorm on Mac too.

ksdboasit can you try pub serve of pop-pop-win, launch Dartium and hit http://localhost:8080

@kevmoo

This comment has been minimized.

Copy link
Member

commented Jun 7, 2017

@ksdboasit

This comment has been minimized.

Copy link
Author

commented Jun 8, 2017

Alright, I got the sound working, but only when i launch Dartium separately. If it is launched with WebStorm or intelliJ, it still doesn't work.

@alexander-doroshko

This comment has been minimized.

Copy link

commented Jun 8, 2017

I have no idea about the reason, but I'm pretty sure that the issue won't arise with WebStorm 2017.2 EAP because since 2017.2 IDE redirects to a direct use of the Pub Server, without its internal proxy.

@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 8, 2017

This version of WebStorm 2017.1.3 works for me. I launched pop-pop-win in Dartium from WebStorm using Dart build 1.24.0-dev.6.8 here's my WebStorm about box version:

WebStorm 2017.1.3
Build #WS-171.4424.63, built on May 16, 2017
Licensed to Google

JRE: 1.8.0_112-release-736-b21 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.5
@kevmoo

This comment has been minimized.

Copy link
Member

commented Jun 8, 2017

@ksdboasit have you verified the version of Dartium being launched by the IDE? Could it be an old one. Check chrome://version

@ksdboasit

This comment has been minimized.

Copy link
Author

commented Jun 9, 2017

@kevmoo I have varified that it is the correct version being launched. It actually works fine, when I set the dartium path to an old version.

@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 9, 2017

@alexander-doroshko I've since updated my Mac, rebooted, and re-tried WebStorm EAP and 2017.1.3 and sound now does NOT play in Dartium when launched from WebStorm. However, Dartium 1.24.dev.6.8 with pub serve does work (sans WebStorm).

I've noticed this:

Launching same version of Dartium that WebStorm launched and using the same URL as WebStorm/Dartium is using DOES play sound (e.g., http://localhost:49921) below is the WebStorm pub serve window:

/Users/terry/dart-sdk/bin/pub serve web --port=49921
Loading source assets...
Loading test/pub_serve and dart_to_js_script_rewriter transformers...
Serving pop_pop_win web on http://localhost:49921
Build completed successfully

Here's how I launch my version of Chromium:

./Chromium --user-data-dir=out --disable-web-security
If I launch Dartium w/o the switch "--user-data-dir=out" I get no sound e.g.,

Likewise, if I use the URL in Run/Debug Configuration dialog is:

http://localhost:63342/pop_pop_win/sample-pop_pop_win/web/index.html?_ijt=a35amhh8gdeulji3fm1oc5bct2

with my launched Dartium and the switch "--user-data-dir=out" sound plays.

How is WebStorm starting up Dartium?

@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 9, 2017

If I set up command line switch for I think launching Dartium in WebStorm Preferences dialog to:

--user-data-dir=/Users/terry/dart-sdk/bin/dartium-mac-x64-dev-1.24.0-dev.6.8.0/Chromium.app/Contents/MacOS/out --disable-web-security

Still doesn't work (out is the location of the out directory when I launch my Dartium from the shell).

@alexander-doroshko

This comment has been minimized.

Copy link

commented Jun 9, 2017

Reproduced on Windows: no sound in dartium-win-ia32-dev-1.24.0-dev.6.8.0. Sound works in Chrome and in dartium-win-ia32-stable-1.23.0.0. I'll get back with more details shortly.

@alexander-doroshko

This comment has been minimized.

Copy link

commented Jun 9, 2017

I've found the cause!
WebStorm starts Dartium with one additional environment variable:

DART_FLAGS=--checked

and it causes the sound to fail. This option is not configurable inside WebStorm, Dartium is always started in checked mode. I patched WebStorm locally and can confirm that without this flag sound works.

So, is passing DART_FLAGS=--checked env var illegal now? I hope no.

@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 12, 2017

Siva

Running pop-pop-win with --checked plays no sound (with just Dartium outside of WebStorm).

Steps to repro:

Use a Macintosh

Get the pop-pop-win source and serve pop-pop-win:

> launch terminal
> mkdir pop-pop-win
> cd pop-pop-win
> git clone https://github.com/dart-lang/sample-pop_pop_win.git
> cd sample-pop_pop_pop-win
> pub serve

Set --checked flag:

> export DART_FLAGS=--checked

Run Dartium 50 from terminal:

> ./Chromium.app/Contents/MacOS/Chromium --user-data-dir=out --disable-web-security
Use the UR:   L http://localhost:8080

Click on the circle and you'll hear NO sound.

Turn off --checked:

> export DART_FLAGS=

then Run Dartium 50 from terminal:

Click on a circle and you'll hear sound.

The surprising thing - no warnings or errors are displayed in the console.

@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 12, 2017

I've looked at this and something is happening in the VM with checked mode but no errors or warnings are displayed. I've updated the bug and assigned to Siva. To give me some idea on what the VM is doing.

@bp74

This comment has been minimized.

Copy link

commented Jun 12, 2017

StageXL by default does not throw errors when loading an audio file failed. I did a quick look at the problem and the underlying error message (which you don't see) is this:

Failed to load packages/pop_pop_win/assets/audio/audio.ogg type 'JSObjectImpl' is not a subtype of type 'Future' of 'function result' where
JSObjectImpl is from dart:js
Future is from dart:async

This is in the StageXL package, i will try to find out what is going on here and i will keep you posted.

@bp74

This comment has been minimized.

Copy link

commented Jun 12, 2017

This line throws the error:
https://github.com/bp74/StageXL/blob/master/lib/src/media/implementation/web_audio_api_sound.dart#L20

type 'JSObjectImpl' is not a subtype of type 'Future' of 'function result' where
JSObjectImpl is from dart:js
Future is from dart:async

@bp74

This comment has been minimized.

Copy link

commented Jun 12, 2017

I'm sorry, the debugger was lying to me. The error is actually thrown in line 22.

https://github.com/bp74/StageXL/blob/master/lib/src/media/implementation/web_audio_api_sound.dart#L22

Here we try to decode the OGG file, with the Web Audio API to an AudioBuffer.

@bp74

This comment has been minimized.

Copy link

commented Jun 12, 2017

This is a small repro of the problem (please take the audio.ogg file from the Pop Pop Win repo, any other ogg file can be used too).

import 'dart:html';
import 'dart:async';
import 'dart:web_audio';
import 'dart:typed_data';

Future main() async {
  var audioContext = new AudioContext();
  var httpRequest = await HttpRequest.request("audio.ogg", responseType: 'arraybuffer');
  var audioData = httpRequest.response as ByteBuffer;
  var audioBuffer = await audioContext.decodeAudioData(audioData);
}
@kevmoo

This comment has been minimized.

Copy link
Member

commented Jun 12, 2017

Yup, @bp74 got the repo.

The issue seems to be here:

Future _decodeAudioData(ByteBuffer audioData,

The API returns a JS promise, but Dartium tries to turn it into a Future – which breaks in checked-mode.

This should be an easy fix & patch release for 1.24

Thanks so much for your help, @bp74 !!

@terrylucas terrylucas assigned terrylucas and unassigned a-siva Jun 12, 2017

@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 13, 2017

CL to fix this problem. This is the easiest solution more robust is to fix the PYTHON code that generates the Dartium file but its quite involved.

Thanks @bp74

terrylucas added a commit that referenced this issue Jun 13, 2017
Fix sound not playing in Dartium checked mode.
Checked mode failure with optional args and Promise missing convertNativePromiseToDartFuture calls.
Easiest solution is to emit proper code instead of re-plumbing the Dartium emitter for operations
with optional arguments that are Promises.

#29810

TBR=alanknight@google.com,kevmoo@google.com

Review-Url: https://codereview.chromium.org/2940543002 .
@terrylucas

This comment has been minimized.

Copy link
Member

commented Jun 13, 2017

Committed b3a9054

@terrylucas terrylucas closed this Jun 13, 2017

whesse added a commit that referenced this issue Jun 14, 2017
Fix sound not playing in Dartium checked mode.
Checked mode failure with optional args and Promise missing convertNativePromiseToDartFuture calls.
Easiest solution is to emit proper code instead of re-plumbing the Dartium emitter for operations
with optional arguments that are Promises.

#29810

TBR=alanknight@google.com,kevmoo@google.com

Review-Url: https://codereview.chromium.org/2940543002 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.