How to Autoplay an HTML5 video on Mobile - javascript

I'm working on a fairly simple mobile App, geared more towards people who may have trouble with technology. As such, it needs to be as easy to use as possible and I need to be able to play HTML5 audio/video files on start. The problem, as many of you may know, is that mobile devices tend to turn off Autoplay of video content for bandwidth purposes. I'm told there are ways around it using some mild scripting, but all the resources I've found seem to either be outdated, or unsuited to my needs. The development tool I'm using allows me to plug in HTML5 code, but I need to be able to plug in a video that will run without user input. It should also be noted that these video's must be hosted online somewhere (ie, It cant have the video load from inside the app).
Any Help you could give me on this issue would be greatly appreciated.

You didn't specify OS or device or browser. It's been a long time and you probably don't care anymore but if anyone else comes past this, my answer.
Try placing "playsinline" inside the video tag.
Eg. <video playsinline> </video>
I can confirm this works in iOS 10.

Related

Adding audio/video calls in HTML5 app

I'm working on HTML5 app that lets several users to work on one document. I need to add a possibility for users (editing the same document) to talk to each other. And I just don't know how to start with that. Here are my questions
Is there an HTML5 lib allowing to transfer sound from microphone between clients?
What about streaming video from camera?
What is an easiest server-side solution for that?
Any thoughts are strongly appreciated! So don't be shy! :)
UPD: please note that I need an abbility for more then two users to talk.
For this you can use WebRTC.
However, this is a very young and unfinished technology that as already stated is currently available only in Chrome stable and Firefox beta. This means there will probably come changes to the current spec, something to be aware of in case of early implementation. But it allow you to use video and audio communication directly in the browser.
Quick-start here:
http://www.html5rocks.com/en/tutorials/webrtc/basics/
Other options are Flash based plugins such as flash-videoio. This is an open source plugin but will naturally require Adobe Flash installed. This may or may not be a problem depending on the company's security policy.
For technical details on implementation please see examples on the provided links.
For many-to-many you can use either:
"Mesh" - everybody connects to everybody. This however is costly on CPU and mobiles are often left out.
"Star" - everybody goes through the most capable device. However, with many connections this will soon run slow for the device handling all connections.
MCU. Specialized server to handle all connections. If mixes audio and video and handles drop-outs as well without affecting the other callers.
Examples of MCU's:
http://sourceforge.net/projects/mcumediaserver/ (open source)
http://www.medooze.com/products/mcu.aspx (commercial)
you are searching for navigator.getUserMedia()
that allows the various users to share video audio and data.
the support is very low... only chrome and the latest verions of opera and firefox support it.
and totally no support on mobile devices... maybe in the next android chrome... dunno
as there is much to talk about and i have no clue on how u wanna setup everything i suggest u read a little more about that on the urls...
http://caniuse.com/stream
http://www.html5rocks.com/en/tutorials/getusermedia/intro/
http://dev.w3.org/2011/webrtc/editor/getusermedia.html
https://developer.mozilla.org/en-US/docs/WebRTC/navigator.getUserMedia
http://my.opera.com/core/blog/2011/03/23/webcam-orientation-preview
http://simpl.info/getusermedia/
and SERVERSIDE solution nahh... thats not a good solution
clientside is the way to go.
Not sure if you're required to do it yourself from scratch or are able to use third party libraries/tools.
In which case I would recommend using Tokbox which has support for WebRTC and SDK for iOS.
Their API is simple and easy to use.

Smooth Streaming .ism to an HTML5 video tag

I understand that the best bet when streaming a video as a source in an HTML5 tag would be .mp4. But let's say that I have a source that only outputs fragmented to an ism/manifest.
Is there any way at all, whether through other libraries or messy hacks, that I can bring this video into something rendered as a tag onscreen? The closest I have found is Walkthrough: Building Your First HTML5 Smooth Streaming Player because it allows this to be done - but I neither have Windows 8, or want to have this running a server capable of .NET. I was hoping there was something, messy or not, that I could achieve this with entirely within javascript and executable locally without a deploy.
Thanks
Firstly, W3C does not provide a standard for adaptive bitrate streaming, yet. So for the time being most browsers only support simple progressive download playback.
Hence, there is no JS implementation of a Smooth Streaming player and Microsoft is not working on one, as far as I know.
The example you provide uses the "Microsoft Smooth Streaming Client SDK Beta 2 for Windows 8" which is a C++ library and is only available for Windows Store Apps development. It has nothing to do with browsers.
So, unfortunately this is not yet possible. Even more, I doubt that this will ever happen, because everybody is waiting for MPEG DASH to be finalized.
UPDATE.
Please, notice that you always can use Siverlight application for playing SmoothStreaming. The referenced HTML5 Player framework is capable of falling back to Silverlight.
no luck for Microsoft Smooth Streaming, but regarding MPEG-DASH which is similar (see http://blog.johndeutscher.com/2013/06/10/mpeg-dash-preview-from-windows-azure-media-services):
"Dash.js is permissively licensed (under the BSD license) and can therefore be studied and reused by anyone seeking to provide their own DASH-AVC/264 compliant player. The goal is to make it easier for third-parties to build adaptive streaming video players."
http://msopentech.com/blog/2013/06/20/ms-open-tech-contributes-to-open-source-adaptive-streaming-video-player/
also see:
https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html
which is required for Dash.js

How to manipulate an embedded player with time slider?

I am now using an embedded Windows Media Player (tutorial) and I can manipulate with time slider through Javascript. But then I discovered the Jlembed plugin for jQuery and thought it solves all my problems because of the different platforms, etc.
But after I spent a few hours in setting things up I relized that it does not have functions like setCurrentTime or getCurrentTime and these functions are most important for my type of project.
Is there a way to achieve this functionallity with Jlembed?
As far as I know, Windows Media Player does not support the type of interaction you're trying to achieve with it's embedded player. I did not include any javascript functions for Windows Media Player because it is not necessary. jlEmbed does not affect your ability to control the embedded player with javascript. So, if Windows Media Player supports a particular script, jlEmbed supports it also.
If there is a javascript API for WMP please point me in that direction and I will add better support for it, but I don't think it exists. However, if one does exist, jlEmbed will not prevent you from scripting as would normally be done.
I spent a great deal of time on the YouTube support, but only because I had to. Otherwise, it would have been much more difficult to control the YouTube player, which is the most popular and widely available media player on the web.
Only a small percentage of users will actually be able to use your embedded WMP presentation. The YouTube player is compatible with any browser that supports Flash. You would be better off creating a custom 'chromeless' YouTube player than using WMP for your presentation. An even better alternative would be to use Flash to make your video presentation.
According to the documentation, the following functions exist that might help:
jlembed_seekTo(playerId, seconds, allowSeekAhead)
jlembed_getCurrentTime(playerId)
Hope that helps!

Best option for capturing audio and video online

We are looking for various options which will help us to record audio and video through web on various platforms including iPhone and iPad? Recorded media will be saved on the server. Any suggestions would be helpful... We are looking for a cross browser approach.
Thanks and Regards
I hate to say, but the only way to do it on desktop in a cross-browser fashion would be Adobe Flash. On iOS you need to develop Apps for that.
HTML5 will provide Device API at some point of future to achieve your goal.
You have to use Flash. Flash can access your webcam and microphone.
Of course, Flash won't fly on iDevices.
There, you'll need to write a native app. :)
Because you need to gain hardware control, you'll most likely need a native application that can access the hardware drivers and API.
My guess is that Java may be able to do the job.
Here's another StackOverflow question that may have an embedded solution.
Nevermind: iFamily doesn't support Java either

Video encoding for websites

I am a little new to embedding videos on a website. What is the best way to go about it? I just started reading up on it.
I read that I should use HTML5 and the browser's native player. -- Does anyone know of a javascript library that will use the browser's player and detect if the browser is not using HTML5 to downgrade to a flash player?
As far as encoding what is the best approach? I am planning on writing a little console app to use FFMPEG to convert the videos. But what encoding should I use? I heard H.264 is promising? But
This is what you're looking for: http://videojs.com/
Encoding wise, I think H.264 and WebM is a wise choice. That way you'll satisfy all modern browsers and mobile devices (incl. iOS and Android), and only fall back to Flash for older, pre-HTML5 browsers (and FF 3.6, which only supports Theora.)
The DIY approach would be to use the Video For Everybody embed code. That will lead with HTML5 video and fallback to flash.
Then for video encoding, you can use FFmpeg like you said.
To make your life easier, you should check out VideoJS for your HTML5 video player. It handles a lot of cross browser issues and some extra features that browsers don't support yet.
For video encoding, if you're planning to use FFmpeg specifically for automating encoding, you should check out Zencoder's video encoding API. It could save you some set up time and compatibility issues.
For codecs, #1 priority should be h.264, specifically using the baseline profile so it will work on smartphones. After that, ogg and webm are both good choices. WebM is higher quality for file size, but Ogg can be viewed by way more users because older version of Firefox support it. And just to note, if you only do h.264, the Video For Everybody code won't fallback to Flash in Firefox and Opera (that don't support h.264) so you'll need to use a player like VideoJS.
Use Handbrake for video encoding, especially for HTML 5 support.
HTML 5 is an awesome way of embedding video, however it hasn't been standardized yet. You definitely want to use it if you're supporting iOS devices, as they of course don't support Flash which is the most mainstream way of embedding video.
HTML5 is pretty awesome because this is how simple it is:
<video src="video.m4v" />
Here is a fantastic link you will find useful:
http://www.robwalshonline.com/posts/tutorial-serving-html5-video-cross-browser-including-ipad/
I read that I should use HTML5 and the
browser's native player
Which idiot told you that? Given that you will loose out on a significant portion of the client population you either run a monoculture of HTML 5 browsers, of whoever said that should be serving burgers at McDonalds, not give advice to people. HTML 5 and the integrated player are nice, but not there yet for the general public. In a couple of years, yes. Now - if I hire a web company for putting videos on a website and they do that, they get sued for gross neglect and incompetence.
Today, playback is mostly flash - that has a high penetration. A flash video player is also what sites like youtube currently use. If you go for less (penetration), Silverlight is very good and has the complete backend infrastructure.
I heard H.264 is promising?
So what? FIRST you need to fix the playback side, then you use whatever format is most efficient given your playback decision.

Categories

Resources