How to stream a HTML5 video from FTP without showing credentials? [duplicate] - php

in video tag src we are trying to give src as a ftp resource its not picking it up. Can somebody give some direction on that.
<video src='ftp://server/pqr.mp4' />

I suspect that's because to allow efficient usage, the browser makes HTTP range requests, which are part of HTTP, not FTP. FTP is a pretty old protocol, and isn't really appropriate here for lots of reasons (no range requests, basic/no caching info, etc).

something like this
<video width="320" height="240" controls="controls">
<source src="http://movie.mp4" type="video/mp4" />
<source src="http://movie.ogg" type="video/ogg" />
Your browser does not support the video tag.
</video>

The issue here is :
Loading an FTP sub-resource through an HTTP / S page is not allowed
This is for security issues, see https://bugzilla.mozilla.org/show_bug.cgi?id=1361848

Use this code:
<video width="320" height="240" controls="controls">
<source src="http://movie.mp4" type="video/mp4" />

Related

How to load one image if sopported or another if not in HTML

I have been reworking a web site to optimize for SEO. One thing I did is to optimize Images using Googles Webp Format. But Webp is not supported on any version of Safari.
My question is: What can I do to load one image (Webp) if supported or load another like JPG if not supported.
It could be great if it is something like the Audio or Video TAG
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
Add your code like as below and it should most probably work.
<picture>
<source srcset="image.webp" type="image/webp">
<source srcset="image.jpg" type="image/jpeg">
<img src="image.jpg">
</picture>
More details are mentioned here in this link.
I assume you are using only 1 image in src (in img tag) if that fails to load then you are trying to loan any other image. So, You can use
<img src="invalid_link" onerror="this.onerror=null;this.src='other_image_url';">
Hope this helps.

playing an mp3 file and loading a waveform image?

How can I play an mp3 and generate a wafeform image using HTML5 or Jquery?
Thanks Advance!
Playing an audio file with HTML 5 is pretty straight forward:
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Above Example from W3Schools
As for generating a waveform I'd check out waveform.js

PHP Video Url with GET

So I have a video player with the following source code.
<video width="320" height="240" controls>
<source src=<?php echo $tryOne; ?> type="video/mp4">
</video>
It will echo something something similar to below and insert it as the source video.
'176.227.210.66/Kuroko%20no%20Basket%202%20Episode%205.mp4?st=zEws3h1Xg-to07f3as6KqA&e=1385059955'
However, the player will not load the the video. If I open page source and copy the generate url into the address bar and hit enter, it will go to the direct url and load the video just fine. I think that the player won't load the url because it has GET variables in it, and I need to know how to fix this. Please tell me how I can load a video in a player from the above url with GET variables.
Note: the player will load a video just fine if it is named without the get variables.
As per the HTML specification for <video>, you need a valid URL:
src = non-empty URL potentially surrounded by spaces.
The URL for the video.
In this case, it is missing the protocol information (http://) and it is not being recognized as a video src. Change the value of $tryOne to include the protocol information or manually prepend it to the variable when outputting to the page. It might also be a good idea to URL-encode the string.
For example:
<video width="320" height="240" controls>
<source src=<?php echo 'http://'.urlencode($tryOne); ?> type="video/mp4">
</video>
Live demo.

Embed IP Camera streaming into website with PHP?

I have done a quick google on this but i was wondering if this is possible? I have opened up ports on our router to it so its accessible from anywhere but could i use PHP or similar to grab live streaming and show it on a website somewhere?
Try this (HTML5) or just the inner object (HTML<5) with all occurences of %StreamURL% replaced with the URL of your stream.
<video width="320" height="240" autoplay controls>
<source src="%StreamURL%" type="video/mp4">
<object width="320" height="240" type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf" />
<param name="flashvars" value='config={"clip": {"url": "%StreamURL%", "autoPlay":true, "autoBuffering":true}}' />
<p>view with external app</p>
</object>
</video>
You need a server to broadcast the stream for the viewers and player component that can work on desktop and mobile as well.
I have posted some info about this here on another stackowerflow topic:
How can I display an RTSP video stream in a web page?
More info: http://ipcamlive.com/howdoesitwork

HTML5 video, prefered codecs and indirect delivery

i am currently trying to build a html5 video page with restrictive access to the videos. Therefor i want to put the videos out of web root and have some kind of script check the user account and deliver the video.
If i put a .ogv (theora) and a .mp4 (h264) file just into webroot and use a video tag with multiple source tags, they work on all tested browsers: Firefox (ogg), Chrome (ogg), IE9 (mp4), Safari (mp4), Opera (ogg)
<video id="currentVideo" controls width=640>
<source type='video/ogg; codecs="theora, vorbis"' src="http://mysite/1.ogv" />
<source type='video/mp4; codecs="avc1.64001E, mp4a.40.2"' src="http://mysite/2.mp4" />
</video>
Now the first question that comes up is: Why is chrome using the ogg format? It scrubs much faster through the timeline with mp4 videos and it does support mp4 videos... Is there a way to mark a format as 'preferred format'?
Now if i put the files out of my webroot and use a php script like this to deliver them:
download.php:
$path=explode('/',$_SERVER['PATH_INFO']);
if (sizeof($path)>1) {
$inf=explode('.',$path[1]);
$id=intval($inf[0]);
$type=$inf[1];
$ctype='';
if ($type=='ogv') {
$ctype='video/ogg';
} elseif ($type=='mp4') {
$ctype='video/mp4';
}
$fname=sprintf('/var/outsidewebroot/videos/test.%s',$type);
http_send_content_type($ctype);
http_throttle(0.1);
http_send_file($fname);
}
which should put out the file including support for http range queries.
HTML:
<video id="currentVideo" controls width=640>
<source type='video/ogg; codecs="theora, vorbis"' src="http://mysite/download.php/1.ogv" />
<source type='video/mp4; codecs="avc1.64001E, mp4a.40.2"' src="http://mysite/download.php/2.mp4" />
</video>
Opera is not able anymore to determine playing length of the video, and even worse: google chrome (and its free clone iron) hang (mac and windows) - chrome itself remains running, but the tab loading the site is locked
Is there a way to mark a format as 'preferred format'?
List them in order of preference. You have ogg first, so it is taken as preferred.
<video id="currentVideo" controls width=640>
<source type='video/mp4; codecs="avc1.64001E, mp4a.40.2"' src="http://mysite/2.mp4" />
<source type='video/ogg; codecs="theora, vorbis"' src="http://mysite/1.ogv" />
</video>

Categories