Fancybox - how to set default Youtube video quality - jquery-plugins

Is there a way to set default Youtube video quality when displaying video with Fancybox? I tried supplying &hd=1 query-string parameter in video url, as suggested by Youtube, but looks like this gets ignored when Fancybox embeds video... Sometimes it embeds 260p, sometimes 320p, sometimes 480p and I am out of idea how to alter this parameter.
http://www.youtube.com/watch?v=VRT0OhHnOzo&autoplay=1&hd=1
If the URL is entered directly into browser then yotube displays HD version when supplying &hd=1 parameter.

Ok I found the solution with the help of this question.
The code I used and worked with Fancybox 2 is:
$('.fancybox-media').fancybox({
openEffect : 'none',
closeEffect : 'none',
width : 1000,
height : 563,
helpers : {
media: true
},
youtube : {
autoplay: 1,
hd: 1,
vq: 'hd720'
}
});
The key is the youtube: part... You can also supply vq: '1080' this will then force 1080p video quality.

Related

change max Buffer Length in MPEG-dash format

I'm trying to change the max buffer length on my video streaming in clappr video player.
I know that in HLS format the way to do it is like this:
player = new Clappr.Player({
playback: {
hlsjsConfig: {
maxMaxBufferLength: 30
}}})
And it's realy working for HLS videos,
I'm looking for equivalent way to do it with MPEG-dash foramt
How are you playing DASH in Clappr?
If you are using Shaka, https://github.com/clappr/dash-shaka-playback, set it up as shown at https://github.com/clappr/dash-shaka-playback, using the buffer settings you require as described at https://github.com/google/shaka-player/blob/master/docs/tutorials/network-and-buffering-config.md#buffering-configuration
Eg:
player = new Clappr.Player({
source: '//storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd',
plugins: [DashShakaPlayback],
shakaConfiguration: {
preferredAudioLanguage: 'pt-BR',
streaming: {
bufferingGoal: 30,
rebufferingGoal: 15,
bufferBehind: 60
}
}
});

Browser Print dialog not showing

I have print.min.js referenced in my angularjs project. I have it printing successfully (very simple!) for most of my needs. I have run into a case where the browser print dialog does not appear when a user presses my 'Print' button. The issue seems to be related to file size. I don't know the size threshold yet, but it seems after a few pages in length, the process hangs in print.min.js somewhere. Smaller files (2 - 3 pages or so) print without issue. Any thoughts?
Thanks!
Joe
By default, Print.js will process the computed styles for each html element. When printing large and / or complex html, this process may take a while. Specially on slower machines.
To prevent this, the library has a parameter scanStyles that can be set to false.
However, for this to work properly, you may want to style your html with css classes instead of inline style. Since the library isn't scanning the computed styles, it needs to receive the css you want to use when printing.
For example, when printing an element of id myElement on a page with two attached stylesheets, myStylesheet.css and vendor.css:
printJS(
{
printable: 'myElement',
type: 'html',
scanStyles: false,
css: ['myStyleSheet', 'vendor.css']
}
)
This supports css print media query as well.
You can also pass custom inline style if necessary:
printJS(
{
printable: 'myElement',
type: 'html',
scanStyles: false,
css: ['myStyleSheet', 'vendor.css'],
style: 'h1 { color: blue; }, someClass { font-size: 1rem; }'
}
)
http://printjs.crabbly.com/#configuration

Main images ( large size ) display like blurry , when are shared with youtube video in same post (Blogger)

please I have a case very weird. My blog show blurry images ( these are high resolution or original size ) on "slide carusel' and "related posts" when are shared with a youtube video. These problems only happens when a main image is shared with an embebed youtube video.
For example, the post have a main pic ( for example 800x600) , below a second image, and down embebed a youtube video, so the first image will lost absolutely its quality ( like blurry) on "slider carusel' and "related post" section,
I was googling this issue but I dont found articles about it. I have a test blog where I show this problem, .. the blogger template is premium was purchased., is not free version.
Thanks in ADVANCE
YOU CAN see it here http://blurryimagesblurry.blogspot.com
Joan (Wendynow)
Locate the following code in the template -
function getImage(sora,z){var n=sora[z].title.$t,p=sora[z].content.$t,u=$("<div>").html(p);if("media$thumbnail"in sora[z]){var w=sora[z].media$thumbnail.url.replace(/\/s[0-9]+\-c/g,"/s1600");if(p.indexOf("youtube.com/embed")>-1){w=sora[z].media$thumbnail.url.replace("/default.jpg","/mqdefault.jpg");}}else if(p.indexOf("<img")>-1){w=u.find("img:first").attr("src");}else{w=soraOptions.noThumbnail;}var code='<img class="sora-thumb" alt="'+n+'" src="'+w+'"/>';return code;}
There are two instances of the getImage function in the template. Replace them both with the following code -
function getImage(sora, z) {
var n = sora[z].title.$t,
p = sora[z].content.$t,
u = $("<div>").html(p);
if("media$thumbnail" in sora[z]) {
var w = sora[z].media$thumbnail.url.replace(/\/s[0-9]+\-c/g, "/s1600");
if(sora[z]["media$thumbnail"].url.indexOf("youtube.com") > -1 ) {
w = sora[z].media$thumbnail.url.replace("/default.jpg", "/maxresdefault.jpg");
}
} else if(p.indexOf("<img") > -1) {
w = u.find("img:first").attr("src");
} else {
w = soraOptions.noThumbnail;
}
var code = '<img class="sora-thumb" alt="' + n + '" src="' + w + '"/>';
return code;
}
The problem was happening because of the wrong if condition being used. The if condition was applying YouTube specific image resolution changes when a YouTube video is present inside the post content (due to this, when a post contains a YouTube video and the media$thumbnail URL is not the YouTube thumbnail, it tries to apply YouTube specific image resolution changes to the Blogger hosted image, which fail to work, causing the default thumbnail of the size 72x72px being used instead). Whereas it should be applying the YouTube specific image resolution changes (aka resizing the YouTube Thumbnail to higher resolution) when the media$thumbnail URL is only a YouTube thumbnail.

Set scrollLeft/scrollTop simultaneously does not work in Safari 6

When setting the scrollTop and scrollLeft parameters in Safari 6 simultaneously, only one of both gets executed, scrolling the page only over one axis. This happens both using native JavaScript, jQuery and the jquery.scrollTo plugin.
Example using jQuery's .animate():
$('body').animate({
'scrollLeft': 100,
'scrollTop': 100
}, {
'duration': 500,
'easing': 'swing'
});
I've set up a demo page here: http://nabble.nl/demo/safari6scrollto/
All examples work fine in all major browsers as expected, in Safari 6 only example no. 4, 6 and 7 work.
Somehow, when loading the demo page in an IFRAME (see bottom of demo page), everything works just fine.
Is this a bug in Safari? If so, how to work around this issue? If not, what is causing it and how can this be resolved?
Other related reports:
https://github.com/flesler/jquery.scrollTo/issues/9
http://forum.jquery.com/topic/scrolltop-scrollleft-not-working-in-safari-6
http://bugs.jquery.com/ticket/12588
I needed to get the jquery.scrollTo plugin working on OSX Mountain Lion, and since I couldn't find the specifics on what is causing this behaviour, I put together a rather ugly workaround. It uses window.scrollTo(x, y) in the step function of jQuery's .animate(), which gives no problems in Safari 6:
var left;
$(window).animate({
'pageXOffset': 100,
'pageYOffset': 100
}, {
duration: 500,
easing: 'swing',
step: function(now, fx) {
if (fx.prop == 'pageXOffset') {
left = now;
} else if (fx.prop == 'pageYOffset') {
window.scrollTo(left, now);
}
}
});
Please note that the step function is called for every animated property, for every element the animation is applied on (in our case just 1: window). Hence the intermediate variable to store the current X position in the animation.
It uses the pageXOffset and pageYOffset properties of the window object, so I don't know how suitable this workaround is for animating the scrollLeft and scrollTop properties of non-window objects.
Anyway, it works for scrolling the entire document, which was all I wanted, and does so very smooth in Safari 6, too!

how to improve video quality?

I am using the following code snippets to record screen, and in most situations recorded wmv file is clear enough, but for some part of video it is not very clear (grey color for some parts). What I record is ppt with full screen mode. I am using Windows Media Encoder 9.
Here is my code snippet,
IWMEncSourceGroup SrcGrp;
IWMEncSourceGroupCollection SrcGrpColl;
SrcGrpColl = encoder.SourceGroupCollection;
SrcGrp = (IWMEncSourceGroup)SrcGrpColl.Add("SG_1");
IWMEncVideoSource2 SrcVid;
IWMEncSource SrcAud;
SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcVid.SetInput("ScreenCap://ScreenCapture1", "", "");
SrcAud.SetInput("Device://Default_Audio_Device", "", "");
// Specify a file object in which to save encoded content.
IWMEncFile File = encoder.File;
string CurrentFileName = Guid.NewGuid().ToString();
File.LocalFileName = CurrentFileName;
CurrentFileName = File.LocalFileName;
// Choose a profile from the collection.
IWMEncProfileCollection ProColl = encoder.ProfileCollection;
IWMEncProfile Pro;
for (int i = 0; i < ProColl.Count; i++)
{
Pro = ProColl.Item(i);
if (Pro.Name == "Screen Video/Audio High (CBR)")
{
SrcGrp.set_Profile(Pro);
break;
}
}
encoder.Start();
thanks in advance,
George
I would guess that it's a problem with your encoder profile or settings, and not a problem with the code. If you're using the default "Screen Video/Audio High (CBR)" profile in WME9, it's using a video bitrate of 250Kbps, which is pretty low. I'd suggest creating a custom profile in the Windows Media Encoder Profile Editor Utility. Something like this:
awesomesc.prx
Name: Awesome Screen Profile
Audio: WMA 9.2 CBR (32kbps, 44kHz, mono CBR)
Video: WMV 9 Screen Quality VBR (Video size Same as video input, Frame rate 10fps, Key frame interval 3sec, Video quality 90)
Then just change the code to match the custom profile's name.
if (Pro.Name == "Awesome Screen Profile")
The encoder settings would take a much longer post to go through, but if you have not changed them from the defaults, you should be OK.
The Quality-based VBR algorithm can be pretty amazing, and will likely produce a surprisingly low average bitrate, but if VBR won't work for your needs, you can use the Windows Media Encoder Profile Editor utility to import the schia.prx profile that you're using and tweak the settings to find a higher CBR bitrate that produces acceptable quality.
"Screen Video/Audio Medium (CBR)"
it solved my problem

Resources