Changeset 12043
- Timestamp:
- 09/02/2022 05:03:46 AM (2 years ago)
- Location:
- sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-rest/wordpresstv-rest.php
r9762 r12043 97 97 'producer' => array(), 98 98 'video' => array( 99 'mp4' => array(), 100 'ogg' => array(), 101 ) 99 'mp4' => array(), 100 'ogg' => array(), 101 'original' => false, 102 ), 103 'subtitles' => array(), 102 104 ); 103 105 … … 145 147 if ( $post_videos ) { 146 148 $post_video = video_get_info_by_guid( $post_videos[0] ); 147 148 // Ogg 149 $api_data = video_get_single_response( $post_video ); 150 151 // Original uploaded file, may vary in format. 152 $video['video']['original'] = $api_data['original']; 153 154 // Ogg - No longer generated as of May 2021 149 155 if ( $link = video_highest_resolution_ogg( $post_video ) ) { 150 156 $video['video']['ogg']['low'] = $link; 151 157 } 152 158 153 // MP4 159 // MP4 - Audio no longer available in all formats 154 160 $mp4_formats = array( 'low' => 'fmt_std', 'med' => 'fmt_dvd', 'high' => 'fmt_hd' ); 155 161 foreach ( $mp4_formats as $mp4_field => $mp4_format ) { 156 if ( $link = video_url_by_format( $post_video, $mp4_format ) ) { 157 $video['video']['mp4'][ $mp4_field ] = $link; 162 // Check if HLS transcoded, no audio, no need to link to it. 163 if ( ! empty( $api_data['files'][ str_replace( 'fmt_', '', $mp4_format ) ]['hls'] ) ) { 164 continue; 158 165 } 166 167 $video['video']['mp4'][ $mp4_field ] = video_url_by_format( $post_video, $mp4_format ); 159 168 } 160 169 } 170 171 // Expose the subtitles 172 $video['subtitles'] = (array) $api_data['subtitles']; 161 173 } 162 174 -
sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/sidebar-single.php
r8230 r12043 26 26 $videos = array_keys( find_all_videopress_shortcodes( $originalcontent ) ); 27 27 if ( ! empty( $videos ) ) { 28 $video = video_get_info_by_guid( $videos[0] ); 29 $formats = array( 'fmt_std' => 'Low', 'fmt_dvd' => 'Med', 'fmt_hd' => 'High', 'fmt1_ogg' => 'Low' ); 28 $video = video_get_info_by_guid( $videos[0] ); 29 $api_data = video_get_single_response( $video ); 30 $formats = array( 'fmt_std' => 'Low', 'fmt_dvd' => 'Med', 'fmt_hd' => 'High', 'fmt1_ogg' => 'Low' ); 30 31 $mp4_links = array(); 31 $ogg_link = NULL; 32 $ogg_link = false; 33 32 34 foreach ( $formats as $format => $name ) { 33 35 if ( 'fmt1_ogg' == $format ) { 34 36 $link = video_highest_resolution_ogg( $video ); 35 37 } else { 38 39 // Check if HLS transcoded, no audio, no need to link to it. 40 if ( ! empty( $api_data['files'][ str_replace( 'fmt_', '', $format ) ]['hls'] ) ) { 41 continue; 42 } 43 36 44 $link = video_url_by_format( $video, $format ); 37 45 } … … 46 54 $mp4_links[] = "<a href='$link'>$name</a>"; 47 55 } 56 } 57 58 if ( ! empty( $api_data['original'] ) ) { 59 $mp4_links[] = "<a href='{$api_data['original']}'>Original</a>"; 48 60 } 49 61
Note: See TracChangeset
for help on using the changeset viewer.