Closed Bug 1095185 Opened 10 years ago Closed 10 years ago

Soundcloud uses mozaudiochannel=content but does not play in background

Categories

(Firefox OS Graveyard :: AudioChannel, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Harald, Unassigned)

Details

Attachments

(3 files)

Discussed in bug 1084464. Soundcloud correctly initializes the audio channel to content but doesn't play in background. A simplified test case done by :dkuo worked as expected.
Randy was recommended by Dominic Kuo to investigate this.

2 ways to test this:
http://m.soundcloud.com/foofighters/everlong
https://marketplace.firefox.com/app/soundcloud

This is how they initialize their audio element:

  M = new Audio;
  M.mozAudioChannelType = 'content';
  M.addEventListener('play', L.onPlay, false);
  M.addEventListener('pause', L.onPause, false);
  M.addEventListener('ended', L.onFinish, false);
  M.addEventListener('error', L.onError, false);
  M.addEventListener('timeupdate', L.onTime, false);
  M.addEventListener('progress', L.onLoading, false);
  M.addEventListener('loadedmetadata', L.onLoading, false);
  M.addEventListener('canplay', L.onLoading, false)
Flags: needinfo?(rlin)
Did you add the audio-channel-content at permissions set in manifest.webapp?
You can refer to how does music application.
Flags: needinfo?(rlin) → needinfo?(hkirschner)
How to get the manifest for an app in Marketplace:
1. Go to the app page: https://marketplace.firefox.com/app/soundcloud
2. Inspect the Install button
3. Copy the manifest URL from the "data-manifest_url" attribute: http://soundcloud.com/manifest.webapp

In the case of Soundcloud, looking at the manifest you can see the audio-channel-content permission.
Flags: needinfo?(hkirschner) → needinfo?(rlin)
As reference, the manifest:

{
    "name": "SoundCloud",
    "default_locale": "en",
    "icons": {
        "24": "/images/logos/soundcloud_24.png",
        "48": "/images/logos/soundcloud_48.png",
        "16": "/images/logos/soundcloud_16.png",
        "32": "/images/logos/soundcloud_32.png",
        "56": "/images/logos/soundcloud_56.png",
        "40": "/images/logos/soundcloud_40.png",
        "64": "/images/logos/soundcloud_64.png",
        "128": "/images/logos/soundcloud_128.png"
    },
    "installs_allowed_from": [
        "*"
    ],
    "description": "Share Your Sounds",
    "version": "1.1.0",
    "permissions": {
        "audio-channel-content": {
            "description": "Use the audio channel for SoundCloud Mobile"
        }
    },
    "developer": {
        "url": "http://soundcloud.com",
        "name": "SoundCloud LTD"
    }
}
I set the break point on 
Breakpoint 1, mozilla::dom::HTMLMediaElement::SetMozAudioChannelType (this=this@entry=0xb3ce6790, aValue=mozilla::dom::Content, aRv=...) at ../../../../../../media/ssd/gecko_c2/dom/html/HTMLMediaElement.cpp:4184
4184	{
And I can't found this line called by sound cloud, but music application will.
Flags: needinfo?(rlin)
Hi, I checked your website and found there's 2 places to set mozAudioChannelType
https://gist.github.com/alivedise/5bd1e8b966dd2d862aa8

But neither of the two are run when testing on firefox.

Could you make sure it's really called?
The above screenshots prove that soundcloud *are* correctly settings the `audio.mozAudioChannelType` to 'content' and that it is being ignored. Reading back `audio.mozChannelType` returns 'normal'.

NOTE: Soundcloud are creating their `Audio` element on demand when the first song is played.
Flags: needinfo?(rlin)
Flags: needinfo?(alive)
This suggests that the requested "audio-channel-content" permission is not being respected.
Sounds platform issue. Clearing ni
Flags: needinfo?(alive)
Hey, I am an Engineer at SoundCloud working on this, let me know if I can do anything to fix that :)
(In reply to Yves Van Goethem from comment #12)
> Hey, I am an Engineer at SoundCloud working on this, let me know if I can do
> anything to fix that :)

Brilliant, great to have your support! My feeling is that this is a platform issue on our side, related to us not granting your app the correct permissions for some reason or another. I'm not a platform dev, but I'm hoping :rlin can shed some light on the matter :)
Attached file test app
I just had a test on today's 2.2 (master branch), 
It works well.
Flags: needinfo?(rlin)
(In reply to Randy Lin [:rlin] from comment #14)
> Created attachment 8529539 [details]
> test app
> 
> I just had a test on today's 2.2 (master branch), 
> It works well.

Myself, :dkuo and you have all managed to make working test apps both hosted and packaged. This does not solve Soundcloud's (or any other Marketplace app's) issue. I am yet to find an application on the Marketplace where background audio works.

I have gone as far as I can investigating this on the client-side. I need someone from Gecko to tell us WHY Soundcloud's app hasn't been granted the permission to use the 'content' audio channel.
Flags: needinfo?(rlin)
Hey folks,

I just updated the app, the manifest (and its location), and the marketplace. And I was able to get sound in the Firefox OS 2.0 emulator when the app is in background (Firefox Developer Edition).

That worked both as an installed hosted app, and the app in the browser. Would anybody be able to confirm that it works on an actual device? My test device is dead and on its way to the reseller…
I just did a fresh install of the Soundcloud app on 2 different devices and the sound continues playing even when the app is in background! So I confirmed it fixed it. Thanks for that!

Yves, can you give us more details about what you changed? I'm interested to know more.
Flags: needinfo?(yves.vangoethem)
Well, we just released a new mobile site. So I updated the manifest and changed its location as-well, it was previously served on soundcloud.com/manifest.webapp (it still exists is, I need to remove it), and is now served on m.soundcloud.com/manifest.webapp under the same domain as the app itself.
So either it was a x-origin issue, or we just got all a bit confused because we were running 3 apps in parallel and only one was benefiting from the mozaudiochannel=content…
Flags: needinfo?(yves.vangoethem)
I flash the flame 2.2 pvt build and install soundcloud app from market, it works well on background playing.
Flags: needinfo?(rlin)
Confirmed using SoundCloud on a Flame, 2.0 build.
Can we close this issue then? :)
(In reply to Yves Van Goethem from comment #21)
> Can we close this issue then? :)

Two things while I have you here:

1. Would it be possible to not prompt to 'download app' if the platform is not iOS or Android?
2. The new site doesn't seem to have a way to log-in and thus vastly limiting its use. Is that going to be built or is it intentionally left out?
Flags: needinfo?(yves.vangoethem)
1. If you touch the button on a Firefox OS device, it will install the web app, perhaps the wording could be changed on this platform.
2. It is a conscious design choice, and something we'll evaluate as we go with this new codebase :)

Thanks for your feedback!
Flags: needinfo?(yves.vangoethem)
(In reply to Yves Van Goethem from comment #23)
> 1. If you touch the button on a Firefox OS device, it will install the web
> app, perhaps the wording could be changed on this platform.
> 2. It is a conscious design choice, and something we'll evaluate as we go
> with this new codebase :)
> 
> Thanks for your feedback!

Good to know! Thanks very much for your help, I'm sure you've many people happy! :)
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: