FV Flowplayer Video Player - Version 7.5.14.727

Version Description

  • 2021/01/06 =

  • Bunny Stream - show video collections

  • Bugfix - Editor - show HLS stream checkboxes if the stream cannot be checked as it's not available

Download this release

Release Info

Developer FolioVision
Plugin Icon 128x128 FV Flowplayer Video Player
Version 7.5.14.727
Comparing to
See all releases

Code changes from version 7.5.13.727 to 7.5.14.727

css/license.css CHANGED
@@ -194,7 +194,7 @@ td.aligntop > label { margin-top:4px; }
194
  }
195
 
196
  #fv_flowplayer_default_options input#width, #fv_flowplayer_default_options input#height {
197
- width: 48px;
198
  }
199
 
200
  .description .more {
194
  }
195
 
196
  #fv_flowplayer_default_options input#width, #fv_flowplayer_default_options input#height {
197
+ width: 54px;
198
  }
199
 
200
  .description .more {
flowplayer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: FV Player
4
  Plugin URI: http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer
5
  Description: Formerly FV WordPress Flowplayer. Supports MP4, HLS, MPEG-DASH, WebM and OGV. Advanced features such as overlay ads or popups. Uses Flowplayer 7.2.7.
6
- Version: 7.5.13.727
7
  Author URI: http://foliovision.com/
8
  License: GPL-3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@@ -27,7 +27,7 @@ License URI: http://www.gnu.org/licenses/gpl-3.0.txt
27
  */
28
 
29
  global $fv_wp_flowplayer_ver;
30
- $fv_wp_flowplayer_ver = '7.5.13.727';
31
  $fv_wp_flowplayer_core_ver = '7.2.7.2';
32
  include_once( dirname( __FILE__ ) . '/includes/extra-functions.php' );
33
  if( file_exists( dirname( __FILE__ ) . '/includes/module.php' ) ) {
3
  Plugin Name: FV Player
4
  Plugin URI: http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer
5
  Description: Formerly FV WordPress Flowplayer. Supports MP4, HLS, MPEG-DASH, WebM and OGV. Advanced features such as overlay ads or popups. Uses Flowplayer 7.2.7.
6
+ Version: 7.5.14.727
7
  Author URI: http://foliovision.com/
8
  License: GPL-3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.txt
27
  */
28
 
29
  global $fv_wp_flowplayer_ver;
30
+ $fv_wp_flowplayer_ver = '7.5.14.727';
31
  $fv_wp_flowplayer_core_ver = '7.2.7.2';
32
  include_once( dirname( __FILE__ ) . '/includes/extra-functions.php' );
33
  if( file_exists( dirname( __FILE__ ) . '/includes/module.php' ) ) {
js/bunny_stream-browser.js CHANGED
@@ -54,6 +54,19 @@ jQuery( function($) {
54
  }
55
 
56
  ajax_data['page'] = page;
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  ajax_data['appending'] = (appending ? 1 : 0);
58
  ajax_data['firstLoad'] = (firstLoad ? 1 : 0);
59
 
@@ -61,7 +74,23 @@ jQuery( function($) {
61
  // don't overwrite the page if we've shown the browser for the first time already
62
  // ... instead, we'll be either clearing and rewriting the UL or appending data to it
63
  if (firstLoad) {
64
- var renderOptions = {};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  // add errors, if any
67
  if (ret.err) {
@@ -69,6 +98,17 @@ jQuery( function($) {
69
  }
70
 
71
  $media_frame_content.html( renderBrowserPlaceholderHTML(renderOptions) );
 
 
 
 
 
 
 
 
 
 
 
72
  } else if (!appending && !allLoaded) {
73
  // clear the UL if we're not appending
74
  jQuery('#__assets_browser').find('li').remove();
54
  }
55
 
56
  ajax_data['page'] = page;
57
+
58
+ // check if we have any collection selected
59
+ var collectionVal = jQuery('#browser-dropdown').val(),
60
+ collectionName = jQuery('#browser-dropdown option:selected').text();
61
+
62
+ if (collectionVal != -1) {
63
+ ajax_data['collection_id'] = collectionVal;
64
+ ajax_data['collection_name'] = collectionName;
65
+ } else {
66
+ delete(ajax_data['collection_id']);
67
+ delete(ajax_data['collection_name']);
68
+ }
69
+
70
  ajax_data['appending'] = (appending ? 1 : 0);
71
  ajax_data['firstLoad'] = (firstLoad ? 1 : 0);
72
 
74
  // don't overwrite the page if we've shown the browser for the first time already
75
  // ... instead, we'll be either clearing and rewriting the UL or appending data to it
76
  if (firstLoad) {
77
+ var
78
+ renderOptions = {
79
+ 'dropdownItems' : [],
80
+ 'dropdownItemSelected' : ret.active_collection_link,
81
+ 'dropdownDefaultOption' : {
82
+ 'value' : -1,
83
+ 'text' : 'Choose Collection...'
84
+ }
85
+ };
86
+
87
+ // fill dropdown options
88
+ for (var i in ret.collections) {
89
+ renderOptions.dropdownItems.push({
90
+ 'value' : ret.collections[i].link,
91
+ 'text' : ret.collections[i].name
92
+ });
93
+ }
94
 
95
  // add errors, if any
96
  if (ret.err) {
98
  }
99
 
100
  $media_frame_content.html( renderBrowserPlaceholderHTML(renderOptions) );
101
+
102
+ // add change event listener to the playlists dropdown
103
+ jQuery('#browser-dropdown').on('change', function() {
104
+ allLoaded = false;
105
+ appending = false;
106
+ page = 1;
107
+ // disable Choose button
108
+ jQuery('.media-button-select').prop('disabled', 'disabled');
109
+ // load collection contents
110
+ fv_player_bunny_stream_browser_load_assets();
111
+ });
112
  } else if (!appending && !allLoaded) {
113
  // clear the UL if we're not appending
114
  jQuery('#__assets_browser').find('li').remove();
js/bunny_stream-upload.js CHANGED
@@ -117,6 +117,7 @@ jQuery( function($) {
117
  nonce: fv_player_bunny_stream_upload_settings.job_submit_nonce,
118
  source: file.name,
119
  target: file.name,
 
120
  no_source_verify: 1,
121
  ignore_duplicates: 1,
122
  }).done( function( data ) {
117
  nonce: fv_player_bunny_stream_upload_settings.job_submit_nonce,
118
  source: file.name,
119
  target: file.name,
120
+ collection_id: jQuery('#browser-dropdown').val(),
121
  no_source_verify: 1,
122
  ignore_duplicates: 1,
123
  }).done( function( data ) {
js/shortcode-editor.js CHANGED
@@ -597,12 +597,7 @@ jQuery(function() {
597
  $('.fv_wp_flowplayer_field_height').val(attachment.height);
598
  }
599
  if( typeof(attachment.fileLength) != "undefined" ) {
600
- $('#fv_wp_flowplayer_file_info').show();
601
- $('#fv_wp_flowplayer_file_duration').html(attachment.fileLength);
602
- }
603
- if( typeof(attachment.filesizeHumanReadable) != "undefined" ) {
604
- $('#fv_wp_flowplayer_file_info').show();
605
- $('#fv_wp_flowplayer_file_size').html(attachment.filesizeHumanReadable);
606
  }
607
 
608
  } else if( attachment.type == 'image' && typeof(fv_flowplayer_set_post_thumbnail_id) != "undefined" ) {
@@ -1001,10 +996,12 @@ jQuery(function() {
1001
  var ajax_call = function () {
1002
 
1003
  debug_log('Running fv_wp_flowplayer_retrieve_video_data Ajax.');
 
 
1004
 
1005
  $element.data('fv_player_video_data_ajax', jQuery.post(ajaxurl, {
1006
  action: 'fv_wp_flowplayer_retrieve_video_data',
1007
- video_url: $element.val(),
1008
  cookie: encodeURIComponent(document.cookie),
1009
  }, function (json_data) {
1010
  fv_player_editor.meta_data_load_finished();
@@ -1156,11 +1153,19 @@ jQuery(function() {
1156
  check.push('audio');
1157
  }
1158
 
 
 
 
 
 
 
1159
  show_stream_fields_worker( item, show, check );
1160
 
1161
  $element.removeData('fv_player_video_data_ajax');
1162
  $element.removeData('fv_player_video_data_ajax_retry_count');
1163
 
 
 
1164
  // remove spinners
1165
  $('.fv-player-shortcode-editor-small-spinner').remove();
1166
  }).fail(function () {
@@ -1485,7 +1490,8 @@ jQuery(function() {
1485
  instance_fp_wysiwyg = FCKeditorAPI.GetInstance('content');
1486
  }
1487
 
1488
- jQuery('#fv_wp_flowplayer_file_info').hide();
 
1489
  jQuery(".fv_wp_flowplayer_field_src2_wrapper").hide();
1490
  jQuery("#fv_wp_flowplayer_field_src2_uploader").hide();
1491
  jQuery(".fv_wp_flowplayer_field_src1_wrapper").hide();
@@ -2893,7 +2899,35 @@ jQuery(function() {
2893
  return;
2894
 
2895
  }
2896
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2897
  function insert_button_toggle_disabled( disable ) {
2898
  var button = $('.fv_player_field_insert-button');
2899
  if( disable ) {
597
  $('.fv_wp_flowplayer_field_height').val(attachment.height);
598
  }
599
  if( typeof(attachment.fileLength) != "undefined" ) {
600
+ file_info_show( { duration: attachment.fileLength } );
 
 
 
 
 
601
  }
602
 
603
  } else if( attachment.type == 'image' && typeof(fv_flowplayer_set_post_thumbnail_id) != "undefined" ) {
996
  var ajax_call = function () {
997
 
998
  debug_log('Running fv_wp_flowplayer_retrieve_video_data Ajax.');
999
+
1000
+ var video_url = $element.val();
1001
 
1002
  $element.data('fv_player_video_data_ajax', jQuery.post(ajaxurl, {
1003
  action: 'fv_wp_flowplayer_retrieve_video_data',
1004
+ video_url: video_url,
1005
  cookie: encodeURIComponent(document.cookie),
1006
  }, function (json_data) {
1007
  fv_player_editor.meta_data_load_finished();
1153
  check.push('audio');
1154
  }
1155
 
1156
+ // If we are unable to check the HLS stream, show all the options
1157
+ if( json_data.error && video_url.match(/\.m3u8/) ) {
1158
+ show.push('audio');
1159
+ show.push('live');
1160
+ }
1161
+
1162
  show_stream_fields_worker( item, show, check );
1163
 
1164
  $element.removeData('fv_player_video_data_ajax');
1165
  $element.removeData('fv_player_video_data_ajax_retry_count');
1166
 
1167
+ file_info_show( json_data );
1168
+
1169
  // remove spinners
1170
  $('.fv-player-shortcode-editor-small-spinner').remove();
1171
  }).fail(function () {
1490
  instance_fp_wysiwyg = FCKeditorAPI.GetInstance('content');
1491
  }
1492
 
1493
+ file_info_hide();
1494
+
1495
  jQuery(".fv_wp_flowplayer_field_src2_wrapper").hide();
1496
  jQuery("#fv_wp_flowplayer_field_src2_uploader").hide();
1497
  jQuery(".fv_wp_flowplayer_field_src1_wrapper").hide();
2899
  return;
2900
 
2901
  }
2902
+
2903
+ function file_info_hide() {
2904
+ jQuery('#fv_wp_flowplayer_file_info').hide();
2905
+ jQuery('#fv_wp_flowplayer_file_info td').html('');
2906
+ }
2907
+
2908
+ function file_info_show( args ) {
2909
+
2910
+ var html = '';
2911
+ if( args.duration ) {
2912
+ var duration = args.duration;
2913
+ if( !isNaN(duration) ) {
2914
+ duration = fv_player_time_hms(duration);
2915
+ }
2916
+ html += 'Duration: '+duration;
2917
+ }
2918
+ if( args.error ) {
2919
+ html += 'Error: '+args.error;
2920
+ }
2921
+
2922
+ if( html ) {
2923
+ $('#fv_wp_flowplayer_file_info').show();
2924
+ $('#fv_wp_flowplayer_file_info td').html(html);
2925
+ } else {
2926
+ file_info_hide();
2927
+ }
2928
+
2929
+ }
2930
+
2931
  function insert_button_toggle_disabled( disable ) {
2932
  var button = $('.fv_player_field_insert-button');
2933
  if( disable ) {
models/checker.php CHANGED
@@ -107,7 +107,8 @@ class FV_Player_Checker {
107
  public function check_mimetype( $URLs = false, $meta = false, $force_is_cron = false ) {
108
 
109
  add_action( 'http_api_curl', array( 'FV_Player_Checker', 'http_api_curl' ) );
110
-
 
111
  $tStart = microtime(true);
112
 
113
  global $fv_wp_flowplayer_ver, $fv_fp;
@@ -165,7 +166,13 @@ class FV_Player_Checker {
165
  }
166
  fclose($out);
167
 
168
- $headers = WP_Http::processHeaders( $header );
 
 
 
 
 
 
169
 
170
  list( $aVideoErrors, $sContentType, $bFatal ) = $this->check_headers( $headers, $remotefilename, $random );
171
  if( $bFatal ) {
@@ -186,7 +193,7 @@ class FV_Player_Checker {
186
  /*
187
  Only check file length
188
  */
189
-
190
  if( (isset($meta_action) && $meta_action == 'check_time') || $force_is_cron ) {
191
  $time = false;
192
  if( isset($ThisFileInfo) && isset($ThisFileInfo['playtime_seconds']) ) {
@@ -206,9 +213,9 @@ class FV_Player_Checker {
206
  $duration = 0;
207
  $segments = false;
208
 
209
- $is_live = stripos( $response, '#EXT-X-ENDLIST' ) === false;
210
-
211
  if(preg_match_all('/^#EXTINF:([0-9]+\.?[0-9]*)/im', $response,$segments)){
 
 
212
  foreach($segments[1] as $segment_item){
213
  $duration += $segment_item;
214
  }
@@ -247,10 +254,10 @@ class FV_Player_Checker {
247
  }
248
  $request = wp_remote_get($item_url);
249
  $playlist_item = wp_remote_retrieve_body( $request );
250
-
251
- $is_live = stripos( $playlist_item, '#EXT-X-ENDLIST' ) === false;
252
-
253
  if(preg_match_all('/^#EXTINF:([0-9]+\.?[0-9]*)/im', $playlist_item,$segments)){
 
 
254
  foreach($segments[1] as $segment_item){
255
  $duration += $segment_item;
256
  }
@@ -273,6 +280,7 @@ class FV_Player_Checker {
273
  if( !$fv_flowplayer_meta ) $fv_flowplayer_meta = array();
274
  }
275
 
 
276
  $fv_flowplayer_meta['duration'] = $time;
277
  $fv_flowplayer_meta['is_live'] = $is_live;
278
  $fv_flowplayer_meta['is_audio'] = $is_audio;
@@ -280,7 +288,7 @@ class FV_Player_Checker {
280
  $fv_flowplayer_meta['date'] = time();
281
  $fv_flowplayer_meta['check_time'] = microtime(true) - $tStart;
282
 
283
- if( $time > 0 || $this->is_cron ) {
284
  if( !empty($post) ) {
285
  update_post_meta( $post->ID, $key, $fv_flowplayer_meta );
286
  }
107
  public function check_mimetype( $URLs = false, $meta = false, $force_is_cron = false ) {
108
 
109
  add_action( 'http_api_curl', array( 'FV_Player_Checker', 'http_api_curl' ) );
110
+
111
+ $error = false;
112
  $tStart = microtime(true);
113
 
114
  global $fv_wp_flowplayer_ver, $fv_fp;
166
  }
167
  fclose($out);
168
 
169
+ $headers = WP_Http::processHeaders( $header );
170
+ if( !empty($headers['response']['code']) && intval($headers['response']['code']) > 399 ) {
171
+ $error = 'HTTP '.$headers['response']['code'];
172
+ if( !empty($headers['response']['message']) ) {
173
+ $error .= ': '.$headers['response']['message'];
174
+ }
175
+ }
176
 
177
  list( $aVideoErrors, $sContentType, $bFatal ) = $this->check_headers( $headers, $remotefilename, $random );
178
  if( $bFatal ) {
193
  /*
194
  Only check file length
195
  */
196
+
197
  if( (isset($meta_action) && $meta_action == 'check_time') || $force_is_cron ) {
198
  $time = false;
199
  if( isset($ThisFileInfo) && isset($ThisFileInfo['playtime_seconds']) ) {
213
  $duration = 0;
214
  $segments = false;
215
 
 
 
216
  if(preg_match_all('/^#EXTINF:([0-9]+\.?[0-9]*)/im', $response,$segments)){
217
+ $is_live = stripos( $response, '#EXT-X-ENDLIST' ) === false;
218
+
219
  foreach($segments[1] as $segment_item){
220
  $duration += $segment_item;
221
  }
254
  }
255
  $request = wp_remote_get($item_url);
256
  $playlist_item = wp_remote_retrieve_body( $request );
257
+
 
 
258
  if(preg_match_all('/^#EXTINF:([0-9]+\.?[0-9]*)/im', $playlist_item,$segments)){
259
+ $is_live = stripos( $playlist_item, '#EXT-X-ENDLIST' ) === false;
260
+
261
  foreach($segments[1] as $segment_item){
262
  $duration += $segment_item;
263
  }
280
  if( !$fv_flowplayer_meta ) $fv_flowplayer_meta = array();
281
  }
282
 
283
+ $fv_flowplayer_meta['error'] = $error;
284
  $fv_flowplayer_meta['duration'] = $time;
285
  $fv_flowplayer_meta['is_live'] = $is_live;
286
  $fv_flowplayer_meta['is_audio'] = $is_audio;
288
  $fv_flowplayer_meta['date'] = time();
289
  $fv_flowplayer_meta['check_time'] = microtime(true) - $tStart;
290
 
291
+ if( $time > 0 || $error || $this->is_cron ) {
292
  if( !empty($post) ) {
293
  update_post_meta( $post->ID, $key, $fv_flowplayer_meta );
294
  }
models/class.fv-player-bunny_stream-browser.php CHANGED
@@ -24,102 +24,14 @@ class FV_Player_Bunny_Stream_Browser extends FV_Player_Media_Browser {
24
 
25
  function register() {
26
  add_action( $this->ajax_action_name, array($this, 'load_assets') );
27
-
28
- // register extra AJAX functions for file uploads to DOS
29
- add_action( 'wp_ajax_create_upload', array( $this, 'create_upload' ) );
30
- add_action( 'wp_ajax_upload_complete', array( $this, 'upload_complete' ) );
31
- add_action( 'wp_ajax_upload_abort', array( $this, 'upload_abort' ) );
32
  }
33
 
34
  // Legacy
35
  function init_for_gutenberg() {}
36
 
37
- function create_upload() {
38
- global $FV_Player_DigitalOcean_Spaces;
39
-
40
- // make sure we have correct CORS on the DOS bucket
41
- $this->s3("putBucketCors",
42
- array(
43
- "Bucket" => $FV_Player_DigitalOcean_Spaces->get_space(),
44
- "CORSConfiguration" => array(
45
- "CORSRules" => array(
46
- array(
47
- 'AllowedHeaders' => array(
48
- 'Access-Control-Allow-Methods',
49
- 'Access-Control-Allow-Origin',
50
- 'Origin',
51
- 'Range',
52
- ),
53
- 'AllowedMethods'=> array('GET','HEAD','PUT'),
54
- "AllowedOrigins"=> array("*"),
55
- ),
56
- ),
57
- ),
58
- )
59
- );
60
-
61
- $res = $this->s3( "createMultipartUpload", array(
62
- 'Bucket' => $FV_Player_DigitalOcean_Spaces->get_space(),
63
- 'Key' => $_POST['fileInfo']['name'],
64
- 'ContentType' => $_REQUEST['fileInfo']['type'],
65
- 'Metadata' => $_REQUEST['fileInfo']
66
- ));
67
-
68
- wp_send_json( array(
69
- 'uploadId' => $res->get('UploadId'),
70
- 'key' => $res->get('Key'),
71
- ));
72
- wp_die();
73
- }
74
-
75
- function upload_complete() {
76
- global $FV_Player_DigitalOcean_Spaces;
77
-
78
- $partsModel = $this->s3("listParts", array(
79
- 'Bucket' => $FV_Player_DigitalOcean_Spaces->get_space(),
80
- 'Key' => $_REQUEST['sendBackData']['key'],
81
- 'UploadId' => $_REQUEST['sendBackData']['uploadId'],
82
- ) );
83
-
84
- $ret = $this->s3( "completeMultipartUpload" , array(
85
- 'Bucket' => $FV_Player_DigitalOcean_Spaces->get_space(),
86
- 'Key' => $_REQUEST['sendBackData']['key'],
87
- 'UploadId' => $_REQUEST['sendBackData']['uploadId'],
88
- 'MultipartUpload' => array(
89
- "Parts" => $partsModel["Parts"],
90
- ),
91
- ))->toArray();
92
-
93
- wp_send_json( array(
94
- 'success' => true,
95
- 'url' => $ret['ObjectURL'],
96
- 'key' => $ret['Key'],
97
- 'nonce' => wp_create_nonce( 'fv_player_coconut' ),
98
- ));
99
- wp_die();
100
- }
101
-
102
- function upload_abort() {
103
- global $FV_Player_DigitalOcean_Spaces;
104
-
105
- // if initial pre-upload request fails, we'll have no sendBackData to abort
106
- if ( !empty( $_REQUEST['sendBackData'] ) ) {
107
- $this->s3("abortMultipartUpload",[
108
- 'Bucket' => $FV_Player_DigitalOcean_Spaces->get_space(),
109
- 'Key' => $_REQUEST['sendBackData']['key'],
110
- 'UploadId' => $_REQUEST['sendBackData']['uploadId']
111
- ]);
112
- }
113
-
114
- wp_send_json( array(
115
- 'success' => true
116
- ));
117
- wp_die();
118
- }
119
-
120
  function get_formatted_assets_data() {
121
  global $fv_fp, $wpdb;
122
-
123
  $local_jobs = $wpdb->get_results( "SELECT id, job_id FROM " . FV_Player_Bunny_Stream()->get_table_name() );
124
  $local_jobs = wp_list_pluck( $local_jobs, 'id', 'job_id');
125
 
@@ -132,12 +44,17 @@ class FV_Player_Bunny_Stream_Browser extends FV_Player_Media_Browser {
132
  $query_string['search'] = $_POST['search'];
133
  }
134
 
 
 
 
 
 
135
  $endpoint = add_query_arg(
136
  $query_string,
137
  'https://video.bunnycdn.com/library/'.$fv_fp->_get_option( array('bunny_stream','lib_id') ).'/videos'
138
  );
139
 
140
- $result = $api->api_call( $endpoint );
141
 
142
  if ( is_wp_error( $result ) ) {
143
  $result = array( 'error' => $result->get_error_message() );
@@ -174,7 +91,7 @@ class FV_Player_Bunny_Stream_Browser extends FV_Player_Media_Browser {
174
  'height' => $video->height,
175
  'extra' => array(),
176
  );
177
-
178
  if( !empty($local_jobs[$video->guid]) ) {
179
  $item['extra']['encoding_job_id'] = $local_jobs[$video->guid];
180
  }
@@ -214,6 +131,35 @@ class FV_Player_Bunny_Stream_Browser extends FV_Player_Media_Browser {
214
  }
215
  }
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  $json_final = array(
218
  'items' => $body,
219
  'is_last_page' => !$video_data_more_pages_exist,
@@ -224,6 +170,10 @@ class FV_Player_Bunny_Stream_Browser extends FV_Player_Media_Browser {
224
  $json_final['err'] = $result['error'];
225
  }
226
 
 
 
 
 
227
  return $json_final;
228
  }
229
 
24
 
25
  function register() {
26
  add_action( $this->ajax_action_name, array($this, 'load_assets') );
 
 
 
 
 
27
  }
28
 
29
  // Legacy
30
  function init_for_gutenberg() {}
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  function get_formatted_assets_data() {
33
  global $fv_fp, $wpdb;
34
+
35
  $local_jobs = $wpdb->get_results( "SELECT id, job_id FROM " . FV_Player_Bunny_Stream()->get_table_name() );
36
  $local_jobs = wp_list_pluck( $local_jobs, 'id', 'job_id');
37
 
44
  $query_string['search'] = $_POST['search'];
45
  }
46
 
47
+ // query default videos or concrete collection library
48
+ if( isset($_POST['collection_id']) ) {
49
+ $query_string['collection'] = $_POST['collection_id'];
50
+ }
51
+
52
  $endpoint = add_query_arg(
53
  $query_string,
54
  'https://video.bunnycdn.com/library/'.$fv_fp->_get_option( array('bunny_stream','lib_id') ).'/videos'
55
  );
56
 
57
+ $result = $api->api_call( $endpoint );
58
 
59
  if ( is_wp_error( $result ) ) {
60
  $result = array( 'error' => $result->get_error_message() );
91
  'height' => $video->height,
92
  'extra' => array(),
93
  );
94
+
95
  if( !empty($local_jobs[$video->guid]) ) {
96
  $item['extra']['encoding_job_id'] = $local_jobs[$video->guid];
97
  }
131
  }
132
  }
133
 
134
+ // get collections for list
135
+ if( $_POST['firstLoad'] == 1 ) {
136
+ $collections = array();
137
+
138
+ $query_string = array( 'itemsPerPage' => 50, 'orderBy' => 'date' );
139
+ $query_string['page'] = ( !empty($_POST['page']) && is_numeric($_POST['page']) && (int) $_POST['page'] == $_POST['page'] ? $_POST['page'] : 1 );
140
+
141
+ $endpoint = add_query_arg(
142
+ $query_string,
143
+ 'http://video.bunnycdn.com/library/'. $fv_fp->_get_option( array('bunny_stream','lib_id') ) .'/collections'
144
+ );
145
+
146
+ $result_collection = $api->api_call( $endpoint );
147
+
148
+ if( !is_wp_error( $result_collection ) ) {
149
+ foreach( $result_collection->items as $collection ) {
150
+ $item_collection = array(
151
+ 'link' => $collection->guid,
152
+ 'name' => $collection->name
153
+ );
154
+
155
+ $collections[ $collection->name ] = $item_collection;
156
+ }
157
+ }
158
+
159
+ // sort collections by name
160
+ ksort( $collections, SORT_NATURAL | SORT_FLAG_CASE );
161
+ }
162
+
163
  $json_final = array(
164
  'items' => $body,
165
  'is_last_page' => !$video_data_more_pages_exist,
170
  $json_final['err'] = $result['error'];
171
  }
172
 
173
+ if ($_POST['firstLoad'] == 1) {
174
+ $json_final['collections'] = $collections;
175
+ }
176
+
177
  return $json_final;
178
  }
179
 
models/class.fv-player-bunny_stream.php CHANGED
@@ -32,7 +32,7 @@ class FV_Player_Bunny_Stream extends FV_Player_Video_Encoder {
32
  }
33
 
34
  protected function __construct( $encoder_id, $encoder_name, $encoder_wp_url_slug, $browser_inc_file ) {
35
- $this->version = '7.5.13.727';
36
 
37
  parent::__construct( $encoder_id, $encoder_name, $encoder_wp_url_slug, $browser_inc_file );
38
  }
@@ -265,13 +265,20 @@ class FV_Player_Bunny_Stream extends FV_Player_Video_Encoder {
265
 
266
  $target_name = $wpdb->get_var( $wpdb->prepare( "SELECT target FROM " . $this->table_name ." WHERE id = %d", $id ) );
267
 
 
 
 
 
 
 
 
 
 
268
  require_once( dirname( __FILE__ ) . '/class.fv-player-bunny_stream-api.php');
269
  $api = new FV_Player_Bunny_Stream_API();
270
  $job = $api->api_call(
271
  'https://video.bunnycdn.com/library/' . $fv_fp->_get_option( array('bunny_stream','lib_id') ) . '/videos',
272
- array(
273
- 'title' => $target_name,
274
- ),
275
  'POST'
276
  );
277
 
32
  }
33
 
34
  protected function __construct( $encoder_id, $encoder_name, $encoder_wp_url_slug, $browser_inc_file ) {
35
+ $this->version = '7.5.14.727';
36
 
37
  parent::__construct( $encoder_id, $encoder_name, $encoder_wp_url_slug, $browser_inc_file );
38
  }
265
 
266
  $target_name = $wpdb->get_var( $wpdb->prepare( "SELECT target FROM " . $this->table_name ." WHERE id = %d", $id ) );
267
 
268
+ $body = array(
269
+ 'title' => $target_name,
270
+ );
271
+
272
+ // check if we have collection
273
+ if( isset( $_POST['collection_id'] ) && strcmp( $_POST['collection_id'], '-1' ) !== 0 ) {
274
+ $body['collectionId'] = $_POST['collection_id'];
275
+ }
276
+
277
  require_once( dirname( __FILE__ ) . '/class.fv-player-bunny_stream-api.php');
278
  $api = new FV_Player_Bunny_Stream_API();
279
  $job = $api->api_call(
280
  'https://video.bunnycdn.com/library/' . $fv_fp->_get_option( array('bunny_stream','lib_id') ) . '/videos',
281
+ $body,
 
 
282
  'POST'
283
  );
284
 
models/db.php CHANGED
@@ -1593,6 +1593,7 @@ class FV_Player_Db {
1593
  }
1594
 
1595
  $check = $FV_Player_Checker->check_mimetype(array($url), false, true);
 
1596
  $json_data['duration'] = $check['duration'];
1597
  $json_data['is_live'] = $check['is_live'];
1598
  $json_data['is_audio'] = $check['is_audio'];
1593
  }
1594
 
1595
  $check = $FV_Player_Checker->check_mimetype(array($url), false, true);
1596
+ $json_data['error'] = $check['error'];
1597
  $json_data['duration'] = $check['duration'];
1598
  $json_data['is_live'] = $check['is_live'];
1599
  $json_data['is_audio'] = $check['is_audio'];
models/flowplayer-frontend.php CHANGED
@@ -569,8 +569,8 @@ class flowplayer_frontend extends flowplayer
569
  $attributes['data-fullscreen'] = 'false';
570
  }
571
 
572
- if( !$bIsAudio && stripos($width,'%') == false && intval($width) > 0 && stripos($height,'%') == false && intval($height) > 0 ) {
573
- $ratio = round($height / $width, 4);
574
  $this->fRatio = $ratio;
575
 
576
  $attributes['data-ratio'] = str_replace(',','.',$ratio);
569
  $attributes['data-fullscreen'] = 'false';
570
  }
571
 
572
+ if( !$bIsAudio && stripos($width,'%') === false && intval($width) > 0 && stripos($height,'%') === false && intval($height) > 0 ) {
573
+ $ratio = round( intval($height) / intval($width), 4);
574
  $this->fRatio = $ratio;
575
 
576
  $attributes['data-ratio'] = str_replace(',','.',$ratio);
readme.txt CHANGED
@@ -359,6 +359,11 @@ Thank you for being part of the HMTL 5 mobile video revolution!
359
 
360
  == Changelog ==
361
 
 
 
 
 
 
362
  = 7.5.13.727 - 2021/12/20 =
363
 
364
  * New feature - drag&drop video upload and encoding with the Bunny Stream service!
359
 
360
  == Changelog ==
361
 
362
+ = 7.5.14.727 - 2021/01/06 =
363
+
364
+ * Bunny Stream - show video collections
365
+ * Bugfix - Editor - show HLS stream checkboxes if the stream cannot be checked as it's not available
366
+
367
  = 7.5.13.727 - 2021/12/20 =
368
 
369
  * New feature - drag&drop video upload and encoding with the Bunny Stream service!
view/admin.php CHANGED
@@ -410,45 +410,6 @@ jQuery(document).ready(function($) {
410
 
411
  $('.fv_flowplayer_target').val(attachment.url);
412
  $('.fv_flowplayer_target').removeClass('fv_flowplayer_target' );
413
-
414
- /*if( attachment.type == 'video' ) {
415
- if( typeof(attachment.width) != "undefined" && attachment.width > 0 ) {
416
- $('.fv_wp_flowplayer_field_width').val(attachment.width);
417
- }
418
- if( typeof(attachment.height) != "undefined" && attachment.height > 0 ) {
419
- $('.fv_wp_flowplayer_field_height').val(attachment.height);
420
- }
421
- if( typeof(attachment.fileLength) != "undefined" ) {
422
- $('#fv_wp_flowplayer_file_info').show();
423
- $('#fv_wp_flowplayer_file_duration').html(attachment.fileLength);
424
- }
425
- if( typeof(attachment.filesizeHumanReadable) != "undefined" ) {
426
- $('#fv_wp_flowplayer_file_info').show();
427
- $('#fv_wp_flowplayer_file_size').html(attachment.filesizeHumanReadable);
428
- }
429
-
430
- } else if( attachment.type == 'image' && typeof(fv_flowplayer_set_post_thumbnail_id) != "undefined" ) {
431
- if( jQuery('#remove-post-thumbnail').length > 0 ){
432
- return;
433
- }
434
- jQuery.post(ajaxurl, {
435
- action:"set-post-thumbnail",
436
- post_id: fv_flowplayer_set_post_thumbnail_id,
437
- thumbnail_id: attachment.id,
438
- _ajax_nonce: fv_flowplayer_set_post_thumbnail_nonce,
439
- cookie: encodeURIComponent(document.cookie)
440
- }, function(str){
441
- var win = window.dialogArguments || opener || parent || top;
442
- if ( str == '0' ) {
443
- alert( setPostThumbnailL10n.error );
444
- } else {
445
- jQuery('#postimagediv .inside').html(str);
446
- jQuery('#postimagediv .inside #plupload-upload-ui').hide();
447
- }
448
- } );
449
-
450
- }*/
451
-
452
  });
453
 
454
  //Open the uploader dialog
410
 
411
  $('.fv_flowplayer_target').val(attachment.url);
412
  $('.fv_flowplayer_target').removeClass('fv_flowplayer_target' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  });
414
 
415
  //Open the uploader dialog
view/wizard.php CHANGED
@@ -255,10 +255,7 @@ var fv_Player_site_base = '<?php echo home_url('/') ?>';
255
 
256
  <tr style="display: none" id="fv_wp_flowplayer_file_info">
257
  <th></th>
258
- <td colspan="2">
259
- <?php _e('Video Duration', 'fv_flowplayer'); ?>: <span id="fv_wp_flowplayer_file_duration"></span><br />
260
- <?php _e('File size', 'fv_flowplayer'); ?>: <span id="fv_wp_flowplayer_file_size"></span>
261
- </td>
262
  </tr>
263
 
264
  <tr style="display: none;" class="fv_wp_flowplayer_field_src1_wrapper">
255
 
256
  <tr style="display: none" id="fv_wp_flowplayer_file_info">
257
  <th></th>
258
+ <td colspan="2"></td>
 
 
 
259
  </tr>
260
 
261
  <tr style="display: none;" class="fv_wp_flowplayer_field_src1_wrapper">