Skip to content

Commit 211ae52

Browse files
author
dugajean
authored
Merge pull request #47 from cloudinary/fix/CLOUD-371
2 parents 1bcf86e + 416f1cb commit 211ae52

File tree

1 file changed

+11
-4
lines changed
  • cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media

1 file changed

+11
-4
lines changed

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,21 @@ public function filter_video_shortcode( $html, $attr ) {
199199
if ( false === $this->player_enabled ) {
200200
return $html;
201201
};
202-
203-
// Queue video.
204-
$video = wp_get_attachment_metadata( $attr['id'] );
202+
// Check for override flag.
205203
$overwrite_transformations = false;
206204
if ( ! empty( $attr['cldoverwrite'] ) ) {
207205
$overwrite_transformations = true;
208206
}
209-
$cloudinary_url = $this->media->cloudinary_url( $attr['id'], false, false, null, $overwrite_transformations );
207+
// Check for a cloudinary url, or prep sync if not found.
208+
$cloudinary_url = $this->media->cloudinary_url( $attr['id'], false, false, null, $overwrite_transformations );
209+
if ( ! $this->media->plugin->components['sync']->is_synced( $attr['id'] ) ) {
210+
// If the asset is not synced, then the metadata will not be complete since v1 didn't save any.
211+
// Return html for now since cloudinary_url will queue it up for syncing in the background.
212+
return $html;
213+
}
214+
215+
// Queue video.
216+
$video = wp_get_attachment_metadata( $attr['id'] );
210217
$transformations = $this->media->get_transformations_from_string( $cloudinary_url, 'video' );
211218
$args = array();
212219

0 commit comments

Comments
 (0)