From ddb060d6851ec3bf8bd2867a474936fa5d566a83 Mon Sep 17 00:00:00 2001 From: Alex Fandrianto Date: Mon, 11 Jan 2016 18:13:50 -0800 Subject: [PATCH 1/2] Add reference to "mojo:media_service" in sound.dart Related: https://github.com/domokit/mojo/issues/614 Flutter can play sounds using this package. However, when Mojo Shell is running Flutter, it lacks the necessary media service. This patch creates a hook to the mojo binary `media_service.mojo`. If Mojo Shell is built with this media service, then it will be able to play sounds when running Flutter. --- packages/flutter_sprites/lib/src/sound.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flutter_sprites/lib/src/sound.dart b/packages/flutter_sprites/lib/src/sound.dart index f3b748e13f6..76395b0d6f0 100644 --- a/packages/flutter_sprites/lib/src/sound.dart +++ b/packages/flutter_sprites/lib/src/sound.dart @@ -67,7 +67,7 @@ class SoundEffectStream { class SoundEffectPlayer { SoundEffectPlayer(int maxStreams) { MediaServiceProxy mediaService = new MediaServiceProxy.unbound(); - shell.connectToService(null, mediaService); + shell.connectToService("mojo:media_service", mediaService); _soundPool = new SoundPoolProxy.unbound(); mediaService.ptr.createSoundPool(_soundPool, maxStreams); } @@ -146,7 +146,7 @@ class SoundTrackPlayer { SoundTrackPlayer() { _mediaService = new MediaServiceProxy.unbound(); - shell.connectToService(null, _mediaService); + shell.connectToService("mojo:media_service", _mediaService); } MediaServiceProxy _mediaService; From 9bf16fbd6a81e5be46321dbd7f3e4e6a2f6b48f3 Mon Sep 17 00:00:00 2001 From: Alex Fandrianto Date: Mon, 11 Jan 2016 18:53:32 -0800 Subject: [PATCH 2/2] Also update piano.dart --- examples/widgets/piano.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/widgets/piano.dart b/examples/widgets/piano.dart index 155fdf98343..02e914f7f9b 100644 --- a/examples/widgets/piano.dart +++ b/examples/widgets/piano.dart @@ -64,7 +64,7 @@ class PianoApp extends StatelessComponent { Future loadSounds() async { MediaServiceProxy mediaService = new MediaServiceProxy.unbound(); try { - shell.connectToService(null, mediaService); + shell.connectToService("mojo:media_service", mediaService); List> pending = >[]; for (PianoKey key in keys) pending.add(key.load(mediaService));