vimeo private videos
-
Hi there,
your vimeo integration service tries to get images-sources for the placeholder of an video. We have some videos that are not public listed (but can be embeded) so the vimeo-api will not provide the data for the preview-image.
The current code do not handle that well an always expect to get the correct api-response from vimeo.I’ve modified the code so it will also work with private/no-listed videos:
Function -> cmplz_vimeo_placeholder$vimeo_pattern = '/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?/i'; if (preg_match($vimeo_pattern, $src, $matches)) { $vimeo_id = $matches[1]; $new_src = get_transient("cmplz_vimeo_image_$vimeo_id"); if (!$new_src || !file_exists($new_src)) { $xml = @file_get_contents("https://vimeo.com/api/v2/video/$vimeo_id.xml"); if(empty($xml)) {//-> maybe a not public video set_transient("cmplz_vimeo_image_$vimeo_id", '', WEEK_IN_SECONDS); } else { $vimeo_images = simplexml_load_string($xml); $new_src = $vimeo_images->video->thumbnail_large; $new_src = cmplz_download_to_site($new_src, 'vimeo'.$vimeo_id); set_transient("cmplz_vimeo_image_$vimeo_id", $new_src, WEEK_IN_SECONDS); } } } return $new_src;
Also i override the bugfix via filter, it would be great if you could include the modified code in your plugin.
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘vimeo private videos’ is closed to new replies.