Embedded Youtube videos slowwww things down - php

I'm creating a site with a lot of embedded Youtube videos, but it seems the video players take a while to load. Is there a way I could speed things up?
If this is not possible, then how do you embed just the thumbnails and load the videos when a user clicks on the thumbnail?

About your first question:
You cannot control the load speed because the videos are not hosted on your server but on Youtube's one.
About your second question:
You can check this address in order to find out how to extract the thumbnails from the youtube videos: http://www.reelseo.com/youtube-thumbnail-image/
After that you can load the youtube video on onclick using Ajax or simple redirect to a separate page where video is positioned.

Related

How to retrieve videos from server and play it onclick?

I am doing a tutorial website project. In this i hav a video player at the right side, and vertical menu at the left side of the page. I hav lots of videos to put in. I am trying to play the videos in the same video player in the same page. How to retrieve videos from database and play it onclick from menu?
I am using video tag for video player. Also i wanted to display the video name at th bottom of the video player in the page, that changes for every videos. Like youtube website!!. I am using Wamp local server. Below is the code for single static video and video name.
<div class="video" align="right"><video id="movie" class="video" width="800" height="520" title="franklin" data-uid="movie" controls poster="images/LMS.JPG"><source src="videos/Learning Management System.mp4" /></video></div>
<div id="video_heading"><p><b>Introduction to Learning Management System</b></p></div>
How to make use of database system to retrieve the video and name of the video using PHP. Please help. I am desperately in need of someone's help.
Use AJAX to send a request from JavaScript to your server to retrieve the correct video information from the database and return it in a format that you can use, like JSON. Then, using the response data, update your video object and other DOM elements accordingly.

Retrieve a thumbnail of any video in an iFrame?

I have various video hosts that I like to use on my website. I am trying to code a way to retrieve their video thumbnails.
Most of these video hosts actually have a frame of the video on display before the video starts to play. If it's possible to even get that frame as the thumbnail, that would be great. Most if not all of these video hosts use iframes for embedding.
I am looking for a fairly generic way of retrieving thumbnails for all video hosts that display some type of frame from the video once the video is embedded. If that frame can somehow be retrieved and then turned into an image that can be used that would be amazing. However, I am not exactly sure how to go about doing that.
You'd have to have the actual binary file data. If you have that access, install ffmpeg-php on your server and use this question for further direction: ffmpeg to get screenshot
Depends on the site.
For example, if you have a youtube video
http://www.youtube.com/watch?v=AC2FKbyC28k
then its thumbnail is at
http://i2.ytimg.com/vi/AC2FKbyC28k/mqdefault.jpg
I found this out by right clicking the image thumbnail, opening it in a tab and inspecting the url, so I'm sure you can do this exhaustively for every site ;)
It sounds like what you want is oEmbed, which is supported by most popular video hosting sites (Youtube, Vimeo, ...). There are several PHP oEmbed libraries, which come preconfigured with oEmbed endpoints.
What oEmbed allows you to do is to make a request to the provider (Youtube for example) with the video URL. It will return a JSON response with information about the video. Both Youtube and Vimeo return a thumbnail_url element in the JSON.

Control youtube's Overlay with api

i made a script to upload videos to youtube from a folder on my server, but now i want a way to control the overlay ads. i saw a video that has just like what i want.
here is the video link:
http://www.youtube.com/watch?v=_v0JoEarI8s
is there any way to do that?
I think that the Call-to-Action overlays can not be managed from the API
https://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata/wyUoI9S2c0M
Apparently can only be configured manually
http://support.google.com/youtube/bin/answer.py?hl=en&answer=150471

Preview video from thumbnail

Recently stumbled upon a stock video footage site http://www.pond5.com/stock-video-footage/1/*.html , and saw that they had a preview of a video when the user hovered over a thumbnail. I want to recreate this, because it seems like useful practice and it will allow me to workout my web developing muscles.
I would like to be able to preview a video when a user hovers over a thumbnail.
For example like pond5.com. Audio is not necessary, but I would like it to look smooth like a video rather than a video preview that contains a frame every 5 seconds.
On pond5.com, I originally thought they used a gif, but it plays very smoothly. Some also contain audio. As far as I thought, audio can't be used in .GIFs
Is this a case where I would have to just upload a 2nd video for the preview?
Thank you for any help.
Pond5, the website you specifically mentioned, creates a video thumbnail with watermark and lowered quality and stores it. It is then played back using JavaScript to dynamically load a div element that contains the flash player. So no GIFs are involved. You do need to upload a 2nd video, but the steps to this project are as follows:
Server-side video thumbnail/watermarking: Not sure if there are any PHP packages that are up to the task on this one. I would write a more powerful program in C++ or C#. If you go with C#, quick and easy solution would be Microsoft Expression Encoder.
Flash/Silverlight/HTML5 video player: To play the video.
Client-side JavaScript: To load the fancy popup and the aforementioned video player. Note that you might need to use PHP and a database engine to load the thumbnail URL for the video requested.
This is what Pond5, and what many other stock-footage sites use, and the basic outline of what you would need to do to achieve similar results.

Using own video player for youtube, dailymotion,vimeo etc

I have my own video player, I've bought it from activeden. And im going to use youtube, dailymotion, video api with php. But i want to use my own video player. How can i do that? It takes list from a xml files like this;
<video_item>
<hd_video_path>.flv</hd_video_path>
<sd_video_path>.flv</sd_video_path>
<video_title>....</video_title>
<video_description>...</video_description>
</video_item>
You should write a script(PHP/.NET or whatever) that pulls in the correct video url for the videos you want to put in your player and assembles your playlist based on those.

Categories