Commit ddb060d6 authored by Alex Fandrianto's avatar Alex Fandrianto

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.
parent 7fb70ecc
...@@ -67,7 +67,7 @@ class SoundEffectStream { ...@@ -67,7 +67,7 @@ class SoundEffectStream {
class SoundEffectPlayer { class SoundEffectPlayer {
SoundEffectPlayer(int maxStreams) { SoundEffectPlayer(int maxStreams) {
MediaServiceProxy mediaService = new MediaServiceProxy.unbound(); MediaServiceProxy mediaService = new MediaServiceProxy.unbound();
shell.connectToService(null, mediaService); shell.connectToService("mojo:media_service", mediaService);
_soundPool = new SoundPoolProxy.unbound(); _soundPool = new SoundPoolProxy.unbound();
mediaService.ptr.createSoundPool(_soundPool, maxStreams); mediaService.ptr.createSoundPool(_soundPool, maxStreams);
} }
...@@ -146,7 +146,7 @@ class SoundTrackPlayer { ...@@ -146,7 +146,7 @@ class SoundTrackPlayer {
SoundTrackPlayer() { SoundTrackPlayer() {
_mediaService = new MediaServiceProxy.unbound(); _mediaService = new MediaServiceProxy.unbound();
shell.connectToService(null, _mediaService); shell.connectToService("mojo:media_service", _mediaService);
} }
MediaServiceProxy _mediaService; MediaServiceProxy _mediaService;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment