Google Chromecast receiver doesn't play simultaneous audio - android

I'm developing a Chromecast application (receiver, HTML5 and Javascript) which communicates with an Android app, all is fine, but I have a problem trying to play two "sounds" at a time in the receiver.
It's a kind of game where I need to play a song at the beggining and play some sound effects during it.
Is this possible? And if it is anyone could help me to do it? I have tried it and it works nice in the browser but in the Chromecast only one of the "sound" is played, the song or the effect, never both.
Thank you very much

You cannot have more than one active Media Element in your DOM in chromecast. For what you want to do, however, you can use Web Audio APIs and accomplish the same for short audio files.

Related

How can I use an app (programming with Android Studio) to control the sound outputs of a device?

I would like to develop an app with which you can control the focus of individual sound outputs, so that you can, for example, play music with Spotify and at the same time play a video via Youtube, which then no longer has any sound. Is something like that even possible?
Thanks for an answer

How to disable audio capabilities for entire app

I have an app that plays videos using the video_player package. These videos have sound, but I don't want to play it. To achieve this, I use:
controller.setVolume(0.0)
The problem is whenever I open the app, even before playing a video, any background music stops.
I figure there must be a way to say "this app does not have sound capability" and then the OS won't pause any background music.
Is there a flutter specific way to do this, or should I look for iOS and Android specific solutions?
Thanks!

What are the differences between MediaPlayer, MediaSessionCompat and RemotePlaybackClient

I have been searching for days but I am still not able to understand how exactly these differ in functionality and what role does each of them play in Media Playback? It would be very helpful if someone can explain the difference.
how exactly these differ in functionality
That is akin to asking how a shovel, a hammer, and a piece of rope differ in functionality. While all can be considered tools, they are not really replacements for one another in most use cases.
what role does each of them play in Media Playback?
MediaPlayer plays media on the Android device (audio and video, from local or streaming sources).
RemotePlaybackClient directs some other piece of hardware to play media. The classic example of this is using RemotePlaybackClient to tell a Chromecast to play a video.
While I have not dealt with MediaSession (or MediaSessionCompat), it appears to tie your media playback logic with media controllers that live outside your app, such as a Notification.MediaStyle notification (to control media playback from the Android 5.0+ lockscreen), Android Auto, etc.

Is it possible to play/pause the current chromecast media stream by a generic Android app?

I can't find a way to do this. is it possible to control the media stream that is current playing on chromecast, like youtube, video app, music app, or whatever from a generic Android application?
I've tried many ways to do it, but I had no success. I'm able to join the chromecast while it's playing a video from youtube for example and get it's session id and some other info, but I can't play/pause the streaming. Is it possible to do it?
Thanks in advance.
It very much depends on the application that is running on the receiver; not all applications use the Media namespace (from the Cast SDK) for control; if they don't, you will not be able to do anything of the sort that you are trying to do. If they do, then you should be able to send control commands.

Play an HLS audio only stream on IOS and Android but keep audio controls

Here the short of it.
I'm using an HLS stream with JWPlayer6 for an iOS/Android app I am working on. JWPlayer http://www.longtailvideo.com/ works well and fallbacks to other streaming and player types gracefully. The problem is this, when I want to securely play back audio only in iOS the player is just a condensed black rectangle with a play icon in the middle if I click on the audio it plays fine but it launches the file in quicktime window, and the quicktime player window completely covers the app so you can't listen to the file and continue to use the app.
Is there any possible way to play an audio only stream that utilizes an actually embed-able player instead of the default mechanism of launching audio media types on iOS and Android.
I have already used JPlayer to achieve the functionality I want by placing the js/css player at the bottom of the app in a fixed position so that you can still browse the app while the file is being played, but this is only demo solution for my boss to show him how it would work, but in the end we will need a solution that can securely stream the audio with a player that lets you keep the controls in-app on the page rather than launching quicktime which even after playing the file does not return you to the apps other views.
Any suggestions would be greatly appreciated.
Lol...anyway finally figured out a solution that works for me in my particular case. Since the html side of things for our application resides in a webview on iOS, thanks to phonegap, I was able to do the following.
HTML5 inline video on iPhone vs iPad/Browser
and now the player finally plays inline just like the iPad. I tested this and it works flawlessly. I also tested it without added the obj-c flag in the app code and it does not work. This means the solution I've provided only works if you are packaging you application using html and obj-c like with phonegap or Titanium etc. This is EXACTLY what I was looking for. Now I can use all of jw's awesomeness and still play nice with iOS and give a great user experience to all of our members...thanks for you time and patience. As a side note the inline audio only player even works flawlessly with Android to write of of the box not java code needed to edit anything. Surprised me because I know how HLS is not really all that well supported yet on the Androids.

Categories

Resources