Live streaming video in HTML5 - html

I need to develop a web application, it needs to support IE9 as well as iPad and Android tablets. The problem I am facing is that the client is required to show live streaming video on all the pages. How can I implement live streaming video in HTML5?

I recommended you to use Wowza Media Server ( Ofcourse there are several streaming servers are there. Wowza delivers video/audio with great performance and service ) I am using it for my projects. It also supports opensource players like flow player, Jw players etc.. Install Wowza Media Server on your machine and create a live application on it and start broadcast. You need an encoder for live streaming, You can use Adobe Flash Media Live Encoder for testing. Wowza can able to broadcast the videos to iphone, Webpage, etc.,

Try the code
<video id="movie" width="" height="" preload controls>
<source id="srcMp4" src="video.mp4" />
<source id="srcOgg" src="video.ogg" />
<object id="flowplayer" name="flowplayer" width="480" height="352"
data="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf"
type="application/x-shockwave-flash">
<param name="movie"
value="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf" />
<param name="allowfullscreen" value="true" />
<param name="flashvars"
value='config={"clip":"http://domain.com/video.flv"}' />
</object>
</video>
The MP4 format is provided first, due to a previous bug in iPad which only sees the first source listed.
If the browser can't play the MP4 version, it tries to load the Ogg version. If that fails, it uses Flowplayer (flash) as a fallback.s

Related

HTML5 video using only one video format

Adobe has said that it plans to phase out its Flash Player plug-in by the end of 2020. People said that all Flash content should have been migrated to other technologies like HTML5. I agree more or less, but how ready is HTML5 when in comes to replacing Flash entirely?
Let's take an everyday example - video playback on web.
On Flash, I can just embed one player for all the videos on a website and just change the paths to link to different FLV videos(or MP4's) for different videos on the site. As long as Flash is installed on client side, I need not worry much which browser they are using.
However with HTML5, to be cross-browser compatible, AFAIK, I need to have three video files (three different formats of the same video - MP4, WEBM and OGG).
<video id="video" controls preload="metadata" poster="img/poster.jpg">
<source src="video/v1.mp4" type="video/mp4">
<source src="video/v1.webm" type="video/webm">
<source src="video/v1.ogg" type="video/ogg">
<!-- Flash fallback -->
<object type="application/x-shockwave-flash" data="flash-player.swf?videoUrl=video/v1.mp4" width="1024" height="576">
<param name="movie" value="flash-player.swf?videoUrl=video/v1.mp4" />
<param name="allowfullscreen" value="true" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="controlbar=over&image=img/poster.jpg&file=flash-player.swf?videoUrl=video/v1.mp4" />
<img alt="My video" src="img/poster.jpg" width="1024" height="428" title="No video playback possible, please download the video from the link below" />
</object>
<!-- Offer download -->
Download MP4
If I have 80+ different videos on the site, I will have to host 240+ video files on the server, which is quite troublesome to prepare and manage the files. I hate to transcode a video to different format every time before putting the video content on the server.
It is now mid-2017, and HTML5 video is nothing new. I wonder if there is any new cross-browser compatible method/hack to embed video playback using just one video format?
HTML5 is very ready for video. The advantages of using HTML5 over Flash is also to have playback on mobile which is definitely a must in 2017. To the solution to your issue the best you can do is use MP4 (encoded with h264 and aac). This video format is supported on all browsers (webm and ogg are only supported on some browsers).
MPEG-DASH is the new "one standard to rule them all" but it's a way off native support across all browsers at the moment. One answer would be to use a player like Ooyala's or Shaka.js to give you a polyfill, but that's going to be limited in support for older browsers.
If you're worried about managing assets there are Media Asset Management systems that can take a single asset and produce a variety of versions (eg mp4, webm, ogg as well as fragmented mp4 such as HLS and Dash) or you could roll your own using something like ffmpeg for transcoding or use a service like Azure Media Service

Backwards and cross-browser compatible audio playing

I need to playback audio files in many different web browsers and different versions. The old system produces 4-bit WAV files, which many browsers can't handle. All files contain synthesized or recorded human voices. Anyway I'm gonna need to replace it. So my questions are:
1) what is the best file format to use for audio files, with regards to compatibility, size and quality?
2) what is the best way to use HTML5 and staying backwards-compatible?
We need to support Internet Explorer versions 6, 7, 8 and 9; Firefox, Chrome and Safari.
Update: finally got it working for IE 6-9, Firefox and Chrome; haven't tested Safari yet. I learned that Safari for windows requires Quicktime and IE requires windows media player.
Here's what I'm using:
<audio autoplay>
<source src="/static/sound/SOUND.mp3" type="audio/mpeg">
<source src="/static/sound/SOUND.ogg" type="audio/ogg">
<source src="/static/sound/SOUND.wav" type="audio/wav">
<source src="/static/sound/SOUND.aiff" type="audio/x-aiff">
<object>
<param name="autostart" value="true">
<param name="src" value="/static/sound/SOUND.mp3">
<param name="autoplay" value="true">
<param name="controller" value="false">
<embed src="/static/sound/SOUND.mp3" controller="false" autoplay="true" autostart="true" type="audio/mpeg"></embed>
</object>
</audio>
I provide the same audio clip in MP3, OGG, WAV, and AIFF and then let the browser pick which it wants to play. The audio tag is for HTML5, the object tag is for older systems, and embed works on some systems not supporting the object tag.
I put this together from some information on a few websites, but unfortunately I've forgotten the URL.
UPDATE
I've since switched to using howler.js for this stuff. It automatically deals with all the cross-browser issues related to sound. Unfortunately it doesn't support IE 6-8, but I've given up supporting those any way.
With the HTML5 audio tag you can specify different audio types to attempt to load because each browser allows different types. There is a nice compatibility chart on this page: http://html5doctor.com/native-audio-in-the-browser/
The below code will work with most browsers. It first attempts the new HTML5 audio method then falls back on the embed method.
<audio width="100" height="100" autoplay="" controls="" tabindex="0">
<source type="audio/mpeg" src="songs/All-My-Life.mp3"></source>
<source type="audio/ogg" src="songs/All-My-Life.ogg"></source>
<source type="audio/wav" src="songs/All-My-Life.wav"></source>
<embed width="100" height="50" src="songs/All-My-Life.mp3">
</audio>

How to stream live video in HTML5?

I'm looking for a way to broadcast a live video taken from a webcam or camera rooted to a PC.
The broadcast should be displayed in a HTML5 page using the tag (which support rtp, and rtsp I think).
The user viewing the stream should not have to install any plug-in or video player such as QuickTime.
I need the video to be in mp4 format such as: rtsp://www.mywebsite/streaming/video.mp4
This would be the link I'd put as the src of the html 5 video tag.
So I'd like to know if it's possible, what are my options to do such things.
It's possible. But you will have major problems if you're looking for cross browser support. What you can do is offer HTML5 video to the browsers supporting it and then offer QuickTime for browsers not supporting it.
<video src="stream.mp4">
<!-- Don't support <video> -->
<object>
<param name="src" value="video.mp4" />

 <param name="autoplay" value="true" />

 <param name="type" value="video/quicktime" height="256" width="320" />

 
 <embed src="video.mp4" height="256" width="320" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" />
</object>
</video>
Also see: Streaming via RTSP or RTP in HTML5
I don't think it is possible now to "cheat" the HTML5 browser to encapsulate the live video stream to a ".mp4" file.
I believe HTML5 will consider live video support in a near future.
What you can do is just wait. :)
For maximum compatibility, here’s what our video workflow will look like,
Make one version that uses H.264 baseline video and AAC “low complexity” audio in an MP4 container & Make another version that uses WebM (VP8 + Vorbis) or Theora video and Vorbis audio in an Ogg container.
I think this combination solves your problem & it plays on most of browsers.
You should required at least two versions of Video to play in all the browsers.

How to embed stream content that Windows Media Player supports in a web page that works in Mac OS?

I have HTML page where windows media player is embedded. It works very well in all browsers on Windows, but when trying to open in Firefox on Mac OS, it fails to open.
Is there any alternative method which can be controlled using Javascript or HTML or do I have to install Window Media Player support for Mac OS?
Try streaming with flash as a fallback, or use the <video> or <audio> tag, that Safari supports.
If you are trying to stream video in a way that works consistently on every browser, you should look into Video For Everyone:
Video for Everybody is very simply a chunk of HTML code that embeds a video into a website
using the HTML5 element which offers native playback in Firefox
3.5 and Safari 3 & 4 and an increasing number of other browsers.
The video is played by the browser itself. It loads quickly and doesn’t threaten to crash your browser.
In other browsers that do not support , it falls
back to QuickTime.
If QuickTime is not installed, Adobe Flash is used. You can host locally or embed any Flash file, such as a YouTube video.
The only downside, is that you have to have 2/3 versions of the same video stored, but you can serve to every existing device/browser that supports video (i.e.: the iPhone).
<video width="640" height="360" poster="__POSTER__.jpg" controls="controls">
<source src="__VIDEO__.ogv" type="video/ogg" />
<source src="__VIDEO__.mp4" type="video/mp4" /><!--[if gt IE 6]>
<object width="640" height="375" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"><!
[endif]--><!--[if !IE]><!-->
<object width="640" height="375" type="video/quicktime" data="__VIDEO__.mp4"><!--<![endif]-->
<param name="src" value="__VIDEO__.mp4" />
<param name="autoplay" value="false" />
<param name="showlogo" value="false" />
<object width="640" height="380" type="application/x-shockwave-flash"
data="__FLASH__.swf?image=__POSTER__.jpg&file=__VIDEO__.mp4">
<param name="movie" value="__FLASH__.swf?image=__POSTER__.jpg&file=__VIDEO__.mp4" />
<img src="__POSTER__.jpg" width="640" height="360" />
<p>
<strong>No video playback capabilities detected.</strong>
Why not try to download the file instead?<br />
MPEG4 / H.264 “.mp4” (Windows / Mac) |
Ogg Theora & Vorbis “.ogv” (Linux)
</p>
</object><!--[if gt IE 6]><!-->
</object><!--<![endif]-->
</video>
If you need to look for a Flash based player (both audio and video), take a look at Flowplayer, an Open Source (GPL 3) video player for the Web. It can do almost anything you might want to do, and there is an extensive collection of plugins for many applications.
Side-step the problem by using a flash based mp4 video player, this approach is the de facto one currently.

what's the current best way to put audio and video on a web site?

I'm working on a very small site, with almost zero budget as a favor for a friend. She wants to put a short audio and video clip on the site (both clips are under two minutes). The audio is currently a 1.6 MB AAC (.m4a) and the video is a 30 MB H.264 (.mov).
What's the current best practice that's going to be the easiest for me, while still creating a good experience for the users? Should we upload the video to youtube or vimeo and embed? There's probably some simple audio player I could download. I have flash, so could make an FLV; I could convert the m4a to an mp3, etc. I could just link directly to the raw files....
Outsource it.
Youtube
Blip.tv (FAQ)
Vimeo (Basics)
Many popular video sites use Blip.tv
Thatguywiththeglasses
Cinemassacre
And others use Youtube
Screwattack
In terms of being modern and standards compliant for video embedding, Video for Everyone is probably the best way.
<!-- “Video for Everybody” by Kroc Camen <camendesign.com> cc-by -->
<video width="640" height="480" controls="controls">
<source src="__MY_VIDEO__.ogv" type="video/ogg" />
<source src="__MY_VIDEO__.mp4" type="video/mp4" />
<object width="640" height="500" type="application/x-shockwave-flash"
data="__FLASH_PLAYER__.swf" flashvars="file=__MY_VIDEO__.mp4"
> <param name="movie" value="__FLASH_PLAYER_.swf" />
<param name="flashvars" value="file=__MY_VIDEO__.mp4" />
<!--[if gt IE 6]>
<object width="640" height="495" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B">
<param name="src" value="__MY_VIDEO__.mp4" /><!
[endif]--><!--[if gt IE 6]><!-->
<object width="640" height="495" type="video/quicktime" data="__MY_VIDEO__.mp4"
> <param name="src" value="__MY_VIDEO__.mp4" />
<!--<![endif]--><p>
<strong>No video playback capabilities detected.</strong>
Why not try to download the file instead?<br />
MPEG4 / H.264 “.mp4” (Windows / Mac) |
Ogg Theora & Vorbis “.ogv” (Linux)
</p><!--[if gt IE 6]><!--></object><!--<![endif]-->
<!--[if gt IE 6]></object><![endif]-->
</object>
</video>
A fully commented version is available at the link above.
This uses the video tag if it's supported, but as Firefox and Safari both support different formats (Ogg and Mp4) you need to have a couple of different versions of the video files.
This works on every browser, from IE6 to the iPhone, and from Chrome to Opera including everything in between.
For audio, the audio tag is the most modern, though I'm not sure about browser support at the moment.
Uploading to a service like YouTube, Blip.tv, or Vimeo is good, but you'll have to settle for them tossing in "related videos" or other ads on your content, and you'll be forced to stick with their player/branding.
You could get the JW FLV Media Player, and play the .mov through flash. And actually, if you go with blip, they will host the file and give you the absolute path to the .flv itself - meaning you could load it directly into your local copy of JW FLV Player, and likely bypass their ads/related content.
Another nifty thing to consider would be the jQuery Media Player. It quickly converts markup/css into a media-player driven by the powerful jQuery framework. Using this with the free hosting provided by Blip.tv (who again give you direct access to your .flv files) would be a great solution too.
for the video, I recommend to use youtube. you can embed into your pages without sacrificing spaces and bandwith.
For the sound, i would recommend to use mp3 (not aac since not everybody has aac) and then you can put flash mp3 player (try this : 5 best flash podcast players)
For mp3, if it is a speech or just human talking about something, you don't need to make stereo, mono is more than enough. You can edit using Audacity (free-open source software). I guest (from my past experience) 1 hour speech could be 5-6 MB mono mp3 (about 96Kbps if i am not wrong)