AWS signed url

Video tag browser compatibility test


Expiry time is 5 seconds.

Issues with signed urls:

For further details check the disclaimer in this demo.

<body/>

<div id="container"></div>
 
<pre id="src">
 
</pre>

HTML

<script>

$(function () {
var vtype,
video = $("<video/>").attr({
controls: "controls",
preload: "preload",
"x-webkit-airplay": "allow",
width: 640,
height: 480
});
 
// report url
video.on("loadeddata", function (e) {
$("#src").text(e.target.currentSrc);
});

$.each(["webm", "mp4"], function (i, type) {
if (!!video[0].canPlayType("video/" + type).replace("no", "")) {
vtype = type;
return false;
}
});
 
$.ajax({
// github does not offer php, therefore remote origin
url: "http://flowplayer.blacktrash.org/getsignedurl.php?expires=5",
data: {
"movie": "http://d2yz3vc7rxs49u.cloudfront.net/ccc." + vtype
},
dataType: "text",
success: function (data) {
video.append($("<source/>").attr({
type: "video/" + vtype,
src: data
}));
 
$("#container").append(video);
}
});
});

JavaScript