webtiming / mediasync

MediaSync is a JavaScrpt library implementing timed playback of HTML5 audio/video, based on the TimingObject
6 stars 0 forks source link

audio tag doesn't work on mobile #1

Open getarobo opened 8 years ago

getarobo commented 8 years ago

Hi, I am using audio tag for sound and it doesn't seem to make sound on iphone/android. How would be able to make sound on mobiles phones?

Snarkdoof commented 8 years ago

The media elements (on Chrome and Safari at least) require a user generated event to allow the elements to play. You can typically do this by having the user click a play button and call the play() function in the handler. We've made a small function for this: MCorp.mediaNeedKick(the_element); It will return true if you need a user event - bind to a button and call the mediaNeedKick function again.

I also believe Firefox on Android allows you to play media without kicking it first, but the solution above works on all. Hope this helps!

Regards, N

getarobo commented 8 years ago

Great, it worked! also if possible can I ask you one more questions.

Audio is being too spiky what options do you recommend to play with to fix this issue?

something like sync every 5sec like this.

Thanks!

Snarkdoof commented 8 years ago

You can pass options to the media sync object, send {target:0.1} for example. Note that it will likely give you an echo, a better alternative would be using mp4 audio if you use iOS, or use Firefox on Android.

N On 18 Dec 2015 8:45 p.m., "Gene Han" notifications@github.com wrote:

Great, it worked! also if possible can I ask you one more questions.

Audio is being too spiky what options do you recommend to play with to fix this issue?

something like sync every 5sec like this.

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/webtiming/mediasync/issues/1#issuecomment-165880669.

getarobo commented 8 years ago

Unfortunately, we are using this for sound installation, so we don't really have control on what mobile browser they will use. We are sending out different parts of the song and trying to spatialize the space. So yeah little echo is kinda what we intended.(because of the distance, its 5mx5m closed space).

I believe "target" is how syncy the mediasync is hoping to be?

If thats the case I will continue to play this changing target. Thank you so much!

Snarkdoof commented 8 years ago

I see. Yes, the target is the range from "perfect" the MediaSync library accepts without adjusting, in seconds. Default is 0.03, or 30ms. You can also mute the audio until the sync event is reported as true, which will allow you to synchronise quite well with a sensible (but slow) start.

N

N On 18 Dec 2015 8:55 p.m., "Gene Han" notifications@github.com wrote:

Unfortunately, we are using this for sound installation, so we don't really have control on what mobile browser they will use. We are sending out different parts of the song and trying to spatialize the space. So yeah little echo is kinda what we intended.(because of the distance, its 5mx5m closed space).

I believe "target" is how syncy the mediasync is hoping to be?

If thats the case I will continue to play this changing target. Thank you so much!

— Reply to this email directly or view it on GitHub https://github.com/webtiming/mediasync/issues/1#issuecomment-165884058.

getarobo commented 8 years ago

Great, it worked out!

iOS doesn't support volume control, but worked on android. Thank you.

One more concern, festival is expecting 10k people and our installation we are expecting around 50 people using the app at the same time, do you think MotionCorporate timer can handle this? Wanted to provide timer from our server but couldn't find a document related to creating timer.

Thank you so much!! This project is really sweet.

Snarkdoof commented 8 years ago

50 people is no problem, but we do request you to have "synchronised by the motion corporation" visible as attribution. If you could give us some feedback on how it was used and how it worked, that would also be highly appreciated!

N On 18 Dec 2015 10:29 p.m., "Gene Han" notifications@github.com wrote:

Great, it worked out!

iOS doesn't support volume control, but worked on android. Thank you.

One more concern, festival is expecting 10k people and our installation we are expecting around 50 people using the app at the same time, do you think MotionCorporate timer can handle this? Wanted to provide timer from our server but couldn't find a document related to creating timer.

Thank you so much!! This project is really sweet.

— Reply to this email directly or view it on GitHub https://github.com/webtiming/mediasync/issues/1#issuecomment-165901739.

getarobo commented 8 years ago

For sure this a big festival expectint total of 30k, called dayfornight. we will tell how it went.

Somewhat out of context but relevant questions: Spike comes from when audio file isn't fully loaded from audio tag. Can't find a way to preload all the sound before triggering the sound on mobile devices. Using web audio api can resolve that but I believe mediasync doesn't work with web audio api.

Any workaround you might suggest will be greatly helpful.

Thanks Gene

Snarkdoof commented 8 years ago

You could try starting on the canplaythrough event, but I haven't really had much issues with that I think. Could be worth testing both mp4 audio and mp3, mobiles are a bit inconsistent still. Mp4 is likely better.

We have tried synchronising Web audio, but in particular on mobiles, it's still not usable due to unknown and very long latency.

Perhaps going for a more compressed format could give better results?

Also, do set the option remember:false while debugging, as it will otherwise try to avoid some detection phases.

N On 18 Dec 2015 11:48 p.m., "Gene Han" notifications@github.com wrote:

For sure this a big festival expectint total of 30k, called dayfornight. we will tell how it went.

Somewhat out of context but relevant questions: Spike comes from when audio file isn't fully loaded from audio tag. Can't find a way to preload all the sound before triggering the sound on mobile devices. Using web audio api can resolve that but I believe mediasync doesn't work with web audio api.

Any workaround you might suggest will be greatly helpful.

Thanks Gene

— Reply to this email directly or view it on GitHub https://github.com/webtiming/mediasync/issues/1#issuecomment-165914414.