HTML5 Multi Track Sync Video Audio on IOS - html

I'm looking for a way to multitrack a video with a bunch of sounds.
IOS prevent multiple audio and video to play at the same time.
I found a way on IOS, to launch a sound and an audio by putting the video.play() command in a setTimout (500ms). But this don't works every time, and the medias are not sync. This is not code consistent and maybe apple will correct this on breach on next version of iOS
MediaGroup and MediaController seem supported on iOS but not work properly.
AudioTrack was implemented on some navigators and seem to be removed
What is the alternative?
I've already tried those:
//gingertech.net/2011/05/01/html5-multi-track-audio-or-video/
//blog.denivip.ru/index.php/2013/10/alternative-audio-tracks-in-html5-video/?lang=en
//ldki.blogspot.ca/2012/11/15-html5-video-player-sync-second-audio.html

Related

Only one video is playing simultaneously on Safari (Mac)

I used Simple Peer(WebRTC), ReactJS for my video call service. In the video call screen, I used 2 video tags(contact video and user video) for video playback. When the call gets started after a successful connection, only the contact video is getting played(1st video tag) and when the contact turns off their video user video is getting played(2nd video tag).
This only happens on Safari(I only tested on Mac). It works fine in other browsers(Google Chrome, Firefox).
Is there a way to fix this issue?
WebRTC depends a lot on browsers and Safari has specific requirements (like strict order of tracks). Check JS console to identify any errors.
You can experiment with a turnkey html5 videocall solution that works and try to replicate.

HTML5 audio with HLS streaming with DVR timeshift on Samsung Internet

i am trying to make a web based streaming player (http://srv.deutschlandradio.de/themes/streamplayer/index.html) work for Samsung Internet (Samsung's Android stock browser), without success.
The stream plays, but I am unable to control it's position. It seems that Samsung's browser supports basic HLS streaming, but no seeking (nor live playing) of streams with DVR (DVR functionality allows viewers to pause, play, and rewind live streams for a certain time).
For example, audioElement.currentTime always returns 0, and changing it's value, it switches back to 0 every time.
This works fine on other browsers (as documented here: https://www.w3schools.com/tags/av_prop_currenttime.asp).
Is there any documentation on streaming support with DVR window for Samsung Internet?
I am asking Samsung directly at the same time, but as Peter O'Shaughnessy suggests I am posting it here. I still hope I am not the only one who tried to implement this on StackOverflow... Maybe there are some workarounds? MediaSourceExtensions are not supported either, as it seems.
Thanks!
The samsung browser, known as "Samsung Internet", does not seem to support MediaSource Extensions, see this thread for more details: https://github.com/SamsungInternet/support/issues/5
It behaves exactly as chrome without MediaSource extensions.

Auto play html5 video on mobile browser

It is argued that html5 video cannot be automatically payed in mobile browsers.
However, I found this website autoplaying video (though not looping it) on mobile:
http://campaign.nissan.co.il/qashqai0515
How is this possible?
Autoplay does not work on all versions of iOS and modern versions of Android. Both platforms require the user to click the video or a play button to initiate video play. It was made this way to conserve the devices battery life and limit cellular bandwidth.
There have been some workarounds in the past that use javascript to trigger the play event however from my testing those workarounds no longer work. Another trick is showing a sequence of images that looks like a video - Apple has done this in the past.
Note: I tested the link you provided in iOS 8 and it does not autoplay.

How did Scirra get HTML5 audio so perfect in Construct 2?

Check out this space shooter demo.
The HTML5 audio is perfect on Chrome 18 and Firefox 10. There is no lag in playing sounds and each sample plays perfectly. The last time I tried to play sounds using HTML5 audio and JavaScript I couldn't get a sound to play more than once.
What sorcery is Scirra doing to make this so perfect?
I'm the developer of Construct 2, so I hope I'm sufficiently qualified to answer your question :)
HTML5 audio is indeed a mess, so I've gone to considerable lengths to try and make it bulletproof in Construct 2. Here's an outline of what I've done:
Use the Web Audio API
HTML5 audio appears designed for streaming music, so a HTML5 Audio object is kind of a heavyweight object. Playing 10 sounds a second with it like Space Blaster does can easily seize up the browser. On the other hand, the Web Audio API is a high-performance audio engine with routing, effects, and lightweight sound playback. It's perfect for games. Audio buffers and audio playback are separated, so you can have one data buffer and efficiently play it many times simultaneously, whereas some browsers are so buggy if you play a HTML5 sound a few times it re-downloads it each time! Since it was actually designed for games and such, you can happily play back tonnes of sound for ages and it will still hum along nicely. It can also use HTML5 audio as a sound source, although I only use HTML5 audio for things the user has designated as music tracks (since that's where you'd prefer to have streaming - typically everything else in the Web Audio API is fully downloaded before playing).
The Web Audio API is supported in Chrome, has also made it in to iOS 6+ (although it's muted until you try to play some audio in a touch event), Firefox are working on support, and it should be coming soon to Chrome for Android. So on these platforms audio will be significantly more reliable.
More info on HTML5Rocks and the proposed spec - you'll have to use the spec as the documentation for now, there's not much else out there.
Other browsers: implement an audio recycling system
The Web Audio API isn't yet supported everywhere, notably IE, which means you still need to crowbar HTML5 audio in to something that might work for games for backwards compatibility. The way to do this is to recycle audio objects.
The player's laser in Space Blaster fires 10 times a second - and that's not including any other sound effects! As I mentioned earlier, Audio is kind of a heavyweight object, so if you're doing new Audio() 10+ times a second, lo and behold, the browser eventually dies and audio starts glitching up. However, you can drastically reduce the number of Audio objects created by recycling them.
Basically, for each sound effect, keep a cache of every Audio object you've created with that sound as a source. Then, when playing a new sound, search the cache for any sound effects which have finished playing (the ended property will be true). If you find one, rewind it back to the beginning (currentTime = 0) and play() again. Otherwise, create a new Audio() object in the cache.
Since the player's laser sound effect is short, instead of creating 600 Audio objects a minute, there will just be 3 or 4 that it keeps cycling round. Some browsers unfortunately will still download it 4 times (Safari did this last I checked!) or have high latency the first time each sound buffer is played, but eventually the browser catches up since the same buffers are always being reused. So basically sound might be a bit weird for a few moments, then it clears up. We also use the HTML5 app cache so next time you play everything loads from disk, so subsequent plays should perform well immediately.
That's basically it. It's still a little dodgy on the first play with HTML5 audio, but every time after that should be fairly solid providing the browser has a sane audio implementation. There are a number of ways to try to clone Audio objects, but I've found that rewinding existing Audios works best.
There's no SoundManager or any Flash/plugin-based fallbacks at all since we make a point of being pure HTML5.
We also support audio APIs provided by PhoneGap and appMobi for mobile, since HTML5 audio on mobile isn't even worth trying. That makes a total of four audio APIs our audio engine wraps, and yes, it does look like a frankenstein mess, but it works.
That's it. I suppose our competitors will read this, but who cares when there's SO rep to be had???!!!1111

How can i make a Flash-free, basic audio control?

I need to make a basic audio control: one audio file, play and pause buttons, no more.
I cannot use Flash at all - this website will only be used if the client does not have flash enabled.
HTML5 does not seem to be a good solution because my target clients (who do not enable Flash) most likely won't have modern browsers. Even worse, Safari does not seem to play the best solution available (jPlayer).
The lastest versions of all the main browsers (IE, Chrome, FF, Safari, Mobile Safari, Android) can play audio natively using the HTML5 audio element (so long as the media is encoded in a supported format).
IE6,7 and 8 can only play audio directly in the browser with the help of plugs-ins (e.g. Quicktime, Flash etc.).
So, if you have IE8 or less i'm afraid you cannot play audio directly in the browser without Flash or another plug-in.