Showing posts with label videos. Show all posts
Showing posts with label videos. Show all posts

Friday, June 16, 2017

Posted by beni in , , , , , , , , , | June 16, 2017

A Better Method for Embedding YouTube Videos on your Website


It is easy to embed a YouTube video but you�ll be surprised to know how much extra weight that embedded YouTube video can add to your web pages. The browser has to download about half a Mb of extra JavaScript files (see screenshot) for rendering the YouTube video player alone. And these files are downloaded even if the visitor never plays the embedded video.

The embedded video not only increases the byte size of your web pages but the browser has to make multiple HTTP requests to render the video player. This increases the overall loading time of your page thus affecting the page speed score. The other drawback with the default YouTube embed code is that it isn�t responsive. If people view your website on a mobile phone, the video player may not resize properly for the small screen.

Embed YouTube Videos without Increasing Page Size

Google+ uses a clever technique for embedding YouTube videos � it just embeds the thumbnail image of a YouTube video and the actual video player is loaded only when the user manually clicks the thumbnail.

YouTube thumbnail images are about 15 kB in size so we are able to reduce the byte size of web pages by 500+ kb. That�s huge!

The video above is embedded using the same on-demand technique (demo).

When a visitor clicks the play button, the thumbnail image is replaced with the standard YouTube video player with autoplay set to 1 so the plays the video instantly. The advantage is that the extra YouTube JavaScript gets loaded only when someone decides to watch the embedded video and not otherwise.

Light and Responsive YouTube Embeds

The standard embed code for YouTube uses the IFRAME tag and the width and height of the video player are hard-coded thus making the player non-responsive.

The new on-demand embed code for YouTube is slightly different. You need not specify the player size as we are now embedding the video responsively. Also, the IFRAME is replaced with a DIV tag and the IFRAME is added to the page only when the visitor clicks the play button.

YouTube Embed Code

Embed YouTube Videos Responsively � Tutorial

Copy-paste the following snippet anywhere in your web page where you would like the YouTube video to appear. Remember to replace VIDEO_ID with the actual ID of the YouTube video.


<div class="youtube-player" data-id="VIDEO_ID"></div>

We will not assign height and width since the video player will automatically occupy the width of the parent while the height is auto-calculated. You can paste multiple DIV blocks with different video IDs if you need to embed multiple videos on the same page.

Next, place the JavaScript anywhere in your web template. It finds all embedded videos on a web page and then replaces the DIV elements with the video thumbnails.


<script>

/* Light YouTube Embeds by @labnol */
/* Web: http://ift.tt/2bGFoam */

document.addEventListener("DOMContentLoaded",
function() {
var div, n,
v = document.getElementsByClassName("youtube-player");
for (n = 0; n < v.length; n++) {
div = document.createElement("div");
div.setAttribute("data-id", v[n].dataset.id);
div.innerHTML = labnolThumb(v[n].dataset.id);
div.onclick = labnolIframe;
v[n].appendChild(div);
}
});

function labnolThumb(id) {
var thumb = <img src="http://ift.tt/2bGFpex;,
play = <div class="play"></div>;
return thumb.replace("ID", id) + play;
}

function labnolIframe() {
var iframe = document.createElement("iframe");
var embed = "https://www.youtube.com/embed/ID?autoplay=1";
iframe.setAttribute("src", embed.replace("ID", this.dataset.id);
iframe.setAttribute("frameborder", "0");
iframe.setAttribute("allowfullscreen", "1");
this.parentNode.replaceChild(iframe, this);
}

</script>

Finally, paste the CSS before the closing head tag of your web template.

This method will reduce the size of your web pages by 500 KB while making your site mobile friendly. You may refer to the annotated code to understanding how on-demand embedding works.


<style>
.youtube-player {
position: relative;
padding-bottom: 56.23%;
/* Use 75% for 4:3 videos */
height: 0;
overflow: hidden;
max-width: 100%;
background: #000;
margin: 5px;
}

.youtube-player iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100;
background: transparent;
}

.youtube-player img {
bottom: 0;
display: block;
left: 0;
margin: auto;
max-width: 100%;
width: 100%;
position: absolute;
right: 0;
top: 0;
border: none;
height: auto;
cursor: pointer;
-webkit-transition: .4s all;
-moz-transition: .4s all;
transition: .4s all;
}

.youtube-player img:hover {
-webkit-filter: brightness(75%);
}

.youtube-player .play {
height: 72px;
width: 72px;
left: 50%;
top: 50%;
margin-left: -36px;
margin-top: -36px;
position: absolute;
background: url("//i.imgur.com/TxzC70f.png") no-repeat;
cursor: pointer;
}

</style>

Please do note that Chrome and Safari browsers on iPhone and Android only allow playback of HTML5 video when initiated by a user interaction. They block embedded media from automatic playback to prevent unsolicited downloads over cellular networks.

YouTube Embed Tutorials

  1. Embed a YouTube Video with Sound Muted
  2. Place YouTube Video as your Webpage Background
  3. Embed Just a Portion of a YouTube Video

The story, A Better Method for Embedding YouTube Videos on your Website, was originally published at Digital Inspiration by Amit Agarwal on 31/08/2016 under Embed, YouTube, Internet.

via Digital Inspiration Technology Blog http://ift.tt/10LvFUi

Sunday, June 11, 2017

Posted by beni in , , , , , , | June 11, 2017

5 iPhone Apps for Streaming Videos on iPhone


Streaming videos and movies on your iPhone is a very cool way to pass the time, and in many cases, it become more crucial when you are getting video streaming services for free. And if you are looking for these type of apps for your iPhone device, then this article is surely your cup of tea.

In this article we are going to discuss some of the top stream- worthy your apps for your viewing pleasure. And if you feel that I forget to share some of the best name with your don�t forget to share the name with us in comment sections.

lets we  start with:

1. Air Video

air video free

If you really want to watch movies and video, without caring about format, then Air Video is one of the best app which you might love to install on your iPhone and other iOS device. Using this app you can get more video library on your device, iPod touch and New iPad, also its great solution to watch your AVI, DivX, MKV and other videos. Air video featuring  Video Streaming, Live Conversion, One Touch Offline Conversion and more. You can also use this app as full version with the small fee of $3.

2. Plex

Plexapp

Plex is one of the best home media center iOS app for your iPhone device. Using this app your device get ability to browse and play videos from a Mac computer. This might not be a great app for everyone, but its perfect for users who love plex. One this which I really like about this app is that app automatically ports over content via its myPlex service.

3. Netflixnetflixs copy is another cool app fore streaming videos on iphone, we all know that its one of the world�s leading subscription service for watching TV episodes and movies on iphone. This Netflix mobile application delivers the best experience anywhere, anytime. So if you are not member of this amazing service till use this and enjoy one year free subscription and more.

Note: Video out is supported on the iPad, iPhone 4, iPhone 4S, and iPod Touch 4G

4. YouTube Stream

youtube stream

If we are talking about videos and movies streaming how can we forget the name of this this videos giant. This app is a must-have music/video player, using this app you can search & make your own playlists from millions of music and videos from YouTube. You can also play your playlists on background, continuously!

5. StreamToMe

StreamToMe

Another cool iphone app to stream movies on your iphone and with the help of this  movies with additional new features which  you will not get in above mentioned Air Video. If youre looking for a more fully-featured streaming option, StreamToMe may be a good choice for you.

Saturday, May 20, 2017

Posted by beni in , , , , , , , , | May 20, 2017

5 Easy Ways to Download YouTube Videos in Ubuntu


Be it Ubuntu or any other platform, one thing I learned over the years is the fact that people like to download their favorite YouTube videos and would want to keep a local copy of it no matter how hard it is. Luckily, there are plenty of tools to do this in Ubuntu without any hassles. Here, well explore 5 of the most capable YouTube video downloading tools for Ubuntu.

top 5 youtube video downloading tools for ubuntu

download from ubuntu software center

Minitube: When it comes to "conventional" YouTube video streaming and downloading in Ubuntu, nothing beats Minitube. You can type any keyword, and Minitube will give you an endless stream of videos to watch, as simple as that. Minitube does not use the Flash Player either, which means lesser CPU consumption. And of course you can download videos in the quality you choose with the click of a button. What more, Minitube is available for download in default Ubuntu repositories (Edit: Ubuntu 16.04 LTS supported). Click the link above.

top 5 video downloading tools for ubuntu

best 5 youtube video downloading tools for ubuntu

Youtube-dl: Command line tools are a big no-no to many. But I would argue otherwise. Youtube-dl is the best and easiest way to download YouTube videos in Ubuntu. It is fast and obviously nimble. And make no mistake, it has quite a wide range of functionalities. But if all you need is to download the best quality version of a particular video, open up the Terminal and type "youtube-dl<space><link to the video>". Does that look complicated? A more detailed installation and how-to-use instructions can be found in our previous post on Youtube-dl.

top 5 youtube video downloading tools for ubuntu

Gmediafinder: A good Minitube alternative loaded with YouTube streaming and downloading capabilities. In my experience, Minitube has been more stable and a little bit more easier to use when compared Gmediafinder. But it gets the job done. To install it though, you have to add the following PPA and it is not readily available in Ubuntu Software Center (Ubuntu 12.04, Ubuntu 12.10 and Ubuntu 13.04 supported). Just do the following in Terminal.

sudo add-apt-repository ppa:s-lagui/ppa
sudo apt-get update
sudo apt-get install gmediafinder

5 ways to download youtube videos in ubuntu

Movegrab: Yet another command-line tool for downloading YouTube videos in Ubuntu. Somehow, I am finding it difficult to download YouTube specific videos using Movgrab at the moment, even though I didnt had any problem with sites like Dailymotion. Many consider Movgrab to be a superior alternative to my favorite Youtube-dl. More details and how-to-use instructions on Movgrab at WebUpd8. Do the following in Terminal to install Movgrab.

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install movgrab

top 5 youtube video downloading tools for ubuntu
YouTube Downloader Script: Heres a simple cross-browser script that will add a download button to the YouTube page, literally. It will let you download your favorite videos in MP4 format (HD, Full HD and even 4K supported). See installation instructions below,

For Firefox: You need to download Greasemonkey extension for Firefox first. Afterwards, simply visit the script download page and install it.
For Chrome/Chromium: Install Tampermonkey extension first. And then, like before, visit the script download page and hit Install button on top.

Make no mistake, almost all the tools featured above (except the cross-browser script) does support other popular sites like Dailymotion, Vimeo, Metacafe, Liveleak, Blip.tv etc. apart from YouTube. Try them out and let us know your feedback. Thanks for reading.

Recommended: Top 5 Video Editors for Ubuntu/Linux

Search