playing .swf file with videojs - video.js

I am trying to play .swf file using Videojs but getting message that media could not be loaded either the server or network failed or because the format is not supported. Here is my code:
<link href="/html/js/video/videojs/video-js-5.17.0/video-js.css" rel="stylesheet">
<script type="text/javascript" src="/html/js/video/videojs/video-js-5.17.0/video.min.js"></script>
<script>videojs.options.flash.swf = "/html/js/vendor/video-js-swf-5.3.0/dist/video-js.swf"</script>
<div style="display:block; margin-top: [[margin_top]]px; color: #fff; border:none;">
<video id="vidojs-player-swf"
class="video-js vjs-default-skin vjs-big-play-centered"
controls
preload="auto"
width="[[width]]"
height="[[height]]"
data-setup="{}">
<source src="/path/to/swf/file" type="video/x-flv"></source>
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a
web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">
supports HTML5 video
</a>
</p>
</video>
</div>

Related

video.js with flv file

I am trying to play a flv file using video.js. So far I have included:
<link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/6.3.3/video-js.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/6.3.3/video.js"></script>
and then in my body:
<video id="my-player" class="video-js" controls="" preload="auto" width="640" height="264" poster="" data-setup="{}">
<source src="http://www.mediacollege.com/video-gallery/testclips/20051210-w50s.flv" type="video/flv">
</video>
However, the video is not loaded and not shown. Anyone has experience with video.js and flv files and why it does not work?
You need to use the "videojs-flash" plugin and set mime type to "video/x-flv". Be careful "videojs-flash" plugin also used "videojs-swf" plugin
Example html file with video.js v7, supports flv, hls, rtmp stream.
<!DOCTYPE html>
<html>
<head><meta charset=utf-8 /></head>
<body>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<link href="//vjs.zencdn.net/7.3/video-js.min.css" rel="stylesheet">
<script src="//vjs.zencdn.net/7.3/video.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/videojs-flash#2/dist/videojs-flash.min.js"></script>
<ul id="playlist">
<li data-url="http://podcast.rickygervais.com/rickyandpepe_twitter.mp4">Source 1</li>
<li data-url="http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4">Source mp4</li>
<li data-url="http://assets3.ign.com/videos/zencoder/2016/06/15/640/7080c56a76e2b74ec8ecfe4c224441d4-500000-1466028542-w.mp4">Source 3</li>
<li data-url="https://nmxlive.akamaized.net/hls/live/529965/Live_1/index.m3u8" data-type="application/x-mpegURL">TV HLS</li>
<li data-url="http://path /aquila.mkv" data-type="video/mp4">aquila.mkv</li>
<li data-url="rtmp://path" data-type="rtmp/mp4">camera RTMP</li>
<li data-url="http://www.mediacollege.com/video-gallery/testclips/20051210-w50s.flv" data-type="video/x-flv">testclips.flv</li>
</ul>
<video id="my-video" class="video-js" controls preload="auto" width="640" height="480"
data-setup="{}">
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
supports HTML5 video
</p>
</video></body>
<script>
$(function(){
var player = videojs('my-video');
$("#playlist li").on("click", function() {
player.pause();
var src = $(this).attr("data-url");
var type = $(this).attr("data-type");
player.src({src, type})
// set src track corresponding to new movie //
player.load();
player.play();
});
});
</script>
</html>

Change HTML5 video src does not work in Safari mobile browser

I have a scenario, i have to play two video in HTML5 player in mobile browsers. The videos are playing fine in desktop browsers.
one thing i know ,
We not autoplay videos in mobile browsers, user has to tap on the video player to play video.
What i am doing, on video ended event of first video i am changing the src of the . but sometimes it is shaky or it does not plays the second video. user has to tap on play button to play 2nd video. I just need to exclude the 2nd tap. YouTube is doing this somehow. The ad video plays fine, the player minimize and then the 2nd video starts playing.
It takes much time to play the video on start.
Following is my sample implementation. try this url in iPhone or Android
http://abuzer.github.io/videojs-liverail-vpaid/sample.html
<script>
videojs.options.flash.swf = "video-js.swf";
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
video1 = 'https://d3hh3bpy3h68fd.cloudfront.net/processed_videos/47fad7e0-7477-0132-8e95-123139254ded/_preview_640x480_2932_edit.mp4';
video2 = 'https://drgta5lwz3cck.cloudfront.net/uploads-public-videos/fd6eefe0-73cc-0132-a03a-12313b07582a/640x480.mp4';
video1Played = false;
video2Played = false;
$(function() {
$('#playAd').on('click', function() {
$('#playAd').hide();
$('#videoElement').attr('src', video1);
$('#videoSource').attr('src', video1);
$('#videoElement')[0].play();
video1Played = true;
});
$('#videoElement').bind('ended', function() {
if (video1Played && !video2Played) {
$('#videoElement').attr('src', video2);
$('#videoSource').attr('src', video2);
$('#videoElement')[0].load();
$('#videoElement')[0].play();
video2Played = true;
}
});
$('.videoElement').bind('progress', function(e) {
$('#state').hide();
});
$('.videoElement').bind('waiting', function(e) {
$('#state').show();
});
});
</script>
<html>
<head>
<meta charset="utf-8">
<title></title>
<!-- Chang URLs to wherever Video.js files will be hosted -->
<link href="video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="video.js"></script>
<!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
</head>
<body>
<button type="button" id="playAd">Click to Play</button>
<div id="videoWrapper" style="">
<div id="state" style="display:none; text-align: center">
<img style="-webkit-user-select: none" src="http://www.loadinfo.net/images/preview/14_cyrle_four_24.gif?1384388177">
</div>
<video x-webkit-airplay="allow" id="videoElement" class="video-js videoElement vjs-default-skin" height="50%" width="100%" controls src="" poster="">
<source id="videoSource" src="" type="video/mp4">
</video>
<!-- <video data-setup="{}" x-webkit-airplay="allow" id="videoElement1" class="video-js videoElement1 vjs-default-skin" height="50%" width="100%" controls src="" poster="">
<source id="videoSource" src="https://d3hh3bpy3h68fd.cloudfront.net/processed_videos/47fad7e0-7477-0132-8e95-123139254ded/_preview_640x480_2932_edit.mp4" type="video/mp4">
</video>
-->
</div>
</body>
</html>

html5videoplayer - control bar - missing or double display

I'm using html5videoplayer 6.2.14 in a typo3 6.1.7 installation. The control bar doesn't appear as it should - either missing or double display (because the mouseover text like "play" appears with the image, mouseover text doesn't show up).
The plugin parameters are set to autoplay and show control bar.
http://www.alexianer-berlin-hedwigkliniken.de/index.php?id=5674
How can I correct this?
This is the code without control bar:
<div id="video_4" class="video-js vjs-default-skin vjs-paused" width="680" height="385" style="width: 680px; height: 385px;">
<video id="video_4_html5_api" class="vjs-tech" data-setup="{"techOrder":["youtube","vimeo","html5","flash"], "ytcontrols": true}" autoplay="" preload="auto">
</video>
</div>
And that's the code with double control bar:
<video id="video_4_html5_api" class="vjs-tech" data-setup="{"techOrder":["youtube","vimeo","html5","flash"], "ytcontrols": true}" autoplay="" preload="auto" src="....webm">
<div class="vjs-control-bar">
<div class="vjs-play-control vjs-control vjs-playing" role="button" aria-live="polite" tabindex="0">
<div class="vjs-control-content">
<span class="vjs-control-text">Pause</span>
</div>
</div>
</div>
Thanks for any help!
You're loading two different versions of video.js's javascript and css, and they're conflicting.
v4.9.0:
<link href="typo3conf/ext/html5videoplayer/Resources/Public/video-js-4.9.0/video-js.min.css" type="text/css" rel="stylesheet" media="screen" />
<script src="typo3conf/ext/html5videoplayer/Resources/Public/video-js-4.9.0/video.js" type="text/javascript"></script>
v3.2.0:
<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/c/video.js"></script>
You should remove the old version.

Video-JS + Colorbox, loading dynamic videos

Having an issue that has been frustrating me the last few days.
I have some videos on a site that are loaded dynamically from sitecore, and display on a page with thumbnail images. When you click those images you are taken to a lightbox with the video.
The problem is, the video plays in Chrome, Firefox and IE8 -, but not IE9 +. I thought it may be an encoding issue, but I have converted this video so many times to every format available to the web to no avail.
I am setting the plugin to load the video as flash first, then if flash isn't available, load as html5. This will clear all worries in terms of browser support of HTML5 video.
I was thinking that it may be the lightbox and videoJS plugin fighting with each other, or the fact that i am hiding videos and showing them, which i know can sometimes cause issues. I have decided to use a different lightbox, and people seem to have said that colorbox is a decent one to use with videoJS, especially since it has some built in callbacks onLoad.
On to the problem and the code:
The problem:
This lightbox is working, but videoJS seems to throw a few errors when i try and reset the player, which is breaking the videos in IE since its such a dumb browser.
As you can see in the demo link at the bottom, the videos play in IE just fine when they are just set on the page, but when you open the lightbox by pressing "vid1" or "vid2" you are riddled with console errors and the videos no longer play.
The code:
HTML + jScript:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"> </script>
<link href="http://vjs.zencdn.net/4.3/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/4.3/video.js"></script>
<link type="text/css" rel="stylesheet" href="colorbox.css" />
<script type="text/javascript" src="js/jquery.colorbox.js"></script>
<style type="text/css">
.hide {
display: none;
}
</style>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
$(".inline", this).colorbox({
inline: true,
rel: 'videohook',
width: '650px',
onLoad: function() {
//grab the video ID and store it
var vidID = $(this).attr("data-vidID");
//Reset the video players
videojs.players = {};
//set the videoJS player for this video.
videojs(vidID);
}
});
});
</script>
<a rel="videohook" data-vidID="my_video_1" class="inline" href="#video_1">vid 1</a>
<a rel="videohook" data-vidID="my_video_2" class="inline" href="#video_2">vid 2</a>
<div id="video_1" class="video">
<video id="my_video_1" class="video-js vjs-default-skin" controls
preload="none" width="640" height="264" poster=""
data-setup='{"techOrder": ["flash", "html5"]}'>
<source src="http://www.w3schools.com/html/mov_bbb.mp4" type='video/mp4'>
<source src="http://www.w3schools.com/html/mov_bbb.ogg" type='video/ogv'>
</video>
</div>
<div id="video_2" class="video">
<video id="my_video_2" class="video-js vjs-default-skin" controls
preload="none" width="640" height="264" poster=""
data-setup='{"techOrder": ["flash", "html5"]}'>
<source src="http://www.w3schools.com/html/mov_bbb.mp4" type='video/mp4'>
<source src="http://www.w3schools.com/html/mov_bbb.ogg" type='video/ogv'>
</video>
</div>
</body>
</html>
Console errors im getting:
Uncaught TypeError: Object #<HTMLObjectElement> has no method 'vjs_getProperty'
LIVE DEMO:
Go here to see the errors for yourself: http://kodistro.com
In this case, my solution is to inject the video tag HTML into the lightbox content (when opening) and then call videojs().
So, in pseudo-code:
<script type="text/javascript">
$(document).ready(function() {
$(".inline", this).colorbox({
inline: true,
rel: 'videohook',
width: '650px',
height: '274', //the size most be fixed
onLoad: function() {
var appendVideo1 = '<video id="my_video_1"......> </video>'; //insert the <video> tag. Note.Remove attribute data-setup='{"techOrder": ["flash", "html5"]}'
$("video_1").append(appendVideo1);
},
onComplete: function() {
videojs(my_video_1); //initialize video-js
},
onClosed: function() {
videojs(my_video_1).dispose(); //destroy video-js
}
});
});
</script>
<a rel="videohook" data-vidID="my_video_1" class="inline" href="#video_1">vid 1</a>
<div id="video_1" class="video">
</div>

HTTP Dynamic Streaming with video.js flash fallback

I am evaluating video.js flash fallback capabilities for live streaming.
I can stream using either RTMP or Adobe HTTP Dynamic Streaming.
Hovewer, nonne of the options seems to be supported,
here is my demo set up
<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup="{}">
<source src="http://mysite.com:1935/live/android.stream/manifest.f4m" type="video/mp4" />
<source src="rtmp://mysite.com/live" type="video/mp4" />
<source src="http://mysite.com:1935/live/android.stream/playlist.m3u8" type='video/mp4' />
here is what I see in the firebug console
Specified "type" attribute of "video/mp4" is not supported. Load of media resource http://mysite.com:1935/live/android.stream/manifest.f4m failed.
Specified "type" attribute of "video/mp4" is not supported. Load of media resource rtmp://mysite.com/live failed.
I went through the source code of the video.js (both JavaScript and ActionScript) and couldn't find any support for manifest files.
That is a feature I would also like to see...
Rtmp is now supported in video.js an example can be seen by using there already packaged file or this:
<!DOCTYPE html>
<html>
<head>
<title>Video.js</title>
<link href="video-js.css" rel="stylesheet" type="text/css">
<script src="video.js"></script>
<script>
videojs.options.flash.swf = "video-js.swf";
</script>
</head>
<body>
<video id="my_video_1" class="video-js vjs-default-skin" controls
preload="auto" width="640" height="264" data-setup='{ "techOrder": ["flash"] }'>
<!-- Stream testing -->
<source src="rtmp://rtmp.jim.stream.vmmacdn.be/vmma-jim-rtmplive-live/jim" type='rtmp/mp4'>
</video>
<p>Source from: http://support.akamai.com/flash/</p>
</body>
</html>
Hope this helps anyone currently stuck I know this has been dead for awhile.