I´m having a huge problem with the video.js and mp4 (h.264) video viewing in a lightbox (fancy box) on Firefox 22 on the Mac OS X, 10.7.5.
Here’s the test page: http://ranova.thull-hosting.de
Click on the play button in the middle where it says “WILLKOMMEN BEI RANOVA”.
All other browsers work like a charm but FF gives the error: “no video with supported format and MIME Type Found”, Firebug states: “The given ’type-Attribute’ ’video/mp4’ is not supported. Loading media resource http://video-js.zencoder.com/oceans-clip.mp4 failed. ”
Here’s the code:
<script>
$(document).ready(function() {
$('#startplayer').fancybox(
{content : '<video class="video-js vjs-default-skin" controls preload="none" width="555" height="311" poster="http://ranova.thull-hosting.de/fileadmin/videos/interview1_neu_vorschau.jpg" data-setup="{}"><source src="http://video-js.zencoder.com/oceans-clip.mp4" type=\'video/mp4\'></source></video>'
}
);
});
// $("#startplayer").fancybox({'padding':0,'margin':0,'width':640,'height':360,helpers:{title:{type:'inside'},overlay:{css:{'background':'rgba(0,0,0,0.5)'}}},'type':'swf','swf':{'wmode':'transparent','allowfullscreen':true}});
Can anyone help please?
Cheers
andi
Video.js isn't being used on that page, so you just have a plain video element and Firefox can't play the file. By using video.js its Flash fallback will play the MP4 on Firefox.
Include the video.js javascript and css on the page
<link href="http://vjs.zencdn.net/4.1/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/4.1/video.js"></script>
As the video element didn't exist when the document was ready, use Fancybox's onComplete option to create the video.js player. Note I've given the video element an id to reference it.
$('#startplayer').fancybox(
{content : '<video id="my_video" class="video-js vjs-default-skin" controls preload="none" width="555" height="311" poster="http://ranova.thull-hosting.de/fileadmin/videos/interview1_neu_vorschau.jpg"><source src="http://video-js.zencoder.com/oceans-clip.mp4" type=\'video/mp4\'></source></video>',
onComplete: function() {
videojs("my_video");
}
}
);
Related
I am using Yahoo web player and certain steps in order to add song to yahoo web player playlist.
I am displaying list of songs.
On click on a song creating a dynamic song url using jquery and appending in the div tag.
Link Like: Song
I want add this link to yahoo web player playlist.
Code:
fileUrl = "<a href='http://www.example.com/data?v=yaariyaan'> Song </a>";
YAHOO.MediaPlayer.addTracks(fileUrl, 0, true);
YAHOO.MediaPlayer.play();
addTracks is not adding the link to the playlist.
I am also getting the error:
Error : "Uncaught TypeError: Cannot call method 'fadeIn' of undefined ";
How to fix it?
I had the same problem and the only way I could resolve it is to make the autoplay set to true, like this:
<script type="text/javascript">
var YMPParams =
{
autoplay:true
}
</script>
<script type="text/javascript" src="http://mediaplayer.yahoo.com/latest"></script>
Does anyone have a URL of a successful multivideo gallery using mediaelement.js where the same instance of MediaElementPlayer is reused and have it working with the Flash fallback for IE8 & 7?
I have partial success changing the setSrc as a function after the new MediaElementPlayer is created for the first time. This is robust for the HTML5 component but failing for the flash fallback. setSrc is consoling as not available in IE8 & 7. It fails to recognise the object.
Moving the setSrc to the "success" part of the new MediaElementPlayer does load the Flash fallback and HTML5 video as expected. On attempting to change the source of the player I have attempted to "destroy" and recreate the MediaElementPlayer object on the fly without success. I have not declared player using var=player so reasonably have expected to delete it but without success:
player = false;
delete player;
//make a new instance of the mediaelement video player
player = new MediaElementPlayer('#videoPlayer', {
pluginPath: ''+basePath+'_Includes/JS/',
success: function (player, node) {
//set the size (for flash otherwise no video just sound!)
if($("#rg-gallery.smallGallery").length > 0){
player.setVideoSize(400, 225);
} else{
player.setVideoSize(640, 360);
}
player.setSrc([
{ src: mp4, type: 'video/mp4' },
{ src: webm, type: 'video/webm' }
]);
player.load();
player.pause();
//if the video plays stop the slideshow
player.addEventListener('play', function () {
videoPlaying.push('playing');
stopSlideshow();
}, false);
}
});
Research both here and on the web shows that others are attempting to try this type of dynamic gallery but I am unable to find an example that shows it as technically viable.
Any example URLs where someone's cracked it would be lovely. Thanks :)
Solved.
Created a JS variable of video code:
var playerView = '<video width="640" height="360" id="videoPlayer" class="video-js vjs-default-skin" poster="" controls preload="auto"><source id="mp4" type="video/mp4" src="" /><source id="webm" type="video/webm" src="" /></video>';
On initialization removed any DOM rendering of any existing player, set it to false and deleted it:
//remove any existing video player
$(".mejs-container").remove();
player = false;
delete player;
Appended new video view to DOM:
//add a new one
$(".rg-video").append(playerView);
Created new instance of player and set src and load as normal:
//make a new instance of the mediaelement video player
player = new MediaElementPlayer('#videoPlayer', { ...
HTML5 video and Flash video fallback for IE8 & 7 now working as part of dynamic mixed media gallery.
Off for tea and medals.
:)
I just started blogging using jekyll. I write my posts in markdown. Now, I want to include a youtube video in my post. How can I do this?
Also, I dont really like the pygments highlighting provided by jekyll by default. Is there anyway I can change this to some other style? If yes, can you point me to some nice styles/plugins?
You should be able to put the HTML for embedding directly into your markdown. Under the video, there is a "Share" button, click on this, and then the "Embed" button, which should give you something that looks a little like:
<iframe width="420" height="315" src="http://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
Just copy and paste that into your post, the Markdown preprocessor won't touch it.
For Pygments, there is a whole pile of CSS stylesheets for various colour themes in this repository, you could experiment with them. (Note that you will have to replace .codehilite with .highlight for these to work with Jekyll.)
I did similar thing but in my case, simple copy and paste doesn't work. The error message is below:
REXML could not parse this XML/HTML:
To avoid this error, I deleted allowfullscreen from copied source as below:
<iframe width="480" height="360" src="http://www.youtube.com/embed/WO82PoAczTc" frameborder="0"> </iframe>
It is important that Adding a whitespace before the closing </iframe>.
Then, I succeeded to embed the video into my site.
The html code to insert a youtube video can be produced in Jekyll using a simple plugin
as described in https://gist.github.com/1805814.
The syntax becomes as simple as:
{% youtube oHg5SJYRHA0 %}
In my case issue has been resolved with jQuery:
jQuery
$('.x-frame.video').each(function() {
$(this).after("<iframe class=\"video\" src=\"" + ($(this).attr('data-video')) + "\" frameborder=\"0\"></iframe>");
});
Usage
<div class="x-frame video" data-video="http://player.vimeo.com/video/52302939"> </div>
Note that whitespace is required between <div> </div>
One of the nicer features of WordPres is that you can just paste a Youtube URL in the content (on a new line) and WordPress transforms this into an embed code.
The following code does the same for Jekyll. Just put this code in your footer (or use a Jekyll include) and all paragraphs with JUST a Youtube URL are automagically converted to responsive Youtube embeds by Vanilla JS.
<style>
.videoWrapper {position: relative; padding-bottom: 56.333%; height: 0;}
.videoWrapper iframe {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}
</style>
<script>
function getId(url) {
var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
var match = url.match(regExp);
if (match && match[2].length == 11) {
return match[2];
} else {
return 'error';
}
}
function yt_url2embed() {
var p = document.getElementsByTagName('p');
for(var i = 0; i < p.length; i++) {
var pattern = /^((http|https|ftp):\/\/)/;
if(pattern.test(p[i].innerHTML)) {
var myId = getId(p[i].innerHTML);
p[i].innerHTML = '<div class="videoWrapper"><iframe width="720" height="420" src="https://www.youtube.com/embed/' + myId + '?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe></div>';
}
}
}
yt_url2embed();
</script>
Although just adding the HTML code to your Markdown is a very good (maybe even better) and valid solution, this solution might be more user-friendly.
(Source)
How often did you find yourself googling "How to embed a video in markdown?"
While its not possible to embed a video in markdown, the best and easiest way is to extract a frame from the video. To add videos to your markdown files easier, I think the jekyll plugin below would help you, and it will parse the video link inside the image block automatically.
jekyll-spaceship - 🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, emoji, youtube, vimeo,dailymotion, etc.
https://github.com/jeffreytse/jekyll-spaceship
For now, these video links parsing are provided:
Youtube
Vimeo
DailyMotion
...
There are two ways to embed a video in your Jekyll blog page:
Inline-style:
![]({video-link})
Reference-style:
![][{reference}]
[{reference}]: {video-link}
Then, you succeeded to embed the video into your site.
In nowadays:
<iframe width="840" height="473" src="https://www.youtube.com/embed/IQf-vtIC-Uc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Or
right click on the video in your browser and copy-past the embed code.
I have a YouTube video embedded on my site using an iFrame. I want to use the API to pause the video, but in Chrome I get an error:
Unsafe JavaScript attempt to access frame with URL http://subdomain.example.com/ from frame with URL http://www.youtube.com/embed/KmtzQCSh6xk?enablejsapi=1&origin=http://subdomain.example.com. Domains, protocols and ports must match.
In Firefox (3.6) I get this error:
Permission denied for <http://www.youtube.com> to call method Location.toString on <http://subdomain.example.com>.
I've tried putting the iFrame in myself or adding it with the API. Either way the player gets in, but I have no API control over it.
Here's the relevant part of my code:
<div id="player"></div>
<script type="text/javascript">
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '433',
width: '731',
videoId: 'KmtzQCSh6xk'
});
}
$("#pause_button").click(function(){
alert("Pausing " + player);//is undefined :(
player.pauseVideo();
});
</script>
How do I get browsers to allow the YouTube iFrame to access my page's main frame?
Thanks!
Ignore those warnings. The player should still work fine regardless.
Use the recently-introduced JavaScript Player API for iframe embeds.
I'm working on my first GM script, to replace the Flash previews on http://www.freesound.org with HTML 5 audio tags, and to add a download link to search results. I have the latter working fine, but I can't get the audio tag to display in Firefox 3.5.9. Here's my script:
// ==UserScript==
// #name FreeSound HTML 5 Preview
// #namespace http://thewordnerd.info
// #description Replace Flash-based sound previews on freesound.org with audio tags and add quick download links
// #include http://freesound.org/*
// #require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
// ==/UserScript==
$(document).ready(function() {
$("embed").remove();
$(".samplelist").each(function(index) {
sampleNo = $(this).find("a:first").attr("href").split("?")[1].split("=")[1];
userName = $(this).find("a:eq(1)").html();
title = $(this).find("a:first").html().replace(/ /g, "_");
url = "/download/"+sampleNo+"/"+sampleNo+"_"+userName+"_"+title;
$(this).find("script").replaceWith("<audio src='"+url+"' controls='controls' type='audio/wave'/>");
//$(this).find("audio").removeAttr("tabindex");
$(this).append("<a href='"+url+"'>Download</a>");
});
});
I can see the element in Firebug and it seems just fine.
Thoughts on what I might be doing wrong here? Since the download link does download the requested file, since it's a wave and since I think I've set the correct type, I'm at a loss as to why this isn't displaying.
It may not be your script so much as the freesound.org site/server.
When I run a modified version of your script, the audio controls all appear for a split second before reverting to the error display, like so:
Firefox reports MEDIA_ERR_SRC_NOT_SUPPORTED for the files I checked.
Save this code to your machine and then run it with Firefox:
<html>
<head>
<title>Audio File test</title>
</head>
<body>
<audio id="aud1" controls="true" type="audio/ogg"
src="http://www.freesound.org/download/7521/7521_abinadimeza_Rainfall.ogg">xxx</audio>
<audio id="aud2" controls="true" type="audio/ogg"
src="http://developer.mozilla.org/#api/deki/files/2926/=AudioTest_(1).ogg">xxx</audio>
</body>
<script type="text/javascript">
window.addEventListener ("load", ErrorReport, false);
function ErrorReport (evt)
{
console.log (document.getElementById ("aud1").error);
console.log (document.getElementById ("aud2").error);
}
</script>
</html>
.
You'll see that the known good file, from Mozilla, works correctly but the one from freesound.org does not. This may be a bug/limitation in Firefox -- both files play fine on my local player.
Here is a link to the Firefox bug system, to search for or report bugs.