videopress_get_transcoding_status

Get an array of the transcoding status for the given video post.

Description

(array|bool) videopress_get_transcoding_status( (int) $post_id ); 

Returns (array|bool)

Returns an array of statuses if this is a VideoPress post, otherwise it returns false.

Parameters (1)

0. $post_id (int)
The post id.

Usage

  1. if ( !function_exists( 'videopress_get_transcoding_status' ) ) { 
  2. require_once '/modules/videopress/utility-functions.php'; 
  3.  
  4. // The post id. 
  5. $post_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = videopress_get_transcoding_status($post_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/videopress/utility-functions.php  
  1. function videopress_get_transcoding_status( $post_id ) { 
  2. $meta = wp_get_attachment_metadata( $post_id ); 
  3.  
  4. // If this has not been processed by videopress, we can skip the rest. 
  5. if ( ! $meta || ! isset( $meta['file_statuses'] ) ) { 
  6. return false; 
  7.  
  8. $info = (object) $meta['file_statuses']; 
  9.  
  10. $status = array( 
  11. 'std_mp4' => isset( $info->mp4 ) ? $info->mp4 : null,  
  12. 'std_ogg' => isset( $info->ogg ) ? $info->ogg : null,  
  13. 'dvd_mp4' => isset( $info->dvd ) ? $info->dvd : null,  
  14. 'hd_mp4' => isset( $info->hd ) ? $info->hd : null,  
  15. ); 
  16.  
  17. return $status;