• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Missing background image for YouTube Videos

Started by Hersh,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HershTopic starter

This is something which I noticed with a recent update. YouTube videos which are not HD do not include 'maxresdefault.jpg' image. The highest quality is 'hqdefault.jpg.' For this reason, many lower quality videos show this background image in JW Player, which makes it seem like the video has been removed:


To fix this without losing the option of using maxresdefault.jpg when available, you will need to edit class.providers.php

Find:
                        $real_link = 'http://www.youtube.com/watch?v=' . $videoId;
                        $img = 'http://i1.ytimg.com/vi/' . $videoId . '/`maxresdefault.jpg';
                        $embedCode = $this->_jwplayer($real_link, $img, thumb_fix(get_option('player-logo')));
                    }

REPLACE with:
                        $real_link = 'http://www.youtube.com/watch?v=' . $videoId;
                        $md5image1 = md5_file('http://i1.ytimg.com/vi/' . $videoId . '/maxresdefault.jpg');
                        $md5image2 = md5_file('http://i4.ytimg.com/vi/0/0.jpg');
                        if ($md5image1 == $md5image2) {
                            $img = 'http://i1.ytimg.com/vi/' . $videoId . '/hqdefault.jpg';
                        } else {
                            $img = 'http://i1.ytimg.com/vi/' . $videoId . '/maxresdefault.jpg';
                        }


Note, this might reduce page load time.

If you don't want the slight performance reduction for non-cached pages, you can simply just change this:
$img = 'http://i1.ytimg.com/vi/' . $videoId . '/`maxresdefault.jpg';

To this:
$img = 'http://i1.ytimg.com/vi/' . $videoId . '/`hqdefault.jpg';
  •  

 

Similar topics (7)

Important Announcement: PHPVibe Video Sharing CMS End of Life

Started by Marius P.


Replies: 1
Views: 37228

insite ads issue when selecting above/below video player location

Started by georgepanaitescu


Replies: 3
Views: 20608

The problem of video viewing PHPVibe 5.0

Started by Nayn


Replies: 25
Views: 68651

embed video does not work on v5

Started by neospider69


Replies: 6
Views: 48134

when slecting to unpublish music mp3 - next page says unpublished video ?

Started by spirog


Replies: 2
Views: 3947

Like a video - unlinke a video - relike a video does not work

Started by spirog


Replies: 7
Views: 3593

Video that I've uploaded needs to have that value in admin to upload

Started by spirog


Replies: 4
Views: 3767