Version Description
2016/06/29 =
Compatibility - bugfix for FV Player widget as it was breaking Featured Image insertion when also using DesignThemes Core Features Plugin
Iframe embedding - using width and height attributes like YouTube or Vimeo to ensure FV Player Iframe embeds are responsive at least in themes with iframe responsiveness code
Microsoft Smooth Streaming - adding support for http://.streaming.mediaservices.windows.net/.ism/manifest(format=mpd-time-csf) and ...(format=m3u8-aapl) kind of URLs
Reverting - Ajax loading - fix for repeated autoplay if your theme loads FV Player using Ajax and uses autoplay for the loaded content. You have to set fv_player_did_autoplay
Download this release
Release Info
Developer | FolioVision |
Plugin | FV Flowplayer Video Player |
Version | 6.1.5 |
Comparing to | |
See all releases |
Code changes from version 6.0.5.24 to 6.1.5
- controller/backend.php +438 -951
- controller/editor.php +227 -0
- controller/frontend.php +30 -7
- controller/settings.php +298 -0
- css/flowplayer.css +5 -170
- css/img/closelabel-x2.png +0 -0
- css/img/closelabel.png +0 -0
- css/img/controls.png +0 -0
- css/img/exit_btn-x2.png +0 -0
- css/img/exit_btn.png +0 -0
- css/img/flp-share-icons-x2.png +0 -0
- css/img/flp-share-icons.png +0 -0
- css/img/loading.gif +0 -0
- css/img/media-button.png +0 -0
- css/img/no_play_white-x2.png +0 -0
- css/img/no_play_white.png +0 -0
- css/img/play_white-x2.png +0 -0
- css/img/play_white.png +0 -0
- css/img/techinfo.png +0 -0
- css/img/uploader-icons.png +0 -0
- css/lightbox.css +165 -0
- flowplayer.php +8 -2
- flowplayer/flowplayer.hlsjs.min.js +13 -11
- flowplayer/fv-flowplayer.min.js +283 -17
- images/icon-256x256.png +0 -0
- images/icon.png +0 -0
- images/icon@x2.png +0 -0
- js/lightbox.js +60 -1
- js/shortcode-editor.js +39 -32
- models/flowplayer-frontend.php +74 -73
- models/flowplayer.php +189 -103
- models/lightbox.php +18 -3
- models/seo.php +96 -0
- models/subtitles.php +68 -0
- models/widget.php +1 -2
- readme.txt +59 -2
- view/admin.php +21 -1
- view/wizard.php +1 -1
controller/backend.php
CHANGED
@@ -15,714 +15,175 @@
|
|
15 |
|
16 |
You should have received a copy of the GNU General Public License
|
17 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
add_action('wp_ajax_fv_wp_flowplayer_support_mail', 'fv_wp_flowplayer_support_mail');
|
21 |
-
add_action('wp_ajax_fv_wp_flowplayer_activate_extension', 'fv_wp_flowplayer_activate_extension');
|
22 |
-
add_action('wp_ajax_fv_wp_flowplayer_check_template', 'fv_wp_flowplayer_check_template');
|
23 |
-
add_action('wp_ajax_fv_wp_flowplayer_check_files', 'fv_wp_flowplayer_check_files');
|
24 |
-
add_action('wp_ajax_fv_wp_flowplayer_check_license', 'fv_wp_flowplayer_check_license');
|
25 |
-
|
26 |
-
add_action('admin_head', 'flowplayer_admin_head');
|
27 |
-
add_action('admin_footer', 'flowplayer_admin_footer');
|
28 |
-
add_action('admin_print_footer_scripts', 'flowplayer_admin_footer_wp_js_restore', 999999 );
|
29 |
-
|
30 |
-
add_action('admin_menu', 'flowplayer_admin');
|
31 |
-
add_action('media_buttons', 'flowplayer_add_media_button', 10);
|
32 |
-
add_action('media_upload_fvplayer_video', '__return_false'); // keep for compatibility!
|
33 |
-
|
34 |
-
|
35 |
-
add_action('admin_init', 'fv_wp_flowplayer_admin_init');
|
36 |
-
add_action( 'wp_ajax_fv_foliopress_ajax_pointers', 'fv_wp_flowplayer_pointers_ajax' );
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
add_action( 'admin_enqueue_scripts', 'fv_player_shortcode_editor_scripts' );
|
41 |
-
add_action( 'edit_form_after_editor', 'fv_wp_flowplayer_edit_form_after_editor' );
|
42 |
-
|
43 |
-
add_action( 'after_plugin_row', 'fv_wp_flowplayer_after_plugin_row', 10, 3 );
|
44 |
-
|
45 |
-
add_action( 'save_post', 'fv_wp_flowplayer_save_post' );
|
46 |
-
add_action( 'save_post', 'fv_wp_flowplayer_featured_image' , 10000 );
|
47 |
-
|
48 |
-
|
49 |
-
add_filter( 'get_user_option_closedpostboxes_fv_flowplayer_settings', 'fv_wp_flowplayer_closed_meta_boxes' );
|
50 |
-
|
51 |
-
|
52 |
-
add_action('the_content', 'flowplayer_content_remove_commas');
|
53 |
-
|
54 |
-
add_filter('admin_print_scripts', 'flowplayer_print_scripts');
|
55 |
-
add_action('admin_print_styles', 'flowplayer_print_styles');
|
56 |
-
add_action('admin_enqueue_scripts', 'fv_flowplayer_admin_scripts');
|
57 |
-
|
58 |
-
//conversion script via AJAX
|
59 |
-
add_action('wp_ajax_flowplayer_conversion_script', 'flowplayer_conversion_script');
|
60 |
-
add_action('admin_notices', 'fv_wp_flowplayer_admin_notice');
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
function fv_wp_flowplayer_featured_image($post_id) {
|
65 |
-
if( $parent_id = wp_is_post_revision($post_id) ) {
|
66 |
-
$post_id = $parent_id;
|
67 |
-
}
|
68 |
-
|
69 |
-
global $fv_fp;
|
70 |
-
if( !isset($fv_fp->conf['integrations']['featured_img']) || $fv_fp->conf['integrations']['featured_img'] != 'true' ){
|
71 |
-
return;
|
72 |
-
}
|
73 |
-
|
74 |
-
$thumbnail_id = get_post_thumbnail_id($post_id);
|
75 |
-
if( $thumbnail_id != 0 ) {
|
76 |
-
return;
|
77 |
-
}
|
78 |
-
|
79 |
-
$post = get_post($post_id);
|
80 |
-
if( !$post || empty($post->post_content) ){
|
81 |
-
return;
|
82 |
-
}
|
83 |
-
|
84 |
-
$sThumbUrl = array();
|
85 |
-
if (!preg_match('/(?:splash=\\\?")([^"]*.(?:jpg|gif|png))/', $post->post_content, $sThumbUrl) || empty($sThumbUrl[1])) {
|
86 |
-
return;
|
87 |
-
}
|
88 |
-
|
89 |
-
$thumbnail_id = fv_wp_flowplayer_save_to_media_library($sThumbUrl[1], $post_id);
|
90 |
-
if($thumbnail_id){
|
91 |
-
set_post_thumbnail($post_id, $thumbnail_id);
|
92 |
-
}
|
93 |
-
|
94 |
-
}
|
95 |
-
|
96 |
-
function fv_wp_flowplayer_construct_filename( $post_id ) {
|
97 |
-
$filename = get_the_title( $post_id );
|
98 |
-
$filename = sanitize_title( $filename, $post_id );
|
99 |
-
$filename = urldecode( $filename );
|
100 |
-
$filename = preg_replace( '/[^a-zA-Z0-9\-]/', '', $filename );
|
101 |
-
$filename = substr( $filename, 0, 32 );
|
102 |
-
$filename = trim( $filename, '-' );
|
103 |
-
if ( $filename == '' ) $filename = (string) $post_id;
|
104 |
-
return $filename;
|
105 |
-
}
|
106 |
-
|
107 |
-
function fv_wp_flowplayer_save_to_media_library( $image_url, $post_id ) {
|
108 |
-
|
109 |
-
$error = '';
|
110 |
-
$response = wp_remote_get( $image_url );
|
111 |
-
if( is_wp_error( $response ) ) {
|
112 |
-
$error = new WP_Error( 'thumbnail_retrieval', sprintf( __( 'Error retrieving a thumbnail from the URL <a href="%1$s">%1$s</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.', 'video-thumbnails' ), $image_url ) . '<br>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $response->get_error_message() );
|
113 |
-
} else {
|
114 |
-
$image_contents = $response['body'];
|
115 |
-
$image_type = wp_remote_retrieve_header( $response, 'content-type' );
|
116 |
-
}
|
117 |
-
|
118 |
-
if ( $error != '' || $image_contents == '' ) {
|
119 |
-
return false;
|
120 |
-
} else {
|
121 |
-
|
122 |
-
// Translate MIME type into an extension
|
123 |
-
if ( $image_type == 'image/jpeg' ) {
|
124 |
-
$image_extension = '.jpg';
|
125 |
-
} elseif ( $image_type == 'image/png' ) {
|
126 |
-
$image_extension = '.png';
|
127 |
-
} elseif ( $image_type == 'image/gif' ) {
|
128 |
-
$image_extension = '.gif';
|
129 |
-
} else {
|
130 |
-
return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:', 'video-thumbnails' ) . ' ' . $image_type );
|
131 |
-
}
|
132 |
-
|
133 |
-
// Construct a file name with extension
|
134 |
-
$new_filename = fv_wp_flowplayer_construct_filename( $post_id ) . $image_extension;
|
135 |
-
|
136 |
-
// Save the image bits using the new filename
|
137 |
-
$upload = wp_upload_bits( $new_filename, null, $image_contents );
|
138 |
-
|
139 |
-
// Stop for any errors while saving the data or else continue adding the image to the media library
|
140 |
-
if ( $upload['error'] ) {
|
141 |
-
$error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:', 'video-thumbnails' ) . ' ' . $upload['error'] );
|
142 |
-
return $error;
|
143 |
-
} else {
|
144 |
-
|
145 |
-
$wp_filetype = wp_check_filetype( basename( $upload['file'] ), null );
|
146 |
-
|
147 |
-
$upload = apply_filters( 'wp_handle_upload', array(
|
148 |
-
'file' => $upload['file'],
|
149 |
-
'url' => $upload['url'],
|
150 |
-
'type' => $wp_filetype['type']
|
151 |
-
), 'sideload' );
|
152 |
-
|
153 |
-
// Contstruct the attachment array
|
154 |
-
$attachment = array(
|
155 |
-
'post_mime_type' => $upload['type'],
|
156 |
-
'post_title' => get_the_title( $post_id ),
|
157 |
-
'post_content' => '',
|
158 |
-
'post_status' => 'inherit'
|
159 |
-
);
|
160 |
-
// Insert the attachment
|
161 |
-
$attach_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
|
162 |
-
|
163 |
-
}
|
164 |
-
|
165 |
-
}
|
166 |
-
|
167 |
-
return $attach_id;
|
168 |
-
|
169 |
-
}
|
170 |
-
|
171 |
-
function flowplayer_activate() {
|
172 |
-
|
173 |
-
}
|
174 |
-
|
175 |
-
|
176 |
-
function flowplayer_deactivate() {
|
177 |
-
if( flowplayer::is_licensed() ) {
|
178 |
-
delete_transient( 'fv_flowplayer_license' );
|
179 |
-
}
|
180 |
-
delete_option( 'fv_flowplayer_extension_install' );
|
181 |
-
wp_clear_scheduled_hook('fv_flowplayer_checker_event');
|
182 |
-
}
|
183 |
-
|
184 |
-
|
185 |
-
function flowplayer_admin_head() {
|
186 |
-
|
187 |
-
if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
|
188 |
-
return;
|
189 |
-
}
|
190 |
-
|
191 |
-
global $fv_wp_flowplayer_ver;
|
192 |
-
?>
|
193 |
-
<script type="text/javascript" src="<?php echo FV_FP_RELATIVE_PATH; ?>/js/jscolor/jscolor.js"></script>
|
194 |
-
<link rel="stylesheet" type="text/css" href="<?php echo flowplayer::get_plugin_url().'/css/license.css'; ?>?ver=<?php echo $fv_wp_flowplayer_ver; ?>" />
|
195 |
-
|
196 |
-
<script>
|
197 |
-
jQuery(window).on('unload', function(){
|
198 |
-
window.fv_flowplayer_wp = window.wp;
|
199 |
-
});
|
200 |
-
</script>
|
201 |
-
<?php
|
202 |
-
}
|
203 |
-
|
204 |
-
|
205 |
-
function flowplayer_admin_footer() {
|
206 |
-
if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
|
207 |
-
return;
|
208 |
-
}
|
209 |
-
|
210 |
-
flowplayer_prepare_scripts();
|
211 |
-
}
|
212 |
-
|
213 |
-
|
214 |
-
function flowplayer_admin_footer_wp_js_restore() {
|
215 |
-
if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
|
216 |
-
return;
|
217 |
-
}
|
218 |
-
|
219 |
-
?>
|
220 |
-
<script>
|
221 |
-
jQuery(window).on('unload', function(){
|
222 |
-
window.wp = window.fv_flowplayer_wp;
|
223 |
-
});
|
224 |
-
</script>
|
225 |
-
<?php
|
226 |
-
}
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
/**
|
232 |
-
* Administrator environment function.
|
233 |
-
*/
|
234 |
-
function flowplayer_admin () {
|
235 |
-
if( function_exists('add_submenu_page') ) {
|
236 |
-
add_options_page( 'FV Player', 'FV Player', 'manage_options', 'fvplayer', 'flowplayer_page' );
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
|
241 |
-
/**
|
242 |
-
* Outputs HTML code for bool options based on arg passed.
|
243 |
-
* @param string Currently selected value ('true' or 'false').
|
244 |
-
* @return string HTML code
|
245 |
-
*/
|
246 |
-
function flowplayer_bool_select($current) {
|
247 |
-
switch($current) {
|
248 |
-
case "true":
|
249 |
-
$html = '<option selected="selected" value="true">true</option><option value="false">false</option>';
|
250 |
-
break;
|
251 |
-
case "false":
|
252 |
-
$html = '<option value="true" >true</option><option selected="selected" value="false">false</option>';
|
253 |
-
break;
|
254 |
-
default:
|
255 |
-
$html = '<option value="true">true</option><option selected="selected" value="false">false</option>';
|
256 |
-
break;
|
257 |
-
}
|
258 |
-
return $html;
|
259 |
-
}
|
260 |
-
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Displays administrator menu with configuration.
|
264 |
-
*/
|
265 |
-
function flowplayer_page() {
|
266 |
-
global $fv_fp;
|
267 |
-
include dirname( __FILE__ ) . '/../view/admin.php';
|
268 |
-
}
|
269 |
|
270 |
|
271 |
-
|
272 |
-
*
|
273 |
-
* @param object $fv_fp Flowplayer class object.
|
274 |
*/
|
275 |
-
|
276 |
-
|
277 |
-
}
|
278 |
-
|
279 |
-
|
280 |
-
function flowplayer_add_media_button() {
|
281 |
-
if( stripos( $_SERVER['REQUEST_URI'], 'post.php' ) === FALSE && stripos( $_SERVER['REQUEST_URI'], 'post-new.php' ) === FALSE ) {
|
282 |
-
return;
|
283 |
-
}
|
284 |
-
|
285 |
-
global $post;
|
286 |
-
$plugins = get_option('active_plugins');
|
287 |
-
$found = false;
|
288 |
-
foreach ( $plugins AS $plugin ) {
|
289 |
-
if( stripos($plugin,'foliopress-wysiwyg') !== FALSE )
|
290 |
-
$found = true;
|
291 |
-
}
|
292 |
-
$button_tip = 'Insert a video';
|
293 |
-
$wizard_url = 'media-upload.php?post_id='.$post->ID.'&type=fv-wp-flowplayer';
|
294 |
-
$icon = '<span> </span>';
|
295 |
-
|
296 |
-
echo '<a title="' . __('Add FV Player', 'fv-wordpress-flowplayer') . '" title="' . $button_tip . '" href="#" class="button fv-wordpress-flowplayer-button" >'.$icon.' Player</a>';
|
297 |
-
}
|
298 |
-
|
299 |
-
|
300 |
-
function flowplayer_print_scripts() {
|
301 |
-
wp_enqueue_script('media-upload');
|
302 |
-
wp_enqueue_script('thickbox');
|
303 |
-
}
|
304 |
-
|
305 |
-
|
306 |
-
function flowplayer_print_styles() {
|
307 |
-
wp_enqueue_style('thickbox');
|
308 |
-
}
|
309 |
-
|
310 |
-
|
311 |
-
function flowplayer_conversion_script() {
|
312 |
-
global $wpdb;
|
313 |
-
|
314 |
-
$posts = $wpdb->get_results("SELECT ID, post_content FROM {$wpdb->posts} WHERE post_type != 'revision'");
|
315 |
-
|
316 |
-
$old_shorttag = '[flowplayer';
|
317 |
-
$new_shorttag = '[fvplayer';
|
318 |
-
$counter = 0;
|
319 |
-
|
320 |
-
echo '<ol>';
|
321 |
-
foreach($posts as $fv_post) {
|
322 |
-
if ( stripos( $fv_post->post_content, $old_shorttag ) !== false ) {
|
323 |
-
$update_post = array();
|
324 |
-
$update_post['ID'] = $fv_post->ID;
|
325 |
-
$update_post['post_content'] = str_replace( $old_shorttag, $new_shorttag, $fv_post->post_content );
|
326 |
-
wp_update_post( $update_post );
|
327 |
-
echo '<li><a href="' . get_permalink($fv_post->ID) . '">' . get_the_title($fv_post->ID) . '</a> updated</li>';
|
328 |
-
$counter++;
|
329 |
-
}
|
330 |
-
}
|
331 |
-
echo '</ol>';
|
332 |
-
|
333 |
-
echo '<strong>Conversion was succesful. Total number of converted posts: ' . $counter . '</strong>';
|
334 |
-
|
335 |
-
delete_option('fvwpflowplayer_conversion');
|
336 |
-
|
337 |
-
die();
|
338 |
-
}
|
339 |
-
|
340 |
-
|
341 |
-
function fv_wp_flowplayer_admin_notice() {
|
342 |
-
if( $notices = get_option('fv_wordpress_flowplayer_deferred_notices') ) {
|
343 |
-
echo '<div class="updated inline">
|
344 |
-
<p>'.$notices.'</p>
|
345 |
-
</div>';
|
346 |
-
delete_option('fv_wordpress_flowplayer_deferred_notices');
|
347 |
-
}
|
348 |
-
|
349 |
-
$conversion = false; //(bool)get_option('fvwpflowplayer_conversion');
|
350 |
-
if ($conversion) {
|
351 |
-
echo '<div class="updated" id="fvwpflowplayer_conversion_notice"><p>';
|
352 |
-
printf(__('FV Wordpress Flowplayer has found old shortcodes in the content of your posts. <a href="%1$s">Run the conversion script.</a>'), get_admin_url() . 'options-general.php?page=fvplayer');
|
353 |
-
echo "</p></div>";
|
354 |
-
}
|
355 |
-
|
356 |
-
if( isset($_GET['fv-licensing']) && $_GET['fv-licensing'] == "check" ){
|
357 |
-
echo '<div class="updated inline">
|
358 |
-
<p>Thank you for purchase. Your license will be renewed in couple of minutes.<br/>
|
359 |
-
Please make sure you upgrade <strong>FV Player Pro</strong> and <strong>FV Player VAST</strong> if you are using it.</p>
|
360 |
-
</div>';
|
361 |
-
}
|
362 |
-
|
363 |
-
global $FV_Player_Pro;
|
364 |
-
if( $FV_Player_Pro && version_compare($FV_Player_Pro->version,'0.5') == -1 ) :
|
365 |
-
?>
|
366 |
-
<div class="error">
|
367 |
-
<p><?php _e( 'FV Wordpress Flowplayer: Your pro extension is installed, but it\'s not compatible with FV Flowplayer 6! Make sure you upgrade your FV Player Pro to version 0.5 or above.', 'my-text-domain' ); ?></p>
|
368 |
-
</div>
|
369 |
-
<?php
|
370 |
-
endif;
|
371 |
-
|
372 |
-
/*if( isset($_GET['page']) && $_GET['page'] == 'backend.php' ) {
|
373 |
-
$options = get_option( 'fvwpflowplayer' );
|
374 |
-
if( $options['key'] == 'false' ) {
|
375 |
-
echo '<div class="updated"><p>';
|
376 |
-
printf(__('Brand new version of Flowplayer for HTML5. <a href="http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer/buy">Licenses half price</a> in May.' ) );
|
377 |
-
echo "</p></div>";
|
378 |
-
}
|
379 |
-
}*/
|
380 |
-
}
|
381 |
-
|
382 |
|
383 |
-
function
|
384 |
-
if( $
|
385 |
-
return;
|
386 |
-
}
|
387 |
-
|
388 |
-
global $fv_wp_flowplayer_ver;
|
389 |
-
|
390 |
-
|
391 |
-
wp_register_script('fvwpflowplayer-domwindow', flowplayer::get_plugin_url().'/js/jquery.colorbox-min.js',array('jquery'), $fv_wp_flowplayer_ver );
|
392 |
-
wp_enqueue_script('fvwpflowplayer-domwindow');
|
393 |
-
|
394 |
-
wp_register_script('fvwpflowplayer-shortcode-editor', flowplayer::get_plugin_url().'/js/shortcode-editor.js',array('jquery'), $fv_wp_flowplayer_ver );
|
395 |
-
wp_register_script('fvwpflowplayer-shortcode-editor-old', flowplayer::get_plugin_url().'/js/shortcode-editor.old.js',array('jquery'), $fv_wp_flowplayer_ver );
|
396 |
-
|
397 |
-
global $fv_fp;
|
398 |
-
if( isset($fv_fp->conf["interface"]['shortcode_editor_old']) && $fv_fp->conf["interface"]['shortcode_editor_old'] == 'true' ) {
|
399 |
-
wp_enqueue_script('fvwpflowplayer-shortcode-editor-old');
|
400 |
-
} else {
|
401 |
-
wp_enqueue_script('fvwpflowplayer-shortcode-editor');
|
402 |
-
}
|
403 |
-
|
404 |
-
wp_register_style('fvwpflowplayer-domwindow-css', flowplayer::get_plugin_url().'/css/colorbox.css','','1.0','screen');
|
405 |
-
wp_enqueue_style('fvwpflowplayer-domwindow-css');
|
406 |
-
}
|
407 |
|
408 |
-
|
409 |
-
Trick media uploader to show video only, while making sure we use our custom type; Also save options
|
410 |
-
*/
|
411 |
-
function fv_wp_flowplayer_admin_init() {
|
412 |
-
if( isset($_GET['type']) ) {
|
413 |
-
if( $_GET['type'] == 'fvplayer_video' || $_GET['type'] == 'fvplayer_video_1' || $_GET['type'] == 'fvplayer_video_2' || $_GET['type'] == 'fvplayer_mobile' ) {
|
414 |
-
$_GET['post_mime_type'] = 'video';
|
415 |
-
}
|
416 |
-
else if( $_GET['type'] == 'fvplayer_splash' || $_GET['type'] == 'fvplayer_logo' ) {
|
417 |
-
$_GET['post_mime_type'] = 'image';
|
418 |
-
}
|
419 |
-
}
|
420 |
-
|
421 |
-
if( isset($_POST['fv-wp-flowplayer-submit']) ) {
|
422 |
-
check_admin_referer('fv_flowplayer_settings_nonce','fv_flowplayer_settings_nonce');
|
423 |
-
|
424 |
-
global $fv_fp;
|
425 |
-
if( method_exists($fv_fp,'_set_conf') ) {
|
426 |
-
$fv_fp->_set_conf();
|
427 |
-
} else {
|
428 |
-
echo 'Error saving FV Flowplayer options.';
|
429 |
-
}
|
430 |
-
}
|
431 |
-
|
432 |
-
if( isset($_GET['fv-licensing']) && $_GET['fv-licensing'] == "check" ){
|
433 |
-
delete_option("fv_wordpress_flowplayer_persistent_notices");
|
434 |
-
|
435 |
-
//license will expire in 5 seconds in the function:
|
436 |
-
fv_wp_flowplayer_admin_key_update();
|
437 |
-
}
|
438 |
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
) {
|
448 |
-
|
449 |
-
$version = get_option( 'fvwpflowplayer_core_ver' );
|
450 |
-
if( version_compare( $fv_wp_flowplayer_core_ver, $version ) == 1 ) {
|
451 |
-
fv_wp_flowplayer_admin_key_update();
|
452 |
-
fv_wp_flowplayer_delete_extensions_transients();
|
453 |
-
}
|
454 |
-
}
|
455 |
-
|
456 |
-
if(
|
457 |
-
isset($fv_fp->conf['disable_videochecker']) && $fv_fp->conf['disable_videochecker'] == 'false' &&
|
458 |
-
( !isset($fv_fp->conf['video_checker_agreement']) || $fv_fp->conf['video_checker_agreement'] != 'true' ) &&
|
459 |
-
( !isset($fv_fp->conf['key_automatic']) || $fv_fp->conf['key_automatic'] != 'true' )
|
460 |
-
) {
|
461 |
-
$fv_fp->pointer_boxes['fv_flowplayer_video_checker_service'] = array(
|
462 |
-
'id' => '#wp-admin-bar-new-content',
|
463 |
-
'pointerClass' => 'fv_flowplayer_video_checker_service',
|
464 |
-
'heading' => __('FV Player Video Checker', 'fv-wordpress-flowplayer'),
|
465 |
-
'content' => __("<p>FV Player includes a free video checker which will check your videos for any encoding errors and helps ensure smooth playback of all your videos. To work its magic, our video checker must contact our server.</p><p>Would you like to enable the video encoding checker?</p>", 'fv-wordpress-flowplayer'),
|
466 |
-
'position' => array( 'edge' => 'top', 'align' => 'center' ),
|
467 |
-
'button1' => __('Allow', 'fv-wordpress-flowplayer'),
|
468 |
-
'button2' => __('Disable the video checker', 'fv-wordpress-flowplayer')
|
469 |
-
);
|
470 |
-
} else {
|
471 |
-
if(
|
472 |
-
preg_match( '!^\$\d+!', $fv_fp->conf['key'] ) && version_compare( $fv_wp_flowplayer_core_ver, get_option('fvwpflowplayer_core_ver') ) !== 0 &&
|
473 |
-
( !isset($fv_fp->conf['key_automatic']) || $fv_fp->conf['key_automatic'] != 'true' ) &&
|
474 |
-
( !isset($fv_fp->conf['video_checker_agreement']) || $fv_fp->conf['video_checker_agreement'] != 'true' )
|
475 |
-
) {
|
476 |
-
$fv_fp->pointer_boxes['fv_flowplayer_key_automatic'] = array(
|
477 |
-
'id' => '#wp-admin-bar-new-content',
|
478 |
-
'pointerClass' => 'fv_flowplayer_key_automatic',
|
479 |
-
'pointerWidth' => 340,
|
480 |
-
'heading' => __('FV Flowplayer License Update', 'fv-wordpress-flowplayer'),
|
481 |
-
'content' => __('New version of FV Flowplayer core has been installed for your licensed website. Please accept the automatic license key updating (connects to Foliovision servers) or update the key manually by loggin into your Foliovision account.', 'fv-wordpress-flowplayer'),
|
482 |
-
'position' => array( 'edge' => 'top', 'align' => 'center' ),
|
483 |
-
'button1' => __('Always auto-update', 'fv-wordpress-flowplayer'),
|
484 |
-
'button2' => __("I'll update it manually", 'fv-wordpress-flowplayer')
|
485 |
-
);
|
486 |
-
} else if( version_compare( $fv_wp_flowplayer_core_ver, get_option('fvwpflowplayer_core_ver') ) !== 0 && preg_match( '!^\$\d+!', $fv_fp->conf['key'] ) == 0 ) {
|
487 |
-
update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
|
488 |
-
}
|
489 |
-
}
|
490 |
-
|
491 |
-
if(
|
492 |
-
(stripos( $_SERVER['REQUEST_URI'], '/plugins.php') !== false || ( isset($_GET['page']) && $_GET['page'] === 'fvplayer' ) )
|
493 |
-
&& $pnotices = get_option('fv_wordpress_flowplayer_persistent_notices')
|
494 |
-
) {
|
495 |
-
$fv_fp->pointer_boxes['fv_flowplayer_license_expired'] = array(
|
496 |
-
'id' => '#wp-admin-bar-new-content',
|
497 |
-
'pointerClass' => 'fv_flowplayer_license_expired',
|
498 |
-
'pointerWidth' => 340,
|
499 |
-
'heading' => __('FV Flowplayer License Expired', 'fv-wordpress-flowplayer'),
|
500 |
-
'content' => __( $pnotices ),
|
501 |
-
'position' => array( 'edge' => 'top', 'align' => 'center' ),
|
502 |
-
'button1' => __('Hide this notice', 'fv-wordpress-flowplayer'),
|
503 |
-
'button2' => __('I\'ll check this later', 'fv-wordpress-flowplayer')
|
504 |
-
);
|
505 |
-
}
|
506 |
-
|
507 |
-
if( !$fv_fp->_get_option('disable_video_hash_links') && !$fv_fp->_get_option('notification_video_links') ) {
|
508 |
-
$fv_fp->pointer_boxes['fv_player_notification_video_links'] = array(
|
509 |
-
'id' => '#wp-admin-bar-new-content',
|
510 |
-
'pointerClass' => 'fv_player_notification_video_links',
|
511 |
-
'heading' => __('FV Player Video Links', 'fv-wordpress-flowplayer'),
|
512 |
-
'content' => $fv_fp->_get_option('disableembedding') ? __("<p>Now you can enable Video Links to allow people to share exact location in your videos. Clicking that link gives them a link to play that video at the exact time.</p>", 'fv-wordpress-flowplayer') : __("<p>Each video player now contains a link in the top bar. Clicking that link gives your visitors a link to play that video at the exact time where they are watching it.</p>", 'fv-wordpress-flowplayer'),
|
513 |
-
'position' => array( 'edge' => 'top', 'align' => 'center' ),
|
514 |
-
'button1' => __('Open Settings', 'fv-wordpress-flowplayer'),
|
515 |
-
'button2' => __('Dismiss', 'fv-wordpress-flowplayer')
|
516 |
-
);
|
517 |
-
|
518 |
-
add_action( 'admin_print_footer_scripts', 'fv_player_pointer_scripts' );
|
519 |
-
}
|
520 |
-
|
521 |
-
$aOptions = get_option( 'fvwpflowplayer' );
|
522 |
-
if( !isset($aOptions['version']) || version_compare( $fv_wp_flowplayer_ver, $aOptions['version'] ) ) {
|
523 |
-
//update_option( 'fv_wordpress_flowplayer_deferred_notices', 'FV Flowplayer upgraded - please click "Check template" and "Check videos" for automated check of your site at <a href="'.site_url().'/wp-admin/options-general.php?page=fvplayer">the settings page</a> for automated checks!' );
|
524 |
-
|
525 |
-
if( $aOptions['version'] == '6.0.5.20' && $aOptions['playlist_advance'] == 'true' ) { // version 6.0.5 used reverse login for this option!
|
526 |
-
$aOptions['playlist_advance'] = false;
|
527 |
-
$fv_fp->conf = $aOptions;
|
528 |
-
}
|
529 |
-
|
530 |
-
$aOptions['version'] = $fv_wp_flowplayer_ver;
|
531 |
-
update_option( 'fvwpflowplayer', $aOptions );
|
532 |
-
|
533 |
-
fv_wp_flowplayer_pro_settings_update_for_lightbox();
|
534 |
-
$fv_fp->css_writeout();
|
535 |
-
|
536 |
-
fv_wp_flowplayer_delete_extensions_transients();
|
537 |
-
delete_option('fv_flowplayer_extension_install');
|
538 |
-
}
|
539 |
-
|
540 |
-
if( isset($_GET['page']) && $_GET['page'] == 'fvplayer' ) {
|
541 |
-
wp_enqueue_script('common');
|
542 |
-
wp_enqueue_script('wp-lists');
|
543 |
-
wp_enqueue_script('postbox');
|
544 |
-
|
545 |
-
wp_register_script('fv-player-admin', flowplayer::get_plugin_url().'/js/admin.js',array('jquery'), $fv_wp_flowplayer_ver );
|
546 |
-
wp_enqueue_script('fv-player-admin');
|
547 |
-
}
|
548 |
|
549 |
-
|
550 |
-
if( flowplayer::is_licensed() ) {
|
551 |
-
if ( false === ( $aCheck = get_transient( 'fv_flowplayer_license' ) ) ) {
|
552 |
-
$aCheck = fv_wp_flowplayer_license_check( array('action' => 'check') );
|
553 |
-
if( $aCheck ) {
|
554 |
-
set_transient( 'fv_flowplayer_license', $aCheck, 60*60*24 );
|
555 |
-
} else {
|
556 |
-
set_transient( 'fv_flowplayer_license', json_decode(json_encode( array('error' => 'Error checking license') ), FALSE), 60*60*24 );
|
557 |
-
}
|
558 |
-
}
|
559 |
-
|
560 |
-
$aCheck = get_transient( 'fv_flowplayer_license' );
|
561 |
-
$aInstalled = get_option('fv_flowplayer_extension_install');
|
562 |
-
if( isset($aCheck->valid) && $aCheck->valid){
|
563 |
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
|
|
573 |
}
|
574 |
}
|
575 |
|
576 |
-
|
577 |
-
|
578 |
-
global $fv_fp, $fv_wp_flowplayer_core_ver;
|
579 |
|
580 |
-
|
581 |
-
|
582 |
-
if( $data->domain && $data->key && stripos( home_url(), $data->domain ) !== false ) {
|
583 |
-
$fv_fp->conf['key'] = $data->key;
|
584 |
-
update_option( 'fvwpflowplayer', $fv_fp->conf );
|
585 |
-
update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
|
586 |
-
|
587 |
-
fv_wp_flowplayer_change_transient_expiration("fv_flowplayer_license",5);
|
588 |
-
fv_wp_flowplayer_delete_extensions_transients(5);
|
589 |
-
return true;
|
590 |
-
}
|
591 |
-
} else if( isset($data->expired) && $data->expired && isset($data->message) ){
|
592 |
-
update_option( 'fv_wordpress_flowplayer_persistent_notices', $data->message );
|
593 |
-
update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
|
594 |
-
return false;
|
595 |
-
} else {
|
596 |
-
update_option( 'fv_wordpress_flowplayer_deferred_notices', 'FV Flowplayer License upgrade failed - please check if you are running the plugin on your licensed domain.' );
|
597 |
-
update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
|
598 |
-
return false;
|
599 |
}
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
$args = array(
|
607 |
-
'body' => array( 'plugin' => 'fv-wordpress-flowplayer', 'version' => $fv_wp_flowplayer_ver, 'core_ver' => $fv_wp_flowplayer_core_ver, 'type' => home_url(), 'action' => $aArgs['action'], 'admin-url' => admin_url() ),
|
608 |
-
'timeout' => 10,
|
609 |
-
'user-agent' => 'fv-wordpress-flowplayer-'.$fv_wp_flowplayer_ver.' ('.$fv_wp_flowplayer_core_ver.')'
|
610 |
-
);
|
611 |
-
$resp = wp_remote_post( 'https://foliovision.com/?fv_remote=true', $args );
|
612 |
|
613 |
-
if( !is_wp_error($resp) && isset($resp['body']) && $resp['body'] && $data = json_decode( preg_replace( '~[\s\S]*?<FVFLOWPLAYER>(.*?)</FVFLOWPLAYER>[\s\S]*?~', '$1', $resp['body'] ) ) ) {
|
614 |
-
return $data;
|
615 |
-
|
616 |
-
} else if( is_wp_error($resp) && stripos($resp->get_error_message(),'SSL' ) !== false ) {
|
617 |
-
$args = array( 'sslverify' => false );
|
618 |
-
$resp = wp_remote_post( 'https://foliovision.com/?fv_remote=true', $args );
|
619 |
-
|
620 |
-
if( !is_wp_error($resp) && isset($resp['body']) && $resp['body'] && $data = json_decode( preg_replace( '~[\s\S]*?<FVFLOWPLAYER>(.*?)</FVFLOWPLAYER>[\s\S]*?~', '$1', $resp['body'] ) ) ) {
|
621 |
-
return $data;
|
622 |
-
}
|
623 |
-
|
624 |
-
}
|
625 |
-
|
626 |
-
return false;
|
627 |
}
|
628 |
|
629 |
-
function fv_wp_flowplayer_pro_settings_update_for_lightbox(){
|
630 |
-
global $fv_fp;
|
631 |
-
if(isset($fv_fp->conf['pro']) && isset($fv_fp->conf['pro']['interface']['lightbox']) && $fv_fp->conf['pro']['interface']['lightbox'] == true ){
|
632 |
-
$fv_fp->conf['interface']['lightbox'] = true;
|
633 |
-
$fv_fp->conf['pro']['interface']['lightbox'] = false;
|
634 |
-
$options = get_option('fvwpflowplayer');
|
635 |
-
unset($options['pro']['interface']['lightbox']);
|
636 |
-
$options['interface']['lightbox'] = true;
|
637 |
-
update_option('fvwpflowplayer', $options);
|
638 |
-
}
|
639 |
-
if(isset($fv_fp->conf['pro']) && isset($fv_fp->conf['pro']['lightbox_images']) && $fv_fp->conf['pro']['lightbox_images'] == true ){
|
640 |
-
$fv_fp->conf['lightbox_images'] = true;
|
641 |
-
$fv_fp->conf['pro']['lightbox_images'] = false;
|
642 |
-
$options = get_option('fvwpflowplayer');
|
643 |
-
unset($options['pro']['lightbox_images']);
|
644 |
-
$options['lightbox_images'] = true;
|
645 |
-
update_option('fvwpflowplayer', $options);
|
646 |
-
}
|
647 |
-
|
648 |
-
}
|
649 |
|
650 |
-
function fv_wp_flowplayer_change_transient_expiration( $transient_name, $time ){
|
651 |
-
$transient_val = get_transient($transient_name);
|
652 |
-
if( $transient_val ){
|
653 |
-
set_transient($transient_name,$transient_val,$time);
|
654 |
-
return true;
|
655 |
-
}
|
656 |
-
return false;
|
657 |
-
}
|
658 |
|
659 |
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
|
|
|
|
667 |
}
|
668 |
-
$sWhere = implode(" OR ", $aWhere);
|
669 |
-
$aOptions = $wpdb->get_col( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%_transient_fv%' AND ( ".$sWhere." )" );
|
670 |
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
}
|
677 |
-
}
|
678 |
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
}
|
683 |
|
684 |
|
685 |
-
function fv_wp_flowplayer_edit_form_after_editor( ) {
|
686 |
-
global $fv_fp;
|
687 |
-
if( isset($fv_fp->conf["interface"]['shortcode_editor_old']) && $fv_fp->conf["interface"]['shortcode_editor_old'] == 'true' ) {
|
688 |
-
include dirname( __FILE__ ) . '/../view/wizard.old.php';
|
689 |
-
} else {
|
690 |
-
include dirname( __FILE__ ) . '/../view/wizard.php';
|
691 |
-
}
|
692 |
-
}
|
693 |
|
694 |
|
695 |
/*
|
696 |
-
|
697 |
-
*/
|
698 |
-
|
699 |
-
wp_media_upload_handler();
|
700 |
-
}
|
701 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
|
703 |
-
|
704 |
-
|
705 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
706 |
}
|
707 |
|
708 |
-
|
709 |
-
|
710 |
-
if( $args[1]['Name'] == 'FV Wordpress Flowplayer' ) {
|
711 |
-
$options = get_option( 'fvwpflowplayer' );
|
712 |
-
if( $options['key'] == 'false' || $options['key'] == '' ) :
|
713 |
-
?>
|
714 |
-
<tr class="plugin-update-tr fv-wordpress-flowplayer-tr">
|
715 |
-
<td class="plugin-update colspanchange" colspan="3">
|
716 |
-
<div class="update-message">
|
717 |
-
<a href="http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer/download">All Licenses 20% Off</a> - Easter sale!
|
718 |
-
</div>
|
719 |
-
</td>
|
720 |
-
</tr>
|
721 |
-
<?php
|
722 |
-
endif;
|
723 |
-
}
|
724 |
}
|
725 |
-
|
726 |
|
727 |
// enter script URL, return false if it's not version 5
|
728 |
function fv_wp_flowplayer_check_script_version( $url ) {
|
@@ -740,7 +201,6 @@ function fv_wp_flowplayer_check_script_version( $url ) {
|
|
740 |
return 0;
|
741 |
}
|
742 |
|
743 |
-
|
744 |
function fv_wp_flowplayer_check_jquery_version( $url, &$array, $key ) {
|
745 |
$url_mod = preg_replace( '!\?.+!', '', $url );
|
746 |
if( preg_match( '!(\d+.[\d\.]+)!', $url_mod, $version ) && $version[1] ) {
|
@@ -766,6 +226,13 @@ function fv_wp_flowplayer_check_jquery_version( $url, &$array, $key ) {
|
|
766 |
}
|
767 |
|
768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
function fv_wp_flowplayer_check_files() {
|
770 |
if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
|
771 |
global $wpdb;
|
@@ -868,260 +335,309 @@ function fv_wp_flowplayer_check_files() {
|
|
868 |
}
|
869 |
|
870 |
|
871 |
-
function fv_wp_flowplayer_check_template() {
|
872 |
-
$ok = array();
|
873 |
-
$errors = array();
|
874 |
-
|
875 |
-
if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
|
876 |
-
$response = wp_remote_get( home_url().'?fv_wp_flowplayer_check_template=yes' );
|
877 |
-
if( is_wp_error( $response ) ) {
|
878 |
-
$error_message = $response->get_error_message();
|
879 |
-
$output = array( 'error' => $error_message );
|
880 |
-
} else {
|
881 |
-
|
882 |
-
$active_plugins = get_option( 'active_plugins' );
|
883 |
-
foreach( $active_plugins AS $plugin ) {
|
884 |
-
if( stripos( $plugin, 'wp-minify' ) !== false ) {
|
885 |
-
$errors[] = "You are using <strong>WP Minify</strong>, so the script checks would not be accurate. Please check your videos manually.";
|
886 |
-
$output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
|
887 |
-
echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
|
888 |
-
die();
|
889 |
-
}
|
890 |
-
}
|
891 |
-
|
892 |
-
if( function_exists( 'w3_instance' ) && $minify = w3_instance('W3_Plugin_Minify') ) {
|
893 |
-
if( $minify->_config->get_boolean('minify.js.enable') ) {
|
894 |
-
$errors[] = "You are using <strong>W3 Total Cache</strong> with JS Minify enabled. The template check might not be accurate. Please check your videos manually.";
|
895 |
-
$output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
|
896 |
-
echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
|
897 |
-
}
|
898 |
-
}
|
899 |
-
|
900 |
-
if( stripos( $response['body'], '/html5.js') === FALSE && stripos( $response['body'], '/html5shiv.js') === FALSE ) {
|
901 |
-
$errors[] = 'html5.js not found in your template! Videos might not play in old browsers, like Internet Explorer 6-8. Read our instrutions <a href="https://foliovision.com/player/installation#html5js">here</a>.';
|
902 |
-
}
|
903 |
-
|
904 |
-
$ok[] = __('Template checker has changed. Just open any of your videos on your site and see if you get a red warning message about JavaScript not working.', 'fv-wordpress-flowplayer');
|
905 |
-
|
906 |
-
$response['body'] = preg_replace( '$<!--[\s\S]+?-->$', '', $response['body'] ); // handle HTML comments
|
907 |
-
|
908 |
-
// check Flowplayer scripts
|
909 |
-
preg_match_all( '!<script[^>]*?src=[\'"]([^\'"]*?flowplayer[0-9.-]*?(?:\.min)?\.js[^\'"]*?)[\'"][^>]*?>\s*?</script>!', $response['body'], $flowplayer_scripts );
|
910 |
-
if( count($flowplayer_scripts[1]) > 0 ) {
|
911 |
-
if( count($flowplayer_scripts[1]) > 1 ) {
|
912 |
-
$errors[] = "It appears there are <strong>multiple</strong> Flowplayer scripts on your site, your videos might not be playing, please check. There might be some other plugin adding the script.";
|
913 |
-
}
|
914 |
-
foreach( $flowplayer_scripts[1] AS $flowplayer_script ) {
|
915 |
-
$check = fv_wp_flowplayer_check_script_version( $flowplayer_script );
|
916 |
-
if( $check == - 1 ) {
|
917 |
-
$errors[] = "Flowplayer script <code>$flowplayer_script</code> is old version and won't play. You need to get rid of this script.";
|
918 |
-
} else if( $check == 1 ) {
|
919 |
-
$ok[] = __('FV Flowplayer script found: ', 'fv-wordpress-flowplayer') . "<code>$flowplayer_script</code>!";
|
920 |
-
$fv_flowplayer_pos = strpos( $response['body'], $flowplayer_script );
|
921 |
-
}
|
922 |
-
}
|
923 |
-
} else if( count($flowplayer_scripts[1]) < 1 ) {
|
924 |
-
$errors[] = "It appears there are <strong>no</strong> Flowplayer scripts on your site, your videos might not be playing, please check. Check your template's header.php file if it contains wp_head() function call and footer.php should contain wp_footer()!";
|
925 |
-
}
|
926 |
-
|
927 |
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
$errors[] = "It appears your Flowplayer JavaScript library is loading before jQuery. Your videos probably won't work. Please make sure your jQuery library is loading using the standard Wordpress function - wp_enqueue_scripts(), or move it above wp_head() in your header.php template.";
|
946 |
-
}
|
947 |
-
|
948 |
-
$output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
|
949 |
-
}
|
950 |
-
echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
|
951 |
die();
|
952 |
}
|
953 |
-
|
954 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
955 |
}
|
956 |
|
|
|
|
|
957 |
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
$output = array( 'errors' => false, 'ok' => array(__('License key acquired successfully. <a href="">Reload</a>', 'fv-wordpress-flowplayer')) );
|
962 |
-
fv_wp_flowplayer_install_extension();
|
963 |
-
} else {
|
964 |
-
$message = get_option('fv_wordpress_flowplayer_deferred_notices');
|
965 |
-
if( !$message ) $message = get_option('fv_wordpress_flowplayer_persistent_notices');
|
966 |
-
$output = array( 'errors' => array($message), 'ok' => false );
|
967 |
}
|
968 |
-
echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
|
969 |
-
die();
|
970 |
}
|
971 |
-
|
|
|
972 |
}
|
973 |
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
$found[] = $in_array;
|
992 |
-
} else if( $like && stripos($val, $find) !== false ) {
|
993 |
-
$found[] = $in_array;
|
994 |
-
}
|
995 |
-
}
|
996 |
-
}
|
997 |
-
return false;
|
998 |
-
}
|
999 |
return false;
|
1000 |
-
}
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
|
|
1005 |
|
1006 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1007 |
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
|
1019 |
-
//$headers = "Reply-To: \"$current_user->display_name\" <$current_user->user_email>\r\n";
|
1020 |
-
$fv_wp_flowplayer_support_mail_from_name = $current_user->display_name;
|
1021 |
-
$fv_wp_flowplayer_support_mail_from = $current_user->user_email;
|
1022 |
-
|
1023 |
-
add_filter( 'wp_mail_content_type', create_function('', "return 'text/html';") );
|
1024 |
-
|
1025 |
-
//add_action('phpmailer_init', 'fv_wp_flowplayer_support_mail_phpmailer_init' );
|
1026 |
-
wp_mail( 'fvplayer@foliovision.com', 'FV Flowplayer Quick Support Submission', $content );
|
1027 |
-
|
1028 |
-
die('1');
|
1029 |
}
|
|
|
|
|
1030 |
}
|
1031 |
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
if( $fv_wp_flowplayer_support_mail_from ) {
|
1040 |
-
if( strcmp( trim($phpmailer->From), trim($fv_wp_flowplayer_support_mail_from) ) != 0 && !trim($phpmailer->Sender) ) {
|
1041 |
-
$phpmailer->Sender = trim($phpmailer->From);
|
1042 |
-
}
|
1043 |
-
$phpmailer->From = trim( $fv_wp_flowplayer_support_mail_from );
|
1044 |
-
}
|
1045 |
-
|
1046 |
}
|
1047 |
|
1048 |
|
1049 |
-
function fv_wp_flowplayer_closed_meta_boxes( $closed ) {
|
1050 |
-
if ( false === $closed )
|
1051 |
-
$closed = array( 'fv_flowplayer_amazon_options', 'fv_flowplayer_interface_options', 'fv_flowplayer_default_options', 'fv_flowplayer_ads', 'fv_flowplayer_integrations', 'fv_player_pro' );
|
1052 |
|
1053 |
-
return $closed;
|
1054 |
-
}
|
1055 |
|
|
|
1056 |
|
1057 |
-
function
|
1058 |
-
|
1059 |
-
check_ajax_referer('fv_flowplayer_key_automatic');
|
1060 |
-
$conf = get_option( 'fvwpflowplayer' );
|
1061 |
-
if( $conf ) {
|
1062 |
-
$conf['key_automatic'] = ( $_POST['value'] == 'true' ) ? 'true' : 'false';
|
1063 |
-
if( $conf['key_automatic'] == 'true' ) {
|
1064 |
-
fv_wp_flowplayer_admin_key_update();
|
1065 |
-
$conf = get_option( 'fvwpflowplayer' );
|
1066 |
-
} else {
|
1067 |
-
global $fv_wp_flowplayer_core_ver;
|
1068 |
-
update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
|
1069 |
-
}
|
1070 |
-
update_option( 'fvwpflowplayer', $conf );
|
1071 |
-
}
|
1072 |
-
die();
|
1073 |
-
}
|
1074 |
|
1075 |
-
|
1076 |
-
check_ajax_referer('fv_flowplayer_video_checker_service');
|
1077 |
-
$conf = get_option( 'fvwpflowplayer' );
|
1078 |
-
if( $conf ) {
|
1079 |
-
if( $_POST['value'] == 'true' ) {
|
1080 |
-
$conf['disable_videochecker'] = 'false';
|
1081 |
-
$conf['video_checker_agreement'] = 'true';
|
1082 |
-
} else {
|
1083 |
-
$conf['disable_videochecker'] = 'true';
|
1084 |
-
}
|
1085 |
-
update_option( 'fvwpflowplayer', $conf );
|
1086 |
-
}
|
1087 |
-
die();
|
1088 |
-
}
|
1089 |
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
}
|
1105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1106 |
}
|
1107 |
|
1108 |
|
1109 |
-
// allow .vtt subtitle files
|
1110 |
-
add_filter( 'wp_check_filetype_and_ext', 'fv_flowplayer_filetypes', 10, 4 );
|
1111 |
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1120 |
}
|
1121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1122 |
}
|
1123 |
|
1124 |
|
|
|
|
|
|
|
|
|
|
|
1125 |
/*
|
1126 |
* Check the extension info from plugin license transient and activate the plugin
|
1127 |
*/
|
@@ -1137,6 +653,10 @@ function fv_wp_flowplayer_install_extension( $plugin_package = 'fv_player_pro' )
|
|
1137 |
$download_url = $aPluginInfo->{$plugin_package}->url;
|
1138 |
|
1139 |
$sPluginBasenameReal = fv_flowplayer_get_extension_path( str_replace( '_', '-', $plugin_package ) );
|
|
|
|
|
|
|
|
|
1140 |
$plugin_basename = $sPluginBasenameReal ? $sPluginBasenameReal : $plugin_basename;
|
1141 |
|
1142 |
$url = wp_nonce_url( site_url().'/wp-admin/options-general.php?page=fvplayer', 'fv_player_pro_install', 'nonce_fv_player_pro_install' );
|
@@ -1238,40 +758,7 @@ function fv_wp_flowplayer_install_extension_talk( $content ) {
|
|
1238 |
}
|
1239 |
|
1240 |
|
1241 |
-
function fv_wp_flowplayer_activate_extension() {
|
1242 |
-
check_ajax_referer( 'fv_wp_flowplayer_activate_extension', 'nonce' );
|
1243 |
-
if( !isset( $_POST['plugin'] ) ) {
|
1244 |
-
die();
|
1245 |
-
}
|
1246 |
-
|
1247 |
-
$activate = activate_plugin( $_POST['plugin'] );
|
1248 |
-
if ( is_wp_error( $activate ) ) {
|
1249 |
-
echo "<FVFLOWPLAYER>".json_encode( array( 'message' => $activate->get_error_message(), 'error' => $activate->get_error_message() ) )."</FVFLOWPLAYER>";
|
1250 |
-
die();
|
1251 |
-
}
|
1252 |
-
|
1253 |
-
echo "<FVFLOWPLAYER>".json_encode( array( 'message' => 'Success!', 'plugin' => $_POST['plugin'] ) )."</FVFLOWPLAYER>";
|
1254 |
-
die();
|
1255 |
-
}
|
1256 |
-
|
1257 |
-
add_filter('plugin_action_links', 'fv_wp_flowplayer_plugin_action_links', 10, 2);
|
1258 |
-
|
1259 |
-
function fv_wp_flowplayer_plugin_action_links($links, $file) {
|
1260 |
-
if( $file == 'fv-wordpress-flowplayer/flowplayer.php') {
|
1261 |
-
$settings_link = '<a href="https://foliovision.com/pro-support" target="_blank">Premium Support</a>';
|
1262 |
-
array_unshift($links, $settings_link);
|
1263 |
-
$settings_link = '<a href="options-general.php?page=fvplayer">Settings</a>';
|
1264 |
-
array_unshift($links, $settings_link);
|
1265 |
-
}
|
1266 |
-
return $links;
|
1267 |
-
}
|
1268 |
|
1269 |
-
|
1270 |
-
function fv_flowplayer_admin_scripts() {
|
1271 |
-
if (isset($_GET['page']) && $_GET['page'] == 'fvplayer') {
|
1272 |
-
wp_enqueue_media();
|
1273 |
-
}
|
1274 |
-
}
|
1275 |
|
1276 |
//search for plugin path with {slug}.php
|
1277 |
function fv_flowplayer_get_extension_path( $slug ){
|
@@ -1288,8 +775,9 @@ function fv_flowplayer_get_extension_path( $slug ){
|
|
1288 |
return $item;
|
1289 |
}
|
1290 |
|
|
|
1291 |
foreach( $aInactivePlugins as $item ){
|
1292 |
-
if( stripos($item,$slug.'.php') !== false )
|
1293 |
return $item;
|
1294 |
}
|
1295 |
|
@@ -1322,31 +810,30 @@ add_action( 'deleted_transient_fv_flowplayer_license', 'fv_player_disable_object
|
|
1322 |
|
1323 |
|
1324 |
|
1325 |
-
function
|
1326 |
-
if(
|
1327 |
-
|
1328 |
-
foreach( $objUpdates->response AS $key => $objUpdate ) {
|
1329 |
-
if( stripos($key,'fv-wordpress-flowplayer') === 0 ) {
|
1330 |
-
unset($objUpdates->response[$key]);
|
1331 |
-
}
|
1332 |
}
|
1333 |
-
|
1334 |
-
|
1335 |
}
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
|
|
|
|
|
|
1352 |
}
|
15 |
|
16 |
You should have received a copy of the GNU General Public License
|
17 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
|
21 |
+
/*
|
22 |
+
* Video Checker support email
|
|
|
23 |
*/
|
24 |
+
add_action('wp_ajax_fv_wp_flowplayer_support_mail', 'fv_wp_flowplayer_support_mail');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
function fv_wp_flowplayer_support_mail() {
|
27 |
+
if( isset( $_POST['notice'] ) && stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
$current_user = wp_get_current_user();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
$content = '<p>User: '.$current_user->display_name." (".$current_user->user_email.")</p>\n";
|
32 |
+
$content .= '<p>User Agent: '.$_SERVER['HTTP_USER_AGENT']."</p>\n";
|
33 |
+
$content .= '<p>Referer: '.$_SERVER['HTTP_REFERER']."</p>\n";
|
34 |
+
$content .= "<p>Comment:</p>\n".wpautop( stripslashes($_POST['comment']) );
|
35 |
+
$notice = str_replace( '<span class="value"', ': <span class="value"', stripslashes($_POST['notice']) );
|
36 |
+
$notice .= str_replace( '<span class="value"', ': <span class="value"', stripslashes($_POST['details']) );
|
37 |
+
|
38 |
+
$content .= "<p>Video analysis:</p>\n".$notice;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
global $fv_wp_flowplayer_support_mail_from, $fv_wp_flowplayer_support_mail_from_name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
+
//$headers = "Reply-To: \"$current_user->display_name\" <$current_user->user_email>\r\n";
|
43 |
+
$fv_wp_flowplayer_support_mail_from_name = $current_user->display_name;
|
44 |
+
$fv_wp_flowplayer_support_mail_from = $current_user->user_email;
|
45 |
+
|
46 |
+
add_filter( 'wp_mail_content_type', create_function('', "return 'text/html';") );
|
47 |
+
|
48 |
+
//add_action('phpmailer_init', 'fv_wp_flowplayer_support_mail_phpmailer_init' );
|
49 |
+
wp_mail( 'fvplayer@foliovision.com', 'FV Flowplayer Quick Support Submission', $content );
|
50 |
+
|
51 |
+
die('1');
|
52 |
}
|
53 |
}
|
54 |
|
55 |
+
function fv_wp_flowplayer_support_mail_phpmailer_init( $phpmailer ) {
|
56 |
+
global $fv_wp_flowplayer_support_mail_from, $fv_wp_flowplayer_support_mail_from_name;
|
|
|
57 |
|
58 |
+
if( $fv_wp_flowplayer_support_mail_from_name ) {
|
59 |
+
$phpmailer->FromName = trim( $fv_filled_in_phpmailer_init_from_name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
+
if( $fv_wp_flowplayer_support_mail_from ) {
|
62 |
+
if( strcmp( trim($phpmailer->From), trim($fv_wp_flowplayer_support_mail_from) ) != 0 && !trim($phpmailer->Sender) ) {
|
63 |
+
$phpmailer->Sender = trim($phpmailer->From);
|
64 |
+
}
|
65 |
+
$phpmailer->From = trim( $fv_wp_flowplayer_support_mail_from );
|
66 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
|
73 |
+
/*
|
74 |
+
* Activating Extensions
|
75 |
+
*/
|
76 |
+
add_action('wp_ajax_fv_wp_flowplayer_activate_extension', 'fv_wp_flowplayer_activate_extension');
|
77 |
+
|
78 |
+
function fv_wp_flowplayer_activate_extension() {
|
79 |
+
check_ajax_referer( 'fv_wp_flowplayer_activate_extension', 'nonce' );
|
80 |
+
if( !isset( $_POST['plugin'] ) ) {
|
81 |
+
die();
|
82 |
}
|
|
|
|
|
83 |
|
84 |
+
$activate = activate_plugin( $_POST['plugin'] );
|
85 |
+
if ( is_wp_error( $activate ) ) {
|
86 |
+
echo "<FVFLOWPLAYER>".json_encode( array( 'message' => $activate->get_error_message(), 'error' => $activate->get_error_message() ) )."</FVFLOWPLAYER>";
|
87 |
+
die();
|
88 |
+
}
|
|
|
|
|
89 |
|
90 |
+
echo "<FVFLOWPLAYER>".json_encode( array( 'message' => 'Success!', 'plugin' => $_POST['plugin'] ) )."</FVFLOWPLAYER>";
|
91 |
+
die();
|
|
|
92 |
}
|
93 |
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
|
97 |
/*
|
98 |
+
* Template Check
|
99 |
+
*/
|
100 |
+
add_action('wp_ajax_fv_wp_flowplayer_check_template', 'fv_wp_flowplayer_check_template');
|
|
|
|
|
101 |
|
102 |
+
function fv_wp_flowplayer_check_template() {
|
103 |
+
$ok = array();
|
104 |
+
$errors = array();
|
105 |
+
|
106 |
+
if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
|
107 |
+
$response = wp_remote_get( home_url().'?fv_wp_flowplayer_check_template=yes' );
|
108 |
+
if( is_wp_error( $response ) ) {
|
109 |
+
$error_message = $response->get_error_message();
|
110 |
+
$output = array( 'error' => $error_message );
|
111 |
+
} else {
|
112 |
+
|
113 |
+
$active_plugins = get_option( 'active_plugins' );
|
114 |
+
foreach( $active_plugins AS $plugin ) {
|
115 |
+
if( stripos( $plugin, 'wp-minify' ) !== false ) {
|
116 |
+
$errors[] = "You are using <strong>WP Minify</strong>, so the script checks would not be accurate. Please check your videos manually.";
|
117 |
+
$output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
|
118 |
+
echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
|
119 |
+
die();
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
if( function_exists( 'w3_instance' ) && $minify = w3_instance('W3_Plugin_Minify') ) {
|
124 |
+
if( $minify->_config->get_boolean('minify.js.enable') ) {
|
125 |
+
$errors[] = "You are using <strong>W3 Total Cache</strong> with JS Minify enabled. The template check might not be accurate. Please check your videos manually.";
|
126 |
+
$output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
|
127 |
+
echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
if( stripos( $response['body'], '/html5.js') === FALSE && stripos( $response['body'], '/html5shiv.js') === FALSE ) {
|
132 |
+
$errors[] = 'html5.js not found in your template! Videos might not play in old browsers, like Internet Explorer 6-8. Read our instrutions <a href="https://foliovision.com/player/installation#html5js">here</a>.';
|
133 |
+
}
|
134 |
+
|
135 |
+
$ok[] = __('Template checker has changed. Just open any of your videos on your site and see if you get a red warning message about JavaScript not working.', 'fv-wordpress-flowplayer');
|
136 |
+
|
137 |
+
$response['body'] = preg_replace( '$<!--[\s\S]+?-->$', '', $response['body'] ); // handle HTML comments
|
138 |
+
|
139 |
+
// check Flowplayer scripts
|
140 |
+
preg_match_all( '!<script[^>]*?src=[\'"]([^\'"]*?flowplayer[0-9.-]*?(?:\.min)?\.js[^\'"]*?)[\'"][^>]*?>\s*?</script>!', $response['body'], $flowplayer_scripts );
|
141 |
+
if( count($flowplayer_scripts[1]) > 0 ) {
|
142 |
+
if( count($flowplayer_scripts[1]) > 1 ) {
|
143 |
+
$errors[] = "It appears there are <strong>multiple</strong> Flowplayer scripts on your site, your videos might not be playing, please check. There might be some other plugin adding the script.";
|
144 |
+
}
|
145 |
+
foreach( $flowplayer_scripts[1] AS $flowplayer_script ) {
|
146 |
+
$check = fv_wp_flowplayer_check_script_version( $flowplayer_script );
|
147 |
+
if( $check == - 1 ) {
|
148 |
+
$errors[] = "Flowplayer script <code>$flowplayer_script</code> is old version and won't play. You need to get rid of this script.";
|
149 |
+
} else if( $check == 1 ) {
|
150 |
+
$ok[] = __('FV Flowplayer script found: ', 'fv-wordpress-flowplayer') . "<code>$flowplayer_script</code>!";
|
151 |
+
$fv_flowplayer_pos = strpos( $response['body'], $flowplayer_script );
|
152 |
+
}
|
153 |
+
}
|
154 |
+
} else if( count($flowplayer_scripts[1]) < 1 ) {
|
155 |
+
$errors[] = "It appears there are <strong>no</strong> Flowplayer scripts on your site, your videos might not be playing, please check. Check your template's header.php file if it contains wp_head() function call and footer.php should contain wp_footer()!";
|
156 |
+
}
|
157 |
+
|
158 |
|
159 |
+
// check jQuery scripts
|
160 |
+
preg_match_all( '!<script[^>]*?src=[\'"]([^\'"]*?/jquery[0-9.-]*?(?:\.min)?\.js[^\'"]*?)[\'"][^>]*?>\s*?</script>!', $response['body'], $jquery_scripts );
|
161 |
+
if( count($jquery_scripts[1]) > 0 ) {
|
162 |
+
foreach( $jquery_scripts[1] AS $jkey => $jquery_script ) {
|
163 |
+
$ok[] = __('jQuery library found: ', 'fv-wordpress-flowplayer') . "<code>$jquery_script</code>!";
|
164 |
+
$jquery_pos = strpos( $response['body'], $jquery_script );
|
165 |
+
}
|
166 |
+
|
167 |
+
if( count($jquery_scripts[1]) > 1 ) {
|
168 |
+
$errors[] = "It appears there are <strong>multiple</strong> jQuery libraries on your site, your videos might not be playing or may play with defects, please check.\n";
|
169 |
+
}
|
170 |
+
} else if( count($jquery_scripts[1]) < 1 ) {
|
171 |
+
$errors[] = "It appears there are <strong>no</strong> jQuery library on your site, your videos might not be playing, please check.\n";
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
if( $fv_flowplayer_pos > 0 && $jquery_pos > 0 && $jquery_pos > $fv_flowplayer_pos && count($jquery_scripts[1]) < 1 ) {
|
176 |
+
$errors[] = "It appears your Flowplayer JavaScript library is loading before jQuery. Your videos probably won't work. Please make sure your jQuery library is loading using the standard Wordpress function - wp_enqueue_scripts(), or move it above wp_head() in your header.php template.";
|
177 |
+
}
|
178 |
+
|
179 |
+
$output = array( 'errors' => $errors, 'ok' => $ok/*, 'html' => $response['body'] */);
|
180 |
+
}
|
181 |
+
echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
|
182 |
+
die();
|
183 |
}
|
184 |
|
185 |
+
die('-1');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
|
|
187 |
|
188 |
// enter script URL, return false if it's not version 5
|
189 |
function fv_wp_flowplayer_check_script_version( $url ) {
|
201 |
return 0;
|
202 |
}
|
203 |
|
|
|
204 |
function fv_wp_flowplayer_check_jquery_version( $url, &$array, $key ) {
|
205 |
$url_mod = preg_replace( '!\?.+!', '', $url );
|
206 |
if( preg_match( '!(\d+.[\d\.]+)!', $url_mod, $version ) && $version[1] ) {
|
226 |
}
|
227 |
|
228 |
|
229 |
+
|
230 |
+
|
231 |
+
/*
|
232 |
+
* Check video files
|
233 |
+
*/
|
234 |
+
add_action('wp_ajax_fv_wp_flowplayer_check_files', 'fv_wp_flowplayer_check_files');
|
235 |
+
|
236 |
function fv_wp_flowplayer_check_files() {
|
237 |
if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
|
238 |
global $wpdb;
|
335 |
}
|
336 |
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
|
339 |
+
|
340 |
+
/*
|
341 |
+
* Apply Pro Upgrade button
|
342 |
+
*/
|
343 |
+
add_action('wp_ajax_fv_wp_flowplayer_check_license', 'fv_wp_flowplayer_check_license');
|
344 |
+
|
345 |
+
function fv_wp_flowplayer_check_license() {
|
346 |
+
if( stripos( $_SERVER['HTTP_REFERER'], home_url() ) === 0 ) {
|
347 |
+
if( fv_wp_flowplayer_admin_key_update() ) {
|
348 |
+
$output = array( 'errors' => false, 'ok' => array(__('License key acquired successfully. <a href="">Reload</a>', 'fv-wordpress-flowplayer')) );
|
349 |
+
fv_wp_flowplayer_install_extension();
|
350 |
+
} else {
|
351 |
+
$message = get_option('fv_wordpress_flowplayer_deferred_notices');
|
352 |
+
if( !$message ) $message = get_option('fv_wordpress_flowplayer_persistent_notices');
|
353 |
+
$output = array( 'errors' => array($message), 'ok' => false );
|
354 |
+
}
|
355 |
+
echo '<FVFLOWPLAYER>'.json_encode($output).'</FVFLOWPLAYER>';
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
die();
|
357 |
}
|
358 |
+
die('-1');
|
359 |
+
}
|
360 |
+
|
361 |
+
|
362 |
+
|
363 |
+
/*
|
364 |
+
* Run this when new version is installed
|
365 |
+
*/
|
366 |
+
add_action('admin_init', 'fv_player_admin_update');
|
367 |
+
|
368 |
+
function fv_player_admin_update() {
|
369 |
+
global $fv_fp, $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver;
|
370 |
+
|
371 |
+
$aOptions = get_option( 'fvwpflowplayer' );
|
372 |
+
if( !isset($aOptions['version']) || version_compare( $fv_wp_flowplayer_ver, $aOptions['version'] ) ) {
|
373 |
+
//update_option( 'fv_wordpress_flowplayer_deferred_notices', 'FV Flowplayer upgraded - please click "Check template" and "Check videos" for automated check of your site at <a href="'.site_url().'/wp-admin/options-general.php?page=fvplayer">the settings page</a> for automated checks!' );
|
374 |
+
|
375 |
+
if( $aOptions['version'] == '6.0.5.20' && $aOptions['playlist_advance'] == 'true' ) { // version 6.0.5 used reverse login for this option!
|
376 |
+
$aOptions['playlist_advance'] = false;
|
377 |
+
$fv_fp->conf = $aOptions;
|
378 |
+
}
|
379 |
+
|
380 |
+
$aOptions['version'] = $fv_wp_flowplayer_ver;
|
381 |
+
update_option( 'fvwpflowplayer', $aOptions );
|
382 |
+
|
383 |
+
fv_wp_flowplayer_pro_settings_update_for_lightbox();
|
384 |
+
$fv_fp->css_writeout();
|
385 |
+
|
386 |
+
fv_wp_flowplayer_delete_extensions_transients();
|
387 |
+
delete_option('fv_flowplayer_extension_install');
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
function fv_wp_flowplayer_pro_settings_update_for_lightbox(){
|
392 |
+
global $fv_fp;
|
393 |
+
if(isset($fv_fp->conf['pro']) && isset($fv_fp->conf['pro']['interface']['lightbox']) && $fv_fp->conf['pro']['interface']['lightbox'] == true ){
|
394 |
+
$fv_fp->conf['interface']['lightbox'] = true;
|
395 |
+
$fv_fp->conf['pro']['interface']['lightbox'] = false;
|
396 |
+
$options = get_option('fvwpflowplayer');
|
397 |
+
unset($options['pro']['interface']['lightbox']);
|
398 |
+
$options['interface']['lightbox'] = true;
|
399 |
+
update_option('fvwpflowplayer', $options);
|
400 |
+
}
|
401 |
+
if(isset($fv_fp->conf['pro']) && isset($fv_fp->conf['pro']['lightbox_images']) && $fv_fp->conf['pro']['lightbox_images'] == true ){
|
402 |
+
$fv_fp->conf['lightbox_images'] = true;
|
403 |
+
$fv_fp->conf['pro']['lightbox_images'] = false;
|
404 |
+
$options = get_option('fvwpflowplayer');
|
405 |
+
unset($options['pro']['lightbox_images']);
|
406 |
+
$options['lightbox_images'] = true;
|
407 |
+
update_option('fvwpflowplayer', $options);
|
408 |
+
}
|
409 |
+
|
410 |
+
}
|
411 |
+
|
412 |
+
function fv_wp_flowplayer_delete_extensions_transients( $delete_delay = false ){
|
413 |
+
$aTransientsLike = array('fv_flowplayer_license','fv-player-pro_license','fv-player-vast_license','fv-player-pro_fp-private-updates','fv-player-vast_fp-private-updates');
|
414 |
+
|
415 |
+
global $wpdb;
|
416 |
+
$aWhere = array();
|
417 |
+
foreach( $aTransientsLike AS $sKey ) {
|
418 |
+
$aWhere[] = 'option_name LIKE "%'.$sKey.'%"';
|
419 |
+
}
|
420 |
+
$sWhere = implode(" OR ", $aWhere);
|
421 |
+
$aOptions = $wpdb->get_col( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%_transient_fv%' AND ( ".$sWhere." )" );
|
422 |
+
|
423 |
+
foreach( $aOptions AS $sKey ) {
|
424 |
+
if( !$delete_delay ){
|
425 |
+
delete_transient( str_replace('_transient_','',$sKey) );
|
426 |
+
} else {
|
427 |
+
fv_wp_flowplayer_change_transient_expiration( str_replace('_transient_','',$sKey), $delete_delay );
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
$aUpdates = get_site_transient('update_plugins');
|
432 |
+
set_site_transient('update_plugins', $aUpdates );
|
433 |
+
|
434 |
+
}
|
435 |
+
|
436 |
+
|
437 |
+
|
438 |
+
add_action('admin_init', 'fv_player_lchecks');
|
439 |
+
|
440 |
+
function fv_player_lchecks() {
|
441 |
+
if( isset($_GET['fv-licensing']) && $_GET['fv-licensing'] == "check" ){
|
442 |
+
delete_option("fv_wordpress_flowplayer_persistent_notices");
|
443 |
+
|
444 |
+
//license will expire in 5 seconds in the function:
|
445 |
+
fv_wp_flowplayer_admin_key_update();
|
446 |
+
}
|
447 |
+
|
448 |
+
global $fv_fp, $fv_wp_flowplayer_core_ver;
|
449 |
+
if( preg_match( '!^\$\d+!', $fv_fp->conf['key'] ) ) {
|
450 |
+
$version = get_option( 'fvwpflowplayer_core_ver' );
|
451 |
+
if( version_compare( $fv_wp_flowplayer_core_ver, $version ) == 1 ) {
|
452 |
+
fv_wp_flowplayer_admin_key_update();
|
453 |
+
fv_wp_flowplayer_delete_extensions_transients();
|
454 |
+
}
|
455 |
+
}
|
456 |
+
|
457 |
+
if( flowplayer::is_licensed() ) {
|
458 |
+
if ( false === ( $aCheck = get_transient( 'fv_flowplayer_license' ) ) ) {
|
459 |
+
$aCheck = fv_wp_flowplayer_license_check( array('action' => 'check') );
|
460 |
+
if( $aCheck ) {
|
461 |
+
set_transient( 'fv_flowplayer_license', $aCheck, 60*60*24 );
|
462 |
+
} else {
|
463 |
+
set_transient( 'fv_flowplayer_license', json_decode(json_encode( array('error' => 'Error checking license') ), FALSE), 60*60*24 );
|
464 |
+
}
|
465 |
+
}
|
466 |
+
|
467 |
+
$aCheck = get_transient( 'fv_flowplayer_license' );
|
468 |
+
$aInstalled = get_option('fv_flowplayer_extension_install');
|
469 |
+
if( isset($aCheck->valid) && $aCheck->valid){
|
470 |
+
|
471 |
+
if( !isset($aInstalled['fv_player_pro']) || ( isset($_REQUEST['nonce_fv_player_pro_install']) && wp_verify_nonce( $_REQUEST['nonce_fv_player_pro_install'], 'fv_player_pro_install') ) ) {
|
472 |
+
fv_wp_flowplayer_install_extension('fv_player_pro');
|
473 |
+
}
|
474 |
+
delete_option('fv_wordpress_flowplayer_persistent_notices');
|
475 |
+
}
|
476 |
+
|
477 |
+
if( isset($aCheck->expired) && $aCheck->expired && stripos( implode(get_option('active_plugins')), 'fv-player-pro' ) !== false ) {
|
478 |
+
add_filter( 'site_transient_update_plugins', 'fv_player_remove_update' );
|
479 |
+
}
|
480 |
+
}
|
481 |
}
|
482 |
|
483 |
+
function fv_player_remove_update( $objUpdates ) {
|
484 |
+
if( !$objUpdates || !isset($objUpdates->response) || count($objUpdates->response) == 0 ) return $objUpdates;
|
485 |
|
486 |
+
foreach( $objUpdates->response AS $key => $objUpdate ) {
|
487 |
+
if( stripos($key,'fv-wordpress-flowplayer') === 0 ) {
|
488 |
+
unset($objUpdates->response[$key]);
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
}
|
|
|
|
|
490 |
}
|
491 |
+
|
492 |
+
return $objUpdates;
|
493 |
}
|
494 |
|
495 |
+
function fv_wp_flowplayer_admin_key_update() {
|
496 |
+
global $fv_fp, $fv_wp_flowplayer_core_ver;
|
497 |
+
|
498 |
+
$data = fv_wp_flowplayer_license_check( array('action' => 'key_update') );
|
499 |
+
if( isset($data->domain) ) { // todo: test
|
500 |
+
if( $data->domain && $data->key && stripos( home_url(), $data->domain ) !== false ) {
|
501 |
+
$fv_fp->conf['key'] = $data->key;
|
502 |
+
update_option( 'fvwpflowplayer', $fv_fp->conf );
|
503 |
+
update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
|
504 |
+
|
505 |
+
fv_wp_flowplayer_change_transient_expiration("fv_flowplayer_license",5);
|
506 |
+
fv_wp_flowplayer_delete_extensions_transients(5);
|
507 |
+
return true;
|
508 |
+
}
|
509 |
+
} else if( isset($data->expired) && $data->expired && isset($data->message) ){
|
510 |
+
update_option( 'fv_wordpress_flowplayer_persistent_notices', $data->message );
|
511 |
+
update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
return false;
|
513 |
+
} else {
|
514 |
+
update_option( 'fv_wordpress_flowplayer_deferred_notices', 'FV Flowplayer License upgrade failed - please check if you are running the plugin on your licensed domain.' );
|
515 |
+
update_option( 'fvwpflowplayer_core_ver', $fv_wp_flowplayer_core_ver );
|
516 |
+
return false;
|
517 |
+
}
|
518 |
+
}
|
519 |
|
520 |
+
function fv_wp_flowplayer_license_check( $aArgs ) {
|
521 |
+
global $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver;
|
522 |
+
|
523 |
+
$args = array(
|
524 |
+
'body' => array( 'plugin' => 'fv-wordpress-flowplayer', 'version' => $fv_wp_flowplayer_ver, 'core_ver' => $fv_wp_flowplayer_core_ver, 'type' => home_url(), 'action' => $aArgs['action'], 'admin-url' => admin_url() ),
|
525 |
+
'timeout' => 10,
|
526 |
+
'user-agent' => 'fv-wordpress-flowplayer-'.$fv_wp_flowplayer_ver.' ('.$fv_wp_flowplayer_core_ver.')'
|
527 |
+
);
|
528 |
+
$resp = wp_remote_post( 'https://foliovision.com/?fv_remote=true', $args );
|
529 |
|
530 |
+
if( !is_wp_error($resp) && isset($resp['body']) && $resp['body'] && $data = json_decode( preg_replace( '~[\s\S]*?<FVFLOWPLAYER>(.*?)</FVFLOWPLAYER>[\s\S]*?~', '$1', $resp['body'] ) ) ) {
|
531 |
+
return $data;
|
532 |
+
|
533 |
+
} else if( is_wp_error($resp) && stripos($resp->get_error_message(),'SSL' ) !== false ) {
|
534 |
+
$args = array( 'sslverify' => false );
|
535 |
+
$resp = wp_remote_post( 'https://foliovision.com/?fv_remote=true', $args );
|
536 |
+
|
537 |
+
if( !is_wp_error($resp) && isset($resp['body']) && $resp['body'] && $data = json_decode( preg_replace( '~[\s\S]*?<FVFLOWPLAYER>(.*?)</FVFLOWPLAYER>[\s\S]*?~', '$1', $resp['body'] ) ) ) {
|
538 |
+
return $data;
|
539 |
+
}
|
540 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
}
|
542 |
+
|
543 |
+
return false;
|
544 |
}
|
545 |
|
546 |
+
function fv_wp_flowplayer_change_transient_expiration( $transient_name, $time ){
|
547 |
+
$transient_val = get_transient($transient_name);
|
548 |
+
if( $transient_val ){
|
549 |
+
set_transient($transient_name,$transient_val,$time);
|
550 |
+
return true;
|
551 |
+
}
|
552 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
}
|
554 |
|
555 |
|
|
|
|
|
|
|
556 |
|
|
|
|
|
557 |
|
558 |
+
add_action('wp_ajax_flowplayer_conversion_script', 'flowplayer_conversion_script');
|
559 |
|
560 |
+
function flowplayer_conversion_script() {
|
561 |
+
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
|
563 |
+
$posts = $wpdb->get_results("SELECT ID, post_content FROM {$wpdb->posts} WHERE post_type != 'revision'");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
|
565 |
+
$old_shorttag = '[flowplayer';
|
566 |
+
$new_shorttag = '[fvplayer';
|
567 |
+
$counter = 0;
|
568 |
+
|
569 |
+
echo '<ol>';
|
570 |
+
foreach($posts as $fv_post) {
|
571 |
+
if ( stripos( $fv_post->post_content, $old_shorttag ) !== false ) {
|
572 |
+
$update_post = array();
|
573 |
+
$update_post['ID'] = $fv_post->ID;
|
574 |
+
$update_post['post_content'] = str_replace( $old_shorttag, $new_shorttag, $fv_post->post_content );
|
575 |
+
wp_update_post( $update_post );
|
576 |
+
echo '<li><a href="' . get_permalink($fv_post->ID) . '">' . get_the_title($fv_post->ID) . '</a> updated</li>';
|
577 |
+
$counter++;
|
578 |
+
}
|
579 |
}
|
580 |
+
echo '</ol>';
|
581 |
+
|
582 |
+
echo '<strong>Conversion was succesful. Total number of converted posts: ' . $counter . '</strong>';
|
583 |
+
|
584 |
+
delete_option('fvwpflowplayer_conversion');
|
585 |
+
|
586 |
+
die();
|
587 |
}
|
588 |
|
589 |
|
|
|
|
|
590 |
|
591 |
+
|
592 |
+
add_action('admin_notices', 'fv_wp_flowplayer_admin_notice');
|
593 |
+
|
594 |
+
function fv_wp_flowplayer_admin_notice() {
|
595 |
+
if( $notices = get_option('fv_wordpress_flowplayer_deferred_notices') ) {
|
596 |
+
echo '<div class="updated inline">
|
597 |
+
<p>'.$notices.'</p>
|
598 |
+
</div>';
|
599 |
+
delete_option('fv_wordpress_flowplayer_deferred_notices');
|
600 |
+
}
|
601 |
+
|
602 |
+
$conversion = false; //(bool)get_option('fvwpflowplayer_conversion');
|
603 |
+
if ($conversion) {
|
604 |
+
echo '<div class="updated" id="fvwpflowplayer_conversion_notice"><p>';
|
605 |
+
printf(__('FV Player has found old shortcodes in the content of your posts. <a href="%1$s">Run the conversion script.</a>'), get_admin_url() . 'options-general.php?page=fvplayer');
|
606 |
+
echo "</p></div>";
|
607 |
+
}
|
608 |
+
|
609 |
+
if( isset($_GET['fv-licensing']) && $_GET['fv-licensing'] == "check" ){
|
610 |
+
echo '<div class="updated inline">
|
611 |
+
<p>Thank you for purchase. Your license will be renewed in couple of minutes.<br/>
|
612 |
+
Please make sure you upgrade <strong>FV Player Pro</strong> and <strong>FV Player VAST</strong> if you are using it.</p>
|
613 |
+
</div>';
|
614 |
}
|
615 |
+
|
616 |
+
global $FV_Player_Pro;
|
617 |
+
if( $FV_Player_Pro && version_compare($FV_Player_Pro->version,'0.5') == -1 ) :
|
618 |
+
?>
|
619 |
+
<div class="error">
|
620 |
+
<p><?php _e( 'FV Player: Your pro extension is installed, but it\'s not compatible with FV Player 6! Make sure you upgrade your FV Player Pro to version 0.5 or above.', 'my-text-domain' ); ?></p>
|
621 |
+
</div>
|
622 |
+
<?php
|
623 |
+
endif;
|
624 |
+
|
625 |
+
/*if( isset($_GET['page']) && $_GET['page'] == 'backend.php' ) {
|
626 |
+
$options = get_option( 'fvwpflowplayer' );
|
627 |
+
if( $options['key'] == 'false' ) {
|
628 |
+
echo '<div class="updated"><p>';
|
629 |
+
printf(__('Brand new version of Flowplayer for HTML5. <a href="http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer/buy">Licenses half price</a> in May.' ) );
|
630 |
+
echo "</p></div>";
|
631 |
+
}
|
632 |
+
}*/
|
633 |
}
|
634 |
|
635 |
|
636 |
+
|
637 |
+
|
638 |
+
|
639 |
+
|
640 |
+
|
641 |
/*
|
642 |
* Check the extension info from plugin license transient and activate the plugin
|
643 |
*/
|
653 |
$download_url = $aPluginInfo->{$plugin_package}->url;
|
654 |
|
655 |
$sPluginBasenameReal = fv_flowplayer_get_extension_path( str_replace( '_', '-', $plugin_package ) );
|
656 |
+
if( $sPluginBasenameReal ) {
|
657 |
+
return; // already installed
|
658 |
+
}
|
659 |
+
|
660 |
$plugin_basename = $sPluginBasenameReal ? $sPluginBasenameReal : $plugin_basename;
|
661 |
|
662 |
$url = wp_nonce_url( site_url().'/wp-admin/options-general.php?page=fvplayer', 'fv_player_pro_install', 'nonce_fv_player_pro_install' );
|
758 |
}
|
759 |
|
760 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
761 |
|
|
|
|
|
|
|
|
|
|
|
|
|
762 |
|
763 |
//search for plugin path with {slug}.php
|
764 |
function fv_flowplayer_get_extension_path( $slug ){
|
775 |
return $item;
|
776 |
}
|
777 |
|
778 |
+
$sPluginFolder = plugin_dir_path( dirname( dirname(__FILE__) ) );
|
779 |
foreach( $aInactivePlugins as $item ){
|
780 |
+
if( stripos($item,$slug.'.php') !== false && file_exists($sPluginFolder.$item) )
|
781 |
return $item;
|
782 |
}
|
783 |
|
810 |
|
811 |
|
812 |
|
813 |
+
function flowplayer_deactivate() {
|
814 |
+
if( flowplayer::is_licensed() ) {
|
815 |
+
delete_transient( 'fv_flowplayer_license' );
|
|
|
|
|
|
|
|
|
816 |
}
|
817 |
+
delete_option( 'fv_flowplayer_extension_install' );
|
818 |
+
wp_clear_scheduled_hook('fv_flowplayer_checker_event');
|
819 |
}
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
+
add_action( 'admin_notices', 'fv_player_admin_notice_expired_license' );
|
825 |
+
add_action( 'fv_player_settings_pre', 'fv_player_admin_notice_expired_license' );
|
826 |
+
|
827 |
+
function fv_player_admin_notice_expired_license() {
|
828 |
+
global $FV_Player_Pro;
|
829 |
+
$screen = get_current_screen();
|
830 |
+
if( ( $screen && $screen->id == 'plugins' || did_action('fv_player_settings_pre') ) && isset($FV_Player_Pro) && isset($FV_Player_Pro->version) && version_compare( str_replace( '.beta', '', $FV_Player_Pro->version), '0.8.17') == -1 ) {
|
831 |
+
$aCheck = get_transient( 'fv-player-pro_license' );
|
832 |
+
if( !empty($aCheck->expired) || !empty($aCheck->error) ) { ?>
|
833 |
+
<div class="updated">
|
834 |
+
<?php echo $aCheck->message; ?>
|
835 |
+
<?php if( !empty($aCheck->changelog) ) echo $aCheck->changelog; ?>
|
836 |
+
</div>
|
837 |
+
<?php }
|
838 |
+
}
|
839 |
}
|
controller/editor.php
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action( 'admin_enqueue_scripts', 'fv_player_shortcode_editor_scripts' );
|
4 |
+
|
5 |
+
function fv_player_shortcode_editor_scripts( $page ) {
|
6 |
+
if( $page !== 'post.php' && $page !== 'post-new.php' ) {
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
|
10 |
+
global $fv_wp_flowplayer_ver;
|
11 |
+
|
12 |
+
|
13 |
+
wp_register_script('fvwpflowplayer-domwindow', flowplayer::get_plugin_url().'/js/jquery.colorbox-min.js',array('jquery'), $fv_wp_flowplayer_ver );
|
14 |
+
wp_enqueue_script('fvwpflowplayer-domwindow');
|
15 |
+
|
16 |
+
wp_register_script('fvwpflowplayer-shortcode-editor', flowplayer::get_plugin_url().'/js/shortcode-editor.js',array('jquery'), $fv_wp_flowplayer_ver );
|
17 |
+
wp_register_script('fvwpflowplayer-shortcode-editor-old', flowplayer::get_plugin_url().'/js/shortcode-editor.old.js',array('jquery'), $fv_wp_flowplayer_ver );
|
18 |
+
|
19 |
+
global $fv_fp;
|
20 |
+
if( isset($fv_fp->conf["interface"]['shortcode_editor_old']) && $fv_fp->conf["interface"]['shortcode_editor_old'] == 'true' ) {
|
21 |
+
wp_enqueue_script('fvwpflowplayer-shortcode-editor-old');
|
22 |
+
} else {
|
23 |
+
wp_enqueue_script('fvwpflowplayer-shortcode-editor');
|
24 |
+
}
|
25 |
+
|
26 |
+
wp_register_style('fvwpflowplayer-domwindow-css', flowplayer::get_plugin_url().'/css/colorbox.css','','1.0','screen');
|
27 |
+
wp_enqueue_style('fvwpflowplayer-domwindow-css');
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
add_action('media_buttons', 'flowplayer_add_media_button', 10);
|
34 |
+
|
35 |
+
function flowplayer_add_media_button() {
|
36 |
+
if( stripos( $_SERVER['REQUEST_URI'], 'post.php' ) === FALSE && stripos( $_SERVER['REQUEST_URI'], 'post-new.php' ) === FALSE ) {
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
global $post;
|
41 |
+
$plugins = get_option('active_plugins');
|
42 |
+
$found = false;
|
43 |
+
foreach ( $plugins AS $plugin ) {
|
44 |
+
if( stripos($plugin,'foliopress-wysiwyg') !== FALSE )
|
45 |
+
$found = true;
|
46 |
+
}
|
47 |
+
$button_tip = 'Insert a video';
|
48 |
+
$wizard_url = 'media-upload.php?post_id='.$post->ID.'&type=fv-wp-flowplayer';
|
49 |
+
$icon = '<span> </span>';
|
50 |
+
|
51 |
+
echo '<a title="' . __('Add FV Player', 'fv-wordpress-flowplayer') . '" title="' . $button_tip . '" href="#" class="button fv-wordpress-flowplayer-button" >'.$icon.' Player</a>';
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
add_action('media_upload_fvplayer_video', '__return_false'); // keep for compatibility!
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
add_action( 'edit_form_after_editor', 'fv_wp_flowplayer_edit_form_after_editor' );
|
63 |
+
|
64 |
+
function fv_wp_flowplayer_edit_form_after_editor( ) {
|
65 |
+
global $fv_fp;
|
66 |
+
if( isset($fv_fp->conf["interface"]['shortcode_editor_old']) && $fv_fp->conf["interface"]['shortcode_editor_old'] == 'true' ) {
|
67 |
+
include dirname( __FILE__ ) . '/../view/wizard.old.php';
|
68 |
+
} else {
|
69 |
+
include dirname( __FILE__ ) . '/../view/wizard.php';
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
// allow .vtt subtitle files
|
74 |
+
add_filter( 'wp_check_filetype_and_ext', 'fv_flowplayer_filetypes', 10, 4 );
|
75 |
+
|
76 |
+
function fv_flowplayer_filetypes( $aFile ) {
|
77 |
+
$aArgs = func_get_args();
|
78 |
+
foreach( array( 'vtt', 'webm', 'ogg') AS $item ) {
|
79 |
+
if( isset($aArgs[2]) && preg_match( '~\.'.$item.'~', $aArgs[2] ) ) {
|
80 |
+
$aFile['type'] = $item;
|
81 |
+
$aFile['ext'] = $item;
|
82 |
+
$aFile['proper_filename'] = $aArgs[2];
|
83 |
+
}
|
84 |
+
}
|
85 |
+
return $aFile;
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
add_filter('admin_print_scripts', 'flowplayer_print_scripts');
|
92 |
+
|
93 |
+
function flowplayer_print_scripts() {
|
94 |
+
wp_enqueue_script('media-upload');
|
95 |
+
wp_enqueue_script('thickbox');
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
add_action('admin_print_styles', 'flowplayer_print_styles');
|
102 |
+
|
103 |
+
function flowplayer_print_styles() {
|
104 |
+
wp_enqueue_style('thickbox');
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
add_action( 'save_post', 'fv_wp_flowplayer_save_post' );
|
111 |
+
|
112 |
+
|
113 |
+
|
114 |
+
|
115 |
+
add_action( 'save_post', 'fv_wp_flowplayer_featured_image' , 10000 );
|
116 |
+
|
117 |
+
function fv_wp_flowplayer_featured_image($post_id) {
|
118 |
+
if( $parent_id = wp_is_post_revision($post_id) ) {
|
119 |
+
$post_id = $parent_id;
|
120 |
+
}
|
121 |
+
|
122 |
+
global $fv_fp;
|
123 |
+
if( !isset($fv_fp->conf['integrations']['featured_img']) || $fv_fp->conf['integrations']['featured_img'] != 'true' ){
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
$thumbnail_id = get_post_thumbnail_id($post_id);
|
128 |
+
if( $thumbnail_id != 0 ) {
|
129 |
+
return;
|
130 |
+
}
|
131 |
+
|
132 |
+
$post = get_post($post_id);
|
133 |
+
if( !$post || empty($post->post_content) ){
|
134 |
+
return;
|
135 |
+
}
|
136 |
+
|
137 |
+
$sThumbUrl = array();
|
138 |
+
if (!preg_match('/(?:splash=\\\?")([^"]*.(?:jpg|gif|png))/', $post->post_content, $sThumbUrl) || empty($sThumbUrl[1])) {
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
$thumbnail_id = fv_wp_flowplayer_save_to_media_library($sThumbUrl[1], $post_id);
|
143 |
+
if($thumbnail_id){
|
144 |
+
set_post_thumbnail($post_id, $thumbnail_id);
|
145 |
+
}
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
function fv_wp_flowplayer_construct_filename( $post_id ) {
|
150 |
+
$filename = get_the_title( $post_id );
|
151 |
+
$filename = sanitize_title( $filename, $post_id );
|
152 |
+
$filename = urldecode( $filename );
|
153 |
+
$filename = preg_replace( '/[^a-zA-Z0-9\-]/', '', $filename );
|
154 |
+
$filename = substr( $filename, 0, 32 );
|
155 |
+
$filename = trim( $filename, '-' );
|
156 |
+
if ( $filename == '' ) $filename = (string) $post_id;
|
157 |
+
return $filename;
|
158 |
+
}
|
159 |
+
|
160 |
+
function fv_wp_flowplayer_save_to_media_library( $image_url, $post_id ) {
|
161 |
+
|
162 |
+
$error = '';
|
163 |
+
$response = wp_remote_get( $image_url );
|
164 |
+
if( is_wp_error( $response ) ) {
|
165 |
+
$error = new WP_Error( 'thumbnail_retrieval', sprintf( __( 'Error retrieving a thumbnail from the URL <a href="%1$s">%1$s</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.', 'video-thumbnails' ), $image_url ) . '<br>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $response->get_error_message() );
|
166 |
+
} else {
|
167 |
+
$image_contents = $response['body'];
|
168 |
+
$image_type = wp_remote_retrieve_header( $response, 'content-type' );
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( $error != '' || $image_contents == '' ) {
|
172 |
+
return false;
|
173 |
+
} else {
|
174 |
+
|
175 |
+
// Translate MIME type into an extension
|
176 |
+
if ( $image_type == 'image/jpeg' ) {
|
177 |
+
$image_extension = '.jpg';
|
178 |
+
} elseif ( $image_type == 'image/png' ) {
|
179 |
+
$image_extension = '.png';
|
180 |
+
} elseif ( $image_type == 'image/gif' ) {
|
181 |
+
$image_extension = '.gif';
|
182 |
+
} else {
|
183 |
+
return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:', 'video-thumbnails' ) . ' ' . $image_type );
|
184 |
+
}
|
185 |
+
|
186 |
+
// Construct a file name with extension
|
187 |
+
$new_filename = fv_wp_flowplayer_construct_filename( $post_id ) . $image_extension;
|
188 |
+
|
189 |
+
// Save the image bits using the new filename
|
190 |
+
$upload = wp_upload_bits( $new_filename, null, $image_contents );
|
191 |
+
|
192 |
+
// Stop for any errors while saving the data or else continue adding the image to the media library
|
193 |
+
if ( $upload['error'] ) {
|
194 |
+
$error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:', 'video-thumbnails' ) . ' ' . $upload['error'] );
|
195 |
+
return $error;
|
196 |
+
} else {
|
197 |
+
|
198 |
+
$wp_filetype = wp_check_filetype( basename( $upload['file'] ), null );
|
199 |
+
|
200 |
+
$upload = apply_filters( 'wp_handle_upload', array(
|
201 |
+
'file' => $upload['file'],
|
202 |
+
'url' => $upload['url'],
|
203 |
+
'type' => $wp_filetype['type']
|
204 |
+
), 'sideload' );
|
205 |
+
|
206 |
+
// Contstruct the attachment array
|
207 |
+
$attachment = array(
|
208 |
+
'post_mime_type' => $upload['type'],
|
209 |
+
'post_title' => get_the_title( $post_id ),
|
210 |
+
'post_content' => '',
|
211 |
+
'post_status' => 'inherit'
|
212 |
+
);
|
213 |
+
// Insert the attachment
|
214 |
+
$attach_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
}
|
219 |
+
|
220 |
+
return $attach_id;
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
+
|
227 |
+
add_action('the_content', 'flowplayer_content_remove_commas');
|
controller/frontend.php
CHANGED
@@ -73,9 +73,11 @@ function fv_flowplayer_get_js_translations() {
|
|
73 |
'video_issues' =>__('Video Issues','fv-wordpress-flowplayer'),
|
74 |
'link_copied' =>__('Video Link Copied to Clipboard','fv-wordpress-flowplayer'),
|
75 |
'embed_copied' =>__('Embed Code Copied to Clipboard','fv-wordpress-flowplayer'),
|
|
|
|
|
76 |
'warning_iphone_subs' => __('This video has subtitles, that are not supported on your device.','fv-wordpress-flowplayer'),
|
77 |
-
'warning_unstable_android' => __('You are using an old Android device. If you experience issues with the video please use <a href="https://play.google.com/store/apps/details?id=org.mozilla.firefox">Firefox</a>.','fv-wordpress-flowplayer').$sWhy,
|
78 |
-
'warning_old_safari' => __('You are using an old Safari browser. If you experience issues with the video please use <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a> or other modern browser.','fv-wordpress-flowplayer').$sWhy,
|
79 |
);
|
80 |
|
81 |
return $aStrings;
|
@@ -313,6 +315,8 @@ function flowplayer_prepare_scripts() {
|
|
313 |
$aDependencies[] = 'jquery-ui-tabs';
|
314 |
}
|
315 |
|
|
|
|
|
316 |
wp_enqueue_script( 'flowplayer', flowplayer::get_plugin_url().'/flowplayer/fv-flowplayer.min.js', $aDependencies, $fv_wp_flowplayer_ver, true );
|
317 |
|
318 |
$sPluginUrl = preg_replace( '~^.*://~', '//', FV_FP_RELATIVE_PATH );
|
@@ -361,6 +365,17 @@ function flowplayer_prepare_scripts() {
|
|
361 |
if( $aConf['volume'] > 1 ) {
|
362 |
$aConf['volume'] = 1;
|
363 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_conf', $aConf );
|
365 |
if( current_user_can('manage_options') ) {
|
366 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_admin_input', array(true) );
|
@@ -372,11 +387,17 @@ function flowplayer_prepare_scripts() {
|
|
372 |
|
373 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_translations', fv_flowplayer_get_js_translations());
|
374 |
wp_localize_script( 'flowplayer', 'fv_fp_ajaxurl', site_url().'/wp-admin/admin-ajax.php' );
|
375 |
-
|
376 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_ad', $fv_fp->aAds );
|
378 |
}
|
379 |
-
if( count($fv_fp->aPopups) > 0 ) {
|
380 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_popup', $fv_fp->aPopups );
|
381 |
}
|
382 |
|
@@ -397,9 +418,11 @@ function flowplayer_prepare_scripts() {
|
|
397 |
}
|
398 |
|
399 |
global $FV_Player_lightbox;
|
400 |
-
if( $FV_Player_lightbox->bLoad ||
|
401 |
$aConf = array();
|
402 |
-
$aConf['lightbox_images'] =
|
|
|
|
|
403 |
|
404 |
wp_enqueue_script( 'fv_player_lightbox', flowplayer::get_plugin_url().'/js/lightbox.js', 'jquery', $fv_wp_flowplayer_ver, true );
|
405 |
wp_localize_script( 'fv_player_lightbox', 'fv_player_lightbox', $aConf );
|
73 |
'video_issues' =>__('Video Issues','fv-wordpress-flowplayer'),
|
74 |
'link_copied' =>__('Video Link Copied to Clipboard','fv-wordpress-flowplayer'),
|
75 |
'embed_copied' =>__('Embed Code Copied to Clipboard','fv-wordpress-flowplayer'),
|
76 |
+
'subtitles_disabled' =>__('Subtitles disabled','fv-wordpress-flowplayer'),
|
77 |
+
'subtitles_switched' =>__('Subtitles switched to ','fv-wordpress-flowplayer'),
|
78 |
'warning_iphone_subs' => __('This video has subtitles, that are not supported on your device.','fv-wordpress-flowplayer'),
|
79 |
+
'warning_unstable_android' => __('You are using an old Android device. If you experience issues with the video please use <a href="https://play.google.com/store/apps/details?id=org.mozilla.firefox">Firefox</a>.','fv-wordpress-flowplayer').$sWhy,
|
80 |
+
'warning_old_safari' => __('You are using an old Safari browser. If you experience issues with the video please use <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a> or other modern browser.','fv-wordpress-flowplayer').$sWhy,
|
81 |
);
|
82 |
|
83 |
return $aStrings;
|
315 |
$aDependencies[] = 'jquery-ui-tabs';
|
316 |
}
|
317 |
|
318 |
+
if( !$fv_fp->bCSSLoaded ) $fv_fp->css_enqueue(true);
|
319 |
+
|
320 |
wp_enqueue_script( 'flowplayer', flowplayer::get_plugin_url().'/flowplayer/fv-flowplayer.min.js', $aDependencies, $fv_wp_flowplayer_ver, true );
|
321 |
|
322 |
$sPluginUrl = preg_replace( '~^.*://~', '//', FV_FP_RELATIVE_PATH );
|
365 |
if( $aConf['volume'] > 1 ) {
|
366 |
$aConf['volume'] = 1;
|
367 |
}
|
368 |
+
|
369 |
+
$aConf['mobile_native_fullscreen'] = $fv_fp->_get_option('mobile_native_fullscreen');
|
370 |
+
$aConf['mobile_force_fullscreen'] = $fv_fp->_get_option('mobile_force_fullscreen');
|
371 |
+
|
372 |
+
global $post;
|
373 |
+
if( $post && isset($post->ID) && $post->ID > 0 ) {
|
374 |
+
if( get_post_meta($post->ID, 'fv_player_mobile_native_fullscreen', true) ) $aConf['mobile_native_fullscreen'] = true;
|
375 |
+
if( get_post_meta($post->ID, 'fv_player_mobile_force_fullscreen', true) ) $aConf['mobile_force_fullscreen'] = true;
|
376 |
+
}
|
377 |
+
|
378 |
+
|
379 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_conf', $aConf );
|
380 |
if( current_user_can('manage_options') ) {
|
381 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_admin_input', array(true) );
|
387 |
|
388 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_translations', fv_flowplayer_get_js_translations());
|
389 |
wp_localize_script( 'flowplayer', 'fv_fp_ajaxurl', site_url().'/wp-admin/admin-ajax.php' );
|
390 |
+
|
391 |
+
if( $fv_fp->_get_option('old_code') ) {
|
392 |
+
wp_localize_script( 'flowplayer', 'fv_flowplayer_playlists', $fv_fp->aPlaylists );
|
393 |
+
} else {
|
394 |
+
wp_localize_script( 'flowplayer', 'fv_flowplayer_playlists', array() ); // has to be defined for FV Player Pro 0.6.20 and such
|
395 |
+
}
|
396 |
+
|
397 |
+
if( count($fv_fp->aAds) > 0 ) { // todo: move into player
|
398 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_ad', $fv_fp->aAds );
|
399 |
}
|
400 |
+
if( count($fv_fp->aPopups) > 0 ) { // todo: move into player
|
401 |
wp_localize_script( 'flowplayer', 'fv_flowplayer_popup', $fv_fp->aPopups );
|
402 |
}
|
403 |
|
418 |
}
|
419 |
|
420 |
global $FV_Player_lightbox;
|
421 |
+
if( $FV_Player_lightbox->bLoad || $fv_fp->_get_option('lightbox_images') || $fv_fp->_get_option('js-everywhere') ) {
|
422 |
$aConf = array();
|
423 |
+
$aConf['lightbox_images'] = $fv_fp->_get_option('lightbox_images');
|
424 |
+
|
425 |
+
if( !$FV_Player_lightbox->bCSSLoaded ) $FV_Player_lightbox->css_enqueue(true);
|
426 |
|
427 |
wp_enqueue_script( 'fv_player_lightbox', flowplayer::get_plugin_url().'/js/lightbox.js', 'jquery', $fv_wp_flowplayer_ver, true );
|
428 |
wp_localize_script( 'fv_player_lightbox', 'fv_player_lightbox', $aConf );
|
controller/settings.php
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Admin menus and such...
|
5 |
+
*/
|
6 |
+
add_action('admin_menu', 'fv_player_admin_menu');
|
7 |
+
|
8 |
+
function fv_player_admin_menu () {
|
9 |
+
if( function_exists('add_submenu_page') ) {
|
10 |
+
add_options_page( 'FV Player', 'FV Player', 'manage_options', 'fvplayer', 'fv_player_admin_page' );
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
function fv_player_admin_page() {
|
18 |
+
global $fv_fp;
|
19 |
+
include dirname( __FILE__ ) . '/../view/admin.php';
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
add_filter('plugin_action_links', 'fv_wp_flowplayer_plugin_action_links', 10, 2);
|
26 |
+
|
27 |
+
function fv_wp_flowplayer_plugin_action_links($links, $file) {
|
28 |
+
if( $file == 'fv-wordpress-flowplayer/flowplayer.php') {
|
29 |
+
$settings_link = '<a href="https://foliovision.com/pro-support" target="_blank">Premium Support</a>';
|
30 |
+
array_unshift($links, $settings_link);
|
31 |
+
$settings_link = '<a href="options-general.php?page=fvplayer">Settings</a>';
|
32 |
+
array_unshift($links, $settings_link);
|
33 |
+
}
|
34 |
+
return $links;
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
add_action( 'after_plugin_row', 'fv_wp_flowplayer_after_plugin_row', 10, 3 );
|
41 |
+
|
42 |
+
function fv_wp_flowplayer_after_plugin_row( $arg) {
|
43 |
+
if( apply_filters('fv_player_skip_ads',false) ) {
|
44 |
+
return;
|
45 |
+
}
|
46 |
+
|
47 |
+
$args = func_get_args();
|
48 |
+
|
49 |
+
if( $args[1]['Name'] == 'FV Wordpress Flowplayer' ) {
|
50 |
+
$options = get_option( 'fvwpflowplayer' );
|
51 |
+
if( $options['key'] == 'false' || $options['key'] == '' ) :
|
52 |
+
?>
|
53 |
+
<tr class="plugin-update-tr fv-wordpress-flowplayer-tr">
|
54 |
+
<td class="plugin-update colspanchange" colspan="3">
|
55 |
+
<div class="update-message">
|
56 |
+
<a href="http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer/download">All Licenses 20% Off</a> - Easter sale!
|
57 |
+
</div>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<?php
|
61 |
+
endif;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
add_filter( 'get_user_option_closedpostboxes_fv_flowplayer_settings', 'fv_wp_flowplayer_closed_meta_boxes' );
|
69 |
+
|
70 |
+
function fv_wp_flowplayer_closed_meta_boxes( $closed ) {
|
71 |
+
if ( false === $closed )
|
72 |
+
$closed = array( 'fv_flowplayer_amazon_options', 'fv_flowplayer_interface_options', 'fv_flowplayer_default_options', 'fv_flowplayer_ads', 'fv_flowplayer_integrations', 'fv_player_pro' );
|
73 |
+
|
74 |
+
return $closed;
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
/*
|
81 |
+
* Saving settings
|
82 |
+
*/
|
83 |
+
add_action('admin_init', 'fv_player_settings_save', 9);
|
84 |
+
|
85 |
+
function fv_player_settings_save() {
|
86 |
+
// Trick media uploader to show video only, while making sure we use our custom type; Also save options
|
87 |
+
if( isset($_GET['type']) ) {
|
88 |
+
if( $_GET['type'] == 'fvplayer_video' || $_GET['type'] == 'fvplayer_video_1' || $_GET['type'] == 'fvplayer_video_2' || $_GET['type'] == 'fvplayer_mobile' ) {
|
89 |
+
$_GET['post_mime_type'] = 'video';
|
90 |
+
}
|
91 |
+
else if( $_GET['type'] == 'fvplayer_splash' || $_GET['type'] == 'fvplayer_logo' ) {
|
92 |
+
$_GET['post_mime_type'] = 'image';
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
if( isset($_POST['fv-wp-flowplayer-submit']) ) {
|
97 |
+
check_admin_referer('fv_flowplayer_settings_nonce','fv_flowplayer_settings_nonce');
|
98 |
+
|
99 |
+
global $fv_fp;
|
100 |
+
if( method_exists($fv_fp,'_set_conf') ) {
|
101 |
+
$fv_fp->_set_conf();
|
102 |
+
} else {
|
103 |
+
echo 'Error saving FV Flowplayer options.';
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
/*
|
112 |
+
* Pointer boxes
|
113 |
+
*/
|
114 |
+
add_action('admin_init', 'fv_player_admin_pointer_boxes');
|
115 |
+
|
116 |
+
function fv_player_admin_pointer_boxes() {
|
117 |
+
global $fv_fp;
|
118 |
+
global $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver;
|
119 |
+
|
120 |
+
if(
|
121 |
+
isset($fv_fp->conf['disable_videochecker']) && $fv_fp->conf['disable_videochecker'] == 'false' &&
|
122 |
+
( !isset($fv_fp->conf['video_checker_agreement']) || $fv_fp->conf['video_checker_agreement'] != 'true' )
|
123 |
+
) {
|
124 |
+
$fv_fp->pointer_boxes['fv_flowplayer_video_checker_service'] = array(
|
125 |
+
'id' => '#wp-admin-bar-new-content',
|
126 |
+
'pointerClass' => 'fv_flowplayer_video_checker_service',
|
127 |
+
'heading' => __('FV Player Video Checker', 'fv-wordpress-flowplayer'),
|
128 |
+
'content' => __("<p>FV Player includes a free video checker which will check your videos for any encoding errors and helps ensure smooth playback of all your videos. To work its magic, our video checker must contact our server.</p><p>Would you like to enable the video encoding checker?</p>", 'fv-wordpress-flowplayer'),
|
129 |
+
'position' => array( 'edge' => 'top', 'align' => 'center' ),
|
130 |
+
'button1' => __('Allow', 'fv-wordpress-flowplayer'),
|
131 |
+
'button2' => __('Disable the video checker', 'fv-wordpress-flowplayer')
|
132 |
+
);
|
133 |
+
}
|
134 |
+
|
135 |
+
if(
|
136 |
+
(stripos( $_SERVER['REQUEST_URI'], '/plugins.php') !== false || ( isset($_GET['page']) && $_GET['page'] === 'fvplayer' ) )
|
137 |
+
&& $pnotices = get_option('fv_wordpress_flowplayer_persistent_notices')
|
138 |
+
) {
|
139 |
+
$fv_fp->pointer_boxes['fv_flowplayer_license_expired'] = array(
|
140 |
+
'id' => '#wp-admin-bar-new-content',
|
141 |
+
'pointerClass' => 'fv_flowplayer_license_expired',
|
142 |
+
'pointerWidth' => 340,
|
143 |
+
'heading' => __('FV Flowplayer License Expired', 'fv-wordpress-flowplayer'),
|
144 |
+
'content' => __( $pnotices ),
|
145 |
+
'position' => array( 'edge' => 'top', 'align' => 'center' ),
|
146 |
+
'button1' => __('Hide this notice', 'fv-wordpress-flowplayer'),
|
147 |
+
'button2' => __('I\'ll check this later', 'fv-wordpress-flowplayer')
|
148 |
+
);
|
149 |
+
}
|
150 |
+
|
151 |
+
if( !$fv_fp->_get_option('disable_video_hash_links') && !$fv_fp->_get_option('notification_video_links') ) {
|
152 |
+
$fv_fp->pointer_boxes['fv_player_notification_video_links'] = array(
|
153 |
+
'id' => '#wp-admin-bar-new-content',
|
154 |
+
'pointerClass' => 'fv_player_notification_video_links',
|
155 |
+
'heading' => __('FV Player Video Links', 'fv-wordpress-flowplayer'),
|
156 |
+
'content' => $fv_fp->_get_option('disableembedding') ? __("<p>Now you can enable Video Links to allow people to share exact location in your videos. Clicking that link gives them a link to play that video at the exact time.</p>", 'fv-wordpress-flowplayer') : __("<p>Each video player now contains a link in the top bar. Clicking that link gives your visitors a link to play that video at the exact time where they are watching it.</p>", 'fv-wordpress-flowplayer'),
|
157 |
+
'position' => array( 'edge' => 'top', 'align' => 'center' ),
|
158 |
+
'button1' => __('Open Settings', 'fv-wordpress-flowplayer'),
|
159 |
+
'button2' => __('Dismiss', 'fv-wordpress-flowplayer')
|
160 |
+
);
|
161 |
+
|
162 |
+
add_action( 'admin_print_footer_scripts', 'fv_player_pointer_scripts' );
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
add_action( 'wp_ajax_fv_foliopress_ajax_pointers', 'fv_wp_flowplayer_pointers_ajax' );
|
170 |
+
|
171 |
+
function fv_wp_flowplayer_pointers_ajax() {
|
172 |
+
if( isset($_POST['key']) && $_POST['key'] == 'fv_flowplayer_video_checker_service' && isset($_POST['value']) ) {
|
173 |
+
check_ajax_referer('fv_flowplayer_video_checker_service');
|
174 |
+
$conf = get_option( 'fvwpflowplayer' );
|
175 |
+
if( $conf ) {
|
176 |
+
if( $_POST['value'] == 'true' ) {
|
177 |
+
$conf['disable_videochecker'] = 'false';
|
178 |
+
$conf['video_checker_agreement'] = 'true';
|
179 |
+
} else {
|
180 |
+
$conf['disable_videochecker'] = 'true';
|
181 |
+
}
|
182 |
+
update_option( 'fvwpflowplayer', $conf );
|
183 |
+
}
|
184 |
+
die();
|
185 |
+
}
|
186 |
+
|
187 |
+
if( isset($_POST['key']) && $_POST['key'] == 'fv_player_notification_video_links' && isset($_POST['value']) ) {
|
188 |
+
check_ajax_referer('fv_player_notification_video_links');
|
189 |
+
$conf = get_option( 'fvwpflowplayer' );
|
190 |
+
if( $conf ) {
|
191 |
+
$conf['notification_video_links'] = 'true';
|
192 |
+
update_option( 'fvwpflowplayer', $conf );
|
193 |
+
}
|
194 |
+
die();
|
195 |
+
}
|
196 |
+
|
197 |
+
if( isset($_POST['key']) && $_POST['key'] == 'fv_flowplayer_license_expired' && isset($_POST['value']) && $_POST['value'] === 'true' ) {
|
198 |
+
check_ajax_referer('fv_flowplayer_license_expired');
|
199 |
+
delete_option("fv_wordpress_flowplayer_persistent_notices");
|
200 |
+
die();
|
201 |
+
}
|
202 |
+
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
|
208 |
+
function fv_player_pointer_scripts() {
|
209 |
+
?>
|
210 |
+
<script>
|
211 |
+
(function ($) {
|
212 |
+
$(document).on('click', '.fv_player_notification_video_links .button-primary', function(e) {
|
213 |
+
$(document).ajaxComplete( function() {
|
214 |
+
window.location = '<?php echo site_url('wp-admin/options-general.php?page=fvplayer'); ?>#playlist_advance';
|
215 |
+
});
|
216 |
+
});
|
217 |
+
})(jQuery);
|
218 |
+
</script>
|
219 |
+
<?php
|
220 |
+
}
|
221 |
+
|
222 |
+
|
223 |
+
|
224 |
+
|
225 |
+
/*
|
226 |
+
* Making sure FV Player appears properly on settings screen
|
227 |
+
*/
|
228 |
+
add_action('admin_enqueue_scripts', 'fv_flowplayer_admin_scripts');
|
229 |
+
|
230 |
+
function fv_flowplayer_admin_scripts() {
|
231 |
+
global $fv_wp_flowplayer_ver;
|
232 |
+
if (isset($_GET['page']) && $_GET['page'] == 'fvplayer') {
|
233 |
+
wp_enqueue_media();
|
234 |
+
|
235 |
+
wp_enqueue_script('common');
|
236 |
+
wp_enqueue_script('wp-lists');
|
237 |
+
wp_enqueue_script('postbox');
|
238 |
+
|
239 |
+
wp_register_script('fv-player-admin', flowplayer::get_plugin_url().'/js/admin.js',array('jquery'), $fv_wp_flowplayer_ver );
|
240 |
+
wp_enqueue_script('fv-player-admin');
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
|
246 |
+
|
247 |
+
add_action('admin_head', 'flowplayer_admin_head');
|
248 |
+
|
249 |
+
function flowplayer_admin_head() {
|
250 |
+
|
251 |
+
if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
|
252 |
+
return;
|
253 |
+
}
|
254 |
+
|
255 |
+
global $fv_wp_flowplayer_ver;
|
256 |
+
?>
|
257 |
+
<script type="text/javascript" src="<?php echo FV_FP_RELATIVE_PATH; ?>/js/jscolor/jscolor.js"></script>
|
258 |
+
<link rel="stylesheet" type="text/css" href="<?php echo flowplayer::get_plugin_url().'/css/license.css'; ?>?ver=<?php echo $fv_wp_flowplayer_ver; ?>" />
|
259 |
+
|
260 |
+
<script>
|
261 |
+
jQuery(window).on('unload', function(){
|
262 |
+
window.fv_flowplayer_wp = window.wp;
|
263 |
+
});
|
264 |
+
</script>
|
265 |
+
<?php
|
266 |
+
}
|
267 |
+
|
268 |
+
|
269 |
+
|
270 |
+
|
271 |
+
add_action('admin_footer', 'flowplayer_admin_footer');
|
272 |
+
|
273 |
+
function flowplayer_admin_footer() {
|
274 |
+
if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
|
275 |
+
return;
|
276 |
+
}
|
277 |
+
|
278 |
+
flowplayer_prepare_scripts();
|
279 |
+
}
|
280 |
+
|
281 |
+
|
282 |
+
|
283 |
+
|
284 |
+
add_action('admin_print_footer_scripts', 'flowplayer_admin_footer_wp_js_restore', 999999 );
|
285 |
+
|
286 |
+
function flowplayer_admin_footer_wp_js_restore() {
|
287 |
+
if( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) {
|
288 |
+
return;
|
289 |
+
}
|
290 |
+
|
291 |
+
?>
|
292 |
+
<script>
|
293 |
+
jQuery(window).on('unload', function(){
|
294 |
+
window.wp = window.fv_flowplayer_wp;
|
295 |
+
});
|
296 |
+
</script>
|
297 |
+
<?php
|
298 |
+
}
|
css/flowplayer.css
CHANGED
@@ -553,7 +553,7 @@ a #add-format, a #add-rtmp {
|
|
553 |
.flowplayer.is-poster .wpfp_custom_ad { display: none; }
|
554 |
|
555 |
.fv_fp_close { position: absolute; right: 2px; top: 2px; z-index: 20; }
|
556 |
-
.fv_fp_close a { display: block; width: 16px; height: 16px; background: url(img/exit_btn.png) }
|
557 |
|
558 |
.wpfp_custom_ad_content h1, .wpfp_custom_ad_content h2, .wpfp_custom_ad_content h3, .wpfp_custom_ad_content h4, .wpfp_custom_ad_content h5, .wpfp_custom_ad_content p { padding: 0 5px 2px 5px; margin: 0 5px 2px 5px; }
|
559 |
|
@@ -732,175 +732,6 @@ article .entry-content .fvfp_admin_error p { line-height: 18px; }
|
|
732 |
.fv_flowplayer_tabs .ui-tabs .ui-tabs-nav li i.dur {display: none; }
|
733 |
|
734 |
|
735 |
-
|
736 |
-
|
737 |
-
/*
|
738 |
-
* FV Player Lightbox
|
739 |
-
*/
|
740 |
-
|
741 |
-
/*
|
742 |
-
Colorbox Core Style:
|
743 |
-
The following CSS is consistent between example themes and should not be altered.
|
744 |
-
*/
|
745 |
-
#colorbox, #fv_player_pro_boxOverlay, #fv_player_pro_boxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
|
746 |
-
#fv_player_pro_boxWrapper {max-width:none;background:#fff;}
|
747 |
-
#fv_player_pro_boxOverlay{position:fixed; width:100%; height:100%;}
|
748 |
-
#fv_player_pro_boxMiddleLeft, #fv_player_pro_boxBottomLeft{clear:left;}
|
749 |
-
#fv_player_pro_boxContent{position:relative;}
|
750 |
-
#fv_player_pro_boxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
|
751 |
-
#fv_player_pro_boxTitle{margin:0;}
|
752 |
-
#fv_player_pro_boxLoadingOverlay, #fv_player_pro_boxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
753 |
-
#fv_player_pro_boxPrevious, #fv_player_pro_boxNext, #fv_player_pro_boxClose, #fv_player_pro_boxSlideshow{cursor:pointer;}
|
754 |
-
.fv_player_pro_boxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
|
755 |
-
.fv_player_pro_boxIframe{width:100%; height:100%; display:block; border:0;}
|
756 |
-
#colorbox, #fv_player_pro_boxContent, #fv_player_pro_boxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
|
757 |
-
|
758 |
-
/*
|
759 |
-
User Style:
|
760 |
-
Change the following styles to modify the appearance of Colorbox. They are
|
761 |
-
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
762 |
-
*/
|
763 |
-
#fv_player_pro_boxOverlay{background:#000;}
|
764 |
-
#colorbox{outline:0;}
|
765 |
-
#fv_player_pro_boxTopLeft{width:14px; height:14px; background:url(img/controls.png) no-repeat 0 0;}
|
766 |
-
#fv_player_pro_boxTopCenter{height:14px;}
|
767 |
-
#fv_player_pro_boxTopRight{width:14px; height:14px; background:url(img/controls.png) no-repeat -36px 0;}
|
768 |
-
#fv_player_pro_boxBottomLeft{width:14px; height:43px; background:url(img/controls.png) no-repeat 0 -32px;}
|
769 |
-
#fv_player_pro_boxBottomCenter{height:43px;}
|
770 |
-
#fv_player_pro_boxBottomRight{width:14px; height:43px; background:url(img/controls.png) no-repeat -36px -32px;}
|
771 |
-
#fv_player_pro_boxMiddleLeft{width:14px; background:url(img/controls.png) repeat-y -175px 0;}
|
772 |
-
#fv_player_pro_boxMiddleRight{width:14px; background:url(img/controls.png) repeat-y -211px 0;}
|
773 |
-
#fv_player_pro_boxContent{background:#fff; overflow:visible;}
|
774 |
-
.fv_player_pro_boxIframe{background:#fff;}
|
775 |
-
#fv_player_pro_boxError{padding:50px; border:1px solid #ccc;}
|
776 |
-
#fv_player_pro_boxLoadedContent{margin-bottom:5px;}
|
777 |
-
|
778 |
-
#fv_player_pro_boxLoadingGraphic{background:url(img/loading.gif) no-repeat center center;}
|
779 |
-
#fv_player_pro_boxTitle{position:absolute; bottom:-25px; left:0; text-align:center; width:100%; font-weight:bold; color:#7C7C7C;}
|
780 |
-
#fv_player_pro_boxCurrent{position:absolute; bottom:-25px; left:58px; font-weight:bold; color:#7C7C7C;}
|
781 |
-
|
782 |
-
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
783 |
-
#fv_player_pro_boxPrevious, #fv_player_pro_boxNext, #fv_player_pro_boxSlideshow, #fv_player_pro_boxClose {border:0; padding:0; margin:0; overflow:visible; position:absolute; bottom:-29px; background:url(img/controls.png) no-repeat 0px 0px; width:23px; height:23px; text-indent:-9999px;box-shadow:none;-webkit-box-shadow:none;-webkit-appearance:none;}
|
784 |
-
|
785 |
-
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
786 |
-
#fv_player_pro_boxPrevious:active, #fv_player_pro_boxNext:active, #fv_player_pro_boxSlideshow:active, #fv_player_pro_boxClose:active {outline:0;}
|
787 |
-
|
788 |
-
#fv_player_pro_boxPrevious{left:0px; background-position: -51px -25px;}
|
789 |
-
#fv_player_pro_boxPrevious:hover{background-position:-51px 0px;}
|
790 |
-
#fv_player_pro_boxNext{left:27px; background-position:-75px -25px;}
|
791 |
-
#fv_player_pro_boxNext:hover{background-position:-75px 0px;}
|
792 |
-
#fv_player_pro_boxClose{right:0; background-position:-100px -25px;}
|
793 |
-
#fv_player_pro_boxClose:hover{background-position:-100px 0px;}
|
794 |
-
|
795 |
-
.fv_player_pro_boxSlideshow_on #fv_player_pro_boxSlideshow{background-position:-125px 0px; right:27px;}
|
796 |
-
.fv_player_pro_boxSlideshow_on #fv_player_pro_boxSlideshow:hover{background-position:-150px 0px;}
|
797 |
-
.fv_player_pro_boxSlideshow_off #fv_player_pro_boxSlideshow{background-position:-150px -25px; right:27px;}
|
798 |
-
.fv_player_pro_boxSlideshow_off #fv_player_pro_boxSlideshow:hover{background-position:-125px 0px;}
|
799 |
-
|
800 |
-
/* Lightbox Styling */
|
801 |
-
|
802 |
-
|
803 |
-
#fv_player_pro_boxMiddleLeft,
|
804 |
-
#fv_player_pro_boxMiddleRight,
|
805 |
-
#fv_player_pro_boxTopLeft,
|
806 |
-
#fv_player_pro_boxTopCenter,
|
807 |
-
#fv_player_pro_boxTopRight,
|
808 |
-
#fv_player_pro_boxBottomLeft,
|
809 |
-
#fv_player_pro_boxBottomRight,
|
810 |
-
#fv_player_pro_boxBottomCenter {
|
811 |
-
background: #fff;
|
812 |
-
}
|
813 |
-
|
814 |
-
#fv_player_pro_boxSlideshow,
|
815 |
-
#fv_player_pro_boxClose {
|
816 |
-
background-image: url("img/controls.png");
|
817 |
-
background-repeat: no-repeat;
|
818 |
-
}
|
819 |
-
|
820 |
-
#fv_player_pro_boxClose {
|
821 |
-
background-image: url("img/closelabel.png");
|
822 |
-
background-position: center center;
|
823 |
-
width: 66px;
|
824 |
-
}
|
825 |
-
|
826 |
-
#fv_player_pro_boxClose:hover {
|
827 |
-
background-position: center center;
|
828 |
-
}
|
829 |
-
|
830 |
-
#fv_player_pro_boxMiddleLeft,
|
831 |
-
#fv_player_pro_boxMiddleRight,
|
832 |
-
#fv_player_pro_boxTopLeft,
|
833 |
-
#fv_player_pro_boxTopRight,
|
834 |
-
#fv_player_pro_boxBottomLeft,
|
835 |
-
#fv_player_pro_boxBottomRight {
|
836 |
-
width: 10px;
|
837 |
-
}
|
838 |
-
|
839 |
-
#fv_player_pro_boxTopCenter,
|
840 |
-
#fv_player_pro_boxTopLeft,
|
841 |
-
#fv_player_pro_boxTopRight {
|
842 |
-
height: 10px;
|
843 |
-
}
|
844 |
-
|
845 |
-
#fv_player_pro_boxBottomLeft,
|
846 |
-
#fv_player_pro_boxBottomRight,
|
847 |
-
#fv_player_pro_boxBottomCenter {
|
848 |
-
height: 38px;
|
849 |
-
}
|
850 |
-
|
851 |
-
#fv_player_pro_boxTitle,
|
852 |
-
#fv_player_pro_boxCurrent {
|
853 |
-
font-weight: normal;
|
854 |
-
}
|
855 |
-
|
856 |
-
#fv_player_pro_boxLoadedContent {
|
857 |
-
position: relative;
|
858 |
-
display: inline-block;
|
859 |
-
z-index: 99998;
|
860 |
-
}
|
861 |
-
|
862 |
-
#fv_player_pro_boxCurrent {
|
863 |
-
left: 0;
|
864 |
-
}
|
865 |
-
|
866 |
-
#fv_player_pro_boxPrevious,
|
867 |
-
#fv_player_pro_boxNext {
|
868 |
-
background: none;
|
869 |
-
width: 15%;
|
870 |
-
height: auto;
|
871 |
-
top: 30px;
|
872 |
-
bottom: 80px;
|
873 |
-
display: block;
|
874 |
-
z-index: 99999;
|
875 |
-
}
|
876 |
-
|
877 |
-
#fv_player_pro_boxPrevious {
|
878 |
-
left: 0;
|
879 |
-
background: url("img/prevlabel.gif") no-repeat -999em center;
|
880 |
-
}
|
881 |
-
|
882 |
-
#fv_player_pro_boxNext {
|
883 |
-
right: -1px;
|
884 |
-
left: 85%;
|
885 |
-
background: url("img/nextlabel.gif") no-repeat 999em center;
|
886 |
-
}
|
887 |
-
|
888 |
-
#fv_player_pro_boxPrevious:hover {
|
889 |
-
background-position: -4px center;
|
890 |
-
}
|
891 |
-
|
892 |
-
#fv_player_pro_boxNext:hover {
|
893 |
-
background-position: right center;
|
894 |
-
}
|
895 |
-
|
896 |
-
@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 2dppx){
|
897 |
-
#fv_player_pro_colorbox #fv_player_pro_boxClose {
|
898 |
-
background-image: url("img/closelabel-x2.png");
|
899 |
-
background-size: 100%;
|
900 |
-
}
|
901 |
-
}
|
902 |
-
|
903 |
-
|
904 |
.flowplayer {
|
905 |
-webkit-touch-callout: none;
|
906 |
-webkit-user-select: none;
|
@@ -949,3 +780,7 @@ article .entry-content .fvfp_admin_error p { line-height: 18px; }
|
|
949 |
|
950 |
|
951 |
.fvfp-notice { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #fff; text-shadow: 0 0 1px #000;}
|
|
|
|
|
|
|
|
553 |
.flowplayer.is-poster .wpfp_custom_ad { display: none; }
|
554 |
|
555 |
.fv_fp_close { position: absolute; right: 2px; top: 2px; z-index: 20; }
|
556 |
+
.fv_fp_close a { display: block; width: 16px; height: 16px; background: url(img/exit_btn.png) no-repeat; background-size: 16px 16px; }
|
557 |
|
558 |
.wpfp_custom_ad_content h1, .wpfp_custom_ad_content h2, .wpfp_custom_ad_content h3, .wpfp_custom_ad_content h4, .wpfp_custom_ad_content h5, .wpfp_custom_ad_content p { padding: 0 5px 2px 5px; margin: 0 5px 2px 5px; }
|
559 |
|
732 |
.fv_flowplayer_tabs .ui-tabs .ui-tabs-nav li i.dur {display: none; }
|
733 |
|
734 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
735 |
.flowplayer {
|
736 |
-webkit-touch-callout: none;
|
737 |
-webkit-user-select: none;
|
780 |
|
781 |
|
782 |
.fvfp-notice { position: absolute; top: 10%; z-index: 20; text-align: center; width: 100%; color: #fff; text-shadow: 0 0 1px #000;}
|
783 |
+
|
784 |
+
@media (max-width: 40em){
|
785 |
+
.fv_fp_close a { width: 24px; height: 24px; background-size: 24px 24px; }
|
786 |
+
}
|
css/img/closelabel-x2.png
CHANGED
Binary file
|
css/img/closelabel.png
CHANGED
Binary file
|
css/img/controls.png
CHANGED
Binary file
|
css/img/exit_btn-x2.png
ADDED
Binary file
|
css/img/exit_btn.png
CHANGED
Binary file
|
css/img/flp-share-icons-x2.png
CHANGED
Binary file
|
css/img/flp-share-icons.png
CHANGED
Binary file
|
css/img/loading.gif
CHANGED
Binary file
|
css/img/media-button.png
CHANGED
Binary file
|
css/img/no_play_white-x2.png
CHANGED
Binary file
|
css/img/no_play_white.png
CHANGED
Binary file
|
css/img/play_white-x2.png
CHANGED
Binary file
|
css/img/play_white.png
CHANGED
Binary file
|
css/img/techinfo.png
CHANGED
Binary file
|
css/img/uploader-icons.png
CHANGED
Binary file
|
css/lightbox.css
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* FV Player Lightbox
|
3 |
+
*/
|
4 |
+
|
5 |
+
/*
|
6 |
+
Colorbox Core Style:
|
7 |
+
The following CSS is consistent between example themes and should not be altered.
|
8 |
+
*/
|
9 |
+
#colorbox, #fv_player_pro_boxOverlay, #fv_player_pro_boxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
|
10 |
+
#fv_player_pro_boxWrapper {max-width:none;background:#fff;}
|
11 |
+
#fv_player_pro_boxOverlay{position:fixed; width:100%; height:100%;}
|
12 |
+
#fv_player_pro_boxMiddleLeft, #fv_player_pro_boxBottomLeft{clear:left;}
|
13 |
+
#fv_player_pro_boxContent{position:relative;}
|
14 |
+
#fv_player_pro_boxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
|
15 |
+
#fv_player_pro_boxTitle{margin:0;}
|
16 |
+
#fv_player_pro_boxLoadingOverlay, #fv_player_pro_boxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
17 |
+
#fv_player_pro_boxPrevious, #fv_player_pro_boxNext, #fv_player_pro_boxClose, #fv_player_pro_boxSlideshow{cursor:pointer;}
|
18 |
+
.fv_player_pro_boxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
|
19 |
+
.fv_player_pro_boxIframe{width:100%; height:100%; display:block; border:0;}
|
20 |
+
#colorbox, #fv_player_pro_boxContent, #fv_player_pro_boxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
|
21 |
+
|
22 |
+
/*
|
23 |
+
User Style:
|
24 |
+
Change the following styles to modify the appearance of Colorbox. They are
|
25 |
+
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
26 |
+
*/
|
27 |
+
#fv_player_pro_boxOverlay{background:#000;}
|
28 |
+
#colorbox{outline:0;}
|
29 |
+
#fv_player_pro_boxTopLeft{width:14px; height:14px; background:url(img/controls.png) no-repeat 0 0;}
|
30 |
+
#fv_player_pro_boxTopCenter{height:14px;}
|
31 |
+
#fv_player_pro_boxTopRight{width:14px; height:14px; background:url(img/controls.png) no-repeat -36px 0;}
|
32 |
+
#fv_player_pro_boxBottomLeft{width:14px; height:43px; background:url(img/controls.png) no-repeat 0 -32px;}
|
33 |
+
#fv_player_pro_boxBottomCenter{height:43px;}
|
34 |
+
#fv_player_pro_boxBottomRight{width:14px; height:43px; background:url(img/controls.png) no-repeat -36px -32px;}
|
35 |
+
#fv_player_pro_boxMiddleLeft{width:14px; background:url(img/controls.png) repeat-y -175px 0;}
|
36 |
+
#fv_player_pro_boxMiddleRight{width:14px; background:url(img/controls.png) repeat-y -211px 0;}
|
37 |
+
#fv_player_pro_boxContent{background:#fff; overflow:visible;}
|
38 |
+
.fv_player_pro_boxIframe{background:#fff;}
|
39 |
+
#fv_player_pro_boxError{padding:50px; border:1px solid #ccc;}
|
40 |
+
#fv_player_pro_boxLoadedContent{margin-bottom:5px;}
|
41 |
+
|
42 |
+
#fv_player_pro_boxLoadingGraphic{background:url(img/loading.gif) no-repeat center center;}
|
43 |
+
#fv_player_pro_boxTitle{position:absolute; bottom:-25px; left:0; text-align:center; width:100%; font-weight:bold; color:#7C7C7C;}
|
44 |
+
#fv_player_pro_boxCurrent{position:absolute; bottom:-25px; left:58px; font-weight:bold; color:#7C7C7C;}
|
45 |
+
|
46 |
+
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
47 |
+
#fv_player_pro_boxPrevious, #fv_player_pro_boxNext, #fv_player_pro_boxSlideshow, #fv_player_pro_boxClose {border:0; padding:0; margin:0; overflow:visible; position:absolute; bottom:-29px; background:url(img/controls.png) no-repeat 0px 0px; width:23px; height:23px; text-indent:-9999px;box-shadow:none;-webkit-box-shadow:none;-webkit-appearance:none;}
|
48 |
+
|
49 |
+
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
50 |
+
#fv_player_pro_boxPrevious:active, #fv_player_pro_boxNext:active, #fv_player_pro_boxSlideshow:active, #fv_player_pro_boxClose:active {outline:0;}
|
51 |
+
|
52 |
+
#fv_player_pro_boxPrevious{left:0px; background-position: -51px -25px;}
|
53 |
+
#fv_player_pro_boxPrevious:hover{background-position:-51px 0px;}
|
54 |
+
#fv_player_pro_boxNext{left:27px; background-position:-75px -25px;}
|
55 |
+
#fv_player_pro_boxNext:hover{background-position:-75px 0px;}
|
56 |
+
#fv_player_pro_boxClose{right:0; background-position:-100px -25px;}
|
57 |
+
#fv_player_pro_boxClose:hover{background-position:-100px 0px;}
|
58 |
+
|
59 |
+
.fv_player_pro_boxSlideshow_on #fv_player_pro_boxSlideshow{background-position:-125px 0px; right:27px;}
|
60 |
+
.fv_player_pro_boxSlideshow_on #fv_player_pro_boxSlideshow:hover{background-position:-150px 0px;}
|
61 |
+
.fv_player_pro_boxSlideshow_off #fv_player_pro_boxSlideshow{background-position:-150px -25px; right:27px;}
|
62 |
+
.fv_player_pro_boxSlideshow_off #fv_player_pro_boxSlideshow:hover{background-position:-125px 0px;}
|
63 |
+
|
64 |
+
/* Lightbox Styling */
|
65 |
+
|
66 |
+
|
67 |
+
#fv_player_pro_boxMiddleLeft,
|
68 |
+
#fv_player_pro_boxMiddleRight,
|
69 |
+
#fv_player_pro_boxTopLeft,
|
70 |
+
#fv_player_pro_boxTopCenter,
|
71 |
+
#fv_player_pro_boxTopRight,
|
72 |
+
#fv_player_pro_boxBottomLeft,
|
73 |
+
#fv_player_pro_boxBottomRight,
|
74 |
+
#fv_player_pro_boxBottomCenter {
|
75 |
+
background: #fff;
|
76 |
+
}
|
77 |
+
|
78 |
+
#fv_player_pro_boxSlideshow,
|
79 |
+
#fv_player_pro_boxClose {
|
80 |
+
background-image: url("img/controls.png");
|
81 |
+
background-repeat: no-repeat;
|
82 |
+
}
|
83 |
+
|
84 |
+
#fv_player_pro_boxClose {
|
85 |
+
background-image: url("img/closelabel.png");
|
86 |
+
background-position: center center;
|
87 |
+
width: 66px;
|
88 |
+
}
|
89 |
+
|
90 |
+
#fv_player_pro_boxClose:hover {
|
91 |
+
background-position: center center;
|
92 |
+
}
|
93 |
+
|
94 |
+
#fv_player_pro_boxMiddleLeft,
|
95 |
+
#fv_player_pro_boxMiddleRight,
|
96 |
+
#fv_player_pro_boxTopLeft,
|
97 |
+
#fv_player_pro_boxTopRight,
|
98 |
+
#fv_player_pro_boxBottomLeft,
|
99 |
+
#fv_player_pro_boxBottomRight {
|
100 |
+
width: 10px;
|
101 |
+
}
|
102 |
+
|
103 |
+
#fv_player_pro_boxTopCenter,
|
104 |
+
#fv_player_pro_boxTopLeft,
|
105 |
+
#fv_player_pro_boxTopRight {
|
106 |
+
height: 10px;
|
107 |
+
}
|
108 |
+
|
109 |
+
#fv_player_pro_boxBottomLeft,
|
110 |
+
#fv_player_pro_boxBottomRight,
|
111 |
+
#fv_player_pro_boxBottomCenter {
|
112 |
+
height: 38px;
|
113 |
+
}
|
114 |
+
|
115 |
+
#fv_player_pro_boxTitle,
|
116 |
+
#fv_player_pro_boxCurrent {
|
117 |
+
font-weight: normal;
|
118 |
+
}
|
119 |
+
|
120 |
+
#fv_player_pro_boxLoadedContent {
|
121 |
+
position: relative;
|
122 |
+
display: inline-block;
|
123 |
+
z-index: 99998;
|
124 |
+
}
|
125 |
+
|
126 |
+
#fv_player_pro_boxCurrent {
|
127 |
+
left: 0;
|
128 |
+
}
|
129 |
+
|
130 |
+
#fv_player_pro_boxPrevious,
|
131 |
+
#fv_player_pro_boxNext {
|
132 |
+
background: none;
|
133 |
+
width: 15%;
|
134 |
+
height: auto;
|
135 |
+
top: 30px;
|
136 |
+
bottom: 80px;
|
137 |
+
display: block;
|
138 |
+
z-index: 99999;
|
139 |
+
}
|
140 |
+
|
141 |
+
#fv_player_pro_boxPrevious {
|
142 |
+
left: 0;
|
143 |
+
background: url("img/prevlabel.gif") no-repeat -999em center;
|
144 |
+
}
|
145 |
+
|
146 |
+
#fv_player_pro_boxNext {
|
147 |
+
right: -1px;
|
148 |
+
left: 85%;
|
149 |
+
background: url("img/nextlabel.gif") no-repeat 999em center;
|
150 |
+
}
|
151 |
+
|
152 |
+
#fv_player_pro_boxPrevious:hover {
|
153 |
+
background-position: -4px center;
|
154 |
+
}
|
155 |
+
|
156 |
+
#fv_player_pro_boxNext:hover {
|
157 |
+
background-position: right center;
|
158 |
+
}
|
159 |
+
|
160 |
+
@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 2dppx){
|
161 |
+
#fv_player_pro_colorbox #fv_player_pro_boxClose {
|
162 |
+
background-image: url("img/closelabel-x2.png");
|
163 |
+
background-size: 100%;
|
164 |
+
}
|
165 |
+
}
|
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. Embed videos (MP4, WEBM, OGV, FLV) into posts or pages. Uses Flowplayer 6.
|
6 |
-
Version: 6.
|
7 |
Author URI: http://foliovision.com/
|
8 |
License: GPL-3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
@@ -26,7 +26,7 @@ License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
|
26 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
*/
|
28 |
|
29 |
-
$fv_wp_flowplayer_ver = '6.
|
30 |
$fv_wp_flowplayer_core_ver = '6.0.5';
|
31 |
|
32 |
include( dirname( __FILE__ ) . '/includes/extra-functions.php' );
|
@@ -45,6 +45,10 @@ include_once(dirname( __FILE__ ) . '/models/facebook-share.php');
|
|
45 |
|
46 |
include_once(dirname( __FILE__ ) . '/models/custom-videos.php');
|
47 |
|
|
|
|
|
|
|
|
|
48 |
include_once(dirname( __FILE__ ) . '/models/users-ultra-pro.php');
|
49 |
|
50 |
include_once(dirname( __FILE__ ) . '/models/widget.php');
|
@@ -53,6 +57,8 @@ $fv_fp = new flowplayer_frontend();
|
|
53 |
|
54 |
if( is_admin() ) {
|
55 |
include( dirname( __FILE__ ) . '/controller/backend.php' );
|
|
|
|
|
56 |
|
57 |
register_deactivation_hook( __FILE__, 'flowplayer_deactivate' );
|
58 |
|
3 |
Plugin Name: FV Player
|
4 |
Plugin URI: http://foliovision.com/wordpress/plugins/fv-wordpress-flowplayer
|
5 |
Description: Formerly FV WordPress Flowplayer. Embed videos (MP4, WEBM, OGV, FLV) into posts or pages. Uses Flowplayer 6.
|
6 |
+
Version: 6.1.5
|
7 |
Author URI: http://foliovision.com/
|
8 |
License: GPL-3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
26 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
*/
|
28 |
|
29 |
+
$fv_wp_flowplayer_ver = '6.1.5';
|
30 |
$fv_wp_flowplayer_core_ver = '6.0.5';
|
31 |
|
32 |
include( dirname( __FILE__ ) . '/includes/extra-functions.php' );
|
45 |
|
46 |
include_once(dirname( __FILE__ ) . '/models/custom-videos.php');
|
47 |
|
48 |
+
include_once(dirname( __FILE__ ) . '/models/seo.php');
|
49 |
+
|
50 |
+
include_once(dirname( __FILE__ ) . '/models/subtitles.php');
|
51 |
+
|
52 |
include_once(dirname( __FILE__ ) . '/models/users-ultra-pro.php');
|
53 |
|
54 |
include_once(dirname( __FILE__ ) . '/models/widget.php');
|
57 |
|
58 |
if( is_admin() ) {
|
59 |
include( dirname( __FILE__ ) . '/controller/backend.php' );
|
60 |
+
include( dirname( __FILE__ ) . '/controller/editor.php' );
|
61 |
+
include( dirname( __FILE__ ) . '/controller/settings.php' );
|
62 |
|
63 |
register_deactivation_hook( __FILE__, 'flowplayer_deactivate' );
|
64 |
|
flowplayer/flowplayer.hlsjs.min.js
CHANGED
@@ -2,30 +2,32 @@
|
|
2 |
|
3 |
hlsjs engine plugin for Flowplayer HTML5
|
4 |
|
5 |
-
Copyright (c) 2015-
|
6 |
|
7 |
Released under the MIT License:
|
8 |
http://www.opensource.org/licenses/mit-license.php
|
9 |
|
10 |
Includes hls.js
|
11 |
-
Copyright (c)
|
12 |
-
https://github.com/
|
13 |
|
14 |
Requires Flowplayer HTML5 version 6.x
|
15 |
-
v1.0.
|
16 |
|
17 |
*/
|
18 |
/*@cc_on @*/
|
19 |
/*@
|
20 |
@if (@_jscript_version > 10)
|
21 |
@*/
|
22 |
-
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Hls=e()}}(function(){var e;return function e(t,r,i){function a(s,o){if(!r[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(n)return n(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var d=r[s]={exports:{}};t[s][0].call(d.exports,function(e){var r=t[s][1][e];return a(r?r:e)},d,d.exports,e,t,r,i)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s<i.length;s++)a(i[s]);return a}({1:[function(e,t,r){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function a(e){return"function"==typeof e}function n(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,r,i,n,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var d=new Error('Uncaught, unspecified "error" event. ('+t+")");throw d.context=t,d}if(r=this._events[e],o(r))return!1;if(a(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),r.apply(this,n)}else if(s(r))for(n=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,l=0;l<i;l++)u[l].apply(this,n);return!0},i.prototype.addListener=function(e,t){var r;if(!a(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,a(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=o(this._maxListeners)?i.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,"function"==typeof console.trace)),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!a(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){var r,i,n,o;if(!a(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],n=r.length,i=-1,r===t||a(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(o=n;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){i=o;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],a(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(a(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(t,r,i){!function(t){var a={buildAbsoluteURL:function(e,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var r=null,i=null,n=/^([^#]*)(.*)$/.exec(t);n&&(i=n[2],t=n[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(r=s[2],t=s[1]);var o=/^([^#]*)(.*)$/.exec(e);o&&(e=o[1]);var l=/^([^\?]*)(.*)$/.exec(e);l&&(e=l[1]);var u=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(e);if(!u)throw new Error("Error trying to parse base URL.");var d=u[2]||"",h=u[1]||"",f=u[4],c=null;return c=/^\/\//.test(t)?d+"//"+a.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?h+"/"+a.buildAbsolutePath("",t.substring(1)):a.buildAbsolutePath(h+f,t),r&&(c+=r),i&&(c+=i),c},buildAbsolutePath:function(e,t){for(var r,i,a=t,n="",s=e.replace(/[^\/]*$/,a.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),o=0;i=s.indexOf("/../",o),i>-1;o=i+r)r=/^\/(?:\.\.\/)*/.exec(s.slice(i))[0].length,n=(n+s.substring(o,i)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(r-1)/3+"}$"),"/");return n+s.substr(o)}};"object"==typeof i&&"object"==typeof r?r.exports=a:"function"==typeof e&&e.amd?e([],function(){return a}):"object"==typeof i?i.URLToolkit=a:t.URLToolkit=a}(this)},{}],3:[function(e,t,r){var i=arguments[3],a=arguments[4],n=arguments[5],s=JSON.stringify;t.exports=function(e,t){function r(e){p[e]=!0;for(var t in a[e][1]){var i=a[e][1][t];p[i]||r(i)}}for(var o,l=Object.keys(n),u=0,d=l.length;u<d;u++){var h=l[u],f=n[h].exports;if(f===e||f&&f.default===e){o=h;break}}if(!o){o=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var c={},u=0,d=l.length;u<d;u++){var h=l[u];c[h]=h}a[o]=[Function(["require","module","exports"],"("+e+")(self)"),c]}var v=Math.floor(Math.pow(16,8)*Math.random()).toString(16),g={};g[o]=o,a[v]=[Function(["require"],"var f = require("+s(o)+");(f.default ? f.default : f)(self);"),g];var p={};r(v);var y="("+i+")({"+Object.keys(p).map(function(e){return s(e)+":["+a[e][0]+","+s(a[e][1])+"]"}).join(",")+"},{},["+s(v)+"])",m=window.URL||window.webkitURL||window.mozURL||window.msURL,E=new Blob([y],{type:"text/javascript"});if(t&&t.bare)return E;var b=m.createObjectURL(E),_=new Worker(b);return _.objectURL=b,_}},{}],4:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(30),c=i(f),v=e(26),g=e(45),p=e(9),y=i(p),m=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.FRAG_LOADING,u.default.FRAG_LOADED,u.default.FRAG_BUFFERED,u.default.ERROR));return r.lastLoadedFragLevel=0,r._autoLevelCapping=-1,r._nextAutoLevel=-1,r.hls=e,r.onCheck=r.abandonRulesCheck.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){this.clearTimer(),h.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(e){var t=e.frag;if("main"===t.type){if(this.timer||(this.timer=setInterval(this.onCheck,100)),!this.bwEstimator){var r=this.hls,i=e.frag.level,a=r.levels[i].details.live,n=r.config,s=void 0,o=void 0;a?(s=n.abrEwmaFastLive,o=n.abrEwmaSlowLive):(s=n.abrEwmaFastVoD,o=n.abrEwmaSlowVoD),this.bwEstimator=new y.default(r,o,s,n.abrEwmaDefaultEstimate)}this.fragCurrent=t}}},{key:"abandonRulesCheck",value:function(){var e=this.hls,t=e.media,r=this.fragCurrent,i=r.loader,a=this.minAutoLevel;if(!i||i.stats&&i.stats.aborted)return g.logger.warn("frag loader destroy or aborted, disarm abandonRules"),void this.clearTimer();var n=i.stats;if(t&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&r.autoLevel&&r.level){var s=performance.now()-n.trequest,o=Math.abs(t.playbackRate);if(s>500*r.duration/o){var l=e.levels,d=Math.max(1,n.bw?n.bw/8:1e3*n.loaded/s),h=n.total?n.total:Math.max(n.loaded,Math.round(r.duration*l[r.level].bitrate/8)),f=t.currentTime,v=(h-n.loaded)/d,p=(c.default.bufferInfo(t,f,e.config.maxBufferHole).end-f)/o;if(p<2*r.duration/o&&v>p){var y=void 0,m=void 0;for(m=r.level-1;m>a&&(y=r.duration*l[m].bitrate/(6.4*d),!(y<p));m--);y<v&&(g.logger.warn("loading too slow, abort fragment loading and switch to level "+m+":fragLoadedDelay["+m+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+y.toFixed(1)+"<"+v.toFixed(1)+":"+p.toFixed(1)),e.nextLoadLevel=m,this.bwEstimator.sample(s,n.loaded),i.abort(),this.clearTimer(),e.trigger(u.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:n}))}}}}},{key:"onFragLoaded",value:function(e){var t=e.frag;if("main"===t.type&&(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,e.frag.bitrateTest)){var r=e.stats;r.tparsed=r.tbuffered=r.tload,this.onFragBuffered(e)}}},{key:"onFragBuffered",value:function(e){var t=e.stats,r=e.frag;if(t.aborted!==!0&&1===r.loadCounter&&"main"===r.type&&(!r.bitrateTest||t.tload===t.tbuffered)){var i=t.tbuffered-t.trequest;g.logger.log("latency/loading/parsing/append/kbps:"+Math.round(t.tfirst-t.trequest)+"/"+Math.round(t.tload-t.tfirst)+"/"+Math.round(t.tparsed-t.tload)+"/"+Math.round(t.tbuffered-t.tparsed)+"/"+Math.round(8*t.loaded/(t.tbuffered-t.trequest))),this.bwEstimator.sample(i,t.loaded),r.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0}}},{key:"onError",value:function(e){switch(e.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"findBestLevel",value:function(e,t,r,i,a,n,s,o,l){for(var u=a;u>=i;u--){var d=l[u],h=d.details,f=h?h.totalduration/h.fragments.length:t,c=!!h&&h.live,v=void 0;v=u<=e?s*r:o*r;var p=l[u].bitrate,y=p*f/v;if(g.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(v)+"/"+p+"/"+f+"/"+n+"/"+y),v>p&&(!y||c||y<n))return u}return-1}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator,r=this.hls,i=r.levels,a=r.config.minAutoBitrate;if(!(e===-1||t&&t.canEstimate()))return Math.min(e,this.maxAutoLevel);var n=this.nextABRAutoLevel;if(e!==-1&&(n=Math.min(e,n)),void 0!==a)for(;i[n].bitrate<a;)n++;return n},set:function(e){this._nextAutoLevel=e}},{key:"minAutoLevel",get:function(){for(var e=this.hls,t=e.levels,r=e.config.minAutoBitrate,i=0;i<t.length;i++)if(t[i].bitrate>r)return i;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.hls.levels,r=this._autoLevelCapping;return e=r===-1&&t&&t.length?t.length-1:r}},{key:"nextABRAutoLevel",get:function(){var e=this.hls,t=this.maxAutoLevel,r=e.levels,i=e.config,a=this.minAutoLevel,n=e.media,s=this.lastLoadedFragLevel,o=this.fragCurrent?this.fragCurrent.duration:0,l=n?n.currentTime:0,u=n&&0!==n.playbackRate?Math.abs(n.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(c.default.bufferInfo(n,l,i.maxBufferHole).end-l)/u,f=this.findBestLevel(s,o,d,a,t,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor,r);if(f>=0)return f;g.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var v=i.maxStarvationDelay,p=i.abrBandWidthFactor,y=i.abrBandWidthUpFactor;if(0===h){var m=this.bitrateTestDelay;m&&(v=i.maxLoadingDelay-m,g.logger.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),p=y=1)}return f=this.findBestLevel(s,o,d,a,t,h+v,p,y,r),Math.max(f,0)}}]),t}(h.default);r.default=m},{26:26,27:27,28:28,30:30,45:45,9:9}],5:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(41),u=i(l),d=e(30),h=i(d),f=e(22),c=i(f),v=e(28),g=i(v),p=e(27),y=i(p),m=e(31),E=i(m),b=e(47),_=i(b),R=e(26),k=e(45),T={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR"},A=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,g.default.MEDIA_ATTACHED,g.default.MEDIA_DETACHING,g.default.AUDIO_TRACKS_UPDATED,g.default.AUDIO_TRACK_SWITCH,g.default.AUDIO_TRACK_LOADED,g.default.KEY_LOADED,g.default.FRAG_LOADED,g.default.FRAG_PARSING_INIT_SEGMENT,g.default.FRAG_PARSING_DATA,g.default.FRAG_PARSED,g.default.ERROR,g.default.BUFFER_CREATED,g.default.BUFFER_APPENDED,g.default.BUFFER_FLUSHED));return r.config=e.config,r.audioCodecSwap=!1,r.ticks=0,r.ontick=r.tick.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),y.default.prototype.destroy.call(this),this.state=T.STOPPED}},{key:"startLoad",value:function(e){if(this.tracks){var t=this.media,r=this.lastCurrentTime;this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),this.fragLoadError=0,t&&r?(k.logger.log("configure startPosition @"+r),this.state=T.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=T.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=e,this.state=T.STOPPED}},{key:"stopLoad",value:function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=T.STOPPED}},{key:"tick",value:function(){this.ticks++,1===this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var e,t,r,i=this.hls,a=i.config;switch(this.state){case T.ERROR:case T.PAUSED:break;case T.STARTING:this.state=T.WAITING_TRACK,this.loadedmetadata=!1;break;case T.IDLE:if(!this.media&&(this.startFragRequested||!a.startFragPrefetch))break;e=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition;var n=this.mediaBuffer?this.mediaBuffer:this.media,s=h.default.bufferInfo(n,e,a.maxBufferHole),o=s.len,l=s.end,d=this.fragPrevious,f=a.maxMaxBufferLength;if(o<f&&this.trackId<this.tracks.length){if(r=this.tracks[this.trackId].details,"undefined"==typeof r){this.state=T.WAITING_TRACK;break}if(!r.live&&d&&d.sn===r.endSN&&(!this.media.seeking||this.media.duration-l<d.duration/2)){this.hls.trigger(g.default.BUFFER_EOS,{type:"audio"}),this.state=T.ENDED;break}var c=r.fragments,v=c.length,p=c[0].start,y=c[v-1].start+c[v-1].duration,m=void 0;if(l<p?m=c[0]:!function(){var e=void 0,t=a.maxFragLookUpTolerance;l<y?(l>y-t&&(t=0),e=u.default.search(c,function(e){return e.start+e.duration-t<=l?1:e.start-t>l?-1:0})):e=c[v-1],e&&(m=e,p=e.start,d&&m.level===d.level&&m.sn===d.sn&&(m.sn<r.endSN?(m=c[m.sn+1-r.startSN],k.logger.log("SN just loaded, load next one: "+m.sn)):m=null))}(),m)if(null!=m.decryptdata.uri&&null==m.decryptdata.key)k.logger.log("Loading key for "+m.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+this.trackId),this.state=T.KEY_LOADING,i.trigger(g.default.KEY_LOADING,{frag:m});else{if(k.logger.log("Loading "+m.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+this.trackId+", currentTime:"+e+",bufferEnd:"+l.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,m.loadCounter){m.loadCounter++;var E=a.fragLoadingLoopThreshold;if(m.loadCounter>E&&Math.abs(this.fragLoadIdx-m.loadIdx)<E)return void i.trigger(g.default.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:m})}else m.loadCounter=1;m.loadIdx=this.fragLoadIdx,this.fragCurrent=m,this.startFragRequested=!0,i.trigger(g.default.FRAG_LOADING,{frag:m}),this.state=T.FRAG_LOADING}}break;case T.WAITING_TRACK:t=this.tracks[this.trackId],t&&t.details&&(this.state=T.IDLE);break;case T.FRAG_LOADING_WAITING_RETRY:var b=performance.now(),_=this.retryDate;n=this.media;var A=n&&n.seeking;(!_||b>=_||A)&&(k.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=T.IDLE);break;case T.STOPPED:case T.FRAG_LOADING:case T.PARSING:case T.PARSED:case T.ENDED:}}},{key:"onMediaAttached",value:function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var r=this.config;this.tracks&&r.autoStartLoad&&this.startLoad(r.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(k.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.tracks;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){this.state===T.ENDED&&(this.state=T.IDLE),this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaEnded",value:function(){this.startPosition=this.lastCurrentTime=0}},{key:"onAudioTracksUpdated",value:function(e){k.logger.log("audio tracks updated"),this.tracks=e.audioTracks}},{key:"onAudioTrackSwitch",value:function(e){var t=!!e.url;this.trackId=e.id,this.state=T.IDLE,this.fragCurrent=null,this.state=T.PAUSED,t?this.timer||(this.timer=setInterval(this.ontick,100)):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.hls.trigger(g.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),this.tick()}},{key:"onAudioTrackLoaded",value:function(e){var t=e.details,r=e.id,i=this.tracks[r],a=t.totalduration;if(k.logger.log("track "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),t.PTSKnown=!1,i.details=t,!this.startFragRequested){if(this.startPosition===-1){var n=t.startTimeOffset;isNaN(n)?this.startPosition=0:(k.logger.log("start time offset found in playlist, adjust startPosition to "+n),this.startPosition=n)}this.nextLoadPosition=this.startPosition}this.state===T.WAITING_TRACK&&(this.state=T.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===T.KEY_LOADING&&(this.state=T.IDLE,this.tick())}},{key:"onFragLoaded",value:function(e){var t=this.fragCurrent;if(this.state===T.FRAG_LOADING&&t&&"audio"===e.frag.type&&e.frag.level===t.level&&e.frag.sn===t.sn){this.state=T.PARSING,this.stats=e.stats;var r=this.tracks[this.trackId],i=r.details,a=i.totalduration,n=t.start,s=t.level,o=t.sn,l=this.config.defaultAudioCodec||r.audioCodec;this.pendingAppending=0,this.demuxer||(this.demuxer=new c.default(this.hls,"audio")),k.logger.log("Demuxing "+o+" of ["+i.startSN+" ,"+i.endSN+"],track "+s);var u=i.PTSKnown||!i.live;this.demuxer.push(e.payload,l,null,n,t.cc,s,o,a,t.decryptdata,u)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(e){var t=this.fragCurrent;if(t&&"audio"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING){var r=e.tracks,i=void 0;if(i=r.audio){i.levelCodec="mp4a.40.2",i.id=e.id,this.hls.trigger(g.default.BUFFER_CODECS,r),k.logger.log("audio track:audio,container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var a=i.initSegment;a&&(this.pendingAppending++,this.hls.trigger(g.default.BUFFER_APPENDING,{type:"audio",data:a,parent:"audio",content:"initSegment"})),this.tick()}}}},{key:"onFragParsingData",value:function(e){var t=this,r=this.fragCurrent;if(r&&"audio"===e.id&&e.sn===r.sn&&e.level===r.level&&this.state===T.PARSING){var i=this.tracks[this.trackId],a=this.fragCurrent;k.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),E.default.updateFragPTSDTS(i.details,a.sn,e.startPTS,e.endPTS),[e.data1,e.data2].forEach(function(r){r&&(t.pendingAppending++,t.hls.trigger(g.default.BUFFER_APPENDING,{type:e.type,data:r,parent:"audio",content:"data"}))}),this.nextLoadPosition=e.endPTS,this.tick()}}},{key:"onFragParsed",value:function(e){var t=this.fragCurrent;t&&"audio"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING&&(this.stats.tparsed=performance.now(),this.state=T.PARSED,this._checkAppendedParsed())}},{key:"onBufferCreated",value:function(e){var t=e.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0)}},{key:"onBufferAppended",value:function(e){if("audio"===e.parent)switch(this.state){case T.PARSING:case T.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===T.PARSED&&0===this.pendingAppending){var e=this.fragCurrent,t=this.stats;if(e){this.fragPrevious=e,t.tbuffered=performance.now(),this.hls.trigger(g.default.FRAG_BUFFERED,{stats:t,frag:e,id:"audio"});var r=this.mediaBuffer?this.mediaBuffer:this.media;k.logger.log("audio buffered : "+_.default.toString(r.buffered)),this.state=T.IDLE}this.tick()}}},{key:"onError",value:function(e){var t=e.frag;if(!t||"audio"===t.type)switch(e.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!e.fatal){var r=this.fragLoadError;r?r++:r=1;var i=this.config;if(r<=i.fragLoadingMaxRetry){this.fragLoadError=r,t.loadCounter=0;var a=Math.min(Math.pow(2,r-1)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);k.logger.warn("audioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=performance.now()+a,this.state=T.FRAG_LOADING_WAITING_RETRY}else k.logger.error("audioStreamController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.trigger(g.default.ERROR,e),this.state=T.ERROR}break;case R.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==T.ERROR&&(this.state=e.fatal?T.ERROR:T.IDLE,k.logger.warn("audioStreamController: "+e.details+" while loading frag,switch to "+this.state+" state ..."))}}},{key:"onBufferFlushed",value:function(){this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=T.IDLE,this.fragPrevious=null,this.tick()}}]),t}(y.default);r.default=A},{22:22,26:26,27:27,28:28,30:30,31:31,41:41,45:45,47:47}],6:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(45),c=function(e){function t(e){return a(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MANIFEST_LOADING,u.default.MANIFEST_LOADED,u.default.AUDIO_TRACK_LOADED))}return s(t,e),o(t,[{key:"destroy",value:function(){h.default.prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(){this.tracks=[],this.trackId=-1}},{key:"onManifestLoaded",value:function(e){var t=this,r=e.audioTracks||[],i=!1;this.tracks=r,this.hls.trigger(u.default.AUDIO_TRACKS_UPDATED,{audioTracks:r});var a=0;r.forEach(function(e){return e.default?(t.audioTrack=a,void(i=!0)):void a++}),i===!1&&r.length&&(f.logger.log("no default audio track defined, use first audio track as default"),this.audioTrack=0)}},{key:"onAudioTrackLoaded",value:function(e){e.id<this.tracks.length&&(f.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.timer&&(this.timer=setInterval(this.ontick,1e3*e.details.targetduration)),!e.details.live&&this.timer&&(clearInterval(this.timer),this.timer=null))}},{key:"setAudioTrackInternal",value:function(e){if(e>=0&&e<this.tracks.length){this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=e,f.logger.log("switching to audioTrack "+e);var t=this.tracks[e],r=t.type,i=t.url;this.hls.trigger(u.default.AUDIO_TRACK_SWITCH,{id:e,type:r,url:i});var a=t.details;!i||void 0!==a&&a.live!==!0||(f.logger.log("(re)loading playlist for audioTrack "+e),this.hls.trigger(u.default.AUDIO_TRACK_LOADING,{url:i,id:e}))}}},{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.trackId===e&&void 0!==this.tracks[e].details||this.setAudioTrackInternal(e)}}]),t}(h.default);r.default=c},{27:27,28:28,45:45}],7:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(45),c=e(26),v=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_RESET,u.default.BUFFER_APPENDING,u.default.BUFFER_CODECS,u.default.BUFFER_EOS,u.default.BUFFER_FLUSHING,u.default.LEVEL_PTS_UPDATED,u.default.LEVEL_UPDATED));return r._msDuration=null,r._levelDuration=null,r.onsbue=r.onSBUpdateEnd.bind(r),r.onsbe=r.onSBUpdateError.bind(r),r.pendingTracks={},r.tracks={},r}return s(t,e),o(t,[{key:"destroy",value:function(){h.default.prototype.destroy.call(this)}},{key:"onLevelPtsUpdated",value:function(e){var t=e.type,r=this.tracks.audio;if("audio"===t&&r&&"audio/mpeg"===r.container){var i=this.sourceBuffer.audio,a=Math.abs(i.timestampOffset-e.start);if(a>.1){var n=i.updating;try{i.abort()}catch(e){n=!0,f.logger.warn("can not abort audio buffer: "+e)}n?this.audioTimestampOffset=e.start:(f.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}}},{key:"onManifestParsed",value:function(e){var t=e.audio,r=e.video,i=0;e.altAudio&&(t||r)&&(i=(t?1:0)+(r?1:0),f.logger.log(i+" sourceBuffer(s) expected")),this.sourceBufferNb=i}},{key:"onMediaAttaching",value:function(e){var t=this.media=e.media;if(t){var r=this.mediaSource=new MediaSource;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),t.src=URL.createObjectURL(r)}}},{key:"onMediaDetaching",value:function(){f.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){f.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this.onmso),e.removeEventListener("sourceended",this.onmse),e.removeEventListener("sourceclose",this.onmsc),this.media&&(this.media.removeAttribute("src"),this.media.load()),this.mediaSource=null,this.media=null,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(u.default.MEDIA_DETACHED)}},{key:"onMediaSourceOpen",value:function(){f.logger.log("media source opened"),this.hls.trigger(u.default.MEDIA_ATTACHED,{media:this.media});var e=this.mediaSource;e&&e.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()}},{key:"checkPendingTracks",value:function(){var e=this.pendingTracks,t=Object.keys(e).length;t&&(this.sourceBufferNb<=t||0===this.sourceBufferNb)&&(this.createSourceBuffers(e),this.pendingTracks={},this.doAppending())}},{key:"onMediaSourceClose",value:function(){f.logger.log("media source closed")}},{key:"onMediaSourceEnded",value:function(){f.logger.log("media source ended")}},{key:"onSBUpdateEnd",value:function(){if(this.audioTimestampOffset){var e=this.sourceBuffer.audio;f.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+this.audioTimestampOffset),e.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1,this.hls.trigger(u.default.BUFFER_APPENDED,{parent:this.parent}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()}},{key:"onSBUpdateError",value:function(e){f.logger.error("sourceBuffer error:"+e),this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})}},{key:"onBufferReset",value:function(){var e=this.sourceBuffer;for(var t in e){var r=e[t];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}},{key:"onBufferCodecs",value:function(e){if(0===Object.keys(this.sourceBuffer).length){for(var t in e)this.pendingTracks[t]=e[t];var r=this.mediaSource;r&&"open"===r.readyState&&this.checkPendingTracks()}}},{key:"createSourceBuffers",value:function(e){var t=this.sourceBuffer,r=this.mediaSource;for(var i in e)if(!t[i]){
|
23 |
-
var a=e[i],n=a.levelCodec||a.codec,s=a.container+";codecs="+n;f.logger.log("creating sourceBuffer("+s+")");try{var o=t[i]=r.addSourceBuffer(s);o.addEventListener("updateend",this.onsbue),o.addEventListener("error",this.onsbe),this.tracks[i]={codec:n,container:a.container},a.buffer=o}catch(e){f.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:s})}}this.hls.trigger(u.default.BUFFER_CREATED,{tracks:e})}},{key:"onBufferAppending",value:function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())}},{key:"onBufferAppendFail",value:function(e){f.logger.error("sourceBuffer error:"+e.event),this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1,frag:this.fragCurrent})}},{key:"onBufferEos",value:function(e){var t=this.sourceBuffer,r=e.type;for(var i in t)r&&i!==r||t[i].ended||(t[i].ended=!0,f.logger.log(i+" sourceBuffer now EOS"));this.checkEos()}},{key:"checkEos",value:function(){var e=this.sourceBuffer,t=this.mediaSource;if(!t||"open"!==t.readyState)return void(this._needsEos=!1);for(var r in e){if(!e[r].ended)return;if(e[r].updating)return void(this._needsEos=!0)}f.logger.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment"),t.endOfStream(),this._needsEos=!1}},{key:"onBufferFlushing",value:function(e){this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}),this.flushBufferCounter=0,this.doFlush()}},{key:"onLevelUpdated",value:function(e){var t=e.details;0!==t.fragments.length&&(this._levelDuration=t.totalduration+t.fragments[0].start,this.updateMediaElementDuration())}},{key:"updateMediaElementDuration",value:function(){var e=this.media,t=this.mediaSource,r=this.sourceBuffer,i=this._levelDuration;if(null!==i&&e&&t&&r&&0!==e.readyState&&"open"===t.readyState){for(var a in r)if(r[a].updating)return;null===this._msDuration&&(this._msDuration=t.duration),i>this._msDuration&&i>e.duration&&(f.logger.log("Updating mediasource duration to "+i.toFixed(3)),this._msDuration=t.duration=i)}}},{key:"doFlush",value:function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,r=this.sourceBuffer;for(var i in r)t+=r[i].buffered.length;this.appended=t,this.hls.trigger(u.default.BUFFER_FLUSHED)}}},{key:"doAppending",value:function(){var e=this.hls,t=this.sourceBuffer,r=this.segments;if(Object.keys(t).length){if(this.media.error)return this.segments=[],void f.logger.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(r&&r.length){var i=r.shift();try{var a=i.type;t[a]?(t[a].ended=!1,this.parent=i.parent,t[a].appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(t){f.logger.error("error while trying to append buffer:"+t.message),r.unshift(i);var n={type:c.ErrorTypes.MEDIA_ERROR};if(22===t.code)return this.segments=[],n.details=c.ErrorDetails.BUFFER_FULL_ERROR,void e.trigger(u.default.ERROR,n);if(this.appendError?this.appendError++:this.appendError=1,n.details=c.ErrorDetails.BUFFER_APPEND_ERROR,n.frag=this.fragCurrent,this.appendError>e.config.appendErrorMaxRetry)return f.logger.log("fail "+e.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],n.fatal=!0,void e.trigger(u.default.ERROR,n);n.fatal=!1,e.trigger(u.default.ERROR,n)}}}}},{key:"flushBuffer",value:function(e,t,r){var i,a,n,s,o,l,u=this.sourceBuffer;if(Object.keys(u).length){if(f.logger.log("flushBuffer,pos/start/end: "+this.media.currentTime+"/"+e+"/"+t),this.flushBufferCounter<this.appended){for(var d in u)if(!r||d===r){if(i=u[d],i.ended=!1,i.updating)return f.logger.warn("cannot flush, sb updating in progress"),!1;for(a=0;a<i.buffered.length;a++)if(n=i.buffered.start(a),s=i.buffered.end(a),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&&t===Number.POSITIVE_INFINITY?(o=e,l=t):(o=Math.max(n,e),l=Math.min(s,t)),Math.min(l,s)-o>.5)return this.flushBufferCounter++,f.logger.log("flush "+d+" ["+o+","+l+"], of ["+n+","+s+"], pos:"+this.media.currentTime),i.remove(o,l),!1}}else f.logger.warn("abort flushing too many retries");f.logger.log("buffer flushed")}return!0}}]),t}(h.default);r.default=v},{26:26,27:27,28:28,45:45}],8:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=function(e){function t(e){return a(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.FPS_DROP_LEVEL_CAPPING,u.default.MEDIA_ATTACHING,u.default.MANIFEST_PARSED))}return s(t,e),o(t,[{key:"destroy",value:function(){this.hls.config.capLevelToPlayerSize&&(this.media=this.restrictedLevels=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer)))}},{key:"onFpsDropLevelCapping",value:function(e){this.restrictedLevels||(this.restrictedLevels=[]),this.isLevelRestricted(e.droppedLevel)||this.restrictedLevels.push(e.droppedLevel)}},{key:"onMediaAttaching",value:function(e){this.media=e.media instanceof HTMLVideoElement?e.media:null}},{key:"onManifestParsed",value:function(e){this.hls.config.capLevelToPlayerSize&&(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.levels=e.levels,this.hls.firstLevel=this.getMaxLevel(e.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}},{key:"detectPlayerSize",value:function(){if(this.media){var e=this.levels?this.levels.length:0;e&&(this.hls.autoLevelCapping=this.getMaxLevel(e-1),this.hls.autoLevelCapping>this.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(e){var t=0,r=void 0,i=void 0,a=this.mediaWidth,n=this.mediaHeight,s=0,o=0;for(r=0;r<=e&&(i=this.levels[r],!this.isLevelRestricted(r))&&(t=r,s=i.width,o=i.height,!(a<=s||n<=o));r++);return t}},{key:"isLevelRestricted",value:function(e){return!(!this.restrictedLevels||this.restrictedLevels.indexOf(e)===-1)}},{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}},{key:"mediaWidth",get:function(){var e=void 0;return this.media&&(e=this.media.width||this.media.clientWidth||this.media.offsetWidth,e*=this.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e=void 0;return this.media&&(e=this.media.height||this.media.clientHeight||this.media.offsetHeight,e*=this.contentScaleFactor),e}}]),t}(h.default);r.default=f},{27:27,28:28}],9:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(44),o=i(s),l=function(){function e(t,r,i,n){a(this,e),this.hls=t,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new o.default(r),this.fast_=new o.default(i)}return n(e,[{key:"sample",value:function(e,t){e=Math.max(e,this.minDelayMs_);var r=8e3*t/e,i=e/1e3;this.fast_.sample(i,r),this.slow_.sample(i,r)}},{key:"canEstimate",value:function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_}},{key:"getEstimate",value:function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}},{key:"destroy",value:function(){}}]),e}();r.default=l},{44:44}],10:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(45),c=function(e){function t(e){return a(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MEDIA_ATTACHING))}return s(t,e),o(t,[{key:"destroy",value:function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1}},{key:"onMediaAttaching",value:function(e){this.hls.config.capLevelOnFPSDrop&&(this.video=e.media instanceof HTMLVideoElement?e.media:null,"function"==typeof this.video.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),this.hls.config.fpsDroppedMonitoringPeriod))}},{key:"checkFPS",value:function(e,t,r){var i=performance.now();if(t){if(this.lastTime){var a=i-this.lastTime,n=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*n/a;if(this.hls.trigger(u.default.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:r}),o>0&&n>this.hls.config.fpsDroppedMonitoringThreshold*s){var l=this.hls.currentLevel;f.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(this.hls.autoLevelCapping===-1||this.hls.autoLevelCapping>=l)&&(l-=1,this.hls.trigger(u.default.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:this.hls.currentLevel}),this.hls.autoLevelCapping=l,this.hls.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}},{key:"checkFPSInterval",value:function(){if(this.video)if(this.isVideoPlaybackQualityAvailable){var e=this.video.getVideoPlaybackQuality();this.checkFPS(this.video,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(this.video,this.video.webkitDecodedFrameCount,this.video.webkitDroppedFrameCount)}}]),t}(h.default);r.default=c},{27:27,28:28,45:45}],11:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(45),c=e(26),v=e(30),g=i(v),p=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MANIFEST_LOADED,u.default.LEVEL_LOADED,u.default.ERROR));return r.ontick=r.tick.bind(r),r._manualLevel=r._autoLevelCapping=-1,r}return s(t,e),o(t,[{key:"destroy",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this._manualLevel=-1}},{key:"startLoad",value:function(){this.canload=!0,this.timer&&this.tick()}},{key:"stopLoad",value:function(){this.canload=!1}},{key:"onManifestLoaded",value:function(e){var t,r,i=[],a=[],n={},s=!1,o=!1,l=this.hls;if(e.levels.forEach(function(e){e.videoCodec&&(s=!0),(e.audioCodec||e.attrs&&e.attrs.AUDIO)&&(o=!0);var t=n[e.bitrate];void 0===t?(n[e.bitrate]=i.length,e.url=[e.url],e.urlId=0,i.push(e)):i[t].url.push(e.url)}),s&&o?i.forEach(function(e){e.videoCodec&&a.push(e)}):a=i,a=a.filter(function(e){var t=function(e){return MediaSource.isTypeSupported("audio/mp4;codecs="+e)},r=function(e){return MediaSource.isTypeSupported("video/mp4;codecs="+e)},i=e.audioCodec,a=e.videoCodec;return(!i||t(i))&&(!a||r(a))}),a.length){for(t=a[0].bitrate,a.sort(function(e,t){return e.bitrate-t.bitrate}),this._levels=a,r=0;r<a.length;r++)if(a[r].bitrate===t){this._firstLevel=r,f.logger.log("manifest loaded,"+a.length+" level(s) found, first bitrate:"+t);break}l.trigger(u.default.MANIFEST_PARSED,{levels:this._levels,firstLevel:this._firstLevel,stats:e.stats,audio:o,video:s,altAudio:e.audioTracks.length>0})}else l.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:l.url,reason:"no level with compatible codecs found in manifest"})}},{key:"setLevelInternal",value:function(e){var t=this._levels;if(e>=0&&e<t.length){this.timer&&(clearTimeout(this.timer),this.timer=null),this._level!==e&&(f.logger.log("switching to level "+e),this._level=e,this.hls.trigger(u.default.LEVEL_SWITCH,{level:e}));var r=t[e],i=r.details;if(!i||i.live===!0){var a=r.urlId;this.hls.trigger(u.default.LEVEL_LOADING,{url:r.url[a],level:e,id:a})}}else this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.OTHER_ERROR,details:c.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})}},{key:"onError",value:function(e){if(!e.fatal){var t=e.details,r=this.hls,i=void 0,a=void 0,n=!1,s=r.abrController,o=s.minAutoLevel;switch(t){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:i=e.frag.level;break;case c.ErrorDetails.LEVEL_LOAD_ERROR:case c.ErrorDetails.LEVEL_LOAD_TIMEOUT:i=e.context.level,n=!0}if(void 0!==i)if(a=this._levels[i],a.urlId<a.url.length-1)a.urlId++,a.details=void 0,f.logger.warn("level controller,"+t+" for level "+i+": switching to redundant stream id "+a.urlId);else{var l=this._manualLevel===-1&&i;if(l)f.logger.warn("level controller,"+t+": emergency switch-down for next fragment"),s.nextAutoLevel=o;else if(a&&a.details&&a.details.live)f.logger.warn("level controller,"+t+" on live stream, discard"),n&&(this._level=void 0);else if(t===c.ErrorDetails.LEVEL_LOAD_ERROR||t===c.ErrorDetails.LEVEL_LOAD_TIMEOUT){var d=r.media,h=d&&g.default.isBuffered(d,d.currentTime)&&g.default.isBuffered(d,d.currentTime+.5);if(h){var v=r.config.levelLoadingRetryDelay;f.logger.warn("level controller,"+t+", but media buffered, retry in "+v+"ms"),this.timer=setTimeout(this.ontick,v)}else f.logger.error("cannot recover "+t+" error"),this._level=void 0,this.timer&&(clearTimeout(this.timer),this.timer=null),e.fatal=!0,r.trigger(u.default.ERROR,e)}}}}},{key:"onLevelLoaded",value:function(e){if(e.level===this._level){var t=e.details;if(t.live){var r=1e3*(t.averagetargetduration?t.averagetargetduration:t.targetduration),i=this._levels[e.level],a=i.details;a&&t.endSN===a.endSN&&(r/=2,f.logger.log("same live playlist, reload twice faster")),r-=performance.now()-e.stats.trequest,r=Math.max(1e3,Math.round(r)),f.logger.log("live playlist, reload in "+r+" ms"),this.timer=setTimeout(this.ontick,r)}else this.timer=null}}},{key:"tick",value:function(){var e=this._level;if(void 0!==e&&this.canload){var t=this._levels[e],r=t.urlId;this.hls.trigger(u.default.LEVEL_LOADING,{url:t.url[r],level:e,id:r})}}},{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this._level},set:function(e){var t=this._levels;t&&t.length>e&&(this._level===e&&void 0!==t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(e){this._manualLevel=e,void 0===this._startLevel&&(this._startLevel=e),e!==-1&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=Math.max(e,this.hls.abrController.minAutoLevel)}},{key:"nextLoadLevel",get:function(){return this._manualLevel!==-1?this._manualLevel:this.hls.abrController.nextAutoLevel},set:function(e){this.level=e,this._manualLevel===-1&&(this.hls.abrController.nextAutoLevel=e)}}]),t}(h.default);r.default=p},{26:26,27:27,28:28,30:30,45:45}],12:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(41),u=i(l),d=e(30),h=i(d),f=e(22),c=i(f),v=e(28),g=i(v),p=e(27),y=i(p),m=e(31),E=i(m),b=e(47),_=i(b),R=e(26),k=e(45),T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_LEVEL:"WAITING_LEVEL",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR"},A=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,g.default.MEDIA_ATTACHED,g.default.MEDIA_DETACHING,g.default.MANIFEST_LOADING,g.default.MANIFEST_PARSED,g.default.LEVEL_LOADED,g.default.KEY_LOADED,g.default.FRAG_LOADED,g.default.FRAG_LOAD_EMERGENCY_ABORTED,g.default.FRAG_PARSING_INIT_SEGMENT,g.default.FRAG_PARSING_DATA,g.default.FRAG_PARSED,g.default.ERROR,g.default.AUDIO_TRACK_SWITCH,g.default.BUFFER_CREATED,g.default.BUFFER_APPENDED,g.default.BUFFER_FLUSHED));return r.config=e.config,r.audioCodecSwap=!1,r.ticks=0,r.ontick=r.tick.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),y.default.prototype.destroy.call(this),this.state=T.STOPPED}},{key:"startLoad",value:function(e){if(this.levels){var t=this.media,r=this.lastCurrentTime,i=this.hls;if(this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),this.level=-1,this.fragLoadError=0,t&&r>0?(k.logger.log("configure startPosition @"+r.toFixed(3)),this.lastPaused||(k.logger.log("resuming video"),t.play())):this.lastCurrentTime=this.startPosition?this.startPosition:e,!this.startFragRequested){var a=i.startLevel;a===-1&&(a=0,this.bitrateTest=!0),this.level=i.nextLoadLevel=a,this.loadedmetadata=!1}this.state=T.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else k.logger.warn("cannot start loading as manifest not parsed yet"),this.state=T.STOPPED}},{key:"stopLoad",value:function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=T.STOPPED}},{key:"tick",value:function(){this.ticks++,1===this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){switch(this.state){case T.ERROR:break;case T.BUFFER_FLUSHING:this.fragLoadError=0;break;case T.IDLE:if(!this._doTickIdle())return;break;case T.WAITING_LEVEL:var e=this.levels[this.level];e&&e.details&&(this.state=T.IDLE);break;case T.FRAG_LOADING_WAITING_RETRY:var t=performance.now(),r=this.retryDate;(!r||t>=r||this.media&&this.media.seeking)&&(k.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=T.IDLE);break;case T.ERROR:case T.PAUSED:case T.STOPPED:case T.FRAG_LOADING:case T.PARSING:case T.PARSED:case T.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"_doTickIdle",value:function(){var e=this.hls,t=e.config,r=this.media;if(void 0!==this.levelLastLoaded&&!r&&(this.startFragRequested||!t.startFragPrefetch))return!0;var i=void 0;i=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var a=e.nextLoadLevel,n=this.levels[a],s=n.bitrate,o=void 0;o=s?Math.max(8*t.maxBufferSize/s,t.maxBufferLength):t.maxBufferLength,o=Math.min(o,t.maxMaxBufferLength);var l=h.default.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,i,t.maxBufferHole),u=l.len;if(u>=o)return!0;k.logger.trace("buffer length of "+u.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=a;var d=n.details;if("undefined"==typeof d||d.live&&this.levelLastLoaded!==a)return this.state=T.WAITING_LEVEL,!0;var f=this.fragPrevious;if(!d.live&&f&&f.sn===d.endSN&&(!r.seeking&&l.len||r.duration-l.end<=f.duration/2)){var c={};return this.altAudio&&(c.type="video"),this.hls.trigger(g.default.BUFFER_EOS,c),this.state=T.ENDED,!0}return this._fetchPayloadOrEos({pos:i,bufferInfo:l,levelDetails:d})}},{key:"_fetchPayloadOrEos",value:function(e){var t=e.pos,r=e.bufferInfo,i=e.levelDetails,a=this.fragPrevious,n=this.level,s=i.fragments,o=s.length;if(0===o)return!1;var l=s[0].start,u=s[o-1].start+s[o-1].duration,d=r.end,h=void 0;if(i.live){var f=this.config.initialLiveManifestSize;if(o<f)return k.logger.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+f),!1;if(h=this._ensureFragmentAtLivePoint({levelDetails:i,bufferEnd:d,start:l,end:u,fragPrevious:a,fragments:s,fragLen:o}),null===h)return!1}else d<l&&(h=s[0]);return h||(h=this._findFragment({start:l,fragPrevious:a,fragLen:o,fragments:s,bufferEnd:d,end:u,levelDetails:i})),!h||this._loadFragmentOrKey({frag:h,level:n,levelDetails:i,pos:t,bufferEnd:d})}},{key:"_ensureFragmentAtLivePoint",value:function(e){var t=e.levelDetails,r=e.bufferEnd,i=e.start,a=e.end,n=e.fragPrevious,s=e.fragments,o=e.fragLen,l=this.hls.config,u=this.media,d=void 0,h=void 0!==l.liveMaxLatencyDuration?l.liveMaxLatencyDuration:l.liveMaxLatencyDurationCount*t.targetduration;if(r<Math.max(i,a-h)){var f=this.liveSyncPosition=this.computeLivePosition(i,t);k.logger.log("buffer end: "+r.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+f.toFixed(3)),r=f,u&&u.readyState&&u.duration>f&&(u.currentTime=f)}if(t.PTSKnown&&r>a&&u&&u.readyState)return null;if(this.startFragRequested&&!t.PTSKnown){if(n){var c=n.sn+1;c>=t.startSN&&c<=t.endSN&&(d=s[c-t.startSN],k.logger.log("live playlist, switching playlist, load frag with next SN: "+d.sn))}d||(d=s[Math.min(o-1,Math.round(o/2))],k.logger.log("live playlist, switching playlist, unknown, load middle frag : "+d.sn))}return d}},{key:"_findFragment",value:function(e){var t=e.start,r=e.fragPrevious,i=e.fragLen,a=e.fragments,n=e.bufferEnd,s=e.end,o=e.levelDetails,l=this.hls.config,d=void 0,h=void 0,f=l.maxFragLookUpTolerance;if(n<s?(n>s-f&&(f=0),h=u.default.search(a,function(e){return e.start+e.duration-f<=n?1:e.start-f>n&&e.start?-1:0})):h=a[i-1],h&&(d=h,t=h.start,r&&d.level===r.level&&d.sn===r.sn))if(d.sn<o.endSN){var c=r.deltaPTS,v=d.sn-o.startSN;c&&c>l.maxBufferHole&&r.dropped&&v?(d=a[v-1],k.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),r.loadCounter--):(d=a[v+1],k.logger.log("SN just loaded, load next one: "+d.sn))}else d=null;return d}},{key:"_loadFragmentOrKey",value:function(e){var t=e.frag,r=e.level,i=e.levelDetails,a=e.pos,n=e.bufferEnd,s=this.hls,o=s.config;if(null==t.decryptdata.uri||null!=t.decryptdata.key){if(k.logger.log("Loading "+t.sn+" of ["+i.startSN+" ,"+i.endSN+"],level "+r+", currentTime:"+a.toFixed(3)+",bufferEnd:"+n.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,t.loadCounter){t.loadCounter++;var l=o.fragLoadingLoopThreshold;if(t.loadCounter>l&&Math.abs(this.fragLoadIdx-t.loadIdx)<l)return s.trigger(g.default.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:t}),!1}else t.loadCounter=1;return t.loadIdx=this.fragLoadIdx,this.fragCurrent=t,this.startFragRequested=!0,t.autoLevel=s.autoLevelEnabled,t.bitrateTest=this.bitrateTest,s.trigger(g.default.FRAG_LOADING,{frag:t}),this.state=T.FRAG_LOADING,!0}k.logger.log("Loading key for "+t.sn+" of ["+i.startSN+" ,"+i.endSN+"],level "+r),this.state=T.KEY_LOADING,s.trigger(g.default.KEY_LOADING,{frag:t})}},{key:"getBufferRange",value:function(e){var t,r,i=this.bufferRange;if(i)for(t=i.length-1;t>=0;t--)if(r=i[t],e>=r.start&&e<=r.end)return r;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"_checkFragmentChanged",value:function(){var e,t,r=this.media;if(r&&r.readyState&&r.seeking===!1&&(t=r.currentTime,t>r.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=t),h.default.isBuffered(r,t)?e=this.getBufferRange(t):h.default.isBuffered(r,t+.1)&&(e=this.getBufferRange(t+.1)),e)){var i=e.frag;i!==this.fragPlaying&&(this.fragPlaying=i,this.hls.trigger(g.default.FRAG_CHANGED,{frag:i}))}}},{key:"immediateLevelSwitch",value:function(){if(k.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e=this.media,t=void 0;e?(t=e.paused,e.pause()):t=!0,this.previouslyPaused=t}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=T.BUFFER_FLUSHING,this.hls.trigger(g.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})}},{key:"immediateLevelSwitchEnd",value:function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,h.default.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var e=this.media;if(e&&e.readyState){var t=void 0,r=void 0,i=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,r=this.getBufferRange(e.currentTime),r&&r.start>1&&(this.state=T.BUFFER_FLUSHING,this.hls.trigger(g.default.BUFFER_FLUSHING,{startOffset:0,endOffset:r.start-1})),e.paused)t=0;else{var a=this.hls.nextLoadLevel,n=this.levels[a],s=this.fragLastKbps;t=s&&this.fragCurrent?this.fragCurrent.duration*n.bitrate/(1e3*s)+1:0}if(i=this.getBufferRange(e.currentTime+t),i&&(i=this.followingBufferRange(i))){var o=this.fragCurrent;o&&o.loader&&o.loader.abort(),this.fragCurrent=null,this.state=T.BUFFER_FLUSHING,this.hls.trigger(g.default.BUFFER_FLUSHING,{startOffset:i.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(k.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){var e=this.media,t=e?e.currentTime:void 0,r=this.config;if(k.logger.log("media seeking to "+t.toFixed(3)),this.state===T.FRAG_LOADING){var i=h.default.bufferInfo(e,t,this.config.maxBufferHole),a=this.fragCurrent;if(0===i.len&&a){var n=r.maxFragLookUpTolerance,s=a.start-n,o=a.start+a.duration+n;t<s||t>o?(a.loader&&(k.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),a.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE):k.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===T.ENDED&&(this.state=T.IDLE);e&&(this.lastCurrentTime=t),this.state!==T.FRAG_LOADING&&void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*r.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){k.logger.log("media seeked to "+this.media.currentTime.toFixed(3)),this.tick()}},{key:"onMediaEnded",value:function(){k.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){k.logger.log("trigger BUFFER_RESET"),this.hls.trigger(g.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1,this.startPosition=this.lastCurrentTime=0}},{key:"onManifestParsed",value:function(e){var t,r=!1,i=!1;e.levels.forEach(function(e){t=e.audioCodec,t&&(t.indexOf("mp4a.40.2")!==-1&&(r=!0),t.indexOf("mp4a.40.5")!==-1&&(i=!0))}),this.audioCodecSwitch=r&&i,this.audioCodecSwitch&&k.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startLevelLoaded=!1,this.startFragRequested=!1;var a=this.config;a.autoStartLoad&&this.hls.startLoad(a.startPosition)}},{key:"onLevelLoaded",value:function(e){var t=e.details,r=e.level,i=this.levels[r],a=t.totalduration,n=0;if(k.logger.log("level "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),this.levelLastLoaded=r,t.live){var s=i.details;s&&t.fragments.length>0?(E.default.mergeDetails(s,t),n=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(n,s),t.PTSKnown?k.logger.log("live playlist sliding:"+n.toFixed(3)):k.logger.log("live playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,k.logger.log("live playlist - first load, unknown sliding"))}else t.PTSKnown=!1;if(i.details=t,this.hls.trigger(g.default.LEVEL_UPDATED,{details:t,level:r}),this.startFragRequested===!1){if(this.startPosition===-1||this.lastCurrentTime===-1){var o=t.startTimeOffset;isNaN(o)?t.live?(this.startPosition=this.computeLivePosition(n,t),k.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0:(o<0&&(k.logger.log("negative start time offset "+o+", count from end of last fragment"),o=n+a+o),k.logger.log("start time offset found in playlist, adjust startPosition to "+o),
|
24 |
-
this.startPosition=o)}this.nextLoadPosition=this.startPosition}this.state===T.WAITING_LEVEL&&(this.state=T.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===T.KEY_LOADING&&(this.state=T.IDLE,this.tick())}},{key:"onFragLoaded",value:function(e){var t=this.fragCurrent,r=e.frag;if(this.state===T.FRAG_LOADING&&t&&"main"===r.type&&r.level===t.level&&r.sn===t.sn){var i=e.stats,a=this.levels[t.level],n=a.details;if(k.logger.log("Loaded "+t.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+t.level),this.bitrateTest=!1,r.bitrateTest===!0&&this.hls.nextLoadLevel)this.state=T.IDLE,this.startFragRequested=!1,i.tparsed=i.tbuffered=performance.now(),this.hls.trigger(g.default.FRAG_BUFFERED,{stats:i,frag:t,id:"main"}),this.tick();else{this.state=T.PARSING,this.stats=i;var s=n.totalduration,o=isNaN(t.startDTS)?t.start:t.startDTS,l=t.level,u=t.sn,d=this.config.defaultAudioCodec||a.audioCodec;this.audioCodecSwap&&(k.logger.log("swapping playlist audio codec"),void 0===d&&(d=this.lastAudioCodec),d&&(d=d.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,k.logger.log("Parsing "+u+" of ["+n.startSN+" ,"+n.endSN+"],level "+l+", cc "+t.cc);var h=this.demuxer;h||(h=this.demuxer=new c.default(this.hls,"main"));var f=n.PTSKnown||!n.live;h.push(e.payload,d,a.videoCodec,o,t.cc,l,u,s,t.decryptdata,f)}}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(e){var t=this.fragCurrent;if(t&&"main"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING){var r,i,a=e.tracks;if(a.audio&&this.altAudio&&delete a.audio,i=a.audio){var n=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();n&&this.audioCodecSwap&&(k.logger.log("swapping playlist audio codec"),n=n.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&s.indexOf("firefox")===-1&&(n="mp4a.40.5"),s.indexOf("android")!==-1&&"audio/mpeg"!==i.container&&(n="mp4a.40.2",k.logger.log("Android: force audio codec to"+n)),i.levelCodec=n,i.id=e.id}if(i=a.video,i&&(i.levelCodec=this.levels[this.level].videoCodec,i.id=e.id),e.unique){var o={codec:"",levelCodec:""};for(r in e.tracks)i=a[r],o.container=i.container,o.codec&&(o.codec+=",",o.levelCodec+=","),i.codec&&(o.codec+=i.codec),i.levelCodec&&(o.levelCodec+=i.levelCodec);a={audiovideo:o}}this.hls.trigger(g.default.BUFFER_CODECS,a);for(r in a){i=a[r],k.logger.log("main track:"+r+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var l=i.initSegment;l&&(this.pendingAppending++,this.hls.trigger(g.default.BUFFER_APPENDING,{type:r,data:l,parent:"main",content:"initSegment"}))}this.tick()}}},{key:"onFragParsingData",value:function(e){var t=this,r=this.fragCurrent;if(r&&"main"===e.id&&e.sn===r.sn&&e.level===r.level&&("audio"!==e.type||!this.altAudio)&&this.state===T.PARSING){var i=this.levels[this.level],a=this.fragCurrent;k.logger.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0));var n=E.default.updateFragPTSDTS(i.details,a.sn,e.startPTS,e.endPTS,e.startDTS,e.endDTS),s=this.hls;s.trigger(g.default.LEVEL_PTS_UPDATED,{details:i.details,level:this.level,drift:n,type:e.type,start:e.startPTS,end:e.endPTS}),"video"===e.type&&(a.dropped=e.dropped),[e.data1,e.data2].forEach(function(r){r&&(t.pendingAppending++,s.trigger(g.default.BUFFER_APPENDING,{type:e.type,data:r,parent:"main",content:"data"}))}),this.nextLoadPosition=e.endPTS,this.bufferRange.push({type:e.type,start:e.startPTS,end:e.endPTS,frag:a}),this.tick()}}},{key:"onFragParsed",value:function(e){var t=this.fragCurrent;t&&"main"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING&&(this.stats.tparsed=performance.now(),this.state=T.PARSED,this._checkAppendedParsed())}},{key:"onAudioTrackSwitch",value:function(e){var t=!!e.url;if(t)this.videoBuffer&&this.mediaBuffer!==this.videoBuffer&&(k.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=this.videoBuffer);else if(this.mediaBuffer!==this.media){k.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var r=this.fragCurrent;r.loader&&(k.logger.log("switching to main audio track, cancel main fragment load"),r.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=T.IDLE}this.altAudio=t}},{key:"onBufferCreated",value:function(e){var t=e.tracks,r=void 0,i=void 0,a=!1;for(var n in t){var s=t[n];"main"===s.id?(i=n,r=s,"video"===n&&(this.videoBuffer=t[n].buffer)):a=!0}a&&r?(k.logger.log("alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}},{key:"onBufferAppended",value:function(e){if("main"===e.parent)switch(this.state){case T.PARSING:case T.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===T.PARSED&&0===this.pendingAppending){var e=this.fragCurrent,t=this.stats;if(e){this.fragPrevious=e,t.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*t.total/(t.tbuffered-t.tfirst)),this.hls.trigger(g.default.FRAG_BUFFERED,{stats:t,frag:e,id:"main"});var r=this.mediaBuffer?this.mediaBuffer:this.media;k.logger.log("main buffered : "+_.default.toString(r.buffered)),this.state=T.IDLE}this.tick()}}},{key:"onError",value:function(e){var t=e.frag||this.fragCurrent;if(!t||"main"===t.type){var r=this.media,i=r&&h.default.isBuffered(r,r.currentTime)&&h.default.isBuffered(r,r.currentTime+.5);switch(e.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(!e.fatal){var a=this.fragLoadError;a?a++:a=1;var n=this.config;if(a<=n.fragLoadingMaxRetry||i||t.autoLevel&&t.level){this.fragLoadError=a,t.loadCounter=0;var s=Math.min(Math.pow(2,a-1)*n.fragLoadingRetryDelay,n.fragLoadingMaxRetryTimeout);k.logger.warn("mediaController: frag loading failed, retry in "+s+" ms"),this.retryDate=performance.now()+s,this.state=T.FRAG_LOADING_WAITING_RETRY}else k.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.trigger(g.default.ERROR,e),this.state=T.ERROR}break;case R.ErrorDetails.FRAG_LOOP_LOADING_ERROR:e.fatal||(i?(this._reduceMaxBufferLength(t.duration),this.state=T.IDLE):t.autoLevel&&0!==t.level||(e.fatal=!0,this.hls.trigger(g.default.ERROR,e),this.state=T.ERROR));break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==T.ERROR&&(e.fatal?(this.state=T.ERROR,k.logger.warn("streamController: "+e.details+",switch to "+this.state+" state ...")):this.state===T.WAITING_LEVEL&&(this.state=T.IDLE));break;case R.ErrorDetails.BUFFER_FULL_ERROR:this.state!==T.PARSING&&this.state!==T.PARSED||(i?(this._reduceMaxBufferLength(t.duration),this.state=T.IDLE):(k.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.state=T.PAUSED,this.hls.trigger(g.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})))}}}},{key:"_reduceMaxBufferLength",value:function(e){var t=this.config;t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,k.logger.warn("reduce max buffer length to "+t.maxMaxBufferLength+"s and switch to IDLE state"),this.fragLoadIdx+=2*t.fragLoadingLoopThreshold)}},{key:"_checkBuffer",value:function(){var e=this.media;if(e&&e.readyState){var t=e.currentTime,r=e.buffered;if(!this.loadedmetadata&&r.length){this.loadedmetadata=!0;var i=this.startPosition,a=h.default.isBuffered(e,i);t===i&&a||(k.logger.log("target start position:"+i),a||(i=r.start(0),k.logger.log("target start position not buffered, seek to buffered.start(0) "+i)),k.logger.log("adjust currentTime from "+t+" to "+i),e.currentTime=i)}else if(this.immediateSwitch)this.immediateLevelSwitchEnd();else{var n=h.default.bufferInfo(e,t,0),s=!(e.paused||e.ended||0===e.buffered.length),o=.5,l=t>e.playbackRate*this.lastCurrentTime,u=this.config;if(this.stalled&&l&&(this.stalled=!1,k.logger.log("playback not stuck anymore @"+t)),s&&n.len<=o&&(l?(o=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=u.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,k.logger.log("playback seems stuck @"+t),this.hls.trigger(g.default.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),n.len<=o)){var d=n.nextStart,f=d-t;if(d&&f<u.maxSeekHole&&f>0){k.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+d+" + nudge "+this.seekHoleNudgeDuration);var c=d+this.seekHoleNudgeDuration-e.currentTime;e.currentTime=d+this.seekHoleNudgeDuration,this.hls.trigger(g.default.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:c})}}}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=T.IDLE,this.loadedmetadata||(this.startFragRequested=!1),this.tick()}},{key:"onBufferFlushed",value:function(){var e=this.mediaBuffer?this.mediaBuffer:this.media,t=this.bufferRange,r=[],i=void 0,a=void 0;for(a=0;a<t.length;a++)i=t[a],h.default.isBuffered(e,(i.start+i.end)/2)&&r.push(i);this.bufferRange=r,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=T.IDLE,this.fragPrevious=null}},{key:"swapAudioCodec",value:function(){this.audioCodecSwap=!this.audioCodecSwap}},{key:"computeLivePosition",value:function(e,t){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-r)}},{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,k.logger.log("engine state transition from "+t+" to "+e),this.hls.trigger(g.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getBufferRange(e.currentTime);if(t)return t.frag.level}return-1}},{key:"nextBufferRange",get:function(){var e=this.media;return e?this.followingBufferRange(this.getBufferRange(e.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferRange;return e?e.frag.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e}}]),t}(y.default);r.default=A},{22:22,26:26,27:27,28:28,30:30,31:31,41:41,45:45,47:47}],13:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(42),c=i(f),v=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_USERDATA,u.default.MANIFEST_LOADING,u.default.FRAG_LOADED,u.default.LEVEL_SWITCH));if(r.hls=e,r.config=e.config,r.enabled=!0,r.Cues=e.config.cueHandler,r.config.enableCEA708Captions){var i=r,s={newCue:function(e,t,r){if(!i.textTrack1){var a=i.getExistingTrack("1");if(a){i.textTrack1=a,i.clearCurrentCues(i.textTrack1);var n=new window.Event("addtrack");n.track=i.textTrack1,i.media.dispatchEvent(n)}else i.textTrack1=i.createTextTrack("captions","English","en"),i.textTrack1.textTrack1=!0}i.Cues.newCue(i.textTrack1,e,t,r)}},o={newCue:function(e,t,r){if(!i.textTrack2){var a=i.getExistingTrack("2");if(a){i.textTrack2=a,i.clearCurrentCues(i.textTrack2);var n=new window.Event("addtrack");n.track=i.textTrack2,i.media.dispatchEvent(n)}else i.textTrack2=i.createTextTrack("captions","Spanish","es"),i.textTrack2.textTrack2=!0}i.Cues.newCue(i.textTrack2,e,t,r)}};r.cea608Parser=new c.default(0,s,o)}return r}return s(t,e),o(t,[{key:"clearCurrentCues",value:function(e){if(e&&e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}},{key:"getExistingTrack",value:function(e){var t=this.media;if(t)for(var r=0;r<t.textTracks.length;r++){var i=t.textTracks[r],a="textTrack"+e;if(i[a]===!0)return i}return null}},{key:"createTextTrack",value:function(e,t,r){if(this.media)return this.media.addTextTrack(e,t,r)}},{key:"destroy",value:function(){h.default.prototype.destroy.call(this)}},{key:"onMediaAttaching",value:function(e){this.media=e.media}},{key:"onMediaDetaching",value:function(){}},{key:"onManifestLoading",value:function(){this.lastPts=Number.NEGATIVE_INFINITY}},{key:"onLevelSwitch",value:function(){"NONE"===this.hls.currentLevel.closedCaptions?this.enabled=!1:this.enabled=!0}},{key:"onFragLoaded",value:function(e){if("main"===e.frag.type){var t=e.frag.start;t<=this.lastPts&&(this.clearCurrentCues(this.textTrack1),this.clearCurrentCues(this.textTrack2)),this.lastPts=t}}},{key:"onFragParsingUserdata",value:function(e){if(this.enabled&&this.config.enableCEA708Captions)for(var t=0;t<e.samples.length;t++){var r=this.extractCea608Data(e.samples[t].bytes);this.cea608Parser.addData(e.samples[t].pts,r)}}},{key:"extractCea608Data",value:function(e){for(var t,r,i,a,n,s=31&e[0],o=2,l=[],u=0;u<s;u++)t=e[o++],r=127&e[o++],i=127&e[o++],a=0!==(4&t),n=3&t,0===r&&0===i||a&&0===n&&(l.push(r),l.push(i));return l}}]),t}(h.default);r.default=v},{27:27,28:28,42:42}],14:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(t){i(this,e),this.aesIV=t}return a(e,[{key:"decrypt",value:function(e,t){return window.crypto.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}]),e}();r.default=n},{}],15:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(){i(this,e),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[],this.subMix[0]=new Uint32Array(256),this.subMix[1]=new Uint32Array(256),this.subMix[2]=new Uint32Array(256),this.subMix[3]=new Uint32Array(256),this.invSubMix=[],this.invSubMix[0]=new Uint32Array(256),this.invSubMix[1]=new Uint32Array(256),this.invSubMix[2]=new Uint32Array(256),this.invSubMix[3]=new Uint32Array(256),this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}return a(e,[{key:"uint8ArrayToUint32Array_",value:function(e){for(var t=new DataView(e),r=new Uint32Array(4),i=0;i<r.length;i++)r[i]=t.getUint32(4*i);return r}},{key:"initTable",value:function(){var e=this.sBox,t=this.invSBox,r=this.subMix[0],i=this.subMix[1],a=this.subMix[2],n=this.subMix[3],s=this.invSubMix[0],o=this.invSubMix[1],l=this.invSubMix[2],u=this.invSubMix[3],d=new Uint32Array(256),h=0,f=0,c=0;for(c=0;c<256;c++)c<128?d[c]=c<<1:d[c]=c<<1^283;for(c=0;c<256;c++){var v=f^f<<1^f<<2^f<<3^f<<4;v=v>>>8^255&v^99,e[h]=v,t[v]=h;var g=d[h],p=d[g],y=d[p],m=257*d[v]^16843008*v;r[h]=m<<24|m>>>8,i[h]=m<<16|m>>>16,a[h]=m<<8|m>>>24,n[h]=m,m=16843009*y^65537*p^257*g^16843008*h,s[v]=m<<24|m>>>8,o[v]=m<<16|m>>>16,l[v]=m<<8|m>>>24,u[v]=m,h?(h=g^d[d[d[y^g]]],f^=d[d[f]]):h=f=1}}},{key:"expandKey",value:function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i<t.length&&r;)r=t[i]===this.key[i],i++;if(!r){this.key=t;var a=this.keySize=t.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);var n=this.ksRows=4*(a+6+1),s=void 0,o=void 0,l=this.keySchedule=new Uint32Array(this.ksRows),u=this.invKeySchedule=new Uint32Array(this.ksRows),d=this.sBox,h=this.rcon,f=this.invSubMix[0],c=this.invSubMix[1],v=this.invSubMix[2],g=this.invSubMix[3],p=void 0,y=void 0;for(s=0;s<n;s++)s<a?p=l[s]=t[s]:(y=p,s%a===0?(y=y<<8|y>>>24,y=d[y>>>24]<<24|d[y>>>16&255]<<16|d[y>>>8&255]<<8|d[255&y],y^=h[s/a|0]<<24):a>6&&s%a===4&&(y=d[y>>>24]<<24|d[y>>>16&255]<<16|d[y>>>8&255]<<8|d[255&y]),l[s]=p=(l[s-a]^y)>>>0);for(o=0;o<n;o++)s=n-o,y=3&o?l[s]:l[s-4],o<4||s<=4?u[o]=y:u[o]=f[d[y>>>24]]^c[d[y>>>16&255]]^v[d[y>>>8&255]]^g[d[255&y]],u[o]=u[o]>>>0}}},{key:"networkToHostOrderSwap",value:function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}},{key:"decrypt",value:function(e,t,r){for(var i,a,n=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,l=this.invSubMix[0],u=this.invSubMix[1],d=this.invSubMix[2],h=this.invSubMix[3],f=this.uint8ArrayToUint32Array_(r),c=f[0],v=f[1],g=f[2],p=f[3],y=new Int32Array(e),m=new Int32Array(y.length),E=void 0,b=void 0,_=void 0,R=void 0,k=void 0,T=void 0,A=void 0,S=void 0,L=void 0,D=void 0,w=void 0,O=void 0;t<y.length;){for(L=this.networkToHostOrderSwap(y[t]),D=this.networkToHostOrderSwap(y[t+1]),w=this.networkToHostOrderSwap(y[t+2]),O=this.networkToHostOrderSwap(y[t+3]),k=L^s[0],T=O^s[1],A=w^s[2],S=D^s[3],i=4,a=1;a<n;a++)E=l[k>>>24]^u[T>>16&255]^d[A>>8&255]^h[255&S]^s[i],b=l[T>>>24]^u[A>>16&255]^d[S>>8&255]^h[255&k]^s[i+1],_=l[A>>>24]^u[S>>16&255]^d[k>>8&255]^h[255&T]^s[i+2],R=l[S>>>24]^u[k>>16&255]^d[T>>8&255]^h[255&A]^s[i+3],k=E,T=b,A=_,S=R,i+=4;E=o[k>>>24]<<24^o[T>>16&255]<<16^o[A>>8&255]<<8^o[255&S]^s[i],b=o[T>>>24]<<24^o[A>>16&255]<<16^o[S>>8&255]<<8^o[255&k]^s[i+1],_=o[A>>>24]<<24^o[S>>16&255]<<16^o[k>>8&255]<<8^o[255&T]^s[i+2],R=o[S>>>24]<<24^o[k>>16&255]<<16^o[T>>8&255]<<8^o[255&A]^s[i+3],i+=3,m[t]=this.networkToHostOrderSwap(E^c),m[t+1]=this.networkToHostOrderSwap(R^v),m[t+2]=this.networkToHostOrderSwap(_^g),m[t+3]=this.networkToHostOrderSwap(b^p),c=L,v=D,g=w,p=O,t+=4}return m.buffer}},{key:"destroy",value:function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0}}]),e}();r.default=n},{}],16:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(14),o=i(s),l=e(17),u=i(l),d=e(15),h=i(d),f=e(26),c=e(45),v=function(){function e(t){a(this,e),this.hls=t;try{var r=window?window.crypto:crypto;this.subtle=r.subtle||r.webkitSubtle}catch(e){}this.disableWebCrypto=!this.supportsWebCrypto()}return n(e,[{key:"supportsWebCrypto",value:function(){return this.subtle&&"https:"===window.location.protocol}},{key:"decrypt",value:function(e,t,r,i){var a=this;this.disableWebCrypto&&this.hls.config.enableSoftwareAES?(c.logger.log("decrypting by JavaScript Implementation"),this.decryptor||(this.decryptor=new h.default),this.decryptor.expandKey(t),i(this.decryptor.decrypt(e,0,r))):(c.logger.log("decrypting by WebCrypto API"),this.key!==t&&(this.key=t,this.fastAesKey=new u.default(t)),this.fastAesKey.expandKey().then(function(t){var a=new o.default(r);a.decrypt(e,t).then(function(e){i(e)})}).catch(function(n){a.onWebCryptoError(n,e,t,r,i)}))}},{key:"onWebCryptoError",value:function(e,t,r,i,a){this.hls.config.enableSoftwareAES?(c.logger.log("disabling to use WebCrypto API"),this.disableWebCrypto=!0,this.decrypt(t,r,i,a)):(c.logger.error("decrypting error : "+e.message),this.hls.trigger(Event.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))}},{key:"destroy",value:function(){this.decryptor&&(this.decryptor.destroy(),this.decryptor=void 0)}}]),e}();r.default=v},{14:14,15:15,17:17,26:26,45:45}],17:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(t){i(this,e),this.key=t}return a(e,[{key:"expandKey",value:function(){return window.crypto.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}]),e}();r.default=n},{}],18:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(19),o=i(s),l=e(45),u=e(24),d=i(u),h=function(){function e(t,r,i,n){a(this,e),this.observer=t,this.id=r,this.remuxerClass=i,this.config=n,this.remuxer=new this.remuxerClass(t,r,n),this.insertDiscontinuity()}return n(e,[{key:"insertDiscontinuity",value:function(){this._aacTrack={container:"audio/adts",type:"audio",id:-1,sequenceNumber:0,samples:[],len:0}}},{key:"push",value:function(e,t,r,i,a,n,s,u,h){var f,c,v,g,p,y,m,E,b,_,R=new d.default(e),k=90*R.timeStamp,T=!1;for(a!==this.lastCC?(l.logger.log(this.id+" discontinuity detected"),this.lastCC=a,this.insertDiscontinuity(),this.remuxer.switchLevel(),this.remuxer.insertDiscontinuity()):n!==this.lastLevel?(l.logger.log("audio track switch detected"),this.lastLevel=n,this.remuxer.switchLevel(),this.insertDiscontinuity()):s===this.lastSN+1&&(T=!0),f=this._aacTrack,this.lastSN=s,this.lastLevel=n,y=R.length,b=e.length;y<b-1&&(255!==e[y]||240!==(240&e[y+1]));y++);for(f.audiosamplerate||(c=o.default.getAudioConfig(this.observer,e,y,t),f.config=c.config,f.audiosamplerate=c.samplerate,f.channelCount=c.channelCount,f.codec=c.codec,f.duration=u,l.logger.log("parsed codec:"+f.codec+",rate:"+c.samplerate+",nb channel:"+c.channelCount)),p=0,g=9216e4/f.audiosamplerate;y+5<b&&(m=1&e[y+1]?7:9,v=(3&e[y+3])<<11|e[y+4]<<3|(224&e[y+5])>>>5,v-=m,v>0&&y+m+v<=b);)for(E=k+p*g,_={unit:e.subarray(y+m,y+m+v),pts:E,dts:E},f.samples.push(_),f.len+=v,y+=v+m,p++;y<b-1&&(255!==e[y]||240!==(240&e[y+1]));y++);this.remuxer.remux(n,s,this._aacTrack,{samples:[]},{samples:[{pts:k,dts:k,unit:R.payload}]},{samples:[]},i,T,h)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(e){var t,r,i=new d.default(e);if(i.hasTimeStamp)for(t=i.length,r=e.length;t<r-1;t++)if(255===e[t]&&240===(240&e[t+1]))return!0;return!1}}]),e}();r.default=h},{19:19,24:24,45:45}],19:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(45),s=e(26),o=function(){function e(){i(this,e)}return a(e,null,[{key:"getAudioConfig",value:function(e,t,r,i){var a,o,l,u,d,h=navigator.userAgent.toLowerCase(),f=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];return a=((192&t[r+2])>>>6)+1,o=(60&t[r+2])>>>2,o>f.length-1?void e.trigger(Event.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+o}):(u=(1&t[r+2])<<2,u|=(192&t[r+3])>>>6,n.logger.log("manifest codec:"+i+",ADTS data:type:"+a+",sampleingIndex:"+o+"["+f[o]+"Hz],channelConfig:"+u),/firefox|OPR/i.test(h)?o>=6?(a=5,d=new Array(4),l=o-3):(a=2,d=new Array(2),l=o):h.indexOf("android")!==-1?(a=2,d=new Array(2),l=o):(a=5,d=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&o>=6?l=o-3:((i&&i.indexOf("mp4a.40.2")!==-1&&o>=6&&1===u||!i&&1===u)&&(a=2,d=new Array(2)),l=o)),d[0]=a<<3,d[0]|=(14&o)>>1,d[1]|=(1&o)<<7,d[1]|=u<<3,5===a&&(d[1]|=(14&l)>>1,d[2]=(1&l)<<7,d[2]|=8,d[3]=0),{config:d,samplerate:f[o],channelCount:u,codec:"mp4a.40."+a})}}]),e}();r.default=o},{26:26,45:45}],20:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(28),o=i(s),l=e(26),u=e(18),d=i(u),h=e(25),f=i(h),c=e(38),v=i(c),g=e(39),p=i(g),y=function(){function e(t,r,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;a(this,e),this.hls=t,this.id=r,this.config=this.hls.config||n,this.typeSupported=i}return n(e,[{key:"destroy",value:function(){var e=this.demuxer;e&&e.destroy()}},{key:"push",value:function(e,t,r,i,a,n,s,u,h){var c=this.demuxer;if(!c){var g=this.hls,y=this.id;if(f.default.probe(e))c=this.typeSupported.mp2t===!0?new f.default(g,y,p.default,this.config,this.typeSupported):new f.default(g,y,v.default,this.config,this.typeSupported);else{if(!d.default.probe(e))return void g.trigger(o.default.ERROR,{type:l.ErrorTypes.MEDIA_ERROR,id:y,details:l.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});c=new d.default(g,y,v.default,this.config)}this.demuxer=c}c.push(e,t,r,i,a,n,s,u,h)}}]),e}();r.default=y},{18:18,25:25,26:26,28:28,38:38,39:39}],21:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var a=e(20),n=i(a),s=e(28),o=i(s),l=e(45),u=e(1),d=i(u),h=function(e){var t=new d.default;t.trigger=function(e){for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];t.emit.apply(t,[e,e].concat(i))},t.off=function(e){for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];t.removeListener.apply(t,[e].concat(i))};var r=function(t,r){e.postMessage({event:t,data:r})};e.addEventListener("message",function(i){var a=i.data;switch(a.cmd){case"init":var s=JSON.parse(a.config);e.demuxer=new n.default(t,a.id,a.typeSupported,s);try{(0,l.enableLogs)(s.debug)}catch(e){}r("init",null);break;case"demux":e.demuxer.push(new Uint8Array(a.data),a.audioCodec,a.videoCodec,a.timeOffset,a.cc,a.level,a.sn,a.duration,a.accurateTimeOffset)}}),t.on(o.default.FRAG_PARSING_INIT_SEGMENT,r),t.on(o.default.FRAG_PARSED,r),t.on(o.default.ERROR,r),t.on(o.default.FRAG_PARSING_METADATA,r),t.on(o.default.FRAG_PARSING_USERDATA,r),t.on(o.default.FRAG_PARSING_DATA,function(t,r){var i=r.data1.buffer,a=r.data2.buffer;delete r.data1,delete r.data2,e.postMessage({event:t,data:r,data1:i,data2:a},[i,a])})};r.default=h},{1:1,20:20,28:28,45:45}],22:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(28),o=i(s),l=e(20),u=i(l),d=e(21),h=i(d),f=e(45),c=e(16),v=i(c),g=e(26),p=function(){function t(r,i){a(this,t),this.hls=r,this.id=i;var n={mp4:MediaSource.isTypeSupported("video/mp4"),mp2t:r.config.enableMP2TPassThrough&&MediaSource.isTypeSupported("video/mp2t"),mpeg:MediaSource.isTypeSupported("audio/mpeg"),mp3:MediaSource.isTypeSupported('audio/mp4; codecs="mp3"')};if(r.config.enableWorker&&"undefined"!=typeof Worker){f.logger.log("demuxing in webworker");var s=void 0;try{var l=e(3);s=this.w=l(h.default),this.onwmsg=this.onWorkerMessage.bind(this),s.addEventListener("message",this.onwmsg),s.onerror=function(e){r.trigger(o.default.ERROR,{type:g.ErrorTypes.OTHER_ERROR,details:g.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:e.message+" ("+e.filename+":"+e.lineno+")"}})},s.postMessage({cmd:"init",typeSupported:n,id:i,config:JSON.stringify(r.config)})}catch(e){f.logger.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),s&&URL.revokeObjectURL(s.objectURL),this.demuxer=new u.default(r,i,n)}}else this.demuxer=new u.default(r,i,n);this.demuxInitialized=!0}return n(t,[{key:"destroy",value:function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var r=this.decrypter;r&&(r.destroy(),this.decrypter=null)}},{key:"pushDecrypted",value:function(e,t,r,i,a,n,s,o,l){var u=this.w;if(u)u.postMessage({cmd:"demux",data:e,audioCodec:t,videoCodec:r,timeOffset:i,cc:a,level:n,sn:s,duration:o,accurateTimeOffset:l},[e]);else{var d=this.demuxer;d&&d.push(new Uint8Array(e),t,r,i,a,n,s,o,l)}}},{key:"push",value:function(e,t,r,i,a,n,s,l,u,d){if(e.byteLength>0&&null!=u&&null!=u.key&&"AES-128"===u.method){null==this.decrypter&&(this.decrypter=new v.default(this.hls));var h=this,f=performance.now();this.decrypter.decrypt(e,u.key.buffer,u.iv.buffer,function(e){h.hls.trigger(o.default.FRAG_DECRYPTED,{level:n,sn:s,stats:{tstart:f,tdecrypt:performance.now()}}),h.pushDecrypted(e,t,r,i,a,n,s,l,d)})}else this.pushDecrypted(e,t,r,i,a,n,s,l,d)}},{key:"onWorkerMessage",value:function(e){var t=e.data,r=this.hls;switch(t.event){case"init":URL.revokeObjectURL(this.w.objectURL);break;case o.default.FRAG_PARSING_DATA:t.data.data1=new Uint8Array(t.data1),t.data.data2=new Uint8Array(t.data2);default:r.trigger(t.event,t.data)}}}]),t}();r.default=p},{16:16,20:20,21:21,26:26,28:28,3:3,45:45}],23:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(45),s=function(){function e(t){i(this,e),this.data=t,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}return a(e,[{key:"loadWord",value:function(){var e=this.data.byteLength-this.bytesAvailable,t=new Uint8Array(4),r=Math.min(4,this.bytesAvailable);if(0===r)throw new Error("no bytes available");t.set(this.data.subarray(e,e+r)),this.word=new DataView(t.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}},{key:"skipBits",value:function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t>>3,this.bytesAvailable-=t,
|
25 |
-
this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),t=e-t,t>0&&this.bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!==(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(e){var t,r,i=8,a=8;for(t=0;t<e;t++)0!==a&&(r=this.readEG(),a=(i+r+256)%256),i=0===a?i:a}},{key:"readSPS",value:function(){var e,t,r,i,a,n,s,o,l,u=0,d=0,h=0,f=0,c=1;if(this.readUByte(),e=this.readUByte(),t=this.readBits(5),this.skipBits(3),r=this.readUByte(),this.skipUEG(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var v=this.readUEG();if(3===v&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==v?8:12,l=0;l<o;l++)this.readBoolean()&&(l<6?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var g=this.readUEG();if(0===g)this.readUEG();else if(1===g)for(this.skipBits(1),this.skipEG(),this.skipEG(),i=this.readUEG(),l=0;l<i;l++)this.skipEG();if(this.skipUEG(),this.skipBits(1),a=this.readUEG(),n=this.readUEG(),s=this.readBits(1),0===s&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(u=this.readUEG(),d=this.readUEG(),h=this.readUEG(),f=this.readUEG()),this.readBoolean()&&this.readBoolean()){var p=void 0,y=this.readUByte();switch(y){case 1:p=[1,1];break;case 2:p=[12,11];break;case 3:p=[10,11];break;case 4:p=[16,11];break;case 5:p=[40,33];break;case 6:p=[24,11];break;case 7:p=[20,11];break;case 8:p=[32,11];break;case 9:p=[80,33];break;case 10:p=[18,11];break;case 11:p=[15,11];break;case 12:p=[64,33];break;case 13:p=[160,99];break;case 14:p=[4,3];break;case 15:p=[3,2];break;case 16:p=[2,1];break;case 255:p=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}p&&(c=p[0]/p[1])}return{width:Math.ceil((16*(a+1)-2*u-2*d)*c),height:(2-s)*(n+1)*16-(s?2:4)*(h+f)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();r.default=s},{45:45}],24:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(45),s=function(){function e(t){i(this,e),this._hasTimeStamp=!1;for(var r,a,s,o,l,u,d,h,f=0;;)if(d=this.readUTF(t,f,3),f+=3,"ID3"===d)f+=3,r=127&t[f++],a=127&t[f++],s=127&t[f++],o=127&t[f++],l=(r<<21)+(a<<14)+(s<<7)+o,u=f+l,this._parseID3Frames(t,f,u),f=u;else{if("3DI"!==d)return f-=3,h=f,void(h&&(this.hasTimeStamp||n.logger.warn("ID3 tag found, but no timestamp"),this._length=h,this._payload=t.subarray(0,h)));f+=7,n.logger.log("3DI footer found, end: "+f)}}return a(e,[{key:"readUTF",value:function(e,t,r){var i="",a=t,n=t+r;do i+=String.fromCharCode(e[a++]);while(a<n);return i}},{key:"_parseID3Frames",value:function(e,t,r){for(var i,a,s,o,l;t+8<=r;)switch(i=this.readUTF(e,t,4),t+=4,a=e[t++]<<24+e[t++]<<16+e[t++]<<8+e[t++],o=e[t++]<<8+e[t++],s=t,i){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(e,t,44)){t+=44,t+=4;var u=1&e[t++];this._hasTimeStamp=!0,l=((e[t++]<<23)+(e[t++]<<15)+(e[t++]<<7)+e[t++])/45,u&&(l+=47721858.84),l=Math.round(l),n.logger.trace("ID3 timestamp found: "+l),this._timeStamp=l}}}},{key:"hasTimeStamp",get:function(){return this._hasTimeStamp}},{key:"timeStamp",get:function(){return this._timeStamp}},{key:"length",get:function(){return this._length}},{key:"payload",get:function(){return this._payload}}]),e}();r.default=s},{45:45}],25:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(19),o=i(s),l=e(28),u=i(l),d=e(23),h=i(d),f=e(45),c=e(26),v=function(){function e(t,r,i,n,s){a(this,e),this.observer=t,this.id=r,this.remuxerClass=i,this.config=n,this.typeSupported=s,this.lastCC=0,this.remuxer=new this.remuxerClass(t,r,n,s)}return n(e,[{key:"switchLevel",value:function(){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack={container:"video/mp2t",type:"video",id:-1,sequenceNumber:0,samples:[],len:0,dropped:0},this._audioTrack={container:"video/mp2t",type:"audio",id:-1,sequenceNumber:0,samples:[],len:0,isAAC:!0},this._id3Track={type:"id3",id:-1,sequenceNumber:0,samples:[],len:0},this._txtTrack={type:"text",id:-1,sequenceNumber:0,samples:[],len:0},this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.remuxer.switchLevel()}},{key:"insertDiscontinuity",value:function(){this.switchLevel(),this.remuxer.insertDiscontinuity()}},{key:"push",value:function(e,t,r,i,a,n,s,o,l){var d,h,v,g,p,y,m=e.length,E=this.remuxer.passthrough,b=!1;this.audioCodec=t,this.videoCodec=r,this._duration=o,this.contiguous=!1,this.accurateTimeOffset=l,a!==this.lastCC&&(f.logger.log("discontinuity detected"),this.insertDiscontinuity(),this.lastCC=a),n!==this.lastLevel?(f.logger.log("level switch detected"),this.switchLevel(),this.lastLevel=n):s===this.lastSN+1&&(this.contiguous=!0),this.lastSN=s;var _=this.pmtParsed,R=this._avcTrack,k=this._audioTrack,T=this._id3Track,A=R.id,S=k.id,L=T.id,D=this._pmtId,w=R.pesData,O=k.pesData,P=T.pesData,C=this._parsePAT,I=this._parsePMT,M=this._parsePES,x=this._parseAVCPES.bind(this),F=this._parseAACPES.bind(this),N=this._parseMPEGPES.bind(this),U=this._parseID3PES.bind(this);for(m-=m%188,d=0;d<m;d+=188)if(71===e[d]){if(h=!!(64&e[d+1]),v=((31&e[d+1])<<8)+e[d+2],g=(48&e[d+3])>>4,g>1){if(p=d+5+e[d+4],p===d+188)continue}else p=d+4;switch(v){case A:if(h){if(w&&(y=M(w))&&(x(y,!1),E&&R.codec&&(S===-1||k.codec)))return void this.remux(n,s,e,i);w={data:[],size:0}}w&&(w.data.push(e.subarray(p,d+188)),w.size+=d+188-p);break;case S:if(h){if(O&&(y=M(O))&&(k.isAAC?F(y):N(y),E&&k.codec&&(A===-1||R.codec)))return void this.remux(n,s,e,i);O={data:[],size:0}}O&&(O.data.push(e.subarray(p,d+188)),O.size+=d+188-p);break;case L:h&&(P&&(y=M(P))&&U(y),P={data:[],size:0}),P&&(P.data.push(e.subarray(p,d+188)),P.size+=d+188-p);break;case 0:h&&(p+=e[p]+1),D=this._pmtId=C(e,p);break;case D:h&&(p+=e[p]+1);var G=I(e,p,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0);A=G.avc,A>0&&(R.id=A),S=G.audio,S>0&&(k.id=S,k.isAAC=G.isAAC),L=G.id3,L>0&&(T.id=L),b&&!_&&(f.logger.log("reparse from beginning"),b=!1,d=-188),_=this.pmtParsed=!0;break;case 17:case 8191:break;default:b=!0}}else this.observer.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,id:this.id,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});w&&(y=M(w))?(x(y,!0),R.pesData=null):R.pesData=w,O&&(y=M(O))?(k.isAAC?F(y):N(y),k.pesData=null):(O&&O.size&&f.logger.log("last AAC PES packet truncated,might overlap between fragments"),k.pesData=O),P&&(y=M(P))?(U(y),T.pesData=null):T.pesData=P,this.remux(n,s,null,i)}},{key:"remux",value:function(e,t,r,i){for(var a=this._avcTrack,n=a.samples,s=0,o=0,l=0;l<n.length;l++){for(var u=n[l],d=u.units.units,h=d.length,f=0,c=0;c<h;c++)f+=d[c].data.length;o+=f,s+=h,u.length=f}a.len=o,a.nbNalu=s,this.remuxer.remux(e,t,this._audioTrack,this._avcTrack,this._id3Track,this._txtTrack,i,this.contiguous,this.accurateTimeOffset,r)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){return(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(e,t,r){var i,a,n,s,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(i=(15&e[t+1])<<8|e[t+2],a=t+3+i-4,n=(15&e[t+10])<<8|e[t+11],t+=12+n;t<a;){switch(s=(31&e[t+1])<<8|e[t+2],e[t]){case 15:o.audio===-1&&(o.audio=s);break;case 21:o.id3===-1&&(o.id3=s);break;case 27:o.avc===-1&&(o.avc=s);break;case 3:case 4:r?o.audio===-1&&(o.audio=s,o.isAAC=!1):f.logger.log("MPEG audio found, not supported in this browser for now");break;case 36:f.logger.warn("HEVC stream type found, not supported for now");break;default:f.logger.log("unkown stream type:"+e[t])}t+=((15&e[t+3])<<8|e[t+4])+5}return o}},{key:"_parsePES",value:function(e){var t,r,i,a,n,s,o,l,u,d=0,h=e.data;if(!e||0===e.size)return null;for(;h[0].length<19&&h.length>1;){var f=new Uint8Array(h[0].length+h[1].length);f.set(h[0]),f.set(h[1],h[0].length),h[0]=f,h.splice(1,1)}if(t=h[0],i=(t[0]<<16)+(t[1]<<8)+t[2],1===i){if(a=(t[4]<<8)+t[5],a&&a>e.size-6)return null;for(r=t[7],192&r&&(o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,o>4294967295&&(o-=8589934592),64&r?(l=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,l>4294967295&&(l-=8589934592)):l=o),n=t[8],u=n+9,e.size-=u,s=new Uint8Array(e.size);h.length;){t=h.shift();var c=t.byteLength;if(u){if(u>c){u-=c;continue}t=t.subarray(u),c-=u,u=0}s.set(t,d),d+=c}return a&&(a-=n+3),{data:s,pts:o,dts:l,len:a}}return null}},{key:"pushAccesUnit",value:function(e,t){e.units.units.length&&e.frame&&(!this.config.forceKeyFrameOnDiscontinuity||e.key===!0||t.sps&&(t.samples.length||this.contiguous)?t.samples.push(e):t.dropped++),e.debug.length&&f.logger.log(e.pts+"/"+e.dts+":"+e.debug+","+e.units.length)}},{key:"_parseAVCPES",value:function(e,t){var r,i,a,n=this,s=this._avcTrack,o=this._parseAVCNALu(e.data),l=!1,u=this.avcSample;e.data=null,o.forEach(function(t){switch(t.type){case 1:i=!0,l&&u&&(u.debug+="NDR "),u.frame=!0;break;case 5:i=!0,u||(u=n.avcSample=n._createAVCSample(!0,e.pts,e.dts,"")),l&&(u.debug+="IDR "),u.key=!0,u.frame=!0;break;case 6:i=!0,l&&u&&(u.debug+="SEI "),r=new h.default(n.discardEPB(t.data)),r.readUByte();for(var o=0,d=0,f=!1,c=0;!f&&r.bytesAvailable>1;){o=0;do c=r.readUByte(),o+=c;while(255===c);d=0;do c=r.readUByte(),d+=c;while(255===c);if(4===o&&0!==r.bytesAvailable){f=!0;var v=r.readUByte();if(181===v){var g=r.readUShort();if(49===g){var p=r.readUInt();if(1195456820===p){var y=r.readUByte();if(3===y){var m=r.readUByte(),E=r.readUByte(),b=31&m,_=[m,E];for(a=0;a<b;a++)_.push(r.readUByte()),_.push(r.readUByte()),_.push(r.readUByte());n._insertSampleInOrder(n._txtTrack.samples,{type:3,pts:e.pts,bytes:_})}}}}}else if(d<r.bytesAvailable)for(a=0;a<d;a++)r.readUByte()}break;case 7:if(i=!0,l&&u&&(u.debug+="SPS "),!s.sps){r=new h.default(t.data);var R=r.readSPS();s.width=R.width,s.height=R.height,s.sps=[t.data],s.duration=n._duration;var k=t.data.subarray(1,4),T="avc1.";for(a=0;a<3;a++){var A=k[a].toString(16);A.length<2&&(A="0"+A),T+=A}s.codec=T}break;case 8:i=!0,l&&u&&(u.debug+="PPS "),s.pps||(s.pps=[t.data]);break;case 9:i=!1,u&&n.pushAccesUnit(u,s),u=n.avcSample=n._createAVCSample(!1,e.pts,e.dts,l?"AUD ":"");break;case 12:i=!1;break;default:i=!1,u&&(u.debug+="unknown NAL "+t.type+" ")}if(u&&i){var S=u.units;S.units.push(t)}}),t&&u&&(this.pushAccesUnit(u,s),this.avcSample=null)}},{key:"_createAVCSample",value:function(e,t,r,i){return{key:e,pts:t,dts:r,units:{units:[],length:0},debug:i}}},{key:"_insertSampleInOrder",value:function(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var i=r-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}else e.push(t)}},{key:"_getLastNalUnit",value:function(){var e=this.avcSample,t=void 0;if(!e||0===e.units.units.length){var r=this._avcTrack,i=r.samples;e=i[i.length-1]}if(e){var a=e.units.units;t=a[a.length-1]}return t}},{key:"_parseAVCNALu",value:function(e){for(var t,r,i,a,n,s=0,o=e.byteLength,l=this._avcTrack,u=l.naluState||0,d=u,h=[],f=-1;s<o;)switch(t=e[s++],u){case 0:0===t&&(u=1);break;case 1:u=0===t?2:0;break;case 2:case 3:if(0===t)u=3;else if(1===t){if(f>=0)i={data:e.subarray(f,s-u-1),type:n},h.push(i);else{var c=this._getLastNalUnit();if(c&&(d&&s<=4-d&&c.state&&(c.data=c.data.subarray(0,c.data.byteLength-d)),r=s-u-1,r>0)){var v=new Uint8Array(c.data.byteLength+r);v.set(c.data,0),v.set(e.subarray(0,r),c.data.byteLength),c.data=v}}s<o?(a=31&e[s],f=s,n=a,u=0):u=-1}else u=0;break;case-1:f=0,n=31&t,u=0}if(f>=0&&u>=0&&(i={data:e.subarray(f,o),type:n,state:u},h.push(i)),0===h.length){var g=this._getLastNalUnit();if(g){var p=new Uint8Array(g.data.byteLength+e.byteLength);p.set(g.data,0),p.set(e,g.data.byteLength),g.data=p}}return l.naluState=u,h}},{key:"discardEPB",value:function(e){for(var t,r,i=e.byteLength,a=[],n=1;n<i-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(a.push(n+2),n+=2):n++;if(0===a.length)return e;t=i-a.length,r=new Uint8Array(t);var s=0;for(n=0;n<t;s++,n++)s===a[0]&&(s++,a.shift()),r[n]=e[s];return r}},{key:"_parseAACPES",value:function(e){var t,r,i,a,n,s,l,d,h,v=this._audioTrack,g=e.data,p=e.pts,y=0,m=this.aacOverFlow,E=this.aacLastPTS;if(m){var b=new Uint8Array(m.byteLength+g.byteLength);b.set(m,0),b.set(g,m.byteLength),g=b}for(n=y,d=g.length;n<d-1&&(255!==g[n]||240!==(240&g[n+1]));n++);if(n){var _,R;if(n<d-1?(_="AAC PES did not start with ADTS header,offset:"+n,R=!1):(_="no ADTS header found in AAC PES",R=!0),f.logger.warn("parsing error:"+_),this.observer.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,id:this.id,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:R,reason:_}),R)return}if(v.audiosamplerate||(t=o.default.getAudioConfig(this.observer,g,n,this.audioCodec),v.config=t.config,v.audiosamplerate=t.samplerate,v.channelCount=t.channelCount,v.codec=t.codec,v.duration=this._duration,f.logger.log("parsed codec:"+v.codec+",rate:"+t.samplerate+",nb channel:"+t.channelCount)),a=0,i=9216e4/v.audiosamplerate,m&&E){var k=E+i;Math.abs(k-p)>1&&(f.logger.log("AAC: align PTS for overlapping frames by "+Math.round((k-p)/90)),p=k)}for(;n+5<d&&(s=1&g[n+1]?7:9,r=(3&g[n+3])<<11|g[n+4]<<3|(224&g[n+5])>>>5,r-=s,r>0&&n+s+r<=d);)for(l=p+a*i,h={unit:g.subarray(n+s,n+s+r),pts:l,dts:l},v.samples.push(h),v.len+=r,n+=r+s,a++;n<d-1&&(255!==g[n]||240!==(240&g[n+1]));n++);m=n<d?g.subarray(n,d):null,this.aacOverFlow=m,this.aacLastPTS=l}},{key:"_parseMPEGPES",value:function(e){for(var t,r=e.data,i=e.pts,a=r.length,n=0,s=0;s<a&&(t=this._parseMpeg(r,s,a,n++,i))>0;)s+=t}},{key:"_onMpegFrame",value:function(e,t,r,i,a,n){var s=1152/r*1e3,o=n+a*s,l=this._audioTrack;l.config=[],l.channelCount=i,l.audiosamplerate=r,l.duration=this._duration,l.samples.push({unit:e,pts:o,dts:o}),l.len+=e.length}},{key:"_onMpegNoise",value:function(e){f.logger.warn("mpeg audio has noise: "+e.length+" bytes")}},{key:"_parseMpeg",value:function(e,t,r,i,a){var n=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],s=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3];if(t+2>r)return-1;if(255===e[t]||224===(224&e[t+1])){if(t+24>r)return-1;var o=e[t+1]>>3&3,l=e[t+1]>>1&3,u=e[t+2]>>4&15,d=e[t+2]>>2&3,h=!!(2&e[t+2]);if(1!==o&&0!==u&&15!==u&&3!==d){var f=3===o?3-l:3===l?3:4,c=1e3*n[14*f+u-1],v=3===o?0:2===o?1:2,g=s[3*v+d],p=h?1:0,y=e[t+3]>>6===3?1:2,m=3===l?(3===o?12:6)*c/g+p<<2:(3===o?144:72)*c/g+p|0;return t+m>r?-1:(this._onMpegFrame&&this._onMpegFrame(e.subarray(t,t+m),c,g,y,i,a),m)}}for(var E=t+2;E<r;){if(255===e[E-1]&&224===(224&e[E]))return this._onMpegNoise&&this._onMpegNoise(e.subarray(t,E-1)),E-t-1;E++}return-1}},{key:"_parseID3PES",value:function(e){this._id3Track.samples.push(e)}}],[{key:"probe",value:function(e){return e.length>=564&&71===e[0]&&71===e[188]&&71===e[376]}}]),e}();r.default=v},{19:19,23:23,26:26,28:28,45:45}],26:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},r.ErrorDetails={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],27:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),o=e(45),l=e(26),u=e(28),d=i(u),h=function(){function e(t){a(this,e),this.hls=t,this.onEvent=this.onEvent.bind(this);for(var r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];this.handledEvents=i,this.useGenericHandler=!0,this.registerListeners()}return s(e,[{key:"destroy",value:function(){this.unregisterListeners()}},{key:"isEventHandler",value:function(){return"object"===n(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if("hlsEventGeneric"===e)throw new Error("Forbidden event name: "+e);this.hls.on(e,this.onEvent)}.bind(this))}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)}.bind(this))}},{key:"onEvent",value:function(e,t){this.onEventGeneric(e,t)}},{key:"onEventGeneric",value:function(e,t){var r=function(e,t){var r="on"+e.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,t)};try{r.call(this,e,t).call()}catch(t){o.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(d.default.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();r.default=h},{26:26,28:28,45:45}],28:[function(e,t,r){"use strict";t.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVEL_SWITCH:"hlsLevelSwitch",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCH:"hlsAudioTrackSwitch",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},{}],29:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(){i(this,e)}return a(e,null,[{key:"getSilentFrame",value:function(e){return 1===e?new Uint8Array([0,200,0,128,35,128]):2===e?new Uint8Array([33,0,73,144,2,25,0,35,128]):3===e?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]):4===e?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]):5===e?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]):6===e?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]):null}}]),e}();r.default=n},{}],30:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(){i(this,e)}return a(e,null,[{key:"isBuffered",value:function(e,t){if(e)for(var r=e.buffered,i=0;i<r.length;i++)if(t>=r.start(i)&&t<=r.end(i))return!0;return!1}},{key:"bufferInfo",value:function(e,t,r){if(e){var i,a=e.buffered,n=[];for(i=0;i<a.length;i++)n.push({start:a.start(i),end:a.end(i)});return this.bufferedInfo(n,t,r)}return{len:0,start:0,end:0,nextStart:void 0}}},{key:"bufferedInfo",value:function(e,t,r){var i,a,n,s,o,l=[];for(e.sort(function(e,t){var r=e.start-t.start;return r?r:t.end-e.end}),o=0;o<e.length;o++){var u=l.length;if(u){var d=l[u-1].end;e[o].start-d<r?e[o].end>d&&(l[u-1].end=e[o].end):l.push(e[o])}else l.push(e[o])}for(o=0,i=0,a=n=t;o<l.length;o++){var h=l[o].start,f=l[o].end;if(t+r>=h&&t<f)a=h,n=f,i=n-t;else if(t+r<h){s=h;break}}return{len:i,start:a,end:n,nextStart:s}}}]),e}();r.default=n},{}],31:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(45),s=function(){function e(){i(this,e)}return a(e,null,[{key:"mergeDetails",value:function(t,r){var i,a=Math.max(t.startSN,r.startSN)-r.startSN,s=Math.min(t.endSN,r.endSN)-r.startSN,o=r.startSN-t.startSN,l=t.fragments,u=r.fragments,d=0;if(s<a)return void(r.PTSKnown=!1);for(var h=a;h<=s;h++){var f=l[o+h],c=u[h];c&&f&&(d=f.cc-c.cc,isNaN(f.startPTS)||(c.start=c.startPTS=f.startPTS,c.endPTS=f.endPTS,c.duration=f.duration,i=c))}if(d)for(n.logger.log("discontinuity sliding from playlist, take drift into account"),h=0;h<u.length;h++)u[h].cc+=d;if(i)e.updateFragPTSDTS(r,i.sn,i.startPTS,i.endPTS,i.startDTS,i.endDTS);else if(o>=0&&o<l.length){var v=l[o].start;for(h=0;h<u.length;h++)u[h].start+=v}r.PTSKnown=t.PTSKnown}},{key:"updateFragPTSDTS",value:function(t,r,i,a,n,s){var o,l,u,d;if(r<t.startSN||r>t.endSN)return 0;if(o=r-t.startSN,l=t.fragments,u=l[o],!isNaN(u.startPTS)){var h=Math.abs(u.startPTS-i);isNaN(u.deltaPTS)?u.deltaPTS=h:u.deltaPTS=Math.max(h,u.deltaPTS),i=Math.min(i,u.startPTS),a=Math.max(a,u.endPTS),n=Math.min(n,u.startDTS),s=Math.max(s,u.endDTS)}var f=i-u.start;for(u.start=u.startPTS=i,u.endPTS=a,u.startDTS=n,u.endDTS=s,u.duration=a-i,d=o;d>0;d--)e.updatePTS(l,d,d-1);for(d=o;d<l.length-1;d++)e.updatePTS(l,d,d+1);return t.PTSKnown=!0,f}},{key:"updatePTS",value:function(e,t,r){var i=e[t],a=e[r],s=a.startPTS;isNaN(s)?r>t?a.start=i.start+i.duration:a.start=i.start-a.duration:r>t?(i.duration=s-i.start,i.duration<0&&n.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(a.duration=i.start-s,a.duration<0&&n.logger.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!"))}}]),e}();r.default=s},{45:45}],32:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(28),o=i(s),l=e(26),u=e(36),d=i(u),h=e(34),f=i(h),c=e(4),v=i(c),g=e(7),p=i(g),y=e(8),m=i(y),E=e(5),b=i(E),_=e(12),R=i(_),k=e(11),T=i(k),A=e(13),S=i(A),L=e(10),D=i(L),w=e(6),O=i(w),P=e(45),C=e(48),I=i(C),M=e(1),x=i(M),F=e(35),N=i(F),U=e(43),G=i(U),B=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var r=e.DefaultConfig;if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var i in r)i in t||(t[i]=r[i]);if(void 0!==t.liveMaxLatencyDurationCount&&t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(t.liveMaxLatencyDuration<=t.liveSyncDuration||void 0===t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');(0,P.enableLogs)(t.debug),this.config=t;var n=this.observer=new x.default;n.trigger=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];n.emit.apply(n,[e,e].concat(r))},n.off=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];n.removeListener.apply(n,[e].concat(r))},this.on=n.on.bind(n),this.off=n.off.bind(n),this.trigger=n.trigger.bind(n),this.playlistLoader=new d.default(this),this.fragmentLoader=new f.default(this),this.levelController=new T.default(this),this.abrController=new t.abrController(this),this.bufferController=new t.bufferController(this),this.capLevelController=new t.capLevelController(this),this.fpsController=new t.fpsController(this),this.streamController=new t.streamController(this),this.audioStreamController=new t.audioStreamController(this),this.timelineController=new t.timelineController(this),this.audioTrackController=new O.default(this),this.keyLoader=new N.default(this)}return n(e,null,[{key:"isSupported",value:function(){return window.MediaSource=window.MediaSource||window.WebKitMediaSource,window.MediaSource&&"function"==typeof window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"version",get:function(){return"0.6.11"}},{key:"Events",get:function(){return o.default}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return e.defaultConfig||(e.defaultConfig={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,stalledInBufferedNudgeThreshold:10,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:I.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,fetchSetup:void 0,abrController:v.default,bufferController:p.default,capLevelController:m.default,fpsController:D.default,streamController:R.default,audioStreamController:b.default,timelineController:S.default,cueHandler:G.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1,stretchShortVideoTrack:!1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0}),e.defaultConfig},set:function(t){e.defaultConfig=t}}]),n(e,[{key:"destroy",value:function(){P.logger.log("destroy"),this.trigger(o.default.DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.fpsController.destroy(),this.streamController.destroy(),this.audioStreamController.destroy(),this.timelineController.destroy(),this.audioTrackController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(e){P.logger.log("attachMedia"),this.media=e,this.trigger(o.default.MEDIA_ATTACHING,{media:e})}},{key:"detachMedia",value:function(){P.logger.log("detachMedia"),this.trigger(o.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(e){P.logger.log("loadSource:"+e),this.url=e,this.trigger(o.default.MANIFEST_LOADING,{url:e})}},{key:"startLoad",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;P.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(e),this.audioStreamController.startLoad(e)}},{key:"stopLoad",value:function(){P.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad(),this.audioStreamController.stopLoad()}},{key:"swapAudioCodec",value:function(){P.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec();
|
26 |
-
}},{key:"recoverMediaError",value:function(){P.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),this.attachMedia(e)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){P.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){P.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){P.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.abrController.minAutoLevel)},set:function(e){P.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){P.logger.log("set startLevel:"+e);var t=this.abrController.minAutoLevel;this.levelController.startLevel=Math.max(e,t)}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(e){P.logger.log("set autoLevelCapping:"+e),this.abrController.autoLevelCapping=e}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"audioTracks",get:function(){return this.audioTrackController.audioTracks}},{key:"audioTrack",get:function(){return this.audioTrackController.audioTrack},set:function(e){this.audioTrackController.audioTrack=e}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}}]),e}();r.default=B},{1:1,10:10,11:11,12:12,13:13,26:26,28:28,34:34,35:35,36:36,4:4,43:43,45:45,48:48,5:5,6:6,7:7,8:8}],33:[function(e,t,r){"use strict";t.exports=e(32).default},{32:32}],34:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(26),c=e(45),v=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.FRAG_LOADING));return r.loaders={},r}return s(t,e),o(t,[{key:"destroy",value:function(){var e=this.loaders;for(var t in e){var r=e[t];r&&r.destroy()}this.loaders={},h.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(e){var t=e.frag,r=t.type,i=this.loaders[r],a=this.hls.config;t.loaded=0,i&&(c.logger.warn("abort previous fragment loader for type:"+r),i.abort()),i=this.loaders[r]=t.loader="undefined"!=typeof a.fLoader?new a.fLoader(a):new a.loader(a);var n=void 0,s=void 0,o=void 0;n={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var l=t.byteRangeStartOffset,u=t.byteRangeEndOffset;isNaN(l)||isNaN(u)||(n.rangeStart=l,n.rangeEnd=u),s={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout},o={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},i.load(n,s,o)}},{key:"loadsuccess",value:function(e,t,r){var i=e.data,a=r.frag;a.loader=void 0,this.loaders[a.type]=void 0,this.hls.trigger(u.default.FRAG_LOADED,{payload:i,frag:a,stats:t})}},{key:"loaderror",value:function(e,t){var r=t.loader;r&&r.abort(),this.loaders[t.type]=void 0,this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e})}},{key:"loadtimeout",value:function(e,t){var r=t.loader;r&&r.abort(),this.loaders[t.type]=void 0,this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag})}},{key:"loadprogress",value:function(e,t,r){var i=t.frag;i.loaded=e.loaded,this.hls.trigger(u.default.FRAG_LOAD_PROGRESS,{frag:i,stats:e})}}]),t}(h.default);r.default=v},{26:26,27:27,28:28,45:45}],35:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(26),c=e(45),v=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.KEY_LOADING));return r.loaders={},r.decryptkey=null,r.decrypturl=null,r}return s(t,e),o(t,[{key:"destroy",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},h.default.prototype.destroy.call(this)}},{key:"onKeyLoading",value:function(e){var t=e.frag,r=t.type,i=this.loaders[r],a=t.decryptdata,n=a.uri;if(n!==this.decrypturl||null===this.decryptkey){var s=this.hls.config;i&&(c.logger.warn("abort previous key loader for type:"+r),i.abort()),t.loader=this.loaders[r]=new s.loader(s),this.decrypturl=n,this.decryptkey=null;var o=void 0,l=void 0,d=void 0;o={url:n,frag:t,responseType:"arraybuffer"},l={timeout:s.fragLoadingTimeOut,maxRetry:s.fragLoadingMaxRetry,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},t.loader.load(o,l,d)}else this.decryptkey&&(a.key=this.decryptkey,this.hls.trigger(u.default.KEY_LOADED,{frag:t}))}},{key:"loadsuccess",value:function(e,t,r){var i=r.frag;this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=void 0,this.loaders[i.type]=void 0,this.hls.trigger(u.default.KEY_LOADED,{frag:i})}},{key:"loaderror",value:function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),this.loaders[t.type]=void 0,this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})}},{key:"loadtimeout",value:function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),this.loaders[t.type]=void 0,this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})}}]),t}(h.default);r.default=v},{26:26,27:27,28:28,45:45}],36:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(2),u=i(l),d=e(28),h=i(d),f=e(27),c=i(f),v=e(26),g=e(40),p=i(g),y=e(45),m=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,E=/#EXT-X-MEDIA:(.*)/g,b=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT(INF): *(\d+(?:\.\d+)?)(?:,(.*))?)|(?:(?!#)()(\S.+))|(?:#EXT-X-(BYTERANGE): *(\d+(?:@\d+(?:\.\d+)?)?)|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g,_=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,h.default.MANIFEST_LOADING,h.default.LEVEL_LOADING,h.default.AUDIO_TRACK_LOADING));return r.loaders={},r}return s(t,e),o(t,[{key:"destroy",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},c.default.prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(e){this.load(e.url,{type:"manifest"})}},{key:"onLevelLoading",value:function(e){this.load(e.url,{type:"level",level:e.level,id:e.id})}},{key:"onAudioTrackLoading",value:function(e){this.load(e.url,{type:"audioTrack",id:e.id})}},{key:"load",value:function(e,t){var r=this.loaders[t.type];if(r){var i=r.context;if(i&&i.url===e)return void y.logger.trace("playlist request ongoing");y.logger.warn("abort previous loader for type:"+t.type),r.abort()}var a=this.hls.config,n=void 0,s=void 0,o=void 0,l=void 0;"manifest"===t.type?(n=a.manifestLoadingMaxRetry,s=a.manifestLoadingTimeOut,o=a.manifestLoadingRetryDelay,l=a.manifestLoadingMaxRetryTimeout):(n=a.levelLoadingMaxRetry,s=a.levelLoadingTimeOut,o=a.levelLoadingRetryDelay,l=a.levelLoadingMaxRetryTimeout,y.logger.log("loading playlist for level "+t.level)),r=this.loaders[t.type]=t.loader="undefined"!=typeof a.pLoader?new a.pLoader(a):new a.loader(a),t.url=e,t.responseType="";var u=void 0,d=void 0;u={timeout:s,maxRetry:n,retryDelay:o,maxRetryDelay:l},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},r.load(t,u,d)}},{key:"resolve",value:function(e,t){return u.default.buildAbsoluteURL(t,e)}},{key:"parseMasterPlaylist",value:function(e,t){var r=[],i=void 0;for(m.lastIndex=0;null!=(i=m.exec(e));){var a={},n=a.attrs=new p.default(i[1]);a.url=this.resolve(i[2],t);var s=n.decimalResolution("RESOLUTION");s&&(a.width=s.width,a.height=s.height),a.bitrate=n.decimalInteger("AVERAGE-BANDWIDTH")||n.decimalInteger("BANDWIDTH"),a.name=n.NAME;var o=n.CODECS;if(o){o=o.split(/[ ,]+/);for(var l=0;l<o.length;l++){var u=o[l];u.indexOf("avc1")!==-1?a.videoCodec=this.avc1toavcoti(u):a.audioCodec=u}}r.push(a)}return r}},{key:"parseMasterPlaylistMedia",value:function(e,t,r){var i=void 0,a=[];for(E.lastIndex=0;null!=(i=E.exec(e));){var n={},s=new p.default(i[1]);s.TYPE===r&&(n.groupId=s["GROUP-ID"],n.name=s.NAME,n.type=r,n.default="YES"===s.DEFAULT,n.autoselect="YES"===s.AUTOSELECT,n.forced="YES"===s.FORCED,s.URI&&(n.url=this.resolve(s.URI,t)),n.lang=s.LANGUAGE,n.name||(n.name=n.lang),a.push(n))}return a}},{key:"createInitializationVector",value:function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}},{key:"fragmentDecryptdataFromLevelkey",value:function(e,t){var r=e;return e&&e.method&&e.uri&&!e.iv&&(r=this.cloneObj(e),r.iv=this.createInitializationVector(t)),r}},{key:"avc1toavcoti",value:function(e){var t,r=e.split(".");return r.length>2?(t=r.shift()+".",t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):t=e,t}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(e,t,r,i){var a,n,s=0,o=0,l={type:null,version:null,url:t,fragments:[],live:!0,startSN:0},u={method:null,key:null,iv:null,uri:null},d=0,h=null,f=null,c=null,v=null,g=null,m=null,E=[];for(b.lastIndex=0;null!==(n=b.exec(e));)switch(n.shift(),n=n.filter(function(e){return void 0!==e}),n[0]){case"PLAYLIST-TYPE":l.type=n[1].toUpperCase();break;case"MEDIA-SEQUENCE":s=l.startSN=parseInt(n[1]);break;case"TARGETDURATION":l.targetduration=parseFloat(n[1]);break;case"VERSION":l.version=parseInt(n[1]);break;case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"DIS":d++,E.push(n);break;case"DISCONTINUITY-SEQ":d=parseInt(n[1]);break;case"BYTERANGE":var _=n[1].split("@");m=1===_.length?g:parseInt(_[1]),g=parseInt(_[0])+m;break;case"INF":c=parseFloat(n[1]),v=n[2]?n[2]:null,E.push(n);break;case"":if(!isNaN(c)){var R=s++;a=this.fragmentDecryptdataFromLevelkey(u,R);var k=n[1]?this.resolve(n[1],t):null;f={url:k,type:i,duration:c,title:v,start:o,sn:R,level:r,cc:d,decryptdata:a,programDateTime:h,tagList:E},null!==m&&(f.byteRangeStartOffset=m,f.byteRangeEndOffset=g),l.fragments.push(f),o+=c,c=null,v=null,m=null,h=null,E=[]}break;case"KEY":var T=n[1],A=new p.default(T),S=A.enumeratedString("METHOD"),L=A.URI,D=A.hexadecimalInteger("IV");S&&(u={method:null,key:null,iv:null,uri:null},L&&"AES-128"===S&&(u.method=S,u.uri=this.resolve(L,t),u.key=null,u.iv=D));break;case"START":var w=n[1],O=new p.default(w),P=O.decimalFloatingPoint("TIME-OFFSET");isNaN(P)||(l.startTimeOffset=P);break;case"PROGRAM-DATE-TIME":h=new Date(Date.parse(n[1])),E.push(n);break;case"#":n.shift(),E.push(n);break;default:y.logger.warn("line parsed but not handled: "+n)}return f&&!f.url&&(l.fragments.pop(),o-=f.duration),l.totalduration=o,l.averagetargetduration=o/l.fragments.length,l.endSN=s-1,l}},{key:"loadsuccess",value:function(e,t,r){var i=e.data,a=e.url,n=r.type,s=r.id,o=r.level,l=this.hls;if(this.loaders[n]=void 0,void 0!==a&&0!==a.indexOf("data:")||(a=r.url),t.tload=performance.now(),0===i.indexOf("#EXTM3U"))if(i.indexOf("#EXTINF:")>0){var u="audioTrack"!==n,d=this.parseLevelPlaylist(i,a,(u?o:s)||0,u?"main":"audio");"manifest"===n&&l.trigger(h.default.MANIFEST_LOADED,{levels:[{url:a,details:d}],audioTracks:[],url:a,stats:t}),t.tparsed=performance.now(),d.targetduration?u?l.trigger(h.default.LEVEL_LOADED,{details:d,level:o||0,id:s||0,stats:t}):l.trigger(h.default.AUDIO_TRACK_LOADED,{details:d,id:s,stats:t}):l.trigger(h.default.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:a,reason:"invalid targetduration"})}else{var f=this.parseMasterPlaylist(i,a);if(f.length){var c=this.parseMasterPlaylistMedia(i,a,"AUDIO");if(c.length){var g=!1;c.forEach(function(e){e.url||(g=!0)}),g===!1&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(y.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),c.unshift({type:"main",name:"main"}))}l.trigger(h.default.MANIFEST_LOADED,{levels:f,audioTracks:c,url:a,stats:t})}else l.trigger(h.default.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:a,reason:"no level found in manifest"})}else l.trigger(h.default.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:a,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(e,t){var r,i,a=t.loader;switch(t.type){case"manifest":r=v.ErrorDetails.MANIFEST_LOAD_ERROR,i=!0;break;case"level":r=v.ErrorDetails.LEVEL_LOAD_ERROR,i=!1;break;case"audioTrack":r=v.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,i=!1}a&&(a.abort(),this.loaders[t.type]=void 0),this.hls.trigger(h.default.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:a.url,loader:a,response:e,context:t})}},{key:"loadtimeout",value:function(e,t){var r,i,a=t.loader;switch(t.type){case"manifest":r=v.ErrorDetails.MANIFEST_LOAD_TIMEOUT,i=!0;break;case"level":r=v.ErrorDetails.LEVEL_LOAD_TIMEOUT,i=!1;break;case"audioTrack":r=v.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT,i=!1}a&&(a.abort(),this.loaders[t.type]=void 0),this.hls.trigger(h.default.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:a.url,loader:a,context:t})}}]),t}(c.default);r.default=_},{2:2,26:26,27:27,28:28,40:40,45:45}],37:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(){i(this,e)}return a(e,null,[{key:"init",value:function(){e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var t;for(t in e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:i};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=n,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,l,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,a))}},{key:"box",value:function(e){for(var t,r=Array.prototype.slice.call(arguments,1),i=8,a=r.length,n=a;a--;)i+=r[a].byteLength;for(t=new Uint8Array(i),t[0]=i>>24&255,t[1]=i>>16&255,t[2]=i>>8&255,t[3]=255&i,t.set(e,4),a=0,i=8;a<n;a++)t.set(r[a],i),i+=r[a].byteLength;return t}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return r*=t,e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))}},{key:"moov",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(i))}},{key:"mvhd",value:function(t,r){r*=t;var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,i)}},{key:"sdtp",value:function(t){var r,i,a=t.samples||[],n=new Uint8Array(4+a.length);for(i=0;i<a.length;i++)r=a[i].flags,n[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,n)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var r,i,a,n=[],s=[];for(r=0;r<t.sps.length;r++)i=t.sps[r],a=i.byteLength,n.push(a>>>8&255),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)i=t.pps[r],a=i.byteLength,s.push(a>>>8&255),s.push(255&a),s=s.concat(Array.prototype.slice.call(i));var o=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(s))),l=t.width,u=t.height;return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"mp3",value:function(t){var r=t.audiosamplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))}},{key:"stsd",value:function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,i=t.duration*t.timescale,a=t.width,n=t.height;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,n>>8&255,255&n,0,0]))}},{key:"traf",value:function(t,r){var i=e.sdtp(t),a=t.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.trun(t,i.length+16+16+8+16+8+8),i)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,r){var i,a,n,s,o,l,u=t.samples||[],d=u.length,h=12+16*d,f=new Uint8Array(h);for(r+=8+h,f.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<d;i++)a=u[i],n=a.duration,s=a.size,o=a.flags,l=a.cts,f.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,f)}},{key:"initSegment",value:function(t){e.types||e.init();var r,i=e.moov(t);return r=new Uint8Array(e.FTYP.byteLength+i.byteLength),r.set(e.FTYP),r.set(i,e.FTYP.byteLength),r}}]),e}();r.default=n},{}],38:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(29),o=i(s),l=e(28),u=i(l),d=e(45),h=e(37),f=i(h),c=e(26);e(46);var v=function(){function e(t,r,i,n){a(this,e),this.observer=t,this.id=r,this.config=i,this.typeSupported=n,this.ISGenerated=!1,this.PES2MP4SCALEFACTOR=4,this.PES_TIMESCALE=9e4,this.MP4_TIMESCALE=this.PES_TIMESCALE/this.PES2MP4SCALEFACTOR}return n(e,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){this._initPTS=this._initDTS=void 0}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(e,t,r,i,a,n,s,o,l){if(this.level=e,this.sn=t,this.ISGenerated||this.generateIS(r,i,s),this.ISGenerated)if(r.samples.length){var d=this.remuxAudio(r,s,o,l);if(i.samples.length){var h=void 0;d&&(h=d.endPTS-d.startPTS),this.remuxVideo(i,s,o,h)}}else{var f=void 0;i.samples.length&&(f=this.remuxVideo(i,s,o)),f&&r.codec&&this.remuxEmptyAudio(r,s,o,f)}a.samples.length&&this.remuxID3(a,s),n.samples.length&&this.remuxText(n,s),this.observer.trigger(u.default.FRAG_PARSED,{id:this.id,level:this.level,sn:this.sn})}},{key:"generateIS",value:function(e,t,r){var i,a,n=this.observer,s=e.samples,o=t.samples,l=this.PES_TIMESCALE,h=this.typeSupported,v="audio/mp4",g={},p={id:this.id,level:this.level,sn:this.sn,tracks:g,unique:!1},y=void 0===this._initPTS;y&&(i=a=1/0),e.config&&s.length&&(e.timescale=e.audiosamplerate,e.timescale*e.duration>Math.pow(2,32)&&!function(){var t=function e(t,r){return r?e(r,t%r):t};e.timescale=e.audiosamplerate/t(e.audiosamplerate,e.isAAC?1024:1152)}(),d.logger.log("audio mp4 timescale :"+e.timescale),e.isAAC||(h.mpeg===!0?(v="audio/mpeg",e.codec=""):h.mp3===!0&&(e.codec="mp3")),g.audio={container:v,codec:e.codec,initSegment:f.default.initSegment([e]),metadata:{channelCount:e.channelCount}},y&&(i=a=s[0].pts-l*r)),t.sps&&t.pps&&o.length&&(t.timescale=this.MP4_TIMESCALE,g.video={container:"video/mp4",codec:t.codec,initSegment:f.default.initSegment([t]),metadata:{width:t.width,height:t.height}},y&&(i=Math.min(i,o[0].pts-l*r),a=Math.min(a,o[0].dts-l*r))),Object.keys(g).length?(n.trigger(u.default.FRAG_PARSING_INIT_SEGMENT,p),this.ISGenerated=!0,y&&(this._initPTS=i,this._initDTS=a)):n.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,id:this.id,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(e,t,r,i){var a,n,s,o,l,h,c,v,g=8,p=this.PES_TIMESCALE,y=this.PES2MP4SCALEFACTOR,m=e.samples,E=[];m.sort(function(e,t){return e.dts-t.dts});var b=m.reduce(function(e,t){return Math.max(Math.min(e,t.pts-t.dts),-18e3)},0);if(b<0){d.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(b/90)+" ms to overcome this issue");for(var _=0;_<m.length;_++)m[_].dts+=b}var R=void 0;R=r?this.nextAvcDts:t*p;var k=m[0];l=Math.max(this._PTSNormalize(k.dts-this._initDTS,R),0),o=Math.max(this._PTSNormalize(k.pts-this._initDTS,R),0);var T=Math.round((l-R)/90);r&&T&&(T>1?d.logger.log("AVC:"+T+" ms hole between fragments detected,filling it"):T<-1&&d.logger.log("AVC:"+-T+" ms overlapping between fragments detected"),l=R,m[0].dts=l+this._initDTS,o=Math.max(o-T,R),m[0].pts=o+this._initDTS,d.logger.log("Video/PTS/DTS adjusted: "+Math.round(o/90)+"/"+Math.round(l/90)+",delta:"+T+" ms")),h=l,k=m[m.length-1],v=Math.max(this._PTSNormalize(k.dts-this._initDTS,R),0),c=Math.max(this._PTSNormalize(k.pts-this._initDTS,R),0),c=Math.max(c,v);var A=navigator.vendor,S=navigator.userAgent,L=A&&A.indexOf("Apple")>-1&&S&&!S.match("CriOS");L&&(a=Math.round((v-l)/(y*(m.length-1))));for(var D=0;D<m.length;D++){var w=m[D];L?w.dts=l+D*y*a:(w.dts=Math.max(this._PTSNormalize(w.dts-this._initDTS,R),l),w.dts=Math.round(w.dts/y)*y),w.pts=Math.max(this._PTSNormalize(w.pts-this._initDTS,R),w.dts),w.pts=Math.round(w.pts/y)*y}n=new Uint8Array(e.len+4*e.nbNalu+8);var O=new DataView(n.buffer);O.setUint32(0,n.byteLength),n.set(f.default.types.mdat,4);for(var P=0;P<m.length;P++){for(var C=m[P],I=0,M=void 0;C.units.units.length;){var x=C.units.units.shift();O.setUint32(g,x.data.byteLength),g+=4,n.set(x.data,g),g+=x.data.byteLength,I+=4+x.data.byteLength}if(L)M=Math.max(0,a*Math.round((C.pts-C.dts)/(y*a)));else{if(P<m.length-1)a=m[P+1].dts-C.dts;else{var F=this.config,N=C.dts-m[P>0?P-1:P].dts;if(F.stretchShortVideoTrack){var U=F.maxBufferHole,G=F.maxSeekHole,B=Math.floor(Math.min(U,G)*p),j=(i?o+i*p:this.nextAacPts)-C.pts;j>B?(a=j-N,a<0&&(a=N),d.logger.log("It is approximately "+j/90+" ms to the next segment; using duration "+a/90+" ms for the last video frame.")):a=N}else a=N}a/=y,M=Math.round((C.pts-C.dts)/y)}E.push({size:I,duration:a,cts:M,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:C.key?2:1,isNonSync:C.key?0:1}})}this.nextAvcDts=v+a*y;var H=e.dropped;if(e.len=0,e.nbNalu=0,e.dropped=0,E.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var K=E[0].flags;K.dependsOn=2,K.isNonSync=0}e.samples=E,s=f.default.moof(e.sequenceNumber++,l/y,e),e.samples=[];var V={id:this.id,level:this.level,sn:this.sn,data1:s,data2:n,startPTS:o/p,endPTS:(c+y*a)/p,startDTS:l/p,endDTS:this.nextAvcDts/p,type:"video",nb:E.length,dropped:H};return this.observer.trigger(u.default.FRAG_PARSING_DATA,V),V}},{key:"remuxAudio",value:function(e,t,r,i){var a,n,s,l,h,c,v,g,p,y,m,E,b,_,R,k,T=this.PES_TIMESCALE,A=e.timescale,S=T/A,L=e.timescale*(e.isAAC?1024:1152)/e.audiosamplerate,D=L*S,w=8,O=[],P=[];if(e.samples.sort(function(e,t){return e.pts-t.pts}),P=e.samples,k=this.nextAacPts,r|=P.length&&k&&(Math.abs(t-k/T)<.1||Math.abs(P[0].pts-k-this._initDTS)<20*D),r||(k=t*T),i&&e.isAAC)for(var C=0,I=k;C<P.length;){var M=P[C],x=this._PTSNormalize(M.pts-this._initDTS,k),F=x-I;if(F<=-D)d.logger.warn("Dropping 1 audio frame @ "+Math.round(I/90)/1e3+"s due to "+Math.round(Math.abs(F/90))+" ms overlap."),P.splice(C,1),e.len-=M.unit.length;else if(F>=D){var N=Math.round(F/D);d.logger.warn("Injecting "+N+" audio frame @ "+Math.round(I/90)/1e3+"s due to "+Math.round(F/90)+" ms gap.");for(var U=0;U<N;U++)R=I+this._initDTS,R=Math.max(R,this._initDTS),_=o.default.getSilentFrame(e.channelCount),_||(d.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),_=M.unit.slice(0)),P.splice(C,0,{unit:_,pts:R,dts:R}),e.len+=_.length,I+=D,C+=1;M.pts=M.dts=I+this._initDTS,I+=D,C+=1}else Math.abs(F)>.1*D,I+=D,0===C?M.pts=M.dts=this._initDTS+k:M.pts=M.dts=P[C-1].pts+D,C+=1}for(;P.length;){if(n=P.shift(),l=n.unit,y=n.pts-this._initDTS,m=n.dts-this._initDTS,void 0!==p)E=this._PTSNormalize(y,p),b=this._PTSNormalize(m,p),s.duration=Math.round((b-p)/S);else{E=this._PTSNormalize(y,k),b=this._PTSNormalize(m,k);var G=Math.round(1e3*(E-k)/T),B=0;if(r&&G){if(G>0)B=Math.round((E-k)/D),d.logger.log(G+" ms hole between AAC samples detected,filling it"),B>0&&(_=o.default.getSilentFrame(e.channelCount),_||(_=l.slice(0)),e.len+=B*_.length);else if(G<-12){d.logger.log(-G+" ms overlapping between AAC samples detected, drop frame"),e.len-=l.byteLength;continue}E=b=k}if(v=Math.max(0,E),g=Math.max(0,b),!(e.len>0))return;h=new Uint8Array(e.len+8),a=new DataView(h.buffer),a.setUint32(0,h.byteLength),h.set(f.default.types.mdat,4);for(var j=0;j<B;j++)R=E-(B-j)*D,_=o.default.getSilentFrame(e.channelCount),_||(d.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),_=l.slice(0)),h.set(_,w),w+=_.byteLength,s={size:_.byteLength,cts:0,duration:e.isAAC?1024:1152,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},O.push(s)}h.set(l,w),w+=l.byteLength,s={size:l.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},O.push(s),p=b}var H=0,K=O.length;if(K>=2&&(H=O[K-2].duration,
|
27 |
-
s.duration=H),K){this.nextAacPts=E+S*H,e.len=0,e.samples=O,c=f.default.moof(e.sequenceNumber++,g/S,e),e.samples=[];var V={id:this.id,level:this.level,sn:this.sn,data1:c,data2:h,startPTS:v/T,endPTS:this.nextAacPts/T,startDTS:g/T,endDTS:(b+S*H)/T,type:"audio",nb:K};return this.observer.trigger(u.default.FRAG_PARSING_DATA,V),V}return null}},{key:"remuxEmptyAudio",value:function(e,t,r,i){var a=this.PES_TIMESCALE,n=e.timescale?e.timescale:e.audiosamplerate,s=a/n,l=this.nextAacPts,u=(void 0!==l?l:i.startDTS*a)+this._initDTS,h=i.endDTS*a+this._initDTS,f=1024,c=s*f,v=Math.ceil((h-u)/c),g=o.default.getSilentFrame(e.channelCount);if(d.logger.warn("remux empty Audio"),!g)return void d.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var p=[],y=0;y<v;y++){var m=u+y*c;p.push({unit:g.slice(0),pts:m,dts:m}),e.len+=g.length}e.samples=p,this.remuxAudio(e,t,r)}},{key:"remuxID3",value:function(e,t){var r,i=e.samples.length;if(i){for(var a=0;a<i;a++)r=e.samples[a],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE,r.dts=(r.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(u.default.FRAG_PARSING_METADATA,{id:this.id,level:this.level,sn:this.sn,samples:e.samples})}e.samples=[],t=t}},{key:"remuxText",value:function(e,t){e.samples.sort(function(e,t){return e.pts-t.pts});var r,i=e.samples.length;if(i){for(var a=0;a<i;a++)r=e.samples[a],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(u.default.FRAG_PARSING_USERDATA,{id:this.id,level:this.level,sn:this.sn,samples:e.samples})}e.samples=[],t=t}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),e}();r.default=v},{26:26,28:28,29:29,37:37,45:45,46:46}],39:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(28),o=i(s),l=function(){function e(t,r){a(this,e),this.observer=t,this.id=r,this.ISGenerated=!1}return n(e,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(e,t,r,i,a,n){var s=this.observer;if(!this.ISGenerated){var l={},u={id:this.id,tracks:l,unique:!0},d=t,h=d.codec;h&&(u.tracks.video={container:d.container,codec:h,metadata:{width:d.width,height:d.height}}),d=e,h=d.codec,h&&(u.tracks.audio={container:d.container,codec:h,metadata:{channelCount:d.channelCount}}),this.ISGenerated=!0,s.trigger(o.default.FRAG_PARSING_INIT_SEGMENT,u)}s.trigger(o.default.FRAG_PARSING_DATA,{id:this.id,data1:n,startPTS:a,startDTS:a,type:"audiovideo",nb:1,dropped:0})}},{key:"passthrough",get:function(){return!0}}]),e}();r.default=l},{28:28}],40:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=/^(\d+)x(\d+)$/,s=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,o=function(){function e(t){i(this,e),"string"==typeof t&&(t=e.parseAttrList(t));for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r])}return a(e,[{key:"decimalInteger",value:function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}},{key:"hexadecimalInteger",value:function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(2*i,2*i+2),16);return r}return null}},{key:"hexadecimalIntegerAsNumber",value:function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(e){var t=n.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}}],[{key:"parseAttrList",value:function(e){var t,r={};for(s.lastIndex=0;null!==(t=s.exec(e));){var i=t[2],a='"';0===i.indexOf(a)&&i.lastIndexOf(a)===i.length-1&&(i=i.slice(1,-1)),r[t[1]]=i}return r}}]),e}();r.default=o},{}],41:[function(e,t,r){"use strict";var i={search:function(e,t){for(var r=0,i=e.length-1,a=null,n=null;r<=i;){a=(r+i)/2|0,n=e[a];var s=t(n);if(s>0)r=a+1;else{if(!(s<0))return n;i=a-1}}return null}};t.exports=i},{}],42:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},s=function(e){var t=e;return n.hasOwnProperty(e)&&(t=n[e]),String.fromCharCode(t)},o=15,l=32,u={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},d={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},f={25:2,26:4,29:6,30:8,31:10,27:13,28:15},c=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],v={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(e){this.time=e},log:function(e,t){var r=this.verboseFilter[e];this.verboseLevel>=r}},g=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},p=function(){function e(t,r,a,n,s){i(this,e),this.foreground=t||"white",this.underline=r||!1,this.italics=a||!1,this.background=n||"black",this.flash=s||!1}return a(e,[{key:"reset",value:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}},{key:"setStyles",value:function(e){for(var t=["foreground","underline","italics","background","flash"],r=0;r<t.length;r++){var i=t[r];e.hasOwnProperty(i)&&(this[i]=e[i])}}},{key:"isDefault",value:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}},{key:"equals",value:function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}},{key:"copy",value:function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}},{key:"toString",value:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}]),e}(),y=function(){function e(t,r,a,n,s,o){i(this,e),this.uchar=t||" ",this.penState=new p(r,a,n,s,o)}return a(e,[{key:"reset",value:function(){this.uchar=" ",this.penState.reset()}},{key:"setChar",value:function(e,t){this.uchar=e,this.penState.copy(t)}},{key:"setPenState",value:function(e){this.penState.copy(e)}},{key:"equals",value:function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}},{key:"copy",value:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)}},{key:"isEmpty",value:function(){return" "===this.uchar&&this.penState.isDefault()}}]),e}(),m=function(){function e(){i(this,e),this.chars=[];for(var t=0;t<l;t++)this.chars.push(new y);this.pos=0,this.currPenState=new p}return a(e,[{key:"equals",value:function(e){for(var t=!0,r=0;r<l;r++)if(!this.chars[r].equals(e.chars[r])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<l;t++)this.chars[t].copy(e.chars[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<l;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}},{key:"setCursor",value:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(v.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>l&&(v.log("ERROR","Too large cursor position "+this.pos),this.pos=l)}},{key:"moveCursor",value:function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)}},{key:"backSpace",value:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}},{key:"insertChar",value:function(e){e>=144&&this.backSpace();var t=s(e);return this.pos>=l?void v.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),void this.moveCursor(1))}},{key:"clearFromPos",value:function(e){var t;for(t=e;t<l;t++)this.chars[t].reset()}},{key:"clear",value:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}},{key:"clearToEndOfRow",value:function(){this.clearFromPos(this.pos)}},{key:"getTextString",value:function(){for(var e=[],t=!0,r=0;r<l;r++){var i=this.chars[r].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")}},{key:"setPenStyles",value:function(e){this.currPenState.setStyles(e);var t=this.chars[this.pos];t.setPenState(this.currPenState)}}]),e}(),E=function(){function e(){i(this,e),this.rows=[];for(var t=0;t<o;t++)this.rows.push(new m);this.currRow=o-1,this.nrRollUpRows=null,this.reset()}return a(e,[{key:"reset",value:function(){for(var e=0;e<o;e++)this.rows[e].clear();this.currRow=o-1}},{key:"equals",value:function(e){for(var t=!0,r=0;r<o;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<o;t++)this.rows[t].copy(e.rows[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<o;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}},{key:"backSpace",value:function(){var e=this.rows[this.currRow];e.backSpace()}},{key:"clearToEndOfRow",value:function(){var e=this.rows[this.currRow];e.clearToEndOfRow()}},{key:"insertChar",value:function(e){var t=this.rows[this.currRow];t.insertChar(e)}},{key:"setPen",value:function(e){var t=this.rows[this.currRow];t.setPenStyles(e)}},{key:"moveCursor",value:function(e){var t=this.rows[this.currRow];t.moveCursor(e)}},{key:"setCursor",value:function(e){v.log("INFO","setCursor: "+e);var t=this.rows[this.currRow];t.setCursor(e)}},{key:"setPAC",value:function(e,t){v.log("INFO","pacData = "+JSON.stringify(e));var r=e.row-1;if(this.nrRollUpRows&&r<this.nrRollUpRows-1&&(r=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==r){for(var i=0;i<o;i++)this.rows[i].clear();var a=this.currRow+1-this.nrRollUpRows,n=t.rows[a].cueStartTime;if(n&&n<v.time)for(i=0;i<this.nrRollUpRows;i++)this.rows[r-this.nrRollUpRows+i+1].copy(t.rows[a+i])}this.currRow=r;var s=this.rows[this.currRow];if(null!==e.indent){var l=e.indent,u=Math.max(l-1,0);s.setCursor(e.indent),e.color=s.chars[u].penState.foreground}var d={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(d)}},{key:"setBkgData",value:function(e){v.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}},{key:"setRollUpRows",value:function(e){this.nrRollUpRows=e}},{key:"rollUp",value:function(){if(null===this.nrRollUpRows)return void v.log("DEBUG","roll_up but nrRollUpRows not set yet");v.log("TEXT",this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),v.log("INFO","Rolling up")}},{key:"getDisplayText",value:function(e){e=e||!1;for(var t=[],r="",i=-1,a=0;a<o;a++){var n=this.rows[a].getTextString();n&&(i=a+1,e?t.push("Row "+i+": '"+n+"'"):t.push(n.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r}},{key:"getTextAndFormat",value:function(){return this.rows}}]),e}(),b=function(){function e(t,r){i(this,e),this.chNr=t,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new E,this.nonDisplayedMemory=new E,this.lastOutputScreen=new E,this.currRollUpRow=this.displayedMemory.rows[o-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}return a(e,[{key:"reset",value:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[o-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null}},{key:"getHandler",value:function(){return this.outputFilter}},{key:"setHandler",value:function(e){this.outputFilter=e}},{key:"setPAC",value:function(e){this.writeScreen.setPAC(e,this.lastOutputScreen)}},{key:"setBkgData",value:function(e){this.writeScreen.setBkgData(e)}},{key:"setMode",value:function(e){e!==this.mode&&(this.mode=e,v.log("INFO","MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset(),this.lastOutputScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}},{key:"insertChars",value:function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";v.log("INFO",r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(v.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}},{key:"ccRCL",value:function(){v.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}},{key:"ccBS",value:function(){v.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}},{key:"ccAOF",value:function(){}},{key:"ccAON",value:function(){}},{key:"ccDER",value:function(){v.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}},{key:"ccRU",value:function(e){v.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}},{key:"ccFON",value:function(){v.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})}},{key:"ccRDC",value:function(){v.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}},{key:"ccTR",value:function(){v.log("INFO","TR"),this.setMode("MODE_TEXT")}},{key:"ccRTD",value:function(){v.log("INFO","RTD"),this.setMode("MODE_TEXT")}},{key:"ccEDM",value:function(){v.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()}},{key:"ccCR",value:function(){v.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()}},{key:"ccENM",value:function(){v.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}},{key:"ccEOC",value:function(){if(v.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,v.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()}},{key:"ccTO",value:function(e){v.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}},{key:"ccMIDROW",value:function(e){var t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[r]}v.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}},{key:"outputDataUpdate",value:function(){var e=v.time;null!==e&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(e,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))}},{key:"cueSplitAtTime",value:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}]),e}(),_=function(){function e(t,r,a){i(this,e),this.field=t||1,this.outputs=[r,a],this.channels=[new b(1,r),new b(2,a)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}}return a(e,[{key:"getHandler",value:function(e){return this.channels[e].getHandler()}},{key:"setHandler",value:function(e,t){this.channels[e].setHandler(t)}},{key:"addData",value:function(e,t){var r,i,a,n=!1;this.lastTime=e,v.setTime(e);for(var s=0;s<t.length;s+=2)if(i=127&t[s],a=127&t[s+1],0!==i||0!==a){if(v.log("DATA","["+g([t[s],t[s+1]])+"] -> ("+g([i,a])+")"),r=this.parseCmd(i,a),r||(r=this.parseMidrow(i,a)),r||(r=this.parsePAC(i,a)),r||(r=this.parseBackgroundAttributes(i,a)),!r&&(n=this.parseChars(i,a)))if(this.currChNr&&this.currChNr>=0){var o=this.channels[this.currChNr-1];o.insertChars(n)}else v.log("WARNING","No channel found yet. TEXT-MODE?");r?this.dataCounters.cmd+=2:n?this.dataCounters.char+=2:(this.dataCounters.other+=2,v.log("WARNING","Couldn't parse cleaned data "+g([i,a])+" orig: "+g([t[s],t[s+1]])))}else this.dataCounters.padding+=2}},{key:"parseCmd",value:function(e,t){var r=null,i=(20===e||28===e)&&32<=t&&t<=47,a=(23===e||31===e)&&33<=t&&t<=35;if(!i&&!a)return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,v.log("DEBUG","Repeated command ("+g([e,t])+") is dropped"),!0;r=20===e||23===e?1:2;var n=this.channels[r-1];return 20===e||28===e?32===t?n.ccRCL():33===t?n.ccBS():34===t?n.ccAOF():35===t?n.ccAON():36===t?n.ccDER():37===t?n.ccRU(2):38===t?n.ccRU(3):39===t?n.ccRU(4):40===t?n.ccFON():41===t?n.ccRDC():42===t?n.ccTR():43===t?n.ccRTD():44===t?n.ccEDM():45===t?n.ccCR():46===t?n.ccENM():47===t&&n.ccEOC():n.ccTO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=r,!0}},{key:"parseMidrow",value:function(e,t){var r=null;if((17===e||25===e)&&32<=t&&t<=47){if(r=17===e?1:2,r!==this.currChNr)return v.log("ERROR","Mismatch channel in midrow parsing"),!1;var i=this.channels[r-1];return i.ccMIDROW(t),v.log("DEBUG","MIDROW ("+g([e,t])+")"),!0}return!1}},{key:"parsePAC",value:function(e,t){var r=null,i=null,a=(17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127,n=(16===e||24===e)&&64<=t&&t<=95;if(!a&&!n)return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;r=e<=23?1:2,i=64<=t&&t<=95?1===r?u[e]:h[e]:1===r?d[e]:f[e];var s=this.interpretPAC(i,t),o=this.channels[r-1];return o.setPAC(s),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=r,!0}},{key:"interpretPAC",value:function(e,t){var r=t,i={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,i.underline=1===(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i}},{key:"parseChars",value:function(e,t){var r=null,i=null,a=null;if(e>=25?(r=2,a=e-8):(r=1,a=e),17<=a&&a<=19){var n=t;n=17===a?t+80:18===a?t+112:t+144,v.log("INFO","Special char '"+s(n)+"' in channel "+r),i=[n]}else 32<=e&&e<=127&&(i=0===t?[e]:[e,t]);if(i){var o=g(i);v.log("DEBUG","Char codes = "+o.join(",")),this.lastCmdA=null,this.lastCmdB=null}return i}},{key:"parseBackgroundAttributes",value:function(e,t){var r,i,a,n,s=(16===e||24===e)&&32<=t&&t<=47,o=(23===e||31===e)&&45<=t&&t<=47;return!(!s&&!o)&&(r={},16===e||24===e?(i=Math.floor((t-32)/2),r.background=c[i],t%2===1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0)),a=e<24?1:2,n=this.channels[a-1],n.setBkgData(r),this.lastCmdA=null,this.lastCmdB=null,!0)}},{key:"reset",value:function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null}},{key:"cueSplitAtTime",value:function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)}}]),e}();r.default=_},{}],43:[function(e,t,r){"use strict";var i={newCue:function(e,t,r,i){for(var a,n,s,o,l,u=window.VTTCue||window.TextTrackCue,d=0;d<i.rows.length;d++)if(a=i.rows[d],s=!0,o=0,l="",!a.isEmpty()){for(var h=0;h<a.chars.length;h++)a.chars[h].uchar.match(/\s/)&&s?o++:(l+=a.chars[h].uchar,s=!1);a.cueStartTime=t,n=new u(t,r,l.trim()),o>=16?o--:o++,navigator.userAgent.match(/Firefox\//)?n.line=d+1:n.line=d>7?d-2:d+1,n.align="left",n.position=Math.max(0,Math.min(100,100*(o/32)+(navigator.userAgent.match(/Firefox\//)?50:0))),e.addCue(n)}}};t.exports=i},{}],44:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(t){i(this,e),this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=0,this.totalWeight_=0}return a(e,[{key:"sample",value:function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_}}]),e}();r.default=n},{}],45:[function(e,t,r){"use strict";function i(){}function a(e,t){return t="["+e+"] > "+t}function n(e){var t=self.console[e];return t?function(){for(var r=arguments.length,i=Array(r),n=0;n<r;n++)i[n]=arguments[n];i[0]&&(i[0]=a(e,i[0])),t.apply(self.console,i)}:i}function s(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r.forEach(function(t){u[t]=e[t]?e[t].bind(e):n(t)})}Object.defineProperty(r,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l={trace:i,debug:i,log:i,warn:i,info:i,error:i},u=l;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{u.log()}catch(e){u=l}}else u=l},r.logger=u},{}],46:[function(e,t,r){"use strict";"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=function(e,t){var r=new Uint8Array(this);void 0===t&&(t=r.length);for(var i=new ArrayBuffer(t-e),a=new Uint8Array(i),n=0;n<a.length;n++)a[n]=r[n+e];return i})},{}],47:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(){i(this,e)}return a(e,null,[{key:"toString",value:function(e){for(var t="",r=e.length,i=0;i<r;i++)t+="["+e.start(i).toFixed(3)+","+e.end(i).toFixed(3)+"]";return t}}]),e}();r.default=n},{}],48:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(45),s=function(){function e(t){i(this,e),t&&t.xhrSetup&&(this.xhrSetup=t.xhrSetup)}return a(e,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null}},{key:"load",value:function(e,t,r){this.context=e,this.config=t,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()}},{key:"loadInternal",value:function(){var e,t=this.context;e="undefined"!=typeof XDomainRequest?this.loader=new XDomainRequest:this.loader=new XMLHttpRequest,e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.open("GET",t.url,!0),t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.responseType=t.responseType;var r=this.stats;r.tfirst=0,r.loaded=0,this.xhrSetup&&this.xhrSetup(e,t.url),this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()}},{key:"readystatechange",value:function(e){var t=e.currentTarget,r=t.readyState,i=this.stats,a=this.context,s=this.config;if(!i.aborted&&(window.clearTimeout(this.requestTimeout),r>=2&&(0===i.tfirst&&(i.tfirst=Math.max(performance.now(),i.trequest),this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),s.timeout-(i.tfirst-i.trequest))),4===r))){var o=t.status;if(o>=200&&o<300){i.tload=Math.max(i.tfirst,performance.now());var l=void 0,u=void 0;"arraybuffer"===a.responseType?(l=t.response,u=l.byteLength):(l=t.responseText,u=l.length),i.loaded=i.total=u;var d={url:t.responseURL,data:l};this.callbacks.onSuccess(d,i,a)}else i.retry>=s.maxRetry||o>=400&&o<499?(n.logger.error(o+" while loading "+a.url),this.callbacks.onError({code:o,text:t.statusText},a)):(n.logger.warn(o+" while loading "+a.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),i.retry++)}}},{key:"loadtimeout",value:function(){n.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context)}},{key:"loadprogress",value:function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total);var r=this.callbacks.onProgress;r&&r(t,this.context,null)}}]),e}();r.default=s},{45:45}]},{},[33])(33)});
|
28 |
-
!function(){"use strict";var e=function(e,a){var r,t="hlsjs",o=a.common,i=a.extend,n=a.support,s=a.version,l=0===s.indexOf("6."),u=window,c=u.MediaSource||u.WebKitMediaSource,d=u.performance,f=function(e){return e.toLowerCase().indexOf("mpegurl")>-1},p=function(e){var a=e.clip&&e.clip.hlsQualities||e.hlsQualities;return n.inlineVideo&&(a===!0||a&&a.length)},v=function(n,v){var h,y,g,b,m,k,E,w=a.bean,L="is-seeking",O=function(e,a,r){if(e.debug&&console.log("recovery."+t,"<-",a),o.removeClass(v,"is-paused"),o.addClass(v,L),r)y.startLoad();else{var i=d.now();if(!b||i-b>3e3)b=d.now(),y.recoverMediaError();else{if(m&&!(i-m>3e3))return 3;m=d.now(),y.swapAudioCodec(),y.recoverMediaError()}}g>0&&(g-=1)},C="is-poster",q=function(){w.one(h,"timeupdate."+t,function(){o.addClass(v,C),n.poster=!0})},R=function(){l&&n.poster&&w.one(h,"timeupdate."+t,function(){o.removeClass(v,C),n.poster=!1})},x=!1,A=0,S=function(){y.startLoad(y.config.startPosition)},T="active",M=function(e){return e||(e=n.quality),e.toLowerCase().replace(/\ /g,"")},N=function(){var e=n.qualities;e&&e.length&&(o.removeClass(v,"quality-abr"),e.forEach(function(e){o.removeClass(v,"quality-"+M(e))}))},D=function(){delete n.hlsQualities,N(),o.find(".fp-quality-selector",v).forEach(o.removeNode)},_=function(){return n.hlsQualities[n.qualities.indexOf(n.quality)+1]},P=function(e,a,r){var i,s=r.levels,l=[],u=[],d=0;if(D(),"drive"===e)switch(s.length){case 4:l=[1,2,3];break;case 5:l=[1,2,3,4];break;case 6:l=[1,3,4,5];break;case 7:l=[1,3,5,6];break;case 8:l=[1,3,6,7];break;default:if(s.length<3||s[0].height&&s[2].height&&s[0].height===s[2].height)return;l=[1,2]}else if("string"==typeof e?e.split(/\s*,\s*/).forEach(function(e){u.push(parseInt(e,10))}):"boolean"!=typeof e&&e.forEach(function(e){u.push("number"==typeof e?e:e.level)}),s.forEach(function(a){(e===!0||u.indexOf(d)>-1)&&(!a.videoCodec||a.videoCodec&&c.isTypeSupported("video/mp4;codecs="+a.videoCodec))&&l.push(d),d+=1}),l.length<2)return;n.qualities=[],l.forEach(function(a){var r=s[a],t=r.width,o=r.height,i=u.length?e[u.indexOf(a)]:a,l="object"==typeof i?i.label:t&&o?Math.min(t,o)+"p":"Level "+(a+1);n.qualities.push(l)}),i=o.createElement("ul",{class:"fp-quality-selector"}),o.find(".fp-ui",v)[0].appendChild(i),l.unshift(-1),n.hlsQualities=l,!n.quality||n.qualities.indexOf(n.quality)<0?n.quality="abr":(y.startLevel=_(),y.loadLevel=y.startLevel),i.appendChild(o.createElement("li",{"data-quality":"abr"},"Auto")),n.qualities.forEach(function(e){i.appendChild(o.createElement("li",{"data-quality":M(e)},e))}),o.addClass(v,"quality-"+M()),w.on(v,"click."+t,".fp-quality-selector li",function(e){var r,i,s,l=e.currentTarget,u=a.smoothSwitching,c=h.paused;if(!o.hasClass(l,T)){for(c||u||w.one(h,"pause."+t,function(){o.removeClass(v,"is-paused")}),r=o.find(".fp-quality-selector li",v),s=0;s<r.length;s+=1)i=r[s]===l,i&&(n.quality=s>0?n.qualities[s-1]:"abr",u&&!n.poster?y.nextLevel=_():y.currentLevel=_(),o.addClass(l,T),c&&h.play()),o.toggleClass(r[s],T,i);N(),o.addClass(v,"quality-"+M())}})},j={engineName:t,pick:function(e){var a,r;for(a=0;a<e.length;a+=1)if(r=e[a],f(r.type))return"string"==typeof r.src&&(r.src=o.createAbsoluteUrl(r.src)),r},load:function(a){var s=n.conf,c={ended:"finish",loadeddata:"ready",pause:"pause",play:"resume",progress:"buffer",ratechange:"speed",seeked:"seek",timeupdate:"progress",volumechange:"volume",error:"error"},d=e.Events,f=!!a.autoplay||!!s.autoplay,k=a.hlsQualities||s.hlsQualities,E=i(r,s.hlsjs,s.clip.hlsjs,a.hlsjs),C=i({},E);a.hlsQualities===!1&&(k=!1),y?(y.destroy(),(n.video.src&&a.src!==n.video.src||a.index)&&o.attr(h,"autoplay","autoplay")):(o.removeNode(o.findDirect("video",v)[0]||o.find(".fp-player > video",v)[0]),h=o.createElement("video",{class:"fp-engine "+t+"-engine",autoplay:!!f&&"autoplay",volume:n.volumeLevel,"x-webkit-airplay":"allow"}),Object.keys(c).forEach(function(e){var r,l=c[e],u=e+"."+t;w.on(h,u,function(e){if(s.debug&&l.indexOf("progress")<0&&console.log(u,"->",l,e.originalEvent),n.ready||!(l.indexOf("ready")<0)){var c,f,p,g,b=h.currentTime,m=0,k=0,L=n.video,C=L.src,q=!1,S=L.loop,M=n.quality;switch(l){case"ready":r=i(L,{duration:h.duration,seekable:h.seekable.end(null),width:h.videoWidth,height:h.videoHeight,url:C});break;case"resume":R(),E.bufferWhilePaused||y.startLoad(b);break;case"seek":R(),!E.bufferWhilePaused&&h.paused&&(y.stopLoad(),h.pause()),r=b;break;case"pause":E.bufferWhilePaused||y.stopLoad();break;case"progress":r=b;break;case"speed":r=h.playbackRate;break;case"volume":r=h.volume;break;case"buffer":try{if(c=h.buffered,m=c.end(null),b)for(f=c.length-1;f>-1;f-=1)k=c.end(f),k>=b&&(m=k)}catch(e){}a.buffer=m,r=m;break;case"finish":y.autoLevelEnabled&&(S||s.playlist.length<2||s.advance===!1)&&(q=!y.levels[A].details,q||y.levels[A].details.fragments.forEach(function(e){q=!!q||!e.loadCounter}),q&&(y.trigger(d.BUFFER_FLUSHING,{startOffset:0,endOffset:.9*L.duration}),S&&w.one(h,"pause."+t,function(){o.removeClass(v,"is-paused")}),w.one(h,(S?"play.":"timeupdate.")+t,function(){var e=y.currentLevel;e<A&&(y.currentLevel=A,x=!0)})));break;case"error":g=h.error.code,(E.recoverMediaError&&3===g||E.recoverNetworkError&&2===g||E.recover&&(2===g||3===g))&&(g=O(s,l,2===g)),void 0!==g?(r={code:g},g>2&&(r.video=i(L,{src:C,url:C}))):r=!1}if(r===!1)return r;n.trigger(l,[n,r]),"ready"===l&&M&&(p="abr"===M?0:n.qualities.indexOf(M)+1,o.addClass(o.find(".fp-quality-selector li",v)[p],T))}})}),l&&s.poster&&(n.on("stop."+t,q),!n.live||f||n.video.autoplay||w.one(h,"seeked."+t,q)),E.bufferWhilePaused||n.on("beforeseek."+t,function(e,a,r){a.paused&&(w.one(h,"seeked."+t,function(){h.pause()}),y.startLoad(r))}),n.on("error."+t,function(){y&&(y.destroy(),y=0)}),o.prepend(o.find(".fp-player",v)[0],h)),n.video=a,A=0,x=!1,Object.keys(E).forEach(function(a){e.DefaultConfig.hasOwnProperty(a)||delete C[a];var r=E[a];switch(a){case"adaptOnStartOnly":r&&(C.startLevel=-1);break;case"autoLevelCapping":r===!1&&(r=-1),C[a]=r;break;case"startLevel":switch(r){case"auto":r=-1;break;case"firstLevel":r=void 0}C[a]=r;break;case"recover":E.recoverMediaError=!1,E.recoverNetworkError=!1,g=r;break;case"strict":r&&(E.recoverMediaError=!1,E.recoverNetworkError=!1,g=0)}}),C.autoStartLoad=!1,y=new e(C),n.engine[t]=y,b=null,m=null,Object.keys(d).forEach(function(a){var r=d[a],c=E.listeners,f=c&&c.indexOf(r)>-1;y.on(r,function(r,c){var d,b={},m=e.ErrorTypes,C=e.ErrorDetails,q=n.video,R=q.src;switch(a){case"MEDIA_ATTACHED":y.loadSource(R);break;case"MANIFEST_PARSED":p(s)?k?P(k,E,c):D():delete n.quality,n.live?S():setTimeout(S);break;case"FRAG_LOADED":x?(y.nextLevel=-1,x=!1,A=0):!n.live&&y.autoLevelEnabled&&y.loadLevel>A&&(A=y.loadLevel);break;case"FRAG_PARSING_METADATA":if(l)return;c.samples.forEach(function(e){var a;a=function(){if(!(h.currentTime<e.dts)){w.off(h,"timeupdate."+t,a);var r,o=u.TextDecoder;r=o&&"function"==typeof o?new o("utf-8").decode(e.data):decodeURIComponent(u.escape(String.fromCharCode.apply(null,e.data))),n.trigger("metadata",[n,{key:r.substr(10,4),data:r.substr(21)}])}},w.on(h,"timeupdate."+t,a)});break;case"ERROR":if(c.fatal||E.strict){switch(c.type){case m.NETWORK_ERROR:E.recoverNetworkError||g?O(s,c.type,!0):c.frag&&c.frag.url?(b.url=c.frag.url,d=2):d=4;break;case m.MEDIA_ERROR:d=E.recoverMediaError||g?O(s,c.type):3;break;default:y.destroy(),d=5}void 0!==d&&(b.code=d,d>2&&(b.video=i(q,{src:R,url:c.url||R})),n.trigger("error",[n,b]))}else switch(c.details){case C.BUFFER_STALLED_ERROR:case C.FRAG_LOOP_LOADING_ERROR:o.addClass(v,L),w.one(h,"timeupdate."+t,function(){o.removeClass(v,L)})}}f&&n.trigger(r,[n,c])})}),E.adaptOnStartOnly&&w.one(h,"timeupdate."+t,function(){y.loadLevel=y.loadLevel}),y.attachMedia(h),h.paused&&f&&h.play()},resume:function(){h.play()},pause:function(){h.pause()},seek:function(e){h.currentTime=e},volume:function(e){h&&(h.volume=e)},speed:function(e){h.playbackRate=e,n.trigger("speed",[n,e])},unload:function(){if(y){var e="."+t;y.destroy(),y=0,D(),n.off(e),w.off(v,e),w.off(h,e),o.removeNode(h),h=0}}};return!/^6\.0\.[0-3]$/.test(s)||n.conf.splash||n.conf.poster||n.conf.autoplay||(k=o.css(v,"backgroundColor"),E="none"!==o.css(v,"backgroundImage")||k&&"rgba(0, 0, 0, 0)"!==k&&"transparent"!==k,E&&(n.conf.poster=!0)),j};e.isSupported()&&0!==s.indexOf("5.")&&(v.engineName=t,v.canPlay=function(e,o){var s=n.browser,l=u.navigator,c=l.userAgent.indexOf("Trident/7")>-1;return o[t]!==!1&&o.clip[t]!==!1&&(r=i({bufferWhilePaused:!0,smoothSwitching:!0,recoverMediaError:!0},a.conf[t],o[t],o.clip[t]),!!f(e)&&(!!r.debug||(!r.anamorphic||0!==l.platform.indexOf("Win")||!s.mozilla||0!==s.version.indexOf("44."))&&(c||!s.safari)))},a.engines.unshift(v),a(function(e){e.pluginQualitySelectorEnabled=p(e.conf)&&v.canPlay("application/x-mpegurl",e.conf)}))};"object"==typeof module&&module.exports?module.exports=e.bind(void 0,require("hls.js/lib/index.js")):window.Hls&&window.flowplayer&&e(window.Hls,window.flowplayer)}();
|
|
|
|
|
29 |
/*@
|
30 |
@end
|
31 |
@*/
|
2 |
|
3 |
hlsjs engine plugin for Flowplayer HTML5
|
4 |
|
5 |
+
Copyright (c) 2015-2017, Flowplayer Drive Oy
|
6 |
|
7 |
Released under the MIT License:
|
8 |
http://www.opensource.org/licenses/mit-license.php
|
9 |
|
10 |
Includes hls.js
|
11 |
+
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
|
12 |
+
https://github.com/video-dev/hls.js/blob/master/LICENSE
|
13 |
|
14 |
Requires Flowplayer HTML5 version 6.x
|
15 |
+
v1.0.8-15-g8ddfb16
|
16 |
|
17 |
*/
|
18 |
/*@cc_on @*/
|
19 |
/*@
|
20 |
@if (@_jscript_version > 10)
|
21 |
@*/
|
22 |
+
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Hls=e()}}(function(){var e;return function e(t,r,i){function a(s,o){if(!r[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(n)return n(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var d=r[s]={exports:{}};t[s][0].call(d.exports,function(e){var r=t[s][1][e];return a(r?r:e)},d,d.exports,e,t,r,i)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s<i.length;s++)a(i[s]);return a}({1:[function(e,t,r){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function a(e){return"function"==typeof e}function n(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,r,i,n,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var d=new Error('Uncaught, unspecified "error" event. ('+t+")");throw d.context=t,d}if(r=this._events[e],o(r))return!1;if(a(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),r.apply(this,n)}else if(s(r))for(n=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,l=0;l<i;l++)u[l].apply(this,n);return!0},i.prototype.addListener=function(e,t){var r;if(!a(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,a(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=o(this._maxListeners)?i.defaultMaxListeners:this._maxListeners)&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.trace),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!a(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){var r,i,n,o;if(!a(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],n=r.length,i=-1,r===t||a(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(o=n;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){i=o;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],a(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(a(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(t,r,i){!function(t){var a=/^((?:[^\/;?#]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/;?#]*)(.*)$/,s={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var i=this.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");return i.path=s.normalizePath(i.path),s.buildURLFromParts(i)}var a=this.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=this.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=n.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var d=o.path,f=d.substring(0,d.lastIndexOf("/")+1)+a.path;u.path=s.normalizePath(f)}else u.path=o.path,a.params||(u.params=o.params,a.query||(u.query=o.query));return null===u.path&&(u.path=r.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(u)},parseURL:function(e){var t=a.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(/(?:\/|^)\.(?=\/)/g,"");e.length!==(e=e.replace(/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};"object"==typeof i&&"object"==typeof r?r.exports=s:"function"==typeof e&&e.amd?e([],function(){return s}):"object"==typeof i?i.URLToolkit=s:t.URLToolkit=s}(this)},{}],3:[function(e,t,r){var i=arguments[3],a=arguments[4],n=arguments[5],s=JSON.stringify;t.exports=function(e,t){function r(e){p[e]=!0;for(var t in a[e][1]){var i=a[e][1][t];p[i]||r(i)}}for(var o,l=Object.keys(n),u=0,d=l.length;u<d;u++){var f=l[u],c=n[f].exports;if(c===e||c&&c.default===e){o=f;break}}if(!o){o=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var h={},u=0,d=l.length;u<d;u++){var f=l[u];h[f]=f}a[o]=[Function(["require","module","exports"],"("+e+")(self)"),h]}var g=Math.floor(Math.pow(16,8)*Math.random()).toString(16),v={};v[o]=o,a[g]=[Function(["require"],"var f = require("+s(o)+");(f.default ? f.default : f)(self);"),v];var p={};r(g);var y="("+i+")({"+Object.keys(p).map(function(e){return s(e)+":["+a[e][0]+","+s(a[e][1])+"]"}).join(",")+"},{},["+s(g)+"])",m=window.URL||window.webkitURL||window.mozURL||window.msURL,E=new Blob([y],{type:"text/javascript"});if(t&&t.bare)return E;var b=m.createObjectURL(E),T=new Worker(b);return T.objectURL=b,T}},{}],4:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.hlsDefaultConfig=void 0;var a=e(5),n=i(a),s=e(8),o=i(s),l=e(9),u=i(l),d=e(10),f=i(d),c=e(58),h=i(c),g=e(7),v=i(g),p=e(6),y=i(p),m=e(50),E=i(m),b=e(16),T=i(b),k=e(15),_=i(k),R=e(14),A=i(R);r.hlsDefaultConfig={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:h.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,fetchSetup:void 0,abrController:n.default,bufferController:o.default,capLevelController:u.default,fpsController:f.default,audioStreamController:y.default,audioTrackController:v.default,subtitleStreamController:A.default,subtitleTrackController:_.default,timelineController:T.default,cueHandler:E.default,enableCEA708Captions:!0,enableWebVTT:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",stretchShortVideoTrack:!1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0}},{10:10,14:14,15:15,16:16,5:5,50:50,58:58,6:6,7:7,8:8,9:9}],5:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=e(37),h=i(c),g=e(33),v=e(53),p=e(51),y=i(p),m=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.FRAG_LOADING,u.default.FRAG_LOADED,u.default.FRAG_BUFFERED,u.default.ERROR));return r.lastLoadedFragLevel=0,r._nextAutoLevel=-1,r.hls=e,r.onCheck=r._abandonRulesCheck.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){this.clearTimer(),f.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(e){var t=e.frag;if("main"===t.type){if(this.timer||(this.timer=setInterval(this.onCheck,100)),!this._bwEstimator){var r=this.hls,i=e.frag.level,a=r.levels[i].details.live,n=r.config,s=void 0,o=void 0;a?(s=n.abrEwmaFastLive,o=n.abrEwmaSlowLive):(s=n.abrEwmaFastVoD,o=n.abrEwmaSlowVoD),this._bwEstimator=new y.default(r,o,s,n.abrEwmaDefaultEstimate)}this.fragCurrent=t}}},{key:"_abandonRulesCheck",value:function(){var e=this.hls,t=e.media,r=this.fragCurrent,i=r.loader,a=e.minAutoLevel;if(!i||i.stats&&i.stats.aborted)return v.logger.warn("frag loader destroy or aborted, disarm abandonRules"),void this.clearTimer();var n=i.stats;if(t&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&r.autoLevel&&r.level){var s=performance.now()-n.trequest,o=Math.abs(t.playbackRate);if(s>500*r.duration/o){var l=e.levels,d=Math.max(1,n.bw?n.bw/8:1e3*n.loaded/s),f=l[r.level],c=f.realBitrate?Math.max(f.realBitrate,f.bitrate):f.bitrate,g=n.total?n.total:Math.max(n.loaded,Math.round(r.duration*c/8)),p=t.currentTime,y=(g-n.loaded)/d,m=(h.default.bufferInfo(t,p,e.config.maxBufferHole).end-p)/o;if(m<2*r.duration/o&&y>m){var E=void 0,b=void 0;for(b=r.level-1;b>a;b--){var T=l[b].realBitrate?Math.max(l[b].realBitrate,l[b].bitrate):l[b].bitrate;if((E=r.duration*T/(6.4*d))<m)break}E<y&&(v.logger.warn("loading too slow, abort fragment loading and switch to level "+b+":fragLoadedDelay["+b+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+E.toFixed(1)+"<"+y.toFixed(1)+":"+m.toFixed(1)),e.nextLoadLevel=b,this._bwEstimator.sample(s,n.loaded),i.abort(),this.clearTimer(),e.trigger(u.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:n}))}}}}},{key:"onFragLoaded",value:function(e){var t=e.frag;if("main"===t.type&&!isNaN(t.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var r=this.hls.levels[t.level],i=(r.loaded?r.loaded.bytes:0)+e.stats.loaded,a=(r.loaded?r.loaded.duration:0)+e.frag.duration;r.loaded={bytes:i,duration:a},r.realBitrate=Math.round(8*i/a)}if(e.frag.bitrateTest){var n=e.stats;n.tparsed=n.tbuffered=n.tload,this.onFragBuffered(e)}}}},{key:"onFragBuffered",value:function(e){var t=e.stats,r=e.frag;if(!(t.aborted===!0||1!==r.loadCounter||"main"!==r.type||isNaN(r.sn)||r.bitrateTest&&t.tload!==t.tbuffered)){var i=t.tparsed-t.trequest;v.logger.log("latency/loading/parsing/append/kbps:"+Math.round(t.tfirst-t.trequest)+"/"+Math.round(t.tload-t.tfirst)+"/"+Math.round(t.tparsed-t.tload)+"/"+Math.round(t.tbuffered-t.tparsed)+"/"+Math.round(8*t.loaded/(t.tbuffered-t.trequest))),this._bwEstimator.sample(i,t.loaded),t.bwEstimate=this._bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0}}},{key:"onError",value:function(e){switch(e.details){case g.ErrorDetails.FRAG_LOAD_ERROR:case g.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"_findBestLevel",value:function(e,t,r,i,a,n,s,o,l){for(var u=a;u>=i;u--){var d=l[u],f=d.details,c=f?f.totalduration/f.fragments.length:t,h=!!f&&f.live,g=void 0;g=u<=e?s*r:o*r;var p=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,y=p*c/g;if(v.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(g)+"/"+p+"/"+c+"/"+n+"/"+y),g>p&&(!y||h&&!this.bitrateTestDelay||y<n))return u}return-1}},{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this._bwEstimator;if(!(e===-1||t&&t.canEstimate()))return e;var r=this._nextABRAutoLevel;return e!==-1&&(r=Math.min(e,r)),r},set:function(e){this._nextAutoLevel=e}},{key:"_nextABRAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,r=e.levels,i=e.config,a=e.minAutoLevel,n=e.media,s=this.lastLoadedFragLevel,o=this.fragCurrent?this.fragCurrent.duration:0,l=n?n.currentTime:0,u=n&&0!==n.playbackRate?Math.abs(n.playbackRate):1,d=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,f=(h.default.bufferInfo(n,l,i.maxBufferHole).end-l)/u,c=this._findBestLevel(s,o,d,a,t,f,i.abrBandWidthFactor,i.abrBandWidthUpFactor,r);if(c>=0)return c;v.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var g=o?Math.min(o,i.maxStarvationDelay):i.maxStarvationDelay,p=i.abrBandWidthFactor,y=i.abrBandWidthUpFactor;if(0===f){var m=this.bitrateTestDelay;if(m){g=(o?Math.min(o,i.maxLoadingDelay):i.maxLoadingDelay)-m,v.logger.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),p=y=1}}return c=this._findBestLevel(s,o,d,a,t,f+g,p,y,r),Math.max(c,0)}}]),t}(f.default);r.default=m},{33:33,34:34,35:35,37:37,51:51,53:53}],6:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(48),u=i(l),d=e(37),f=i(d),c=e(25),h=i(c),g=e(35),v=i(g),p=e(34),y=i(p),m=e(38),E=i(m),b=e(54),T=i(b),k=e(33),_=e(53),R={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS"},A=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,v.default.MEDIA_ATTACHED,v.default.MEDIA_DETACHING,v.default.AUDIO_TRACKS_UPDATED,v.default.AUDIO_TRACK_SWITCHING,v.default.AUDIO_TRACK_LOADED,v.default.KEY_LOADED,v.default.FRAG_LOADED,v.default.FRAG_PARSING_INIT_SEGMENT,v.default.FRAG_PARSING_DATA,v.default.FRAG_PARSED,v.default.ERROR,v.default.BUFFER_CREATED,v.default.BUFFER_APPENDED,v.default.BUFFER_FLUSHED,v.default.INIT_PTS_FOUND));return r.config=e.config,r.audioCodecSwap=!1,r.ticks=0,r._state=R.STOPPED,r.ontick=r.tick.bind(r),r.initPTS=[],r.waitingFragment=null,r}return s(t,e),o(t,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),y.default.prototype.destroy.call(this),this.state=R.STOPPED}},{key:"onInitPtsFound",value:function(e){var t=e.id,r=e.frag.cc,i=e.initPTS;"main"===t&&(this.initPTS[r]=i,_.logger.log("InitPTS for cc:"+r+" found from video track:"+i),this.state===R.WAITING_INIT_PTS&&(_.logger.log("sending pending audio frag to demuxer"),this.state=R.FRAG_LOADING,this.onFragLoaded(this.waitingFragment),this.waitingFragment=null))}},{key:"startLoad",value:function(e){if(this.tracks){var t=this.lastCurrentTime;this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),this.fragLoadError=0,t>0&&e===-1?(_.logger.log("audio:override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=R.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=R.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=e,this.state=R.STOPPED}},{key:"stopLoad",value:function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=R.STOPPED}},{key:"tick",value:function(){1===++this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var e,t,r,i=this.hls,a=i.config;switch(this.state){case R.ERROR:case R.PAUSED:case R.BUFFER_FLUSHING:break;case R.STARTING:this.state=R.WAITING_TRACK,this.loadedmetadata=!1;break;case R.IDLE:var n=this.tracks;if(!n)break;if(!this.media&&(this.startFragRequested||!a.startFragPrefetch))break;e=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition;var s=this.mediaBuffer?this.mediaBuffer:this.media,o=f.default.bufferInfo(s,e,a.maxBufferHole),l=o.len,d=o.end,c=this.fragPrevious,h=a.maxMaxBufferLength,g=this.audioSwitch,p=this.trackId;if((l<h||g)&&p<n.length){if(void 0===(r=n[p].details)){this.state=R.WAITING_TRACK;break}if(!g&&!r.live&&c&&c.sn===r.endSN&&(!this.media.seeking||this.media.duration-d<c.duration/2)){this.hls.trigger(v.default.BUFFER_EOS,{type:"audio"}),this.state=R.ENDED;break}var y=r.fragments,m=y.length,E=y[0].start,b=y[m-1].start+y[m-1].duration,T=void 0;if(g)if(r.live&&!r.PTSKnown)_.logger.log("switching audiotrack, live stream, unknown PTS,load first fragment"),d=0;else if(d=e,r.PTSKnown&&e<E){if(!(o.end>E||o.nextStart))return;_.logger.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=E+.05}if(r.initSegment&&!r.initSegment.data)T=r.initSegment;else if(d<=E){if(T=y[0],r.live&&T.loadIdx&&T.loadIdx===this.fragLoadIdx){var A=o.nextStart?o.nextStart:E;return _.logger.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(A+.05)),void(this.media.currentTime=A+.05)}}else{var S=void 0,L=a.maxFragLookUpTolerance,w=c?y[c.sn-y[0].sn+1]:void 0,D=function(e){var t=Math.min(L,e.duration);return e.start+e.duration-t<=d?1:e.start-t>d&&e.start?-1:0};d<b?(d>b-L&&(L=0),S=w&&!D(w)?w:u.default.search(y,D)):S=y[m-1],S&&(T=S,E=S.start,c&&T.level===c.level&&T.sn===c.sn&&(T.sn<r.endSN?(T=y[T.sn+1-r.startSN],_.logger.log("SN just loaded, load next one: "+T.sn)):T=null))}if(T)if(T.decryptdata&&null!=T.decryptdata.uri&&null==T.decryptdata.key)_.logger.log("Loading key for "+T.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+p),this.state=R.KEY_LOADING,i.trigger(v.default.KEY_LOADING,{frag:T});else{if(_.logger.log("Loading "+T.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+p+", currentTime:"+e+",bufferEnd:"+d.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,T.loadCounter){T.loadCounter++;var O=a.fragLoadingLoopThreshold;if(T.loadCounter>O&&Math.abs(this.fragLoadIdx-T.loadIdx)<O)return void i.trigger(v.default.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:T})}else T.loadCounter=1;T.loadIdx=this.fragLoadIdx,this.fragCurrent=T,this.startFragRequested=!0,isNaN(T.sn)||(this.nextLoadPosition=T.start+T.duration),i.trigger(v.default.FRAG_LOADING,{frag:T}),this.state=R.FRAG_LOADING}}break;case R.WAITING_TRACK:t=this.tracks[this.trackId],t&&t.details&&(this.state=R.IDLE);break;case R.FRAG_LOADING_WAITING_RETRY:var I=performance.now(),P=this.retryDate;s=this.media;var C=s&&s.seeking;(!P||I>=P||C)&&(_.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=R.IDLE);break;case R.WAITING_INIT_PTS:case R.STOPPED:case R.FRAG_LOADING:case R.PARSING:case R.PARSED:case R.ENDED:}}},{key:"onMediaAttached",value:function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var r=this.config;this.tracks&&r.autoStartLoad&&this.startLoad(r.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(_.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.tracks;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){this.state===R.ENDED&&(this.state=R.IDLE),this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaEnded",value:function(){this.startPosition=this.lastCurrentTime=0}},{key:"onAudioTracksUpdated",value:function(e){_.logger.log("audio tracks updated"),this.tracks=e.audioTracks}},{key:"onAudioTrackSwitching",value:function(e){var t=!!e.url;this.trackId=e.id,this.state=R.IDLE,this.fragCurrent=null,this.state=R.PAUSED,this.waitingFragment=null,t?this.timer||(this.timer=setInterval(this.ontick,100)):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),t&&(this.audioSwitch=!0,this.state=R.IDLE,void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold)),this.tick()}},{key:"onAudioTrackLoaded",value:function(e){var t=e.details,r=e.id,i=this.tracks[r],a=t.totalduration,n=0;if(_.logger.log("track "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),t.live){var s=i.details;s&&t.fragments.length>0?(E.default.mergeDetails(s,t),n=t.fragments[0].start,t.PTSKnown?_.logger.log("live audio playlist sliding:"+n.toFixed(3)):_.logger.log("live audio playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,_.logger.log("live audio playlist - first load, unknown sliding"))}else t.PTSKnown=!1;if(i.details=t,!this.startFragRequested){if(this.startPosition===-1){var o=t.startTimeOffset;isNaN(o)?this.startPosition=0:(_.logger.log("start time offset found in playlist, adjust startPosition to "+o),this.startPosition=o)}this.nextLoadPosition=this.startPosition}this.state===R.WAITING_TRACK&&(this.state=R.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===R.KEY_LOADING&&(this.state=R.IDLE,this.tick())}},{key:"onFragLoaded",value:function(e){var t=this.fragCurrent,r=e.frag;if(this.state===R.FRAG_LOADING&&t&&"audio"===r.type&&r.level===t.level&&r.sn===t.sn){var i=this.tracks[this.trackId],a=i.details,n=a.totalduration,s=t.level,o=t.sn,l=t.cc,u=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",d=this.stats=e.stats;if("initSegment"===o)this.state=R.IDLE,d.tparsed=d.tbuffered=performance.now(),a.initSegment.data=e.payload,this.hls.trigger(v.default.FRAG_BUFFERED,{stats:d,frag:t,id:"audio"}),this.tick();else{this.state=R.PARSING,this.appended=!1,this.demuxer||(this.demuxer=new h.default(this.hls,"audio"));var f=this.initPTS[l],c=a.initSegment?a.initSegment.data:[];if(a.initSegment||void 0!==f){this.pendingBuffering=!0,_.logger.log("Demuxing "+o+" of ["+a.startSN+" ,"+a.endSN+"],track "+s);this.demuxer.push(e.payload,c,u,null,t,n,!1,f)}else _.logger.log("unknown video PTS for continuity counter "+l+", waiting for video PTS before demuxing audio frag "+o+" of ["+a.startSN+" ,"+a.endSN+"],track "+s),this.waitingFragment=e,this.state=R.WAITING_INIT_PTS}}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(e){var t=this.fragCurrent,r=e.frag;if(t&&"audio"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===R.PARSING){var i=e.tracks,a=void 0;if(i.video&&delete i.video,a=i.audio){a.levelCodec="mp4a.40.2",a.id=e.id,this.hls.trigger(v.default.BUFFER_CODECS,i),_.logger.log("audio track:audio,container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var n=a.initSegment;if(n){var s={type:"audio",data:n,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[s]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(v.default.BUFFER_APPENDING,s))}this.tick()}}}},{key:"onFragParsingData",value:function(e){var t=this,r=this.fragCurrent,i=e.frag;if(r&&"audio"===e.id&&"audio"===e.type&&i.sn===r.sn&&i.level===r.level&&this.state===R.PARSING){var a=this.trackId,n=this.tracks[a],s=this.hls;isNaN(e.endPTS)&&(e.endPTS=e.startPTS+r.duration,e.endDTS=e.startDTS+r.duration),_.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),E.default.updateFragPTSDTS(n.details,r,e.startPTS,e.endPTS);var o=this.audioSwitch,l=this.media,u=!1;if(o&&l)if(l.readyState){var d=l.currentTime;_.logger.log("switching audio track : currentTime:"+d),d>=e.startPTS&&(_.logger.log("switching audio track : flushing all audio"),this.state=R.BUFFER_FLUSHING,s.trigger(v.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),u=!0,this.audioSwitch=!1,s.trigger(v.default.AUDIO_TRACK_SWITCHED,{id:a}))}else this.audioSwitch=!1,s.trigger(v.default.AUDIO_TRACK_SWITCHED,{id:a});var f=this.pendingData;this.audioSwitch||([e.data1,e.data2].forEach(function(t){t&&t.length&&f.push({type:e.type,data:t,parent:"audio",content:"data"})}),!u&&f.length&&(f.forEach(function(e){t.state===R.PARSING&&(t.pendingBuffering=!0,t.hls.trigger(v.default.BUFFER_APPENDING,e))}),this.pendingData=[],this.appended=!0)),this.tick()}}},{key:"onFragParsed",value:function(e){var t=this.fragCurrent,r=e.frag;t&&"audio"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===R.PARSING&&(this.stats.tparsed=performance.now(),this.state=R.PARSED,this._checkAppendedParsed())}},{key:"onBufferCreated",value:function(e){var t=e.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0)}},{key:"onBufferAppended",value:function(e){if("audio"===e.parent){var t=this.state;t!==R.PARSING&&t!==R.PARSED||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}}},{key:"_checkAppendedParsed",value:function(){if(!(this.state!==R.PARSED||this.appended&&this.pendingBuffering)){var e=this.fragCurrent,t=this.stats,r=this.hls;if(e){this.fragPrevious=e,t.tbuffered=performance.now(),r.trigger(v.default.FRAG_BUFFERED,{stats:t,frag:e,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;_.logger.log("audio buffered : "+T.default.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,r.trigger(v.default.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=R.IDLE}this.tick()}}},{key:"onError",value:function(e){var t=e.frag;if(!t||"audio"===t.type)switch(e.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!e.fatal){var r=this.fragLoadError;r?r++:r=1;var i=this.config;if(r<=i.fragLoadingMaxRetry){this.fragLoadError=r,t.loadCounter=0;var a=Math.min(Math.pow(2,r-1)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);_.logger.warn("audioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=performance.now()+a,this.state=R.FRAG_LOADING_WAITING_RETRY}else _.logger.error("audioStreamController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=R.ERROR}break;case k.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==R.ERROR&&(this.state=e.fatal?R.ERROR:R.IDLE,_.logger.warn("audioStreamController: "+e.details+" while loading frag,switch to "+this.state+" state ..."));break;case k.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===e.parent&&(this.state===R.PARSING||this.state===R.PARSED)){var n=this.mediaBuffer,s=this.media.currentTime;if(n&&f.default.isBuffered(n,s)&&f.default.isBuffered(n,s+.5)){var o=this.config;o.maxMaxBufferLength>=o.maxBufferLength&&(o.maxMaxBufferLength/=2,_.logger.warn("audio:reduce max buffer length to "+o.maxMaxBufferLength+"s"),this.fragLoadIdx+=2*o.fragLoadingLoopThreshold),this.state=R.IDLE}else _.logger.warn("buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=R.BUFFER_FLUSHING,this.hls.trigger(v.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}}},{key:"onBufferFlushed",value:function(){var e=this,t=this.pendingData;t&&t.length?(_.logger.log("appending pending audio data on Buffer Flushed"),t.forEach(function(t){e.hls.trigger(v.default.BUFFER_APPENDING,t)}),this.appended=!0,this.pendingData=[],this.state=R.PARSED):(this.state=R.IDLE,this.fragPrevious=null,this.tick())}},{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,_.logger.log("audio stream:"+t+"->"+e)}},get:function(){return this._state}}]),t}(y.default);r.default=A},{25:25,33:33,34:34,35:35,37:37,38:38,48:48,53:53,54:54}],7:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),
|
23 |
+
i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=e(53),h=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MANIFEST_LOADING,u.default.MANIFEST_LOADED,u.default.AUDIO_TRACK_LOADED));return r.ticks=0,r.ontick=r.tick.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){f.default.prototype.destroy.call(this)}},{key:"tick",value:function(){1===++this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){this.updateTrack(this.trackId)}},{key:"onManifestLoading",value:function(){this.tracks=[],this.trackId=-1}},{key:"onManifestLoaded",value:function(e){var t=this,r=e.audioTracks||[],i=!1;this.tracks=r,this.hls.trigger(u.default.AUDIO_TRACKS_UPDATED,{audioTracks:r});var a=0;r.forEach(function(e){if(e.default)return t.audioTrack=a,void(i=!0);a++}),i===!1&&r.length&&(c.logger.log("no default audio track defined, use first audio track as default"),this.audioTrack=0)}},{key:"onAudioTrackLoaded",value:function(e){e.id<this.tracks.length&&(c.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.timer&&(this.timer=setInterval(this.ontick,1e3*e.details.targetduration)),!e.details.live&&this.timer&&(clearInterval(this.timer),this.timer=null))}},{key:"setAudioTrackInternal",value:function(e){if(e>=0&&e<this.tracks.length){this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=e,c.logger.log("switching to audioTrack "+e);var t=this.tracks[e],r=this.hls,i=t.type,a=t.url,n={id:e,type:i,url:a};r.trigger(u.default.AUDIO_TRACK_SWITCH,n),r.trigger(u.default.AUDIO_TRACK_SWITCHING,n);var s=t.details;!a||void 0!==s&&s.live!==!0||(c.logger.log("(re)loading playlist for audioTrack "+e),r.trigger(u.default.AUDIO_TRACK_LOADING,{url:a,id:e}))}}},{key:"updateTrack",value:function(e){if(e>=0&&e<this.tracks.length){this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=e,c.logger.log("updating audioTrack "+e);var t=this.tracks[e],r=t.url,i=t.details;!r||void 0!==i&&i.live!==!0||(c.logger.log("(re)loading playlist for audioTrack "+e),this.hls.trigger(u.default.AUDIO_TRACK_LOADING,{url:r,id:e}))}}},{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.trackId===e&&void 0!==this.tracks[e].details||this.setAudioTrackInternal(e)}}]),t}(f.default);r.default=h},{34:34,35:35,53:53}],8:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=e(53),h=e(33),g=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_RESET,u.default.BUFFER_APPENDING,u.default.BUFFER_CODECS,u.default.BUFFER_EOS,u.default.BUFFER_FLUSHING,u.default.LEVEL_PTS_UPDATED,u.default.LEVEL_UPDATED));return r._msDuration=null,r._levelDuration=null,r.onsbue=r.onSBUpdateEnd.bind(r),r.onsbe=r.onSBUpdateError.bind(r),r.pendingTracks={},r.tracks={},r}return s(t,e),o(t,[{key:"destroy",value:function(){f.default.prototype.destroy.call(this)}},{key:"onLevelPtsUpdated",value:function(e){var t=e.type,r=this.tracks.audio;if("audio"===t&&r&&"audio/mpeg"===r.container){var i=this.sourceBuffer.audio;if(Math.abs(i.timestampOffset-e.start)>.1){var a=i.updating;try{i.abort()}catch(e){a=!0,c.logger.warn("can not abort audio buffer: "+e)}a?this.audioTimestampOffset=e.start:(c.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}}},{key:"onManifestParsed",value:function(e){var t=e.audio,r=e.video,i=0;e.altAudio&&(t||r)&&(i=(t?1:0)+(r?1:0),c.logger.log(i+" sourceBuffer(s) expected")),this.sourceBufferNb=i}},{key:"onMediaAttaching",value:function(e){var t=this.media=e.media;if(t){var r=this.mediaSource=new MediaSource;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),t.src=URL.createObjectURL(r)}}},{key:"onMediaDetaching",value:function(){c.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){c.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this.onmso),e.removeEventListener("sourceended",this.onmse),e.removeEventListener("sourceclose",this.onmsc),this.media&&(URL.revokeObjectURL(this.media.src),this.media.removeAttribute("src"),this.media.load()),this.mediaSource=null,this.media=null,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(u.default.MEDIA_DETACHED)}},{key:"onMediaSourceOpen",value:function(){c.logger.log("media source opened"),this.hls.trigger(u.default.MEDIA_ATTACHED,{media:this.media});var e=this.mediaSource;e&&e.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()}},{key:"checkPendingTracks",value:function(){var e=this.pendingTracks,t=Object.keys(e).length;t&&(this.sourceBufferNb<=t||0===this.sourceBufferNb)&&(this.createSourceBuffers(e),this.pendingTracks={},this.doAppending())}},{key:"onMediaSourceClose",value:function(){c.logger.log("media source closed")}},{key:"onMediaSourceEnded",value:function(){c.logger.log("media source ended")}},{key:"onSBUpdateEnd",value:function(){if(this.audioTimestampOffset){var e=this.sourceBuffer.audio;c.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+this.audioTimestampOffset),e.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;var t=this.parent,r=this.segments.reduce(function(e,r){return r.parent===t?e+1:e},0);this.hls.trigger(u.default.BUFFER_APPENDED,{parent:t,pending:r}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()}},{key:"onSBUpdateError",value:function(e){c.logger.error("sourceBuffer error:",e),this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})}},{key:"onBufferReset",value:function(){var e=this.sourceBuffer;for(var t in e){var r=e[t];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}},{key:"onBufferCodecs",value:function(e){if(0===Object.keys(this.sourceBuffer).length){for(var t in e)this.pendingTracks[t]=e[t];var r=this.mediaSource;r&&"open"===r.readyState&&this.checkPendingTracks()}}},{key:"createSourceBuffers",value:function(e){var t=this.sourceBuffer,r=this.mediaSource;for(var i in e)if(!t[i]){var a=e[i],n=a.levelCodec||a.codec,s=a.container+";codecs="+n;c.logger.log("creating sourceBuffer("+s+")");try{var o=t[i]=r.addSourceBuffer(s);o.addEventListener("updateend",this.onsbue),o.addEventListener("error",this.onsbe),this.tracks[i]={codec:n,container:a.container},a.buffer=o}catch(e){c.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:s})}}this.hls.trigger(u.default.BUFFER_CREATED,{tracks:e})}},{key:"onBufferAppending",value:function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())}},{key:"onBufferAppendFail",value:function(e){c.logger.error("sourceBuffer error:",e.event),this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})}},{key:"onBufferEos",value:function(e){var t=this.sourceBuffer,r=e.type;for(var i in t)r&&i!==r||t[i].ended||(t[i].ended=!0,c.logger.log(i+" sourceBuffer now EOS"));this.checkEos()}},{key:"checkEos",value:function(){var e=this.sourceBuffer,t=this.mediaSource;if(!t||"open"!==t.readyState)return void(this._needsEos=!1);for(var r in e){var i=e[r];if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}c.logger.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment");try{t.endOfStream()}catch(e){c.logger.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}},{key:"onBufferFlushing",value:function(e){this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}),this.flushBufferCounter=0,this.doFlush()}},{key:"onLevelUpdated",value:function(e){var t=e.details;0!==t.fragments.length&&(this._levelDuration=t.totalduration+t.fragments[0].start,this.updateMediaElementDuration())}},{key:"updateMediaElementDuration",value:function(){var e=this.media,t=this.mediaSource,r=this.sourceBuffer,i=this._levelDuration;if(null!==i&&e&&t&&r&&0!==e.readyState&&"open"===t.readyState){for(var a in r)if(r[a].updating)return;null===this._msDuration&&(this._msDuration=t.duration);var n=e.duration;(i>this._msDuration&&i>n||n===1/0||isNaN(n))&&(c.logger.log("Updating mediasource duration to "+i.toFixed(3)),this._msDuration=t.duration=i)}}},{key:"doFlush",value:function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,r=this.sourceBuffer;try{for(var i in r)t+=r[i].buffered.length}catch(e){c.logger.error("error while accessing sourceBuffer.buffered")}this.appended=t,this.hls.trigger(u.default.BUFFER_FLUSHED)}}},{key:"doAppending",value:function(){var e=this.hls,t=this.sourceBuffer,r=this.segments;if(Object.keys(t).length){if(this.media.error)return this.segments=[],void c.logger.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(r&&r.length){var i=r.shift();try{var a=i.type,n=t[a];n?n.updating?r.unshift(i):(n.ended=!1,this.parent=i.parent,n.appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(t){c.logger.error("error while trying to append buffer:"+t.message),r.unshift(i);var s={type:h.ErrorTypes.MEDIA_ERROR,parent:i.parent};if(22===t.code)return this.segments=[],s.details=h.ErrorDetails.BUFFER_FULL_ERROR,s.fatal=!1,void e.trigger(u.default.ERROR,s);if(this.appendError?this.appendError++:this.appendError=1,s.details=h.ErrorDetails.BUFFER_APPEND_ERROR,this.appendError>e.config.appendErrorMaxRetry)return c.logger.log("fail "+e.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],s.fatal=!0,void e.trigger(u.default.ERROR,s);s.fatal=!1,e.trigger(u.default.ERROR,s)}}}}},{key:"flushBuffer",value:function(e,t,r){var i,a,n,s,o,l,u=this.sourceBuffer;if(Object.keys(u).length){if(c.logger.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+e+"/"+t),this.flushBufferCounter<this.appended){for(var d in u)if(!r||d===r){if(i=u[d],i.ended=!1,i.updating)return c.logger.warn("cannot flush, sb updating in progress"),!1;try{for(a=0;a<i.buffered.length;a++)if(n=i.buffered.start(a),s=i.buffered.end(a),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&&t===Number.POSITIVE_INFINITY?(o=e,l=t):(o=Math.max(n,e),l=Math.min(s,t)),Math.min(l,s)-o>.5)return this.flushBufferCounter++,c.logger.log("flush "+d+" ["+o+","+l+"], of ["+n+","+s+"], pos:"+this.media.currentTime),i.remove(o,l),!1}catch(e){c.logger.warn("exception while accessing sourcebuffer, it might have been removed from MediaSource")}}}else c.logger.warn("abort flushing too many retries");c.logger.log("buffer flushed")}return!0}}]),t}(f.default);r.default=g},{33:33,34:34,35:35,53:53}],9:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=function(e){function t(e){return a(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.FPS_DROP_LEVEL_CAPPING,u.default.MEDIA_ATTACHING,u.default.MANIFEST_PARSED))}return s(t,e),o(t,[{key:"destroy",value:function(){this.hls.config.capLevelToPlayerSize&&(this.media=this.restrictedLevels=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer)))}},{key:"onFpsDropLevelCapping",value:function(e){this.restrictedLevels||(this.restrictedLevels=[]),this.isLevelRestricted(e.droppedLevel)||this.restrictedLevels.push(e.droppedLevel)}},{key:"onMediaAttaching",value:function(e){this.media=e.media instanceof HTMLVideoElement?e.media:null}},{key:"onManifestParsed",value:function(e){var t=this.hls;t.config.capLevelToPlayerSize&&(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.levels=e.levels,t.firstLevel=this.getMaxLevel(e.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}},{key:"detectPlayerSize",value:function(){if(this.media){var e=this.levels?this.levels.length:0;if(e){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e-1),t.autoLevelCapping>this.autoLevelCapping&&t.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}},{key:"getMaxLevel",value:function(e){var t=0,r=void 0,i=void 0,a=this.mediaWidth,n=this.mediaHeight,s=0,o=0;for(r=0;r<=e&&(i=this.levels[r],!this.isLevelRestricted(r))&&(t=r,s=i.width,o=i.height,!(a<=s||n<=o));r++);return t}},{key:"isLevelRestricted",value:function(e){return!(!this.restrictedLevels||this.restrictedLevels.indexOf(e)===-1)}},{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}},{key:"mediaWidth",get:function(){var e=void 0,t=this.media;return t&&(e=t.width||t.clientWidth||t.offsetWidth,e*=this.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e=void 0,t=this.media;return t&&(e=t.height||t.clientHeight||t.offsetHeight,e*=this.contentScaleFactor),e}}]),t}(f.default);r.default=c},{34:34,35:35}],10:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=e(53),h=function(e){function t(e){return a(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MEDIA_ATTACHING))}return s(t,e),o(t,[{key:"destroy",value:function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1}},{key:"onMediaAttaching",value:function(e){var t=this.hls.config;if(t.capLevelOnFPSDrop){"function"==typeof(this.video=e.media instanceof HTMLVideoElement?e.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),t.fpsDroppedMonitoringPeriod)}}},{key:"checkFPS",value:function(e,t,r){var i=performance.now();if(t){if(this.lastTime){var a=i-this.lastTime,n=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*n/a,l=this.hls;if(l.trigger(u.default.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:r}),o>0&&n>l.config.fpsDroppedMonitoringThreshold*s){var d=l.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=d)&&(d-=1,l.trigger(u.default.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:l.currentLevel}),l.autoLevelCapping=d,l.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}},{key:"checkFPSInterval",value:function(){var e=this.video;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}]),t}(f.default);r.default=h},{34:34,35:35,53:53}],11:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_METADATA));return r.id3Track=void 0,r.media=void 0,r}return s(t,e),o(t,[{key:"destroy",value:function(){f.default.prototype.destroy.call(this)}},{key:"onMediaAttached",value:function(e){this.media=e.media,this.media&&(this.id3Track=this.media.addTextTrack("metadata","id3"),this.id3Track.mode="hidden")}},{key:"onMediaDetaching",value:function(){this.media=void 0}},{key:"onFragParsingMetadata",value:function(e){var t=e.frag,r=e.samples,i=t.start,a=t.start+t.duration;i===a&&(a+=1e-4);for(var n=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,s=0;s<r.length;s++){var o=this.parseID3Frame(r[s].data),l=this.decodeID3Frame(o);if(l){var u=new n(i,a,"");u.value=l,this.id3Track.addCue(u)}}}},{key:"parseID3Frame",value:function(e){if(!(e.length<21)&&73===e[0]&&68===e[1]&&51===e[2]){var t=String.fromCharCode(e[10],e[11],e[12],e[13]);return e=e.subarray(20),{type:t,data:e}}}},{key:"decodeID3Frame",value:function(e){return"TXXX"===e.type?this.decodeTxxxFrame(e):"PRIV"===e.type?this.decodePrivFrame(e):"T"===e.type[0]?this.decodeTextFrame(e):void 0}},{key:"decodeTxxxFrame",value:function(e){if(!(e.size<2)&&3===e.data[0]){var t=1,r=this.utf8ArrayToStr(e.data.subarray(t));t+=r.length+1;return{key:"TXXX",description:r,data:this.utf8ArrayToStr(e.data.subarray(t))}}}},{key:"decodeTextFrame",value:function(e){if(!(e.size<2)&&3===e.data[0]){var t=e.data.subarray(1);return{key:e.type,data:this.utf8ArrayToStr(t)}}}},{key:"decodePrivFrame",value:function(e){if(!(e.size<2)){var t=this.utf8ArrayToStr(e.data);return{key:"PRIV",info:t,data:e.data.subarray(t.length+1).buffer}}}},{key:"utf8ArrayToStr",value:function(e){for(var t=void 0,r=void 0,i="",a=0,n=e.length;a<n;){var s=e[a++];switch(s>>4){case 0:return i;case 1:case 2:case 3:case 4:case 5:case 6:case 7:i+=String.fromCharCode(s);break;case 12:case 13:t=e[a++],i+=String.fromCharCode((31&s)<<6|63&t);break;case 14:t=e[a++],r=e[a++],i+=String.fromCharCode((15&s)<<12|(63&t)<<6|(63&r)<<0)}}return i}}]),t}(f.default);r.default=c},{34:34,35:35}],12:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=e(53),h=e(33),g=e(37),v=i(g),p=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MANIFEST_LOADED,u.default.LEVEL_LOADED,u.default.FRAG_LOADED,u.default.ERROR));return r.ontick=r.tick.bind(r),r._manualLevel=-1,r}return s(t,e),o(t,[{key:"destroy",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this._manualLevel=-1}},{key:"startLoad",value:function(){this.canload=!0;var e=this._levels;e&&e.forEach(function(e){e.loadError=0;var t=e.details;t&&t.live&&(e.details=void 0)}),this.timer&&this.tick()}},{key:"stopLoad",value:function(){this.canload=!1}},{key:"onManifestLoaded",value:function(e){var t,r=[],i=[],a={},n=!1,s=!1,o=this.hls,l=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(e,t){return MediaSource.isTypeSupported(e+"/mp4;codecs="+t)};if(e.levels.forEach(function(e){e.videoCodec&&(n=!0),l&&e.audioCodec&&e.audioCodec.indexOf("mp4a.40.34")!==-1&&(e.audioCodec=void 0),(e.audioCodec||e.attrs&&e.attrs.AUDIO)&&(s=!0);var t=a[e.bitrate];void 0===t?(a[e.bitrate]=r.length,e.url=[e.url],e.urlId=0,r.push(e)):r[t].url.push(e.url)}),n&&s?r.forEach(function(e){e.videoCodec&&i.push(e)}):i=r,i=i.filter(function(e){var t=e.audioCodec,r=e.videoCodec;return(!t||d("audio",t))&&(!r||d("video",r))}),i.length){t=i[0].bitrate,i.sort(function(e,t){return e.bitrate-t.bitrate}),this._levels=i;for(var f=0;f<i.length;f++)if(i[f].bitrate===t){this._firstLevel=f,c.logger.log("manifest loaded,"+i.length+" level(s) found, first bitrate:"+t);break}o.trigger(u.default.MANIFEST_PARSED,{levels:i,firstLevel:this._firstLevel,stats:e.stats,audio:s,video:n,altAudio:e.audioTracks.length>0})}else o.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:o.url,reason:"no level with compatible codecs found in manifest"})}},{key:"setLevelInternal",value:function(e){var t=this._levels,r=this.hls;if(e>=0&&e<t.length){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this._level!==e){c.logger.log("switching to level "+e),this._level=e;var i=t[e];i.level=e,r.trigger(u.default.LEVEL_SWITCH,i),r.trigger(u.default.LEVEL_SWITCHING,i)}var a=t[e],n=a.details;if(!n||n.live===!0){var s=a.urlId;r.trigger(u.default.LEVEL_LOADING,{url:a.url[s],level:e,id:s})}}else r.trigger(u.default.ERROR,{type:h.ErrorTypes.OTHER_ERROR,details:h.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})}},{key:"onError",value:function(e){if(!e.fatal){var t=e.details,r=this.hls,i=void 0,a=void 0,n=!1;switch(t){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:i=e.frag.level;break;case h.ErrorDetails.LEVEL_LOAD_ERROR:case h.ErrorDetails.LEVEL_LOAD_TIMEOUT:i=e.context.level,n=!0;break;case h.ErrorDetails.REMUX_ALLOC_ERROR:i=e.level}if(void 0!==i){a=this._levels[i],a.loadError?a.loadError++:a.loadError=1;var s=a.url.length;if(s>1&&a.loadError<s)a.urlId=(a.urlId+1)%s,a.details=void 0,c.logger.warn("level controller,"+t+" for level "+i+": switching to redundant stream id "+a.urlId);else{if(this._manualLevel===-1&&i)c.logger.warn("level controller,"+t+": switch-down for next fragment"),r.nextAutoLevel=Math.max(0,i-1);else if(a&&a.details&&a.details.live)c.logger.warn("level controller,"+t+" on live stream, discard"),n&&(this._level=void 0);else if(t===h.ErrorDetails.LEVEL_LOAD_ERROR||t===h.ErrorDetails.LEVEL_LOAD_TIMEOUT){var o=r.media,l=o&&v.default.isBuffered(o,o.currentTime)&&v.default.isBuffered(o,o.currentTime+.5);if(l){var u=r.config.levelLoadingRetryDelay;c.logger.warn("level controller,"+t+", but media buffered, retry in "+u+"ms"),this.timer=setTimeout(this.ontick,u),e.levelRetry=!0}else c.logger.error("cannot recover "+t+" error"),this._level=void 0,this.timer&&(clearTimeout(this.timer),this.timer=null),e.fatal=!0}}}}}},{key:"onFragLoaded",value:function(e){var t=e.frag;if(t&&"main"===t.type){var r=this._levels[t.level];r&&(r.loadError=0)}}},{key:"onLevelLoaded",value:function(e){var t=e.level;if(t===this._level){var r=this._levels[t];r.loadError=0;var i=e.details;if(i.live){var a=1e3*(i.averagetargetduration?i.averagetargetduration:i.targetduration),n=r.details;n&&i.endSN===n.endSN&&(a/=2,c.logger.log("same live playlist, reload twice faster")),a-=performance.now()-e.stats.trequest,a=Math.max(1e3,Math.round(a)),c.logger.log("live playlist, reload in "+a+" ms"),this.timer=setTimeout(this.ontick,a)}else this.timer=null}}},{key:"tick",value:function(){var e=this._level;if(void 0!==e&&this.canload){var t=this._levels[e];if(t&&t.url){var r=t.urlId;this.hls.trigger(u.default.LEVEL_LOADING,{url:t.url[r],level:e,id:r})}}}},{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this._level},set:function(e){var t=this._levels;t&&t.length>e&&(this._level===e&&void 0!==t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(e){this._manualLevel=e,void 0===this._startLevel&&(this._startLevel=e),e!==-1&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return this._manualLevel!==-1?this._manualLevel:this.hls.nextAutoLevel},set:function(e){this.level=e,this._manualLevel===-1&&(this.hls.nextAutoLevel=e)}}]),t}(f.default);r.default=p},{33:33,34:34,35:35,37:37,53:53}],13:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(48),u=i(l),d=e(37),f=i(d),c=e(25),h=i(c),g=e(35),v=i(g),p=e(34),y=i(p),m=e(38),E=i(m),b=e(54),T=i(b),k=e(33),_=e(53),R={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_LEVEL:"WAITING_LEVEL",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR"},A=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,v.default.MEDIA_ATTACHED,v.default.MEDIA_DETACHING,v.default.MANIFEST_LOADING,v.default.MANIFEST_PARSED,v.default.LEVEL_LOADED,v.default.KEY_LOADED,v.default.FRAG_LOADED,v.default.FRAG_LOAD_EMERGENCY_ABORTED,v.default.FRAG_PARSING_INIT_SEGMENT,v.default.FRAG_PARSING_DATA,v.default.FRAG_PARSED,v.default.ERROR,v.default.AUDIO_TRACK_SWITCHING,v.default.AUDIO_TRACK_SWITCHED,v.default.BUFFER_CREATED,v.default.BUFFER_APPENDED,v.default.BUFFER_FLUSHED));return r.config=e.config,r.audioCodecSwap=!1,r.ticks=0,r._state=R.STOPPED,r.ontick=r.tick.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),y.default.prototype.destroy.call(this),this.state=R.STOPPED}},{key:"startLoad",value:function(e){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=r.startLevel;i===-1&&(i=0,this.bitrateTest=!0),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1}t>0&&e===-1&&(_.logger.log("override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=R.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this.forceStartLoad=!0,this.state=R.STOPPED}},{key:"stopLoad",value:function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=R.STOPPED,this.forceStartLoad=!1}},{key:"tick",value:function(){1===++this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){switch(this.state){case R.ERROR:break;case R.BUFFER_FLUSHING:this.fragLoadError=0;break;case R.IDLE:this._doTickIdle();break;case R.WAITING_LEVEL:var e=this.levels[this.level];e&&e.details&&(this.state=R.IDLE);break;case R.FRAG_LOADING_WAITING_RETRY:var t=performance.now(),r=this.retryDate;(!r||t>=r||this.media&&this.media.seeking)&&(_.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=R.IDLE);break;case R.ERROR:case R.STOPPED:case R.FRAG_LOADING:case R.PARSING:case R.PARSED:case R.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"_doTickIdle",
|
24 |
+
value:function(){var e=this.hls,t=e.config,r=this.media;if(void 0===this.levelLastLoaded||r||!this.startFragRequested&&t.startFragPrefetch){var i=void 0;i=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var a=e.nextLoadLevel,n=this.levels[a];if(n){var s=n.bitrate,o=void 0;o=s?Math.max(8*t.maxBufferSize/s,t.maxBufferLength):t.maxBufferLength,o=Math.min(o,t.maxMaxBufferLength);var l=f.default.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,i,t.maxBufferHole),u=l.len;if(!(u>=o)){_.logger.trace("buffer length of "+u.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=a;var d=n.details;if(void 0===d||d.live&&this.levelLastLoaded!==a)return void(this.state=R.WAITING_LEVEL);var c=this.fragPrevious;if(!d.live&&c&&c.sn===d.endSN){if(Math.min(r.duration,c.start+c.duration)-Math.max(l.end,c.start)<=Math.max(.2,c.duration)){var h={};return this.altAudio&&(h.type="video"),this.hls.trigger(v.default.BUFFER_EOS,h),void(this.state=R.ENDED)}}this._fetchPayloadOrEos(i,l,d)}}}}},{key:"_fetchPayloadOrEos",value:function(e,t,r){var i=this.fragPrevious,a=this.level,n=r.fragments,s=n.length;if(0!==s){var o=n[0].start,l=n[s-1].start+n[s-1].duration,u=t.end,d=void 0;if(r.initSegment&&!r.initSegment.data)d=r.initSegment;else if(r.live){var f=this.config.initialLiveManifestSize;if(s<f)return void _.logger.warn("Can not start playback of a level, reason: not enough fragments "+s+" < "+f);if(null===(d=this._ensureFragmentAtLivePoint(r,u,o,l,i,n,s)))return}else u<o&&(d=n[0]);d||(d=this._findFragment(o,i,s,n,u,l,r)),d&&this._loadFragmentOrKey(d,a,r,e,u)}}},{key:"_ensureFragmentAtLivePoint",value:function(e,t,r,i,a,n,s){var o=this.hls.config,l=this.media,u=void 0,d=void 0!==o.liveMaxLatencyDuration?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*e.targetduration;if(t<Math.max(r-o.maxFragLookUpTolerance,i-d)){var f=this.liveSyncPosition=this.computeLivePosition(r,e);_.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+f.toFixed(3)),t=f,l&&l.readyState&&l.duration>f&&(l.currentTime=f)}if(e.PTSKnown&&t>i&&l&&l.readyState)return null;if(this.startFragRequested&&!e.PTSKnown){if(a){var c=a.sn+1;c>=e.startSN&&c<=e.endSN&&(u=n[c-e.startSN],_.logger.log("live playlist, switching playlist, load frag with next SN: "+u.sn))}u||(u=n[Math.min(s-1,Math.round(s/2))],_.logger.log("live playlist, switching playlist, unknown, load middle frag : "+u.sn))}return u}},{key:"_findFragment",value:function(e,t,r,i,a,n,s){var o=this.hls.config,l=void 0,d=void 0,f=o.maxFragLookUpTolerance,c=t?i[t.sn-i[0].sn+1]:void 0,h=function(e){var t=Math.min(f,e.duration);return e.start+e.duration-t<=a?1:e.start-t>a&&e.start?-1:0};if(a<n?(a>n-f&&(f=0),d=c&&!h(c)?c:u.default.search(i,h)):d=i[r-1],d){l=d;var g=l.sn-s.startSN,v=t&&l.level===t.level,p=i[g-1],y=i[g+1];if(t&&l.sn===t.sn)if(v&&!l.backtracked)if(l.sn<s.endSN){var m=t.deltaPTS;m&&m>o.maxBufferHole&&t.dropped&&g?(l=p,_.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),t.loadCounter--):(l=y,_.logger.log("SN just loaded, load next one: "+l.sn))}else l=null;else l.backtracked&&(y&&y.backtracked?(_.logger.warn("Already backtracked from fragment "+y.sn+", will not backtrack to fragment "+l.sn+". Loading fragment "+y.sn),l=y):(_.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),l.dropped=0,p?(p.loadCounter&&p.loadCounter--,l=p,l.backtracked=!0):l=null))}return l}},{key:"_loadFragmentOrKey",value:function(e,t,r,i,a){var n=this.hls,s=n.config;if(!e.decryptdata||null==e.decryptdata.uri||null!=e.decryptdata.key){if(_.logger.log("Loading "+e.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+t+", currentTime:"+i.toFixed(3)+",bufferEnd:"+a.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,e.loadCounter){e.loadCounter++;var o=s.fragLoadingLoopThreshold;if(e.loadCounter>o&&Math.abs(this.fragLoadIdx-e.loadIdx)<o)return void n.trigger(v.default.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:e})}else e.loadCounter=1;return e.loadIdx=this.fragLoadIdx,this.fragCurrent=e,this.startFragRequested=!0,isNaN(e.sn)||(this.nextLoadPosition=e.start+e.duration),e.autoLevel=n.autoLevelEnabled,e.bitrateTest=this.bitrateTest,n.trigger(v.default.FRAG_LOADING,{frag:e}),this.demuxer||(this.demuxer=new h.default(n,"main")),void(this.state=R.FRAG_LOADING)}_.logger.log("Loading key for "+e.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+t),this.state=R.KEY_LOADING,n.trigger(v.default.KEY_LOADING,{frag:e})}},{key:"getBufferedFrag",value:function(e){return u.default.search(this._bufferedFrags,function(t){return e<t.startPTS?-1:e>t.endPTS?1:0})}},{key:"followingBufferedFrag",value:function(e){return e?this.getBufferedFrag(e.endPTS+.5):null}},{key:"_checkFragmentChanged",value:function(){var e,t,r=this.media;if(r&&r.readyState&&r.seeking===!1&&(t=r.currentTime,t>r.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=t),f.default.isBuffered(r,t)?e=this.getBufferedFrag(t):f.default.isBuffered(r,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){var i=e;if(i!==this.fragPlaying){this.hls.trigger(v.default.FRAG_CHANGED,{frag:i});var a=i.level;this.fragPlaying&&this.fragPlaying.level===a||this.hls.trigger(v.default.LEVEL_SWITCHED,{level:a}),this.fragPlaying=i}}}},{key:"immediateLevelSwitch",value:function(){if(_.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e=this.media,t=void 0;e?(t=e.paused,e.pause()):t=!0,this.previouslyPaused=t}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}},{key:"immediateLevelSwitchEnd",value:function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,f.default.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var e=this.media;if(e&&e.readyState){var t=void 0,r=void 0,i=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,r=this.getBufferedFrag(e.currentTime),r&&r.startPTS>1&&this.flushMainBuffer(0,r.startPTS-1),e.paused)t=0;else{var a=this.hls.nextLoadLevel,n=this.levels[a],s=this.fragLastKbps;t=s&&this.fragCurrent?this.fragCurrent.duration*n.bitrate/(1e3*s)+1:0}if((i=this.getBufferedFrag(e.currentTime+t))&&(i=this.followingBufferedFrag(i))){var o=this.fragCurrent;o&&o.loader&&o.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(i.startPTS,Number.POSITIVE_INFINITY)}}}},{key:"flushMainBuffer",value:function(e,t){this.state=R.BUFFER_FLUSHING;var r={startOffset:e,endOffset:t};this.altAudio&&(r.type="video"),this.hls.trigger(v.default.BUFFER_FLUSHING,r)}},{key:"onMediaAttached",value:function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(_.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0,e.backtracked=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){var e=this.media,t=e?e.currentTime:void 0,r=this.config;isNaN(t)||_.logger.log("media seeking to "+t.toFixed(3));var i=this.mediaBuffer?this.mediaBuffer:e,a=f.default.bufferInfo(i,t,this.config.maxBufferHole);if(this.state===R.FRAG_LOADING){var n=this.fragCurrent;if(0===a.len&&n){var s=r.maxFragLookUpTolerance,o=n.start-s,l=n.start+n.duration+s;t<o||t>l?(n.loader&&(_.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),n.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=R.IDLE):_.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===R.ENDED&&(0===a.len&&(this.fragPrevious=0),this.state=R.IDLE);e&&(this.lastCurrentTime=t),this.state!==R.FRAG_LOADING&&void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*r.fragLoadingLoopThreshold),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=t),this.tick()}},{key:"onMediaSeeked",value:function(){var e=this.media,t=e?e.currentTime:void 0;isNaN(t)||_.logger.log("media seeked to "+t.toFixed(3)),this.tick()}},{key:"onMediaEnded",value:function(){_.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){_.logger.log("trigger BUFFER_RESET"),this.hls.trigger(v.default.BUFFER_RESET),this._bufferedFrags=[],this.stalled=!1,this.startPosition=this.lastCurrentTime=0}},{key:"onManifestParsed",value:function(e){var t,r=!1,i=!1;e.levels.forEach(function(e){(t=e.audioCodec)&&(t.indexOf("mp4a.40.2")!==-1&&(r=!0),t.indexOf("mp4a.40.5")!==-1&&(i=!0))}),this.audioCodecSwitch=r&&i,this.audioCodecSwitch&&_.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startLevelLoaded=!1,this.startFragRequested=!1;var a=this.config;(a.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(a.startPosition)}},{key:"onLevelLoaded",value:function(e){var t=e.details,r=e.level,i=this.levels[r],a=t.totalduration,n=0;if(_.logger.log("level "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),this.levelLastLoaded=r,t.live){var s=i.details;s&&t.fragments.length>0?(E.default.mergeDetails(s,t),n=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(n,s),t.PTSKnown?_.logger.log("live playlist sliding:"+n.toFixed(3)):_.logger.log("live playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,_.logger.log("live playlist - first load, unknown sliding"))}else t.PTSKnown=!1;if(i.details=t,this.hls.trigger(v.default.LEVEL_UPDATED,{details:t,level:r}),this.startFragRequested===!1){if(this.startPosition===-1||this.lastCurrentTime===-1){var o=t.startTimeOffset;isNaN(o)?t.live?(this.startPosition=this.computeLivePosition(n,t),_.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0:(o<0&&(_.logger.log("negative start time offset "+o+", count from end of last fragment"),o=n+a+o),_.logger.log("start time offset found in playlist, adjust startPosition to "+o),this.startPosition=o),this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===R.WAITING_LEVEL&&(this.state=R.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===R.KEY_LOADING&&(this.state=R.IDLE,this.tick())}},{key:"onFragLoaded",value:function(e){var t=this.fragCurrent,r=e.frag;if(this.state===R.FRAG_LOADING&&t&&"main"===r.type&&r.level===t.level&&r.sn===t.sn){var i=e.stats,a=this.levels[t.level],n=a.details;if(_.logger.log("Loaded "+t.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+t.level),this.bitrateTest=!1,this.stats=i,r.bitrateTest===!0&&this.hls.nextLoadLevel)this.state=R.IDLE,this.startFragRequested=!1,i.tparsed=i.tbuffered=performance.now(),this.hls.trigger(v.default.FRAG_BUFFERED,{stats:i,frag:t,id:"main"}),this.tick();else if("initSegment"===r.sn)this.state=R.IDLE,i.tparsed=i.tbuffered=performance.now(),n.initSegment.data=e.payload,this.hls.trigger(v.default.FRAG_BUFFERED,{stats:i,frag:t,id:"main"}),this.tick();else{this.state=R.PARSING;var s=n.totalduration,o=t.level,l=t.sn,u=this.config.defaultAudioCodec||a.audioCodec;this.audioCodecSwap&&(_.logger.log("swapping playlist audio codec"),void 0===u&&(u=this.lastAudioCodec),u&&(u=u.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5")),this.pendingBuffering=!0,this.appended=!1,_.logger.log("Parsing "+l+" of ["+n.startSN+" ,"+n.endSN+"],level "+o+", cc "+t.cc);var d=this.demuxer;d||(d=this.demuxer=new h.default(this.hls,"main"));var f=this.media,c=f&&f.seeking,g=!c&&(n.PTSKnown||!n.live),p=n.initSegment?n.initSegment.data:[];d.push(e.payload,p,u,a.videoCodec,t,s,g,void 0)}}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(e){var t=this.fragCurrent,r=e.frag;if(t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===R.PARSING){var i,a,n=e.tracks;if(n.audio&&this.altAudio&&delete n.audio,a=n.audio){var s=this.levels[this.level].audioCodec,o=navigator.userAgent.toLowerCase();s&&this.audioCodecSwap&&(_.logger.log("swapping playlist audio codec"),s=s.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==a.metadata.channelCount&&o.indexOf("firefox")===-1&&(s="mp4a.40.5"),o.indexOf("android")!==-1&&"audio/mpeg"!==a.container&&(s="mp4a.40.2",_.logger.log("Android: force audio codec to "+s)),a.levelCodec=s,a.id=e.id}a=n.video,a&&(a.levelCodec=this.levels[this.level].videoCodec,a.id=e.id),this.hls.trigger(v.default.BUFFER_CODECS,n);for(i in n){a=n[i],_.logger.log("main track:"+i+",container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var l=a.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(v.default.BUFFER_APPENDING,{type:i,data:l,parent:"main",content:"initSegment"}))}this.tick()}}},{key:"onFragParsingData",value:function(e){var t=this,r=this.fragCurrent,i=e.frag;if(r&&"main"===e.id&&i.sn===r.sn&&i.level===r.level&&("audio"!==e.type||!this.altAudio)&&this.state===R.PARSING){var a=this.levels[this.level],n=r;if(isNaN(e.endPTS)&&(e.endPTS=e.startPTS+r.duration,e.endDTS=e.startDTS+r.duration),_.logger.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(n.dropped=e.dropped,n.dropped){if(!n.backtracked)return _.logger.warn("missing video frame(s), backtracking fragment"),n.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=R.IDLE,this.fragPrevious=n,void this.tick();_.logger.warn("Already backtracked on this fragment, appending with the gap")}else n.backtracked=!1;var s=E.default.updateFragPTSDTS(a.details,n,e.startPTS,e.endPTS,e.startDTS,e.endDTS),o=this.hls;o.trigger(v.default.LEVEL_PTS_UPDATED,{details:a.details,level:this.level,drift:s,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach(function(r){r&&r.length&&t.state===R.PARSING&&(t.appended=!0,t.pendingBuffering=!0,o.trigger(v.default.BUFFER_APPENDING,{type:e.type,data:r,parent:"main",content:"data"}))}),this.tick()}}},{key:"onFragParsed",value:function(e){var t=this.fragCurrent,r=e.frag;t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===R.PARSING&&(this.stats.tparsed=performance.now(),this.state=R.PARSED,this._checkAppendedParsed())}},{key:"onAudioTrackSwitching",value:function(e){var t=!!e.url,r=e.id;if(!t){if(this.mediaBuffer!==this.media){_.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i.loader&&(_.logger.log("switching to main audio track, cancel main fragment load"),i.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=R.IDLE}var a=this.hls;a.trigger(v.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),a.trigger(v.default.AUDIO_TRACK_SWITCHED,{id:r}),this.altAudio=!1}}},{key:"onAudioTrackSwitched",value:function(e){var t=e.id,r=!!this.hls.audioTracks[t].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(_.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()}},{key:"onBufferCreated",value:function(e){var t=e.tracks,r=void 0,i=void 0,a=!1;for(var n in t){var s=t[n];"main"===s.id?(i=n,r=s,"video"===n&&(this.videoBuffer=t[n].buffer)):a=!0}a&&r?(_.logger.log("alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}},{key:"onBufferAppended",value:function(e){if("main"===e.parent){var t=this.state;t!==R.PARSING&&t!==R.PARSED||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}}},{key:"_checkAppendedParsed",value:function(){if(!(this.state!==R.PARSED||this.appended&&this.pendingBuffering)){var e=this.fragCurrent;if(e){var t=this.mediaBuffer?this.mediaBuffer:this.media;_.logger.log("main buffered : "+T.default.toString(t.buffered));var r=this._bufferedFrags.filter(function(e){return f.default.isBuffered(t,(e.startPTS+e.endPTS)/2)});r.push(e),this._bufferedFrags=r.sort(function(e,t){return e.startPTS-t.startPTS}),this.fragPrevious=e;var i=this.stats;i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.total/(i.tbuffered-i.tfirst)),this.hls.trigger(v.default.FRAG_BUFFERED,{stats:i,frag:e,id:"main"}),this.state=R.IDLE}this.tick()}}},{key:"onError",value:function(e){var t=e.frag||this.fragCurrent;if(!t||"main"===t.type){var r=this.media,i=r&&f.default.isBuffered(r,r.currentTime)&&f.default.isBuffered(r,r.currentTime+.5);switch(e.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:if(!e.fatal){var a=this.fragLoadError;a?a++:a=1;var n=this.config;if(a<=n.fragLoadingMaxRetry||i||t.autoLevel&&t.level){this.fragLoadError=a,t.loadCounter=0;var s=Math.min(Math.pow(2,a-1)*n.fragLoadingRetryDelay,n.fragLoadingMaxRetryTimeout);_.logger.warn("mediaController: frag loading failed, retry in "+s+" ms"),this.retryDate=performance.now()+s,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.state=R.FRAG_LOADING_WAITING_RETRY}else _.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=R.ERROR}break;case k.ErrorDetails.FRAG_LOOP_LOADING_ERROR:e.fatal||(i?(this._reduceMaxBufferLength(t.duration),this.state=R.IDLE):t.autoLevel&&0!==t.level||(e.fatal=!0,this.state=R.ERROR));break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==R.ERROR&&(e.fatal?(this.state=R.ERROR,_.logger.warn("streamController: "+e.details+",switch to "+this.state+" state ...")):e.levelRetry||this.state!==R.WAITING_LEVEL||(this.state=R.IDLE));break;case k.ErrorDetails.BUFFER_FULL_ERROR:"main"!==e.parent||this.state!==R.PARSING&&this.state!==R.PARSED||(i?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=R.IDLE):(_.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}}},{key:"_reduceMaxBufferLength",value:function(e){var t=this.config;t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,_.logger.warn("main:reduce max buffer length to "+t.maxMaxBufferLength+"s"),this.fragLoadIdx+=2*t.fragLoadingLoopThreshold)}},{key:"_checkBuffer",value:function(){var e=this.media;if(e&&e.readyState){var t=e.currentTime,r=this.mediaBuffer?this.mediaBuffer:e,i=r.buffered;if(!this.loadedmetadata&&i.length){this.loadedmetadata=!0;var a=e.seeking?t:this.startPosition,n=f.default.isBuffered(r,a);t===a&&n||(_.logger.log("target start position:"+a),n||(a=i.start(0),_.logger.log("target start position not buffered, seek to buffered.start(0) "+a)),_.logger.log("adjust currentTime from "+t+" to "+a),e.currentTime=a)}else if(this.immediateSwitch)this.immediateLevelSwitchEnd();else{var s=f.default.bufferInfo(e,t,0),o=!(e.paused||e.ended||0===e.buffered.length),l=t!==this.lastCurrentTime,u=this.config;if(l)this.stallReported&&(_.logger.warn("playback not stuck anymore @"+t+", after "+Math.round(performance.now()-this.stalled)+"ms"),this.stallReported=!1),this.stalled=void 0,this.nudgeRetry=0;else if(o){var d=performance.now(),c=this.hls;if(this.stalled){var h=d-this.stalled,g=s.len,p=this.nudgeRetry||0;if(g<=.5&&h>1e3*u.lowBufferWatchdogPeriod){this.stallReported||(this.stallReported=!0,_.logger.warn("playback stalling in low buffer @"+t),c.trigger(v.default.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}));var y=s.nextStart,m=y-t;if(y&&m<u.maxSeekHole&&m>0){this.nudgeRetry=++p;var E=p*u.nudgeOffset;_.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+y+" + nudge "+E),e.currentTime=y+E,this.stalled=void 0,c.trigger(v.default.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:y+E-t})}}else if(g>.5&&h>1e3*u.highBufferWatchdogPeriod)if(this.stallReported||(this.stallReported=!0,_.logger.warn("playback stalling in high buffer @"+t),c.trigger(v.default.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g})),this.stalled=void 0,this.nudgeRetry=++p,p<u.nudgeMaxRetry){var b=e.currentTime,T=b+p*u.nudgeOffset;_.logger.log("adjust currentTime from "+b+" to "+T),e.currentTime=T,c.trigger(v.default.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else _.logger.error("still stuck in high buffer @"+t+" after "+u.nudgeMaxRetry+", raise fatal error"),c.trigger(v.default.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})}else this.stalled=d,this.stallReported=!1}}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=R.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()}},{key:"onBufferFlushed",value:function(){var e=this.mediaBuffer?this.mediaBuffer:this.media;this._bufferedFrags=this._bufferedFrags.filter(function(t){return f.default.isBuffered(e,(t.startPTS+t.endPTS)/2)}),this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=R.IDLE,this.fragPrevious=null}},{key:"swapAudioCodec",value:function(){this.audioCodecSwap=!this.audioCodecSwap}},{key:"computeLivePosition",value:function(e,t){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-r)}},{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,_.logger.log("main stream:"+t+"->"+e),this.hls.trigger(v.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getBufferedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;return e?this.followingBufferedFrag(this.getBufferedFrag(e.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e}}]),t}(y.default);r.default=A},{25:25,33:33,34:34,35:35,37:37,38:38,48:48,53:53,54:54}],14:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=e(53),h=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.ERROR,u.default.SUBTITLE_TRACKS_UPDATED,u.default.SUBTITLE_TRACK_SWITCH,u.default.SUBTITLE_TRACK_LOADED,u.default.SUBTITLE_FRAG_PROCESSED));return r.config=e.config,r.vttFragSNsProcessed={},r.vttFragQueues=void 0,r.currentlyProcessing=null,r.currentTrackId=-1,r}return s(t,e),o(t,[{key:"destroy",value:function(){f.default.prototype.destroy.call(this)}},{key:"clearVttFragQueues",value:function(){var e=this;this.vttFragQueues={},this.tracks.forEach(function(t){e.vttFragQueues[t.id]=[]})}},{key:"nextFrag",value:function(){if(null===this.currentlyProcessing&&this.currentTrackId>-1&&this.vttFragQueues[this.currentTrackId].length){var e=this.currentlyProcessing=this.vttFragQueues[this.currentTrackId].shift();this.hls.trigger(u.default.FRAG_LOADING,{frag:e})}}},{key:"onSubtitleFragProcessed",value:function(e){e.success&&this.vttFragSNsProcessed[e.frag.trackId].push(e.frag.sn),this.currentlyProcessing=null,this.nextFrag()}},{key:"onError",value:function(e){var t=e.frag;t&&"subtitle"!==t.type||this.currentlyProcessing&&(this.currentlyProcessing=null,this.nextFrag())}},{key:"onSubtitleTracksUpdated",value:function(e){var t=this;c.logger.log("subtitle tracks updated"),this.tracks=e.subtitleTracks,this.clearVttFragQueues(),this.vttFragSNsProcessed={},this.tracks.forEach(function(e){t.vttFragSNsProcessed[e.id]=[]})}},{key:"onSubtitleTrackSwitch",value:function(e){this.currentTrackId=e.id,this.clearVttFragQueues()}},{key:"onSubtitleTrackLoaded",value:function(e){var t=this.vttFragSNsProcessed[e.id],r=this.vttFragQueues[e.id],i=this.currentlyProcessing?this.currentlyProcessing.sn:-1,a=function(e){return t.indexOf(e.sn)>-1},n=function(e){return r.some(function(t){return t.sn===e.sn})};e.details.fragments.forEach(function(t){a(t)||t.sn===i||n(t)||(t.trackId=e.id,r.push(t))}),this.nextFrag()}}]),t}(f.default);r.default=h},{34:34,35:35,53:53}],15:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function o(e){for(var t=[],r=0;r<e.length;r++)"subtitles"===e[r].kind&&t.push(e[r]);return t}Object.defineProperty(r,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),u=e(35),d=i(u),f=e(34),c=i(f),h=e(53),g=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,d.default.MEDIA_ATTACHED,d.default.MEDIA_DETACHING,d.default.MANIFEST_LOADING,d.default.MANIFEST_LOADED,d.default.SUBTITLE_TRACK_LOADED));return r.tracks=[],r.trackId=-1,r.media=void 0,r}return s(t,e),l(t,[{key:"destroy",value:function(){c.default.prototype.destroy.call(this)}},{key:"onMediaAttached",value:function(e){var t=this;this.media=e.media,this.media&&this.media.textTracks.addEventListener("change",function(){if(t.media){for(var e=-1,r=o(t.media.textTracks),i=0;i<r.length;i++)"showing"===r[i].mode&&(e=i);t.subtitleTrack=e}})}},{key:"onMediaDetaching",value:function(){this.media=void 0}},{key:"onManifestLoading",value:function(){this.tracks=[],this.trackId=-1}},{key:"onManifestLoaded",value:function(e){var t=this,r=e.subtitles||[],i=!1;this.tracks=r,this.trackId=-1,this.hls.trigger(d.default.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:r}),r.forEach(function(e){e.default&&(t.subtitleTrack=e.id,i=!0)})}},{key:"onTick",value:function(){var e=this.trackId,t=this.tracks[e];if(t){var r=t.details;void 0!==r&&r.live!==!0||(h.logger.log("(re)loading playlist for subtitle track "+e),this.hls.trigger(d.default.SUBTITLE_TRACK_LOADING,{url:t.url,id:e}))}}},{key:"onSubtitleTrackLoaded",value:function(e){var t=this;e.id<this.tracks.length&&(h.logger.log("subtitle track "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.timer&&(this.timer=setInterval(function(){t.onTick()},1e3*e.details.targetduration,this)),!e.details.live&&this.timer&&(clearInterval(this.timer),this.timer=null))}},{key:"setSubtitleTrackInternal",value:function(e){if(e>=0&&e<this.tracks.length){this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=e,h.logger.log("switching to subtitle track "+e);var t=this.tracks[e];this.hls.trigger(d.default.SUBTITLE_TRACK_SWITCH,{id:e});var r=t.details;void 0!==r&&r.live!==!0||(h.logger.log("(re)loading playlist for subtitle track "+e),this.hls.trigger(d.default.SUBTITLE_TRACK_LOADING,{url:t.url,id:e}))}}},{key:"subtitleTracks",get:function(){return this.tracks}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.trackId!==e&&this.setSubtitleTrackInternal(e)}}]),t}(c.default);r.default=g},{34:34,35:35,53:53}],16:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function o(e){if(e&&e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}function l(e,t){return e&&e.label===t.name&&!(e.textTrack1||e.textTrack2)}function u(e,t,r,i){return Math.min(t,i)-Math.max(e,r)}Object.defineProperty(r,"__esModule",{value:!0});var d=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),f=e(35),c=i(f),h=e(34),g=i(h),v=e(49),p=i(v),y=e(57),m=i(y),E=e(53),b=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,c.default.MEDIA_ATTACHING,c.default.MEDIA_DETACHING,c.default.FRAG_PARSING_USERDATA,c.default.MANIFEST_LOADING,c.default.MANIFEST_LOADED,c.default.FRAG_LOADED,c.default.LEVEL_SWITCHING,c.default.INIT_PTS_FOUND));if(r.hls=e,r.config=e.config,r.enabled=!0,r.Cues=e.config.cueHandler,r.textTracks=[],r.tracks=[],r.unparsedVttFrags=[],r.initPTS=void 0,r.cueRanges=[],r.config.enableCEA708Captions){var i=r,s=function(e,t){var r=null;try{r=new window.Event("addtrack")}catch(e){r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)},l={newCue:function(e,t,r){if(!i.textTrack1){var a=i.getExistingTrack("1");if(a)i.textTrack1=a,o(i.textTrack1),s(i.textTrack1,i.media);else{var n=i.createTextTrack("captions",i.config.captionsTextTrack1Label,i.config.captionsTextTrack1LanguageCode);n&&(n.textTrack1=!0,i.textTrack1=n)}}i.addCues("textTrack1",e,t,r)}},u={newCue:function(e,t,r){if(!i.textTrack2){var a=i.getExistingTrack("2");if(a)i.textTrack2=a,o(i.textTrack2),s(i.textTrack2,i.media);else{
|
25 |
+
var n=i.createTextTrack("captions",i.config.captionsTextTrack2Label,i.config.captionsTextTrack1LanguageCode);n&&(n.textTrack2=!0,i.textTrack2=n)}}i.addCues("textTrack2",e,t,r)}};r.cea608Parser=new p.default(0,l,u)}return r}return s(t,e),d(t,[{key:"addCues",value:function(e,t,r,i){for(var a=this.cueRanges,n=!1,s=a.length;s--;){var o=a[s],l=u(o[0],o[1],t,r);if(l>=0&&(o[0]=Math.min(o[0],t),o[1]=Math.max(o[1],r),n=!0,l/(r-t)>.5))return}n||a.push([t,r]),this.Cues.newCue(this[e],t,r,i)}},{key:"onInitPtsFound",value:function(e){var t=this;void 0===this.initPTS&&(this.initPTS=e.initPTS),this.unparsedVttFrags.length&&(this.unparsedVttFrags.forEach(function(e){t.onFragLoaded(e)}),this.unparsedVttFrags=[])}},{key:"getExistingTrack",value:function(e){var t=this.media;if(t)for(var r=0;r<t.textTracks.length;r++){var i=t.textTracks[r],a="textTrack"+e;if(i[a]===!0)return i}return null}},{key:"createTextTrack",value:function(e,t,r){var i=this.media;if(i)return i.addTextTrack(e,t,r)}},{key:"destroy",value:function(){g.default.prototype.destroy.call(this)}},{key:"onMediaAttaching",value:function(e){this.media=e.media}},{key:"onMediaDetaching",value:function(){o(this.textTrack1),o(this.textTrack2)}},{key:"onManifestLoading",value:function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0};var e=this.media;if(e){var t=e.textTracks;if(t)for(var r=0;r<t.length;r++)o(t[r])}}},{key:"onManifestLoaded",value:function(e){var t=this;if(this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=void 0,this.cueRanges=[],this.config.enableWebVTT){this.tracks=e.subtitles||[];var r=this.media?this.media.textTracks:[];this.tracks.forEach(function(e,i){var a=void 0;if(i<r.length){var n=r[i];l(n,e)&&(a=n)}a||(a=t.createTextTrack("subtitles",e.name,e.lang)),a.mode=e.default?"showing":"hidden",t.textTracks.push(a)})}}},{key:"onLevelSwitching",value:function(){this.enabled="NONE"!==this.hls.currentLevel.closedCaptions}},{key:"onFragLoaded",value:function(e){var t=e.frag,r=e.payload;if("main"===t.type){var i=t.sn;if(i!==this.lastSn+1){var a=this.cea608Parser;a&&a.reset()}this.lastSn=i}else if("subtitle"===t.type)if(r.byteLength){if(void 0===this.initPTS)return void this.unparsedVttFrags.push(e);var n=this.vttCCs;n[t.cc]||(n[t.cc]={start:t.start,prevCC:this.prevCC,new:!0},this.prevCC=t.cc);var s=this.textTracks,o=this.hls;m.default.parse(r,this.initPTS,n,t.cc,function(e){var r=s[t.trackId];e.forEach(function(e){r.cues.getCueById(e.id)||r.addCue(e)}),o.trigger(c.default.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},function(e){E.logger.log("Failed to parse VTT cue: "+e),o.trigger(c.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t})})}else this.hls.trigger(c.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t})}},{key:"onFragParsingUserdata",value:function(e){if(this.enabled&&this.config.enableCEA708Captions)for(var t=0;t<e.samples.length;t++){var r=this.extractCea608Data(e.samples[t].bytes);this.cea608Parser.addData(e.samples[t].pts,r)}}},{key:"extractCea608Data",value:function(e){for(var t,r,i,a,n,s=31&e[0],o=2,l=[],u=0;u<s;u++)t=e[o++],r=127&e[o++],i=127&e[o++],a=0!=(4&t),n=3&t,0===r&&0===i||a&&0===n&&(l.push(r),l.push(i));return l}}]),t}(g.default);r.default=b},{34:34,35:35,49:49,53:53,57:57}],17:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(t,r){i(this,e),this.subtle=t,this.aesIV=r}return a(e,[{key:"decrypt",value:function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}]),e}();r.default=n},{}],18:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(){i(this,e),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}return a(e,[{key:"uint8ArrayToUint32Array_",value:function(e){for(var t=new DataView(e),r=new Uint32Array(4),i=0;i<4;i++)r[i]=t.getUint32(4*i);return r}},{key:"initTable",value:function(){var e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],s=r[3],o=this.invSubMix,l=o[0],u=o[1],d=o[2],f=o[3],c=new Uint32Array(256),h=0,g=0,v=0;for(v=0;v<256;v++)c[v]=v<128?v<<1:v<<1^283;for(v=0;v<256;v++){var p=g^g<<1^g<<2^g<<3^g<<4;p=p>>>8^255&p^99,e[h]=p,t[p]=h;var y=c[h],m=c[y],E=c[m],b=257*c[p]^16843008*p;i[h]=b<<24|b>>>8,a[h]=b<<16|b>>>16,n[h]=b<<8|b>>>24,s[h]=b,b=16843009*E^65537*m^257*y^16843008*h,l[p]=b<<24|b>>>8,u[p]=b<<16|b>>>16,d[p]=b<<8|b>>>24,f[p]=b,h?(h=y^c[c[c[E^y]]],g^=c[c[g]]):h=g=1}}},{key:"expandKey",value:function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i<t.length&&r;)r=t[i]===this.key[i],i++;if(!r){this.key=t;var a=this.keySize=t.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);var n=this.ksRows=4*(a+6+1),s=void 0,o=void 0,l=this.keySchedule=new Uint32Array(n),u=this.invKeySchedule=new Uint32Array(n),d=this.sBox,f=this.rcon,c=this.invSubMix,h=c[0],g=c[1],v=c[2],p=c[3],y=void 0,m=void 0;for(s=0;s<n;s++)s<a?y=l[s]=t[s]:(m=y,s%a==0?(m=m<<8|m>>>24,m=d[m>>>24]<<24|d[m>>>16&255]<<16|d[m>>>8&255]<<8|d[255&m],m^=f[s/a|0]<<24):a>6&&s%a==4&&(m=d[m>>>24]<<24|d[m>>>16&255]<<16|d[m>>>8&255]<<8|d[255&m]),l[s]=y=(l[s-a]^m)>>>0);for(o=0;o<n;o++)s=n-o,m=3&o?l[s]:l[s-4],u[o]=o<4||s<=4?m:h[d[m>>>24]]^g[d[m>>>16&255]]^v[d[m>>>8&255]]^p[d[255&m]],u[o]=u[o]>>>0}}},{key:"networkToHostOrderSwap",value:function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}},{key:"decrypt",value:function(e,t,r){for(var i,a,n=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,l=this.invSubMix,u=l[0],d=l[1],f=l[2],c=l[3],h=this.uint8ArrayToUint32Array_(r),g=h[0],v=h[1],p=h[2],y=h[3],m=new Int32Array(e),E=new Int32Array(m.length),b=void 0,T=void 0,k=void 0,_=void 0,R=void 0,A=void 0,S=void 0,L=void 0,w=void 0,D=void 0,O=void 0,I=void 0,P=this.networkToHostOrderSwap;t<m.length;){for(w=P(m[t]),D=P(m[t+1]),O=P(m[t+2]),I=P(m[t+3]),R=w^s[0],A=I^s[1],S=O^s[2],L=D^s[3],i=4,a=1;a<n;a++)b=u[R>>>24]^d[A>>16&255]^f[S>>8&255]^c[255&L]^s[i],T=u[A>>>24]^d[S>>16&255]^f[L>>8&255]^c[255&R]^s[i+1],k=u[S>>>24]^d[L>>16&255]^f[R>>8&255]^c[255&A]^s[i+2],_=u[L>>>24]^d[R>>16&255]^f[A>>8&255]^c[255&S]^s[i+3],R=b,A=T,S=k,L=_,i+=4;b=o[R>>>24]<<24^o[A>>16&255]<<16^o[S>>8&255]<<8^o[255&L]^s[i],T=o[A>>>24]<<24^o[S>>16&255]<<16^o[L>>8&255]<<8^o[255&R]^s[i+1],k=o[S>>>24]<<24^o[L>>16&255]<<16^o[R>>8&255]<<8^o[255&A]^s[i+2],_=o[L>>>24]<<24^o[R>>16&255]<<16^o[A>>8&255]<<8^o[255&S]^s[i+3],i+=3,E[t]=P(b^g),E[t+1]=P(_^v),E[t+2]=P(k^p),E[t+3]=P(T^y),g=w,v=D,p=O,y=I,t+=4}return E.buffer}},{key:"destroy",value:function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0}}]),e}();r.default=n},{}],19:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(17),o=i(s),l=e(20),u=i(l),d=e(18),f=i(d),c=e(33),h=e(53),g=function(){function e(t,r){a(this,e),this.observer=t,this.config=r,this.logEnabled=!0;try{var i=crypto?crypto:self.crypto;this.subtle=i.subtle||i.webkitSubtle}catch(e){}this.disableWebCrypto=!this.subtle}return n(e,[{key:"isSync",value:function(){return this.disableWebCrypto&&this.config.enableSoftwareAES}},{key:"decrypt",value:function(e,t,r,i){var a=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(h.logger.log("JS AES decrypt"),this.logEnabled=!1);var n=this.decryptor;n||(this.decryptor=n=new f.default),n.expandKey(t),i(n.decrypt(e,0,r))}else{this.logEnabled&&(h.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1);var s=this.subtle;this.key!==t&&(this.key=t,this.fastAesKey=new u.default(s,t)),this.fastAesKey.expandKey().then(function(n){new o.default(s,r).decrypt(e,n).catch(function(n){a.onWebCryptoError(n,e,t,r,i)}).then(function(e){i(e)})}).catch(function(n){a.onWebCryptoError(n,e,t,r,i)})}}},{key:"onWebCryptoError",value:function(e,t,r,i,a){this.config.enableSoftwareAES?(h.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,r,i,a)):(h.logger.error("decrypting error : "+e.message),this.observer.trigger(Event.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))}},{key:"destroy",value:function(){var e=this.decryptor;e&&(e.destroy(),this.decryptor=void 0)}}]),e}();r.default=g},{17:17,18:18,20:20,33:33,53:53}],20:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(t,r){i(this,e),this.subtle=t,this.key=r}return a(e,[{key:"expandKey",value:function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}]),e}();r.default=n},{}],21:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(22),o=i(s),l=e(53),u=e(27),d=i(u),f=function(){function e(t,r,i){a(this,e),this.observer=t,this.config=i,this.remuxer=r}return n(e,[{key:"resetInitSegment",value:function(e,t,r,i){this._audioTrack={container:"audio/adts",type:"audio",id:-1,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}}},{key:"resetTimeStamp",value:function(){}},{key:"append",value:function(e,t,r,i){var a,n,s,u,f,c,h,g,v,p,y=new d.default(e),m=90*y.timeStamp;for(a=this._audioTrack,c=y.length,v=e.length;c<v-1&&(255!==e[c]||240!=(246&e[c+1]));c++);for(a.samplerate||(n=o.default.getAudioConfig(this.observer,e,c,a.manifestCodec),a.config=n.config,a.samplerate=n.samplerate,a.channelCount=n.channelCount,a.codec=n.codec,l.logger.log("parsed codec:"+a.codec+",rate:"+n.samplerate+",nb channel:"+n.channelCount)),f=0,u=9216e4/a.samplerate;c+5<v&&(h=1&e[c+1]?7:9,s=(3&e[c+3])<<11|e[c+4]<<3|(224&e[c+5])>>>5,(s-=h)>0&&c+h+s<=v);)for(g=m+f*u,p={unit:e.subarray(c+h,c+h+s),pts:g,dts:g},a.samples.push(p),a.len+=s,c+=s+h,f++;c<v-1&&(255!==e[c]||240!=(246&e[c+1]));c++);this.remuxer.remux(a,{samples:[]},{samples:[{pts:m,dts:m,data:y.payload}],inputTimeScale:9e4},{samples:[]},t,r,i)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(e){var t,r,i=new d.default(e);if(i.hasTimeStamp)for(t=i.length,r=Math.min(e.length-1,t+100);t<r;t++)if(255===e[t]&&240==(246&e[t+1]))return!0;return!1}}]),e}();r.default=f},{22:22,27:27,53:53}],22:[function(e,t,r){"use strict";var i=e(53),a=e(33),n={getAudioConfig:function(e,t,r,n){var s,o,l,u,d,f=navigator.userAgent.toLowerCase(),c=n,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];return s=1+((192&t[r+2])>>>6),(o=(60&t[r+2])>>>2)>h.length-1?void e.trigger(Event.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+o}):(u=(1&t[r+2])<<2,u|=(192&t[r+3])>>>6,i.logger.log("manifest codec:"+n+",ADTS data:type:"+s+",sampleingIndex:"+o+"["+h[o]+"Hz],channelConfig:"+u),/firefox/i.test(f)?o>=6?(s=5,d=new Array(4),l=o-3):(s=2,d=new Array(2),l=o):f.indexOf("android")!==-1?(s=2,d=new Array(2),l=o):(s=5,d=new Array(4),n&&(n.indexOf("mp4a.40.29")!==-1||n.indexOf("mp4a.40.5")!==-1)||!n&&o>=6?l=o-3:((n&&n.indexOf("mp4a.40.2")!==-1&&o>=6&&1===u||!n&&1===u)&&(s=2,d=new Array(2)),l=o)),d[0]=s<<3,d[0]|=(14&o)>>1,d[1]|=(1&o)<<7,d[1]|=u<<3,5===s&&(d[1]|=(14&l)>>1,d[2]=(1&l)<<7,d[2]|=8,d[3]=0),{config:d,samplerate:h[o],channelCount:u,codec:"mp4a.40."+s,manifestCodec:c})}};t.exports=n},{33:33,53:53}],23:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(35),o=i(s),l=e(33),u=e(19),d=i(u),f=e(21),c=i(f),h=e(29),g=i(h),v=e(32),p=i(v),y=e(28),m=i(y),E=e(45),b=i(E),T=e(46),k=i(T),_=function(){function e(t,r,i,n){a(this,e),this.observer=t,this.typeSupported=r,this.config=i,this.vendor=n}return n(e,[{key:"destroy",value:function(){var e=this.demuxer;e&&e.destroy()}},{key:"push",value:function(e,t,r,i,a,n,s,l,u,f,c,h){if(e.byteLength>0&&null!=t&&null!=t.key&&"AES-128"===t.method){var g=this.decrypter;null==g&&(g=this.decrypter=new d.default(this.observer,this.config));var v,p=this;try{v=performance.now()}catch(e){v=Date.now()}g.decrypt(e,t.key.buffer,t.iv.buffer,function(e){var d;try{d=performance.now()}catch(e){d=Date.now()}p.observer.trigger(o.default.FRAG_DECRYPTED,{stats:{tstart:v,tdecrypt:d}}),p.pushDecrypted(new Uint8Array(e),t,new Uint8Array(r),i,a,n,s,l,u,f,c,h)})}else this.pushDecrypted(new Uint8Array(e),t,new Uint8Array(r),i,a,n,s,l,u,f,c,h)}},{key:"pushDecrypted",value:function(e,t,r,i,a,n,s,u,d,f,h,v){var y=this.demuxer;if(!y||s&&!this.probe(e)){var E=this.observer,T=this.typeSupported,_=this.config,R=[{demux:p.default,remux:b.default},{demux:m.default,remux:b.default},{demux:c.default,remux:b.default},{demux:g.default,remux:k.default}];for(var A in R){var S=R[A],L=S.demux.probe;if(L(e)){var w=this.remuxer=new S.remux(E,_,T,this.vendor);y=new S.demux(E,w,_,T),this.probe=L;break}}if(!y)return void E.trigger(o.default.ERROR,{type:l.ErrorTypes.MEDIA_ERROR,details:l.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=y}var D=this.remuxer;(s||u)&&(y.resetInitSegment(r,i,a,f),D.resetInitSegment()),s&&(y.resetTimeStamp(),D.resetTimeStamp(v)),"function"==typeof y.setDecryptData&&y.setDecryptData(t),y.append(e,n,d,h)}}]),e}();r.default=_},{19:19,21:21,28:28,29:29,32:32,33:33,35:35,45:45,46:46}],24:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var a=e(23),n=i(a),s=e(35),o=i(s),l=e(53),u=e(1),d=i(u),f=function(e){var t=new d.default;t.trigger=function(e){for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];t.emit.apply(t,[e,e].concat(i))},t.off=function(e){for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];t.removeListener.apply(t,[e].concat(i))};var r=function(t,r){e.postMessage({event:t,data:r})};e.addEventListener("message",function(i){var a=i.data;switch(a.cmd){case"init":var s=JSON.parse(a.config);e.demuxer=new n.default(t,a.typeSupported,s,a.vendor);try{(0,l.enableLogs)(s.debug===!0)}catch(e){}r("init",null);break;case"demux":e.demuxer.push(a.data,a.decryptdata,a.initSegment,a.audioCodec,a.videoCodec,a.timeOffset,a.discontinuity,a.trackSwitch,a.contiguous,a.duration,a.accurateTimeOffset,a.defaultInitPTS)}}),t.on(o.default.FRAG_DECRYPTED,r),t.on(o.default.FRAG_PARSING_INIT_SEGMENT,r),t.on(o.default.FRAG_PARSED,r),t.on(o.default.ERROR,r),t.on(o.default.FRAG_PARSING_METADATA,r),t.on(o.default.FRAG_PARSING_USERDATA,r),t.on(o.default.INIT_PTS_FOUND,r),t.on(o.default.FRAG_PARSING_DATA,function(t,r){var i=[],a={event:t,data:r};r.data1&&(a.data1=r.data1.buffer,i.push(r.data1.buffer),delete r.data1),r.data2&&(a.data2=r.data2.buffer,i.push(r.data2.buffer),delete r.data2),e.postMessage(a,i)})};r.default=f},{1:1,23:23,35:35,53:53}],25:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(35),o=i(s),l=e(23),u=i(l),d=e(24),f=i(d),c=e(53),h=e(33),g=e(1),v=i(g),p=function(){function t(r,i){a(this,t),this.hls=r,this.id=i;var n=this.observer=new v.default,s=r.config;n.trigger=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];n.emit.apply(n,[e,e].concat(r))},n.off=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];n.removeListener.apply(n,[e].concat(r))};var l=function(e,t){t=t||{},t.frag=this.frag,t.id=this.id,r.trigger(e,t)}.bind(this);n.on(o.default.FRAG_DECRYPTED,l),n.on(o.default.FRAG_PARSING_INIT_SEGMENT,l),n.on(o.default.FRAG_PARSING_DATA,l),n.on(o.default.FRAG_PARSED,l),n.on(o.default.ERROR,l),n.on(o.default.FRAG_PARSING_METADATA,l),n.on(o.default.FRAG_PARSING_USERDATA,l),n.on(o.default.INIT_PTS_FOUND,l);var d={mp4:MediaSource.isTypeSupported("video/mp4"),mpeg:MediaSource.isTypeSupported("audio/mpeg"),mp3:MediaSource.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(s.enableWorker&&"undefined"!=typeof Worker){c.logger.log("demuxing in webworker");var p=void 0;try{var y=e(3);p=this.w=y(f.default),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(e){r.trigger(o.default.ERROR,{type:h.ErrorTypes.OTHER_ERROR,details:h.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:e.message+" ("+e.filename+":"+e.lineno+")"}})},p.postMessage({cmd:"init",typeSupported:d,vendor:g,id:i,config:JSON.stringify(s)})}catch(e){c.logger.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),p&&URL.revokeObjectURL(p.objectURL),this.demuxer=new u.default(n,d,s,g),this.w=void 0}}else this.demuxer=new u.default(n,d,s,g)}return n(t,[{key:"destroy",value:function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var r=this.observer;r&&(r.removeAllListeners(),this.observer=null)}},{key:"push",value:function(e,t,r,i,a,n,s,o){var l=this.w,u=isNaN(a.startDTS)?a.start:a.startDTS,d=a.decryptdata,f=this.frag,h=!(f&&a.cc===f.cc),g=!(f&&a.level===f.level),v=f&&a.sn===f.sn+1,p=!g&&v;if(h&&c.logger.log(this.id+":discontinuity detected"),g&&c.logger.log(this.id+":switch detected"),this.frag=a,l)l.postMessage({cmd:"demux",data:e,decryptdata:d,initSegment:t,audioCodec:r,videoCodec:i,timeOffset:u,discontinuity:h,trackSwitch:g,contiguous:p,duration:n,accurateTimeOffset:s,defaultInitPTS:o},[e]);else{var y=this.demuxer;y&&y.push(e,d,t,r,i,u,h,g,p,n,s,o)}}},{key:"onWorkerMessage",value:function(e){var t=e.data,r=this.hls;switch(t.event){case"init":URL.revokeObjectURL(this.w.objectURL);break;case o.default.FRAG_PARSING_DATA:t.data.data1=new Uint8Array(t.data1),t.data2&&(t.data.data2=new Uint8Array(t.data2));default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data)}}}]),t}();r.default=p},{1:1,23:23,24:24,3:3,33:33,35:35,53:53}],26:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(53),s=function(){function e(t){i(this,e),this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}return a(e,[{key:"loadWord",value:function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");i.set(e.subarray(r,r+a)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a}},{key:"skipBits",value:function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),t=e-t,t>0&&this.bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(e){var t,r,i=8,a=8;for(t=0;t<e;t++)0!==a&&(r=this.readEG(),a=(i+r+256)%256),i=0===a?i:a}},{key:"readSPS",value:function(){var e,t,r,i,a,n,s,o=0,l=0,u=0,d=0,f=this.readUByte.bind(this),c=this.readBits.bind(this),h=this.readUEG.bind(this),g=this.readBoolean.bind(this),v=this.skipBits.bind(this),p=this.skipEG.bind(this),y=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);if(f(),e=f(),c(5),v(3),f(),y(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var E=h();if(3===E&&v(1),y(),y(),v(1),g())for(n=3!==E?8:12,s=0;s<n;s++)g()&&m(s<6?16:64)}y();var b=h();if(0===b)h();else if(1===b)for(v(1),p(),p(),t=h(),s=0;s<t;s++)p();y(),v(1),r=h(),i=h(),a=c(1),0===a&&v(1),v(1),g()&&(o=h(),l=h(),u=h(),d=h());var T=[1,1];if(g()&&g()){switch(f()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:T=[f()<<8|f(),f()<<8|f()]}}return{width:Math.ceil(16*(r+1)-2*o-2*l),height:(2-a)*(i+1)*16-(a?2:4)*(u+d),pixelRatio:T}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();r.default=s},{53:53}],27:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(53),s=function(){function e(t){i(this,e),this._hasTimeStamp=!1,this._length=0;for(var r,a,s,o,l,u,d,f,c=0;;)if(d=this.readUTF(t,c,3),c+=3,"ID3"===d)c+=3,r=127&t[c++],a=127&t[c++],s=127&t[c++],o=127&t[c++],l=(r<<21)+(a<<14)+(s<<7)+o,u=c+l,this._parseID3Frames(t,c,u),c=u;else{if("3DI"!==d)return c-=3,void((f=c)&&(this.hasTimeStamp||n.logger.warn("ID3 tag found, but no timestamp"),this._length=f,this._payload=t.subarray(0,f)));c+=7,n.logger.log("3DI footer found, end: "+c)}}return a(e,[{key:"readUTF",value:function(e,t,r){var i="",a=t,n=t+r;do{i+=String.fromCharCode(e[a++])}while(a<n);return i}},{key:"_parseID3Frames",value:function(e,t,r){for(var i,a;t+8<=r;)switch(i=this.readUTF(e,t,4),t+=4,e[t++]<<24+e[t++]<<16+e[t++]<<8+e[t++],e[t++]<<8+e[t++],t,i){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(e,t,44)){t+=44,t+=4;var s=1&e[t++];this._hasTimeStamp=!0,a=((e[t++]<<23)+(e[t++]<<15)+(e[t++]<<7)+e[t++])/45,s&&(a+=47721858.84),a=Math.round(a),n.logger.trace("ID3 timestamp found: "+a),this._timeStamp=a}}}},{key:"hasTimeStamp",get:function(){return this._hasTimeStamp}},{key:"timeStamp",get:function(){return this._timeStamp}},{key:"length",get:function(){return this._length}},{key:"payload",get:function(){return this._payload}}]),e}();r.default=s},{53:53}],28:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(27),o=i(s),l=e(30),u=i(l),d=function(){function e(t,r,i){a(this,e),this.observer=t,this.config=i,this.remuxer=r}return n(e,[{key:"resetInitSegment",value:function(e,t,r,i){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}}},{key:"resetTimeStamp",value:function(){}},{key:"append",value:function(e,t,r,i){var a,n,s=new o.default(e),l=90*s.timeStamp,d=s.length;for(a=d,n=e.length;a<n-1&&(255!==e[a]||224!=(224&e[a+1])||0==(6&e[a+1]));a++);u.default.parse(this._audioTrack,e,s.length,l),this.remuxer.remux(this._audioTrack,{samples:[]},{samples:[{pts:l,dts:l,data:s.payload}],inputTimeScale:9e4},{samples:[]},t,r,i)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(e){var t,r,i=new o.default(e);if(i.hasTimeStamp)for(t=i.length,r=Math.min(e.length-1,t+100);t<r;t++)if(255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1]))return!0;return!1}}]),e}();r.default=d},{27:27,30:30}],29:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(35),s=function(e){return e&&e.__esModule?e:{default:e}}(n),o=function(){function e(t,r){i(this,e),this.observer=t,this.remuxer=r}return a(e,[{key:"resetTimeStamp",value:function(){}},{key:"resetInitSegment",value:function(t,r,i,a){var n=this.initData=e.parseInitSegment(t),o={};n.audio&&(o.audio={container:"audio/mp4",codec:r,initSegment:t}),n.video&&(o.video={container:"video/mp4",codec:i,initSegment:t}),this.observer.trigger(s.default.FRAG_PARSING_INIT_SEGMENT,{tracks:o})}},{key:"append",value:function(t,r,i,a){var n=this.initData,s=e.startDTS(n,t);this.remuxer.remux(n.audio,n.video,null,null,s,i,a,t)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){if(t.length>=8){var r=e.bin2str(t.subarray(4,8));return["moof","ftyp","styp"].indexOf(r)>=0}return!1}},{key:"bin2str",value:function(e){return String.fromCharCode.apply(null,e)}},{key:"readUint32",value:function(e,t){var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return r<0?4294967296+r:r}},{key:"findBox",value:function(t,r){var i,a,n,s,o,l=[];if(!r.length)return null;for(i=0;i<t.byteLength;)a=e.readUint32(t,i),n=e.bin2str(t.subarray(i+4,i+8)),s=a>1?i+a:t.byteLength,n===r[0]&&(1===r.length?l.push(t.subarray(i+8,s)):(o=e.findBox(t.subarray(i+8,s),r.slice(1)),o.length&&(l=l.concat(o)))),i=s;return l}},{key:"parseInitSegment",value:function(t){var r=[];return e.findBox(t,["moov","trak"]).forEach(function(t){var i=e.findBox(t,["tkhd"])[0];if(i){var a=i[0],n=0===a?12:20,s=e.readUint32(i,n),o=e.findBox(t,["mdia","mdhd"])[0];if(o){a=o[0],n=0===a?12:20;var l=e.readUint32(o,n),u=e.findBox(t,["mdia","hdlr"])[0];if(u){var d=e.bin2str(u.subarray(8,12)),f={soun:"audio",vide:"video"}[d];f&&(r[s]={timescale:l,type:f},r[f]={timescale:l,id:s})}}}}),r}},{key:"startDTS",value:function(t,r){var i,a,n;return i=e.findBox(r,["moof","traf"]),a=[].concat.apply([],i.map(function(r){return e.findBox(r,["tfhd"]).map(function(i){var a,n,s;return a=e.readUint32(i,4),n=t[a].timescale||9e4,s=e.findBox(r,["tfdt"]).map(function(t){var r,i;return r=t[0],i=e.readUint32(t,4),1===r&&(i*=Math.pow(2,32),i+=e.readUint32(t,8)),i})[0],(s=s||1/0)/n})})),n=Math.min.apply(null,a),isFinite(n)?n:0}}]),e}();r.default=o},{35:35}],30:[function(e,t,r){"use strict";var i=e(53),a={onFrame:function(e,t,r,i,a,n,s){var o=10368e4/i,l=s+n*o;e.config=[],e.channelCount=a,e.samplerate=i,e.samples.push({unit:t,pts:l,dts:l}),e.len+=t.length},onNoise:function(e){i.logger.warn("mpeg audio has noise: "+e.length+" bytes")},parseFrames:function(e,t,r,i,a,n){var s=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],o=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3];if(r+2>i)return-1;if(255===t[r]||224==(224&t[r+1])){if(r+24>i)return-1;var l=t[r+1]>>3&3,u=t[r+1]>>1&3,d=t[r+2]>>4&15,f=t[r+2]>>2&3,c=!!(2&t[r+2]);if(1!==l&&0!==d&&15!==d&&3!==f){var h=3===l?3-u:3===u?3:4,g=1e3*s[14*h+d-1],v=3===l?0:2===l?1:2,p=o[3*v+f],y=c?1:0,m=t[r+3]>>6==3?1:2,E=3===u?(3===l?12:6)*g/p+y<<2:(3===l?144:72)*g/p+y|0;return r+E>i?-1:(this.onFrame(e,t.subarray(r,r+E),g,p,m,a,n),E)}}for(var b=r+2;b<i;){if(255===t[b-1]&&224==(224&t[b]))return this.onNoise(t.subarray(r,b-1)),b-r-1;b++}return-1},parse:function(e,t,r,i){for(var a,n=t.length,s=0;r<n&&(a=this.parseFrames(e,t,r,n,s++,i))>0;)r+=a}};t.exports=a},{53:53}],31:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(19),s=function(e){return e&&e.__esModule?e:{default:e}}(n),o=function(){function e(t,r,a,n){i(this,e),this.decryptdata=a,this.discardEPB=n,this.decrypter=new s.default(t,r)}return a(e,[{key:"decryptBuffer",value:function(e,t){this.decrypter.decrypt(e,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,t)}},{key:"decryptAacSample",value:function(e,t,r,i){
|
26 |
+
var a=e[t].unit,n=a.subarray(16,a.length-a.length%16),s=n.buffer.slice(n.byteOffset,n.byteOffset+n.length),o=this;this.decryptBuffer(s,function(n){n=new Uint8Array(n),a.set(n,16),i||o.decryptAacSamples(e,t+1,r)})}},{key:"decryptAacSamples",value:function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(e,t,r,i),!i)return}}}},{key:"getAvcEncryptedData",value:function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),i=0,a=32;a<=e.length-16;a+=160,i+=16)r.set(e.subarray(a,a+16),i);return r}},{key:"getAvcDecryptedUnit",value:function(e,t){t=new Uint8Array(t);for(var r=0,i=32;i<=e.length-16;i+=160,r+=16)e.set(t.subarray(r,r+16),i);return e}},{key:"decryptAvcSample",value:function(e,t,r,i,a,n){var s=this.discardEPB(a.data),o=this.getAvcEncryptedData(s),l=this;this.decryptBuffer(o.buffer,function(o){a.data=l.getAvcDecryptedUnit(s,o),n||l.decryptAvcSamples(e,t,r+1,i)})}},{key:"decryptAvcSamples",value:function(e,t,r,i){for(;;t++,r=0){if(t>=e.length)return void i();for(var a=e[t].units;!(r>=a.length);r++){var n=a[r];if(!(n.length<=48||1!==n.type&&5!==n.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,r,i,n,s),!s)return}}}}}]),e}();r.default=o},{19:19}],32:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(22),o=i(s),l=e(30),u=i(l),d=e(35),f=i(d),c=e(26),h=i(c),g=e(31),v=i(g),p=e(53),y=e(33),m=function(){function e(t,r,i,n){a(this,e),this.observer=t,this.config=i,this.typeSupported=n,this.remuxer=r,this.sampleAes=null}return n(e,[{key:"setDecryptData",value:function(e){null!=e&&null!=e.key&&"SAMPLE-AES"===e.method?this.sampleAes=new v.default(this.observer,this.config,e,this.discardEPB):this.sampleAes=null}},{key:"resetInitSegment",value:function(e,t,r,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack={container:"video/mp2t",type:"video",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:0},this._audioTrack={container:"video/mp2t",type:"audio",id:-1,inputTimeScale:9e4,duration:i,sequenceNumber:0,samples:[],len:0,isAAC:!0},this._id3Track={type:"id3",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0},this._txtTrack={type:"text",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0},this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=t,this.videoCodec=r,this._duration=i}},{key:"resetTimeStamp",value:function(){}},{key:"append",value:function(e,t,r,i){var a,n,s,o,l,u=e.length,d=!1;this.contiguous=r;var c=this.pmtParsed,h=this._avcTrack,g=this._audioTrack,v=this._id3Track,m=h.id,E=g.id,b=v.id,T=this._pmtId,k=h.pesData,_=g.pesData,R=v.pesData,A=this._parsePAT,S=this._parsePMT,L=this._parsePES,w=this._parseAVCPES.bind(this),D=this._parseAACPES.bind(this),O=this._parseMPEGPES.bind(this),I=this._parseID3PES.bind(this);for(u-=u%188,a=0;a<u;a+=188)if(71===e[a]){if(n=!!(64&e[a+1]),s=((31&e[a+1])<<8)+e[a+2],(48&e[a+3])>>4>1){if((o=a+5+e[a+4])===a+188)continue}else o=a+4;switch(s){case m:n&&(k&&(l=L(k))&&w(l,!1),k={data:[],size:0}),k&&(k.data.push(e.subarray(o,a+188)),k.size+=a+188-o);break;case E:n&&(_&&(l=L(_))&&(g.isAAC?D(l):O(l)),_={data:[],size:0}),_&&(_.data.push(e.subarray(o,a+188)),_.size+=a+188-o);break;case b:n&&(R&&(l=L(R))&&I(l),R={data:[],size:0}),R&&(R.data.push(e.subarray(o,a+188)),R.size+=a+188-o);break;case 0:n&&(o+=e[o]+1),T=this._pmtId=A(e,o);break;case T:n&&(o+=e[o]+1);var P=S(e,o,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,null!=this.sampleAes);m=P.avc,m>0&&(h.id=m),E=P.audio,E>0&&(g.id=E,g.isAAC=P.isAAC),b=P.id3,b>0&&(v.id=b),d&&!c&&(p.logger.log("reparse from beginning"),d=!1,a=-188),c=this.pmtParsed=!0;break;case 17:case 8191:break;default:d=!0}}else this.observer.trigger(f.default.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});k&&(l=L(k))?(w(l,!0),h.pesData=null):h.pesData=k,_&&(l=L(_))?(g.isAAC?D(l):O(l),g.pesData=null):(_&&_.size&&p.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=_),R&&(l=L(R))?(I(l),v.pesData=null):v.pesData=R,null==this.sampleAes?this.remuxer.remux(g,h,v,this._txtTrack,t,r,i):this.decryptAndRemux(g,h,v,this._txtTrack,t,r,i)}},{key:"decryptAndRemux",value:function(e,t,r,i,a,n,s){if(e.samples&&e.isAAC){var o=this;this.sampleAes.decryptAacSamples(e.samples,0,function(){o.decryptAndRemuxAvc(e,t,r,i,a,n,s)})}else this.decryptAndRemuxAvc(e,t,r,i,a,n,s)}},{key:"decryptAndRemuxAvc",value:function(e,t,r,i,a,n,s){if(t.samples){var o=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,function(){o.remuxer.remux(e,t,r,i,a,n,s)})}else this.remuxer.remux(e,t,r,i,a,n,s)}},{key:"destroy",value:function(){this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){return(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(e,t,r,i){var a,n,s,o,l={audio:-1,avc:-1,id3:-1,isAAC:!0};for(a=(15&e[t+1])<<8|e[t+2],n=t+3+a-4,s=(15&e[t+10])<<8|e[t+11],t+=12+s;t<n;){switch(o=(31&e[t+1])<<8|e[t+2],e[t]){case 207:if(!i){p.logger.log("unkown stream type:"+e[t]);break}case 15:l.audio===-1&&(l.audio=o);break;case 21:l.id3===-1&&(l.id3=o);break;case 219:if(!i){p.logger.log("unkown stream type:"+e[t]);break}case 27:l.avc===-1&&(l.avc=o);break;case 3:case 4:r?l.audio===-1&&(l.audio=o,l.isAAC=!1):p.logger.log("MPEG audio found, not supported in this browser for now");break;case 36:p.logger.warn("HEVC stream type found, not supported for now");break;default:p.logger.log("unkown stream type:"+e[t])}t+=5+((15&e[t+3])<<8|e[t+4])}return l}},{key:"_parsePES",value:function(e){var t,r,i,a,n,s,o,l,u=0,d=e.data;if(!e||0===e.size)return null;for(;d[0].length<19&&d.length>1;){var f=new Uint8Array(d[0].length+d[1].length);f.set(d[0]),f.set(d[1],d[0].length),d[0]=f,d.splice(1,1)}if(t=d[0],1===(t[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;r=t[7],192&r&&(s=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s>4294967295&&(s-=8589934592),64&r?(o=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,o>4294967295&&(o-=8589934592),s-o>54e5&&(p.logger.warn(Math.round((s-o)/9e4)+"s delta between PTS and DTS, align them"),s=o)):o=s),a=t[8],l=a+9,e.size-=l,n=new Uint8Array(e.size);for(var c=0,h=d.length;c<h;c++){t=d[c];var g=t.byteLength;if(l){if(l>g){l-=g;continue}t=t.subarray(l),g-=l,l=0}n.set(t,u),u+=g}return i&&(i-=a+3),{data:n,pts:s,dts:o,len:i}}return null}},{key:"pushAccesUnit",value:function(e,t){if(e.units.length&&e.frame){var r=t.samples,i=r.length;!this.config.forceKeyFrameOnDiscontinuity||e.key===!0||t.sps&&(i||this.contiguous)?(e.id=i,r.push(e)):t.dropped++}e.debug.length&&p.logger.log(e.pts+"/"+e.dts+":"+e.debug)}},{key:"_parseAVCPES",value:function(e,t){var r,i,a,n=this,s=this._avcTrack,o=this._parseAVCNALu(e.data),l=this.avcSample;e.data=null,o.forEach(function(t){switch(t.type){case 1:i=!0,l.frame=!0;var o=t.data;if(o.length>4){var u=new h.default(o).readSliceType();2!==u&&4!==u&&7!==u&&9!==u||(l.key=!0)}break;case 5:i=!0,l||(l=n.avcSample=n._createAVCSample(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0,r=new h.default(n.discardEPB(t.data)),r.readUByte();for(var d=0,f=0,c=!1,g=0;!c&&r.bytesAvailable>1;){d=0;do{g=r.readUByte(),d+=g}while(255===g);f=0;do{g=r.readUByte(),f+=g}while(255===g);if(4===d&&0!==r.bytesAvailable){c=!0;if(181===r.readUByte()){if(49===r.readUShort()){if(1195456820===r.readUInt()){if(3===r.readUByte()){var v=r.readUByte(),p=r.readUByte(),y=31&v,m=[v,p];for(a=0;a<y;a++)m.push(r.readUByte()),m.push(r.readUByte()),m.push(r.readUByte());n._insertSampleInOrder(n._txtTrack.samples,{type:3,pts:e.pts,bytes:m})}}}}}else if(f<r.bytesAvailable)for(a=0;a<f;a++)r.readUByte()}break;case 7:if(i=!0,!s.sps){r=new h.default(t.data);var E=r.readSPS();s.width=E.width,s.height=E.height,s.pixelRatio=E.pixelRatio,s.sps=[t.data],s.duration=n._duration;var b=t.data.subarray(1,4),T="avc1.";for(a=0;a<3;a++){var k=b[a].toString(16);k.length<2&&(k="0"+k),T+=k}s.codec=T}break;case 8:i=!0,s.pps||(s.pps=[t.data]);break;case 9:i=!1,l&&n.pushAccesUnit(l,s),l=n.avcSample=n._createAVCSample(!1,e.pts,e.dts,"");break;case 12:i=!1;break;default:i=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}if(l&&i){l.units.push(t)}}),t&&l&&(this.pushAccesUnit(l,s),this.avcSample=null)}},{key:"_createAVCSample",value:function(e,t,r,i){return{key:e,pts:t,dts:r,units:[],debug:i}}},{key:"_insertSampleInOrder",value:function(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var i=r-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}else e.push(t)}},{key:"_getLastNalUnit",value:function(){var e=this.avcSample,t=void 0;if(!e||0===e.units.length){var r=this._avcTrack,i=r.samples;e=i[i.length-1]}if(e){var a=e.units;t=a[a.length-1]}return t}},{key:"_parseAVCNALu",value:function(e){var t,r,i,a,n,s=0,o=e.byteLength,l=this._avcTrack,u=l.naluState||0,d=u,f=[],c=-1;for(u===-1&&(c=0,n=31&e[0],u=0,s=1);s<o;)if(t=e[s++],u)if(1!==u)if(t)if(1===t){if(c>=0)i={data:e.subarray(c,s-u-1),type:n},f.push(i);else{var h=this._getLastNalUnit();if(h&&(d&&s<=4-d&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-d)),(r=s-u-1)>0)){var g=new Uint8Array(h.data.byteLength+r);g.set(h.data,0),g.set(e.subarray(0,r),h.data.byteLength),h.data=g}}s<o?(a=31&e[s],c=s,n=a,u=0):u=-1}else u=0;else u=3;else u=t?0:2;else u=t?0:1;if(c>=0&&u>=0&&(i={data:e.subarray(c,o),type:n,state:u},f.push(i)),0===f.length){var v=this._getLastNalUnit();if(v){var p=new Uint8Array(v.data.byteLength+e.byteLength);p.set(v.data,0),p.set(e,v.data.byteLength),v.data=p}}return l.naluState=u,f}},{key:"discardEPB",value:function(e){for(var t,r,i=e.byteLength,a=[],n=1;n<i-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(a.push(n+2),n+=2):n++;if(0===a.length)return e;t=i-a.length,r=new Uint8Array(t);var s=0;for(n=0;n<t;s++,n++)s===a[0]&&(s++,a.shift()),r[n]=e[s];return r}},{key:"_parseAACPES",value:function(e){var t,r,i,a,n,s,l,u,d,c=this._audioTrack,h=e.data,g=e.pts,v=this.aacOverFlow,m=this.aacLastPTS;if(v){var E=new Uint8Array(v.byteLength+h.byteLength);E.set(v,0),E.set(h,v.byteLength),h=E}for(n=0,u=h.length;n<u-1&&(255!==h[n]||240!=(240&h[n+1]));n++);if(n){var b,T;if(n<u-1?(b="AAC PES did not start with ADTS header,offset:"+n,T=!1):(b="no ADTS header found in AAC PES",T=!0),p.logger.warn("parsing error:"+b),this.observer.trigger(f.default.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:T,reason:b}),T)return}if(!c.samplerate){var k=this.audioCodec;t=o.default.getAudioConfig(this.observer,h,n,k),c.config=t.config,c.samplerate=t.samplerate,c.channelCount=t.channelCount,c.codec=t.codec,c.manifestCodec=t.manifestCodec,p.logger.log("parsed codec:"+c.codec+",rate:"+t.samplerate+",nb channel:"+t.channelCount)}if(a=0,i=9216e4/c.samplerate,v&&m){var _=m+i;Math.abs(_-g)>1&&(p.logger.log("AAC: align PTS for overlapping frames by "+Math.round((_-g)/90)),g=_)}for(;n+5<u&&(s=1&h[n+1]?7:9,r=(3&h[n+3])<<11|h[n+4]<<3|(224&h[n+5])>>>5,(r-=s)>0&&n+s+r<=u);)for(l=g+a*i,d={unit:h.subarray(n+s,n+s+r),pts:l,dts:l},c.samples.push(d),c.len+=r,n+=r+s,a++;n<u-1&&(255!==h[n]||240!=(240&h[n+1]));n++);v=n<u?h.subarray(n,u):null,this.aacOverFlow=v,this.aacLastPTS=l}},{key:"_parseMPEGPES",value:function(e){u.default.parse(this._audioTrack,e.data,0,e.pts)}},{key:"_parseID3PES",value:function(e){this._id3Track.samples.push(e)}}],[{key:"probe",value:function(e){return e.length>=564&&71===e[0]&&71===e[188]&&71===e[376]}}]),e}();r.default=m},{22:22,26:26,30:30,31:31,33:33,35:35,53:53}],33:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},r.ErrorDetails={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",REMUX_ALLOC_ERROR:"remuxAllocError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",BUFFER_NUDGE_ON_STALL:"bufferNudgeOnStall",INTERNAL_EXCEPTION:"internalException",WEBVTT_EXCEPTION:"webVTTException"}},{}],34:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(53),o=e(33),l=e(35),u=function(e){return e&&e.__esModule?e:{default:e}}(l),d=function(){function e(t){i(this,e),this.hls=t,this.onEvent=this.onEvent.bind(this);for(var r=arguments.length,a=Array(r>1?r-1:0),n=1;n<r;n++)a[n-1]=arguments[n];this.handledEvents=a,this.useGenericHandler=!0,this.registerListeners()}return n(e,[{key:"destroy",value:function(){this.unregisterListeners()}},{key:"isEventHandler",value:function(){return"object"===a(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if("hlsEventGeneric"===e)throw new Error("Forbidden event name: "+e);this.hls.on(e,this.onEvent)}.bind(this))}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)}.bind(this))}},{key:"onEvent",value:function(e,t){this.onEventGeneric(e,t)}},{key:"onEventGeneric",value:function(e,t){var r=function(e,t){var r="on"+e.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,t)};try{r.call(this,e,t).call()}catch(t){s.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(u.default.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();r.default=d},{33:33,35:35,53:53}],35:[function(e,t,r){"use strict";t.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCH:"hlsLevelSwitch",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCH:"hlsAudioTrackSwitch",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},{}],36:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(){i(this,e)}return a(e,null,[{key:"getSilentFrame",value:function(e,t){switch(e){case"mp4a.40.2":if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}}]),e}();r.default=n},{}],37:[function(e,t,r){"use strict";var i={isBuffered:function(e,t){if(e)for(var r=e.buffered,i=0;i<r.length;i++)if(t>=r.start(i)&&t<=r.end(i))return!0;return!1},bufferInfo:function(e,t,r){if(e){var i,a=e.buffered,n=[];for(i=0;i<a.length;i++)n.push({start:a.start(i),end:a.end(i)});return this.bufferedInfo(n,t,r)}return{len:0,start:t,end:t,nextStart:void 0}},bufferedInfo:function(e,t,r){var i,a,n,s,o,l=[];for(e.sort(function(e,t){var r=e.start-t.start;return r?r:t.end-e.end}),o=0;o<e.length;o++){var u=l.length;if(u){var d=l[u-1].end;e[o].start-d<r?e[o].end>d&&(l[u-1].end=e[o].end):l.push(e[o])}else l.push(e[o])}for(o=0,i=0,a=n=t;o<l.length;o++){var f=l[o].start,c=l[o].end;if(t+r>=f&&t<c)a=f,n=c,i=n-t;else if(t+r<f){s=f;break}}return{len:i,start:a,end:n,nextStart:s}}};t.exports=i},{}],38:[function(e,t,r){"use strict";var i=e(53),a={mergeDetails:function(e,t){var r,n=Math.max(e.startSN,t.startSN)-t.startSN,s=Math.min(e.endSN,t.endSN)-t.startSN,o=t.startSN-e.startSN,l=e.fragments,u=t.fragments,d=0;if(s<n)return void(t.PTSKnown=!1);for(var f=n;f<=s;f++){var c=l[o+f],h=u[f];h&&c&&(d=c.cc-h.cc,isNaN(c.startPTS)||(h.start=h.startPTS=c.startPTS,h.endPTS=c.endPTS,h.duration=c.duration,h.backtracked=c.backtracked,h.dropped=c.dropped,r=h))}if(d)for(i.logger.log("discontinuity sliding from playlist, take drift into account"),f=0;f<u.length;f++)u[f].cc+=d;if(r)a.updateFragPTSDTS(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS);else if(o>=0&&o<l.length){var g=l[o].start;for(f=0;f<u.length;f++)u[f].start+=g}t.PTSKnown=e.PTSKnown},updateFragPTSDTS:function(e,t,r,i,n,s){if(!isNaN(t.startPTS)){var o=Math.abs(t.startPTS-r);isNaN(t.deltaPTS)?t.deltaPTS=o:t.deltaPTS=Math.max(o,t.deltaPTS),r=Math.min(r,t.startPTS),i=Math.max(i,t.endPTS),n=Math.min(n,t.startDTS),s=Math.max(s,t.endDTS)}var l=r-t.start;t.start=t.startPTS=r,t.endPTS=i,t.startDTS=n,t.endDTS=s,t.duration=i-r;var u=t.sn;if(!e||u<e.startSN||u>e.endSN)return 0;var d,f,c;for(d=u-e.startSN,f=e.fragments,t=f[d],c=d;c>0;c--)a.updatePTS(f,c,c-1);for(c=d;c<f.length-1;c++)a.updatePTS(f,c,c+1);return e.PTSKnown=!0,l},updatePTS:function(e,t,r){var a=e[t],n=e[r],s=n.startPTS;isNaN(s)?n.start=r>t?a.start+a.duration:Math.max(a.start-n.duration,0):r>t?(a.duration=s-a.start,a.duration<0&&i.logger.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!")):(n.duration=a.start-s,n.duration<0&&i.logger.warn("negative duration computed for frag "+n.sn+",level "+n.level+", there should be some duration drift between playlist and fragment!"))}};t.exports=a},{53:53}],39:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(2),o=i(s),l=e(35),u=i(l),d=e(33),f=e(43),c=i(f),h=e(41),g=i(h),v=e(42),p=i(v),y=e(13),m=i(y),E=e(12),b=i(E),T=e(11),k=i(T),_=e(53),R=e(1),A=i(R),S=e(4),L=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var i=e.DefaultConfig;if((r.liveSyncDurationCount||r.liveMaxLatencyDurationCount)&&(r.liveSyncDuration||r.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var n in i)n in r||(r[n]=i[n]);if(void 0!==r.liveMaxLatencyDurationCount&&r.liveMaxLatencyDurationCount<=r.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==r.liveMaxLatencyDuration&&(r.liveMaxLatencyDuration<=r.liveSyncDuration||void 0===r.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');(0,_.enableLogs)(r.debug),this.config=r,this._autoLevelCapping=-1;var s=this.observer=new A.default;s.trigger=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];s.emit.apply(s,[e,e].concat(r))},s.off=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];s.removeListener.apply(s,[e].concat(r))},this.on=s.on.bind(s),this.off=s.off.bind(s),this.trigger=s.trigger.bind(s);var o=this.abrController=new r.abrController(this),l=new r.bufferController(this),u=new r.capLevelController(this),d=new r.fpsController(this),f=new c.default(this),h=new g.default(this),v=new p.default(this),y=new k.default(this),E=this.levelController=new b.default(this),T=this.streamController=new m.default(this),R=[E,T],S=r.audioStreamController;S&&R.push(new S(this)),this.networkControllers=R;var L=[f,h,v,o,l,u,d,y];if(S=r.audioTrackController){var w=new S(this);this.audioTrackController=w,L.push(w)}if(S=r.subtitleTrackController){var D=new S(this);this.subtitleTrackController=D,L.push(D)}[r.subtitleStreamController,r.timelineController].forEach(function(e){e&&L.push(new e(t))}),this.coreComponents=L}return n(e,null,[{key:"isSupported",value:function(){var e=window.MediaSource=window.MediaSource||window.WebKitMediaSource,t=window.SourceBuffer=window.SourceBuffer||window.WebKitSourceBuffer,r=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return r&&i}},{key:"version",get:function(){return"0.7.9"}},{key:"Events",get:function(){return u.default}},{key:"ErrorTypes",get:function(){return d.ErrorTypes}},{key:"ErrorDetails",get:function(){return d.ErrorDetails}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:S.hlsDefaultConfig},set:function(t){e.defaultConfig=t}}]),n(e,[{key:"destroy",value:function(){_.logger.log("destroy"),this.trigger(u.default.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach(function(e){e.destroy()}),this.url=null,this.observer.removeAllListeners(),this._autoLevelCapping=-1}},{key:"attachMedia",value:function(e){_.logger.log("attachMedia"),this.media=e,this.trigger(u.default.MEDIA_ATTACHING,{media:e})}},{key:"detachMedia",value:function(){_.logger.log("detachMedia"),this.trigger(u.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(e){e=o.default.buildAbsoluteURL(window.location.href,e,{alwaysNormalize:!0}),_.logger.log("loadSource:"+e),this.url=e,this.trigger(u.default.MANIFEST_LOADING,{url:e})}},{key:"startLoad",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;_.logger.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})}},{key:"stopLoad",value:function(){_.logger.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})}},{key:"swapAudioCodec",value:function(){_.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){_.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),this.attachMedia(e)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){_.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){_.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){_.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){_.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){_.logger.log("set startLevel:"+e);var t=this;e!==-1&&(e=Math.max(e,t.minAutoLevel)),t.levelController.startLevel=e}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){_.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var e=this,t=e.levels,r=e.config.minAutoBitrate,i=t?t.length:0,a=0;a<i;a++){if((t[a].realBitrate?Math.max(t[a].realBitrate,t[a].bitrate):t[a].bitrate)>r)return a}return 0}},{key:"maxAutoLevel",get:function(){var e=this,t=e.levels,r=e.autoLevelCapping;return r===-1&&t&&t.length?t.length-1:r}},{key:"nextAutoLevel",get:function(){var e=this;return Math.min(Math.max(e.abrController.nextAutoLevel,e.minAutoLevel),e.maxAutoLevel)},set:function(e){var t=this;t.abrController.nextAutoLevel=Math.max(t.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}}]),e}();r.default=L},{1:1,11:11,12:12,13:13,2:2,33:33,35:35,4:4,41:41,42:42,43:43,53:53}],40:[function(e,t,r){"use strict";t.exports=e(39).default},{39:39}],41:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=e(33),h=e(53),g=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.FRAG_LOADING));return r.loaders={},r}return s(t,e),o(t,[{key:"destroy",value:function(){var e=this.loaders;for(var t in e){var r=e[t];r&&r.destroy()}this.loaders={},f.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(e){var t=e.frag,r=t.type,i=this.loaders[r],a=this.hls.config;t.loaded=0,i&&(h.logger.warn("abort previous fragment loader for type:"+r),i.abort()),i=this.loaders[r]=t.loader=void 0!==a.fLoader?new a.fLoader(a):new a.loader(a);var n=void 0,s=void 0,o=void 0;n={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var l=t.byteRangeStartOffset,u=t.byteRangeEndOffset;isNaN(l)||isNaN(u)||(n.rangeStart=l,n.rangeEnd=u),s={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout},o={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},i.load(n,s,o)}},{key:"loadsuccess",value:function(e,t,r){var i=e.data,a=r.frag;a.loader=void 0,this.loaders[a.type]=void 0,this.hls.trigger(u.default.FRAG_LOADED,{payload:i,frag:a,stats:t})}},{key:"loaderror",value:function(e,t){var r=t.loader;r&&r.abort(),this.loaders[t.type]=void 0,this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.NETWORK_ERROR,details:c.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e})}},{key:"loadtimeout",value:function(e,t){var r=t.loader;r&&r.abort(),this.loaders[t.type]=void 0,this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.NETWORK_ERROR,details:c.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag})}},{key:"loadprogress",value:function(e,t,r){var i=t.frag;i.loaded=e.loaded,this.hls.trigger(u.default.FRAG_LOAD_PROGRESS,{frag:i,stats:e})}}]),t
|
27 |
+
}(f.default);r.default=g},{33:33,34:34,35:35,53:53}],42:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(35),u=i(l),d=e(34),f=i(d),c=e(33),h=e(53),g=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.KEY_LOADING));return r.loaders={},r.decryptkey=null,r.decrypturl=null,r}return s(t,e),o(t,[{key:"destroy",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},f.default.prototype.destroy.call(this)}},{key:"onKeyLoading",value:function(e){var t=e.frag,r=t.type,i=this.loaders[r],a=t.decryptdata,n=a.uri;if(n!==this.decrypturl||null===this.decryptkey){var s=this.hls.config;i&&(h.logger.warn("abort previous key loader for type:"+r),i.abort()),t.loader=this.loaders[r]=new s.loader(s),this.decrypturl=n,this.decryptkey=null;var o=void 0,l=void 0,d=void 0;o={url:n,frag:t,responseType:"arraybuffer"},l={timeout:s.fragLoadingTimeOut,maxRetry:s.fragLoadingMaxRetry,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},t.loader.load(o,l,d)}else this.decryptkey&&(a.key=this.decryptkey,this.hls.trigger(u.default.KEY_LOADED,{frag:t}))}},{key:"loadsuccess",value:function(e,t,r){var i=r.frag;this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=void 0,this.loaders[i.type]=void 0,this.hls.trigger(u.default.KEY_LOADED,{frag:i})}},{key:"loaderror",value:function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),this.loaders[t.type]=void 0,this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.NETWORK_ERROR,details:c.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})}},{key:"loadtimeout",value:function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),this.loaders[t.type]=void 0,this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.NETWORK_ERROR,details:c.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})}}]),t}(f.default);r.default=g},{33:33,34:34,35:35,53:53}],43:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(2),u=i(l),d=e(35),f=i(d),c=e(34),h=i(c),g=e(33),v=e(47),p=i(v),y=e(53),m=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,E=/#EXT-X-MEDIA:(.*)/g,b=/#EXTINF:(\d*(?:\.\d+)?)(?:,(.*))?|(?!#)(\S.+)|#EXT-X-BYTERANGE: *(.+)|#EXT-X-PROGRAM-DATE-TIME:(.+)|#.*/g,T=function(){function e(){s(this,e),this.method=null,this.key=null,this.iv=null,this._uri=null}return o(e,[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=u.default.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}]),e}(),k=function(){function e(){s(this,e),this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[]}return o(e,[{key:"createInitializationVector",value:function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}},{key:"fragmentDecryptdataFromLevelkey",value:function(e,t){var r=e;return e&&e.method&&e.uri&&!e.iv&&(r=new T,r.method=e.method,r.baseuri=e.baseuri,r.reluri=e.reluri,r.iv=this.createInitializationVector(t)),r}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=u.default.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e}},{key:"programDateTime",get:function(){return!this._programDateTime&&this.rawProgramDateTime&&(this._programDateTime=new Date(Date.parse(this.rawProgramDateTime))),this._programDateTime}},{key:"byteRange",get:function(){if(!this._byteRange){var e=this._byteRange=[];if(this.rawByteRange){var t=this.rawByteRange.split("@",2);if(1===t.length){var r=this.lastByteRangeEndOffset;e[0]=r?r:0}else e[0]=parseInt(t[1]);e[1]=parseInt(t[0])+e[0]}}return this._byteRange}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){return this._decryptdata||(this._decryptdata=this.fragmentDecryptdataFromLevelkey(this.levelkey,this.sn)),this._decryptdata}}]),e}(),_=function(e){function t(e){s(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,f.default.MANIFEST_LOADING,f.default.LEVEL_LOADING,f.default.AUDIO_TRACK_LOADING,f.default.SUBTITLE_TRACK_LOADING));return r.loaders={},r}return n(t,e),o(t,[{key:"destroy",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},h.default.prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(e){this.load(e.url,{type:"manifest"})}},{key:"onLevelLoading",value:function(e){this.load(e.url,{type:"level",level:e.level,id:e.id})}},{key:"onAudioTrackLoading",value:function(e){this.load(e.url,{type:"audioTrack",id:e.id})}},{key:"onSubtitleTrackLoading",value:function(e){this.load(e.url,{type:"subtitleTrack",id:e.id})}},{key:"load",value:function(e,t){var r=this.loaders[t.type];if(r){var i=r.context;if(i&&i.url===e)return void y.logger.trace("playlist request ongoing");y.logger.warn("abort previous loader for type:"+t.type),r.abort()}var a=this.hls.config,n=void 0,s=void 0,o=void 0,l=void 0;"manifest"===t.type?(n=a.manifestLoadingMaxRetry,s=a.manifestLoadingTimeOut,o=a.manifestLoadingRetryDelay,l=a.manifestLoadingMaxRetryTimeout):(n=a.levelLoadingMaxRetry,s=a.levelLoadingTimeOut,o=a.levelLoadingRetryDelay,l=a.levelLoadingMaxRetryTimeout,y.logger.log("loading playlist for "+t.type+" "+(t.level||t.id))),r=this.loaders[t.type]=t.loader=void 0!==a.pLoader?new a.pLoader(a):new a.loader(a),t.url=e,t.responseType="";var u=void 0,d=void 0;u={timeout:s,maxRetry:n,retryDelay:o,maxRetryDelay:l},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},r.load(t,u,d)}},{key:"resolve",value:function(e,t){return u.default.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}},{key:"parseMasterPlaylist",value:function(e,t){var r=[],i=void 0;for(m.lastIndex=0;null!=(i=m.exec(e));){var a={},n=a.attrs=new p.default(i[1]);a.url=this.resolve(i[2],t);var s=n.decimalResolution("RESOLUTION");s&&(a.width=s.width,a.height=s.height),a.bitrate=n.decimalInteger("AVERAGE-BANDWIDTH")||n.decimalInteger("BANDWIDTH"),a.name=n.NAME;var o=n.CODECS;if(o){o=o.split(/[ ,]+/);for(var l=0;l<o.length;l++){var u=o[l];u.indexOf("avc1")!==-1?a.videoCodec=this.avc1toavcoti(u):a.audioCodec=u}}r.push(a)}return r}},{key:"parseMasterPlaylistMedia",value:function(e,t,r){var i=void 0,a=[],n=0;for(E.lastIndex=0;null!=(i=E.exec(e));){var s={},o=new p.default(i[1]);o.TYPE===r&&(s.groupId=o["GROUP-ID"],s.name=o.NAME,s.type=r,s.default="YES"===o.DEFAULT,s.autoselect="YES"===o.AUTOSELECT,s.forced="YES"===o.FORCED,o.URI&&(s.url=this.resolve(o.URI,t)),s.lang=o.LANGUAGE,s.name||(s.name=s.lang),s.id=n++,a.push(s))}return a}},{key:"avc1toavcoti",value:function(e){var t,r=e.split(".");return r.length>2?(t=r.shift()+".",t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):t=e,t}},{key:"parseLevelPlaylist",value:function(e,t,r,i){var a,n,s=0,o=0,l={type:null,version:null,url:t,fragments:[],live:!0,startSN:0},u=new T,d=0,f=null,c=new k;for(b.lastIndex=0;null!==(a=b.exec(e));){var h=a[1];if(h){c.duration=parseFloat(h);var g=(" "+a[2]).slice(1);c.title=g?g:null,c.tagList.push(g?["INF",h,g]:["INF",h])}else if(a[3]){if(!isNaN(c.duration)){var v=s++;c.type=i,c.start=o,c.levelkey=u,c.sn=v,c.level=r,c.cc=d,c.baseurl=t,c.relurl=(" "+a[3]).slice(1),l.fragments.push(c),f=c,o+=c.duration,c=new k}}else if(a[4]){if(c.rawByteRange=(" "+a[4]).slice(1),f){var m=f.byteRangeEndOffset;m&&(c.lastByteRangeEndOffset=m)}}else if(a[5])c.rawProgramDateTime=(" "+a[5]).slice(1),c.tagList.push(["PROGRAM-DATE-TIME",c.rawProgramDateTime]);else{for(a=a[0].match(/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)(.*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/),n=1;n<a.length&&void 0===a[n];n++);var E=(" "+a[n+1]).slice(1),_=(" "+a[n+2]).slice(1);switch(a[n]){case"#":c.tagList.push(_?[E,_]:[E]);break;case"PLAYLIST-TYPE":l.type=E.toUpperCase();break;case"MEDIA-SEQUENCE":s=l.startSN=parseInt(E);break;case"TARGETDURATION":l.targetduration=parseFloat(E);break;case"VERSION":l.version=parseInt(E);break;case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"DIS":d++,c.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":d=parseInt(E);break;case"KEY":var R=E,A=new p.default(R),S=A.enumeratedString("METHOD"),L=A.URI,w=A.hexadecimalInteger("IV");S&&(u=new T,L&&["AES-128","SAMPLE-AES"].indexOf(S)>=0&&(u.method=S,u.baseuri=t,u.reluri=L,u.key=null,u.iv=w));break;case"START":var D=E,O=new p.default(D),I=O.decimalFloatingPoint("TIME-OFFSET");isNaN(I)||(l.startTimeOffset=I);break;case"MAP":var P=new p.default(E);c.relurl=P.URI,c.rawByteRange=P.BYTERANGE,c.baseurl=t,c.level=r,c.type=i,c.sn="initSegment",l.initSegment=c,c=new k;break;default:y.logger.warn("line parsed but not handled: "+a)}}}return c=f,c&&!c.relurl&&(l.fragments.pop(),o-=c.duration),l.totalduration=o,l.averagetargetduration=o/l.fragments.length,l.endSN=s-1,l}},{key:"loadsuccess",value:function(e,t,r){var i=e.data,a=e.url,n=r.type,s=r.id,o=r.level,l=this.hls;if(this.loaders[n]=void 0,void 0!==a&&0!==a.indexOf("data:")||(a=r.url),t.tload=performance.now(),0===i.indexOf("#EXTM3U"))if(i.indexOf("#EXTINF:")>0){var u="audioTrack"!==n&&"subtitleTrack"!==n,d=isNaN(o)?isNaN(s)?0:s:o,c=this.parseLevelPlaylist(i,a,d,"audioTrack"===n?"audio":"subtitleTrack"===n?"subtitle":"main");c.tload=t.tload,"manifest"===n&&l.trigger(f.default.MANIFEST_LOADED,{levels:[{url:a,details:c}],audioTracks:[],url:a,stats:t}),t.tparsed=performance.now(),c.targetduration?u?l.trigger(f.default.LEVEL_LOADED,{details:c,level:o||0,id:s||0,stats:t}):"audioTrack"===n?l.trigger(f.default.AUDIO_TRACK_LOADED,{details:c,id:s,stats:t}):"subtitleTrack"===n&&l.trigger(f.default.SUBTITLE_TRACK_LOADED,{details:c,id:s,stats:t}):l.trigger(f.default.ERROR,{type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:a,reason:"invalid targetduration"})}else{var h=this.parseMasterPlaylist(i,a);if(h.length){var v=this.parseMasterPlaylistMedia(i,a,"AUDIO"),p=this.parseMasterPlaylistMedia(i,a,"SUBTITLES");if(v.length){var m=!1;v.forEach(function(e){e.url||(m=!0)}),m===!1&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(y.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main"}))}l.trigger(f.default.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:p,url:a,stats:t})}else l.trigger(f.default.ERROR,{type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:a,reason:"no level found in manifest"})}else l.trigger(f.default.ERROR,{type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:a,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(e,t){var r,i,a=t.loader;switch(t.type){case"manifest":r=g.ErrorDetails.MANIFEST_LOAD_ERROR,i=!0;break;case"level":r=g.ErrorDetails.LEVEL_LOAD_ERROR,i=!1;break;case"audioTrack":r=g.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,i=!1}a&&(a.abort(),this.loaders[t.type]=void 0),this.hls.trigger(f.default.ERROR,{type:g.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:a.url,loader:a,response:e,context:t})}},{key:"loadtimeout",value:function(e,t){var r,i,a=t.loader;switch(t.type){case"manifest":r=g.ErrorDetails.MANIFEST_LOAD_TIMEOUT,i=!0;break;case"level":r=g.ErrorDetails.LEVEL_LOAD_TIMEOUT,i=!1;break;case"audioTrack":r=g.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT,i=!1}a&&(a.abort(),this.loaders[t.type]=void 0),this.hls.trigger(f.default.ERROR,{type:g.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:a.url,loader:a,context:t})}}]),t}(h.default);r.default=_},{2:2,33:33,34:34,35:35,47:47,53:53}],44:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=Math.pow(2,32)-1,s=function(){function e(){i(this,e)}return a(e,null,[{key:"init",value:function(){e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var t;for(t in e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:i};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=n,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,l,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,a))}},{key:"box",value:function(e){for(var t,r=Array.prototype.slice.call(arguments,1),i=8,a=r.length,n=a;a--;)i+=r[a].byteLength;for(t=new Uint8Array(i),t[0]=i>>24&255,t[1]=i>>16&255,t[2]=i>>8&255,t[3]=255&i,t.set(e,4),a=0,i=8;a<n;a++)t.set(r[a],i),i+=r[a].byteLength;return t}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){r*=t;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))}},{key:"moov",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(i))}},{key:"mvhd",value:function(t,r){r*=t;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,s)}},{key:"sdtp",value:function(t){var r,i,a=t.samples||[],n=new Uint8Array(4+a.length);for(i=0;i<a.length;i++)r=a[i].flags,n[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,n)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var r,i,a,n=[],s=[];for(r=0;r<t.sps.length;r++)i=t.sps[r],a=i.byteLength,n.push(a>>>8&255),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)i=t.pps[r],a=i.byteLength,s.push(a>>>8&255),s.push(255&a),s=s.concat(Array.prototype.slice.call(i));var o=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(s))),l=t.width,u=t.height,d=t.pixelRatio[0],f=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,f>>24,f>>16&255,f>>8&255,255&f])))}},{key:"esds",value:function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}},{key:"mp4a",value:function(t){var r=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"mp3",value:function(t){var r=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))}},{key:"stsd",value:function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,i=t.duration*t.timescale,a=t.width,s=t.height,o=Math.floor(i/(n+1)),l=Math.floor(i%(n+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,l>>24,l>>16&255,l>>8&255,255&l,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,s>>8&255,255&s,0,0]))}},{key:"traf",value:function(t,r){var i=e.sdtp(t),a=t.id,s=Math.floor(r/(n+1)),o=Math.floor(r%(n+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,i.length+16+20+8+16+8+8),i)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,r){var i,a,n,s,o,l,u=t.samples||[],d=u.length,f=12+16*d,c=new Uint8Array(f);for(r+=8+f,c.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<d;i++)a=u[i],n=a.duration,s=a.size,o=a.flags,l=a.cts,c.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,c)}},{key:"initSegment",value:function(t){e.types||e.init();var r,i=e.moov(t);return r=new Uint8Array(e.FTYP.byteLength+i.byteLength),r.set(e.FTYP),r.set(i,e.FTYP.byteLength),r}}]),e}();r.default=s},{}],45:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(36),o=i(s),l=e(35),u=i(l),d=e(53),f=e(44),c=i(f),h=e(33),g=function(){function e(t,r,i,n){a(this,e),this.observer=t,this.config=r,this.typeSupported=i;var s=navigator.userAgent;this.isSafari=n&&n.indexOf("Apple")>-1&&s&&!s.match("CriOS"),this.ISGenerated=!1}return n(e,[{key:"destroy",value:function(){}},{key:"resetTimeStamp",value:function(e){this._initPTS=this._initDTS=e}},{key:"resetInitSegment",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(e,t,r,i,a,n,s){if(this.ISGenerated||this.generateIS(e,t,a),this.ISGenerated)if(e.samples.length){e.timescale||(d.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(e,t,a));var o=this.remuxAudio(e,a,n,s);if(t.samples.length){var l=void 0;o&&(l=o.endPTS-o.startPTS),t.timescale||(d.logger.warn("regenerate InitSegment as video detected"),this.generateIS(e,t,a)),this.remuxVideo(t,a,n,l,s)}}else{var f=void 0;t.samples.length&&(f=this.remuxVideo(t,a,n,s)),f&&e.codec&&this.remuxEmptyAudio(e,a,n,f)}r.samples.length&&this.remuxID3(r,a),i.samples.length&&this.remuxText(i,a),this.observer.trigger(u.default.FRAG_PARSED)}},{key:"generateIS",value:function(e,t,r){var i,a,n=this.observer,s=e.samples,o=t.samples,l=this.typeSupported,f="audio/mp4",g={},v={tracks:g},p=void 0===this._initPTS;if(p&&(i=a=1/0),e.config&&s.length&&(e.timescale=e.samplerate,d.logger.log("audio sampling rate : "+e.samplerate),e.isAAC||(l.mpeg?(f="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3")),g.audio={container:f,codec:e.codec,initSegment:!e.isAAC&&l.mpeg?new Uint8Array:c.default.initSegment([e]),metadata:{channelCount:e.channelCount}},p&&(i=a=s[0].pts-e.inputTimeScale*r)),t.sps&&t.pps&&o.length){var y=t.inputTimeScale;t.timescale=y,g.video={container:"video/mp4",codec:t.codec,initSegment:c.default.initSegment([t]),metadata:{width:t.width,height:t.height}},p&&(i=Math.min(i,o[0].pts-y*r),a=Math.min(a,o[0].dts-y*r),this.observer.trigger(u.default.INIT_PTS_FOUND,{initPTS:i}))}Object.keys(g).length?(n.trigger(u.default.FRAG_PARSING_INIT_SEGMENT,v),this.ISGenerated=!0,p&&(this._initPTS=i,this._initDTS=a)):n.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(e,t,r,i,a){var n,s,o,l,f,g,v,p=8,y=e.timescale,m=e.samples,E=[],b=m.length,T=this._PTSNormalize,k=this._initDTS,_=this.nextAvcDts,R=this.isSafari;R&&(r|=m.length&&_&&(a&&Math.abs(t-_/y)<.1||Math.abs(m[0].pts-_-k)<y/5)),r||(_=t*y),m.forEach(function(e){e.pts=T(e.pts-k,_),e.dts=T(e.dts-k,_)}),m.sort(function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r?r:i?i:e.id-t.id});var A=m.reduce(function(e,t){return Math.max(Math.min(e,t.pts-t.dts),-18e3)},0);if(A<0){d.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(A/90)+" ms to overcome this issue");for(var S=0;S<m.length;S++)m[S].dts+=A}var L=m[0];f=Math.max(L.dts,0),l=Math.max(L.pts,0);var w=Math.round((f-_)/90);r&&w&&(w>1?d.logger.log("AVC:"+w+" ms hole between fragments detected,filling it"):w<-1&&d.logger.log("AVC:"+-w+" ms overlapping between fragments detected"),f=_,m[0].dts=f,l=Math.max(l-w,_),m[0].pts=l,d.logger.log("Video/PTS/DTS adjusted: "+Math.round(l/90)+"/"+Math.round(f/90)+",delta:"+w+" ms")),L=m[m.length-1],v=Math.max(L.dts,0),g=Math.max(L.pts,0,v),R&&(n=Math.round((v-f)/(m.length-1)));for(var D=0,O=0,I=0;I<b;I++){for(var P=m[I],C=P.units,x=C.length,F=0,M=0;M<x;M++)F+=C[M].data.length;O+=F,D+=x,P.length=F,P.dts=R?f+I*n:Math.max(P.dts,f),P.pts=Math.max(P.pts,P.dts)}var N=O+4*D+8;try{s=new Uint8Array(N)}catch(e){return void this.observer.trigger(u.default.ERROR,{type:h.ErrorTypes.MUX_ERROR,details:h.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:N,reason:"fail allocating video mdat "+N})}var U=new DataView(s.buffer);U.setUint32(0,N),s.set(c.default.types.mdat,4);for(var B=0;B<b;B++){for(var G=m[B],j=G.units,K=0,H=void 0,W=0,V=j.length;W<V;W++){var Y=j[W],X=Y.data,q=Y.data.byteLength;U.setUint32(p,q),p+=4,s.set(X,p),p+=q,K+=4+q}if(R)H=Math.max(0,n*Math.round((G.pts-G.dts)/n));else{if(B<b-1)n=m[B+1].dts-G.dts;else{var z=this.config,Q=G.dts-m[B>0?B-1:B].dts;if(z.stretchShortVideoTrack){var J=z.maxBufferHole,Z=z.maxSeekHole,$=Math.floor(Math.min(J,Z)*y),ee=(i?l+i*y:this.nextAudioPts)-G.pts;ee>$?(n=ee-Q,n<0&&(n=Q),d.logger.log("It is approximately "+ee/90+" ms to the next segment; using duration "+n/90+" ms for the last video frame.")):n=Q}else n=Q}H=Math.round(G.pts-G.dts)}E.push({size:K,duration:n,cts:H,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:G.key?2:1,isNonSync:G.key?0:1}})}this.nextAvcDts=v+n;var te=e.dropped;if(e.len=0,e.nbNalu=0,e.dropped=0,E.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var re=E[0].flags;re.dependsOn=2,re.isNonSync=0}e.samples=E,o=c.default.moof(e.sequenceNumber++,f,e),e.samples=[];var ie={data1:o,data2:s,startPTS:l/y,endPTS:(g+n)/y,startDTS:f/y,endDTS:this.nextAvcDts/y,type:"video",nb:E.length,dropped:te};return this.observer.trigger(u.default.FRAG_PARSING_DATA,ie),ie}},{key:"remuxAudio",value:function(e,t,r,i){var a,n,s,l,f,g,v,p=e.inputTimeScale,y=e.timescale,m=p/y,E=e.isAAC?1024:1152,b=E*m,T=this._PTSNormalize,k=this._initDTS,_=!e.isAAC&&this.typeSupported.mpeg,R=e.samples,A=[],S=this.nextAudioPts;if(r|=R.length&&S&&(i&&Math.abs(t-S/p)<.1||Math.abs(R[0].pts-S-k)<20*b),r||(S=t*p),R.forEach(function(e){e.pts=e.dts=T(e.pts-k,S)}),R.sort(function(e,t){return e.pts-t.pts}),i&&e.isAAC)for(var L=0,w=S;L<R.length;){var D,O=R[L],I=O.pts;D=I-w;var P=Math.abs(1e3*D/p);if(D<=-b)d.logger.warn("Dropping 1 audio frame @ "+(w/p).toFixed(3)+"s due to "+P+" ms overlap."),R.splice(L,1),e.len-=O.unit.length;else if(D>=b&&P<1e4&&w){var C=Math.round(D/b);d.logger.warn("Injecting "+C+" audio frame @ "+(w/p).toFixed(3)+"s due to "+Math.round(1e3*D/p)+" ms gap.");for(var x=0;x<C;x++){var F=Math.max(w,0);s=o.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount),s||(d.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),s=O.unit.subarray()),R.splice(L,0,{unit:s,pts:F,dts:F}),e.len+=s.length,w+=b,L++}O.pts=O.dts=w,w+=b,L++}else Math.abs(D),O.pts=O.dts=w,w+=b,L++}for(var M=0,N=R.length;M<N;M++){var U=R[M],B=U.unit,G=U.pts;if(void 0!==v)n.duration=Math.round((G-v)/m);else{var j=Math.round(1e3*(G-S)/p),K=0;if(r&&e.isAAC&&j){if(j>0&&j<1e4)K=Math.round((G-S)/b),d.logger.log(j+" ms hole between AAC samples detected,filling it"),K>0&&(s=o.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount),s||(s=B.subarray()),e.len+=K*s.length);else if(j<-12){d.logger.log("drop overlapping AAC sample, expected/parsed/delta:"+(S/p).toFixed(3)+"s/"+(G/p).toFixed(3)+"s/"+-j+"ms"),e.len-=B.byteLength;continue}G=S}if(g=Math.max(0,G),!(e.len>0))return;var H=_?e.len:e.len+8;a=_?0:8;try{l=new Uint8Array(H)}catch(e){return void this.observer.trigger(u.default.ERROR,{type:h.ErrorTypes.MUX_ERROR,details:h.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:H,reason:"fail allocating audio mdat "+H})}if(!_){new DataView(l.buffer).setUint32(0,H),l.set(c.default.types.mdat,4)}for(var W=0;W<K;W++)s=o.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount),s||(d.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),s=B.subarray()),l.set(s,a),a+=s.byteLength,n={size:s.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},A.push(n)}l.set(B,a);var V=B.byteLength;a+=V,n={size:V,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},A.push(n),v=G}var Y=0,X=A.length;if(X>=2&&(Y=A[X-2].duration,n.duration=Y),X){this.nextAudioPts=S=v+m*Y,e.len=0,e.samples=A,f=_?new Uint8Array:c.default.moof(e.sequenceNumber++,g/m,e),e.samples=[];var q=g/p,z=S/p,Q={data1:f,data2:l,startPTS:q,endPTS:z,startDTS:q,endDTS:z,type:"audio",nb:X};return this.observer.trigger(u.default.FRAG_PARSING_DATA,Q),Q}return null}},{key:"remuxEmptyAudio",value:function(e,t,r,i){var a=e.inputTimeScale,n=e.samplerate?e.samplerate:a,s=a/n,l=this.nextAudioPts,u=(void 0!==l?l:i.startDTS*a)+this._initDTS,f=i.endDTS*a+this._initDTS,c=1024*s,h=Math.ceil((f-u)/c),g=o.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(d.logger.warn("remux empty Audio"),!g)return void d.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var v=[],p=0;p<h;p++){var y=u+p*c;v.push({unit:g,pts:y,dts:y}),e.len+=g.length}e.samples=v,this.remuxAudio(e,t,r)}},{key:"remuxID3",value:function(e,t){var r,i=e.samples.length,a=e.inputTimeScale,n=this._initPTS,s=this._initDTS;if(i){for(var o=0;o<i;o++)r=e.samples[o],r.pts=(r.pts-n)/a,r.dts=(r.dts-s)/a;this.observer.trigger(u.default.FRAG_PARSING_METADATA,{samples:e.samples})}e.samples=[],t=t}},{key:"remuxText",value:function(e,t){e.samples.sort(function(e,t){return e.pts-t.pts});var r,i=e.samples.length,a=e.inputTimeScale,n=this._initPTS;if(i){for(var s=0;s<i;s++)r=e.samples[s],r.pts=(r.pts-n)/a;this.observer.trigger(u.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[],t=t}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}}]),e}();r.default=g},{33:33,35:35,36:36,44:44,53:53}],46:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(35),s=function(e){return e&&e.__esModule?e:{default:e}}(n),o=function(){function e(t){i(this,e),this.observer=t}return a(e,[{key:"destroy",value:function(){}},{key:"resetTimeStamp",value:function(){}},{key:"resetInitSegment",value:function(){}},{key:"remux",value:function(e,t,r,i,a,n,o,l){var u=this.observer,d="";e&&(d+="audio"),t&&(d+="video"),u.trigger(s.default.FRAG_PARSING_DATA,{data1:l,startPTS:a,startDTS:a,type:d,nb:1,
|
28 |
+
dropped:0}),u.trigger(s.default.FRAG_PARSED)}}]),e}();r.default=o},{35:35}],47:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=/^(\d+)x(\d+)$/,s=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,o=function(){function e(t){i(this,e),"string"==typeof t&&(t=e.parseAttrList(t));for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r])}return a(e,[{key:"decimalInteger",value:function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}},{key:"hexadecimalInteger",value:function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(2*i,2*i+2),16);return r}return null}},{key:"hexadecimalIntegerAsNumber",value:function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(e){var t=n.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}}],[{key:"parseAttrList",value:function(e){var t,r={};for(s.lastIndex=0;null!==(t=s.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[t[1]]=i}return r}}]),e}();r.default=o},{}],48:[function(e,t,r){"use strict";var i={search:function(e,t){for(var r=0,i=e.length-1,a=null,n=null;r<=i;){a=(r+i)/2|0,n=e[a];var s=t(n);if(s>0)r=a+1;else{if(!(s<0))return n;i=a-1}}return null}};t.exports=i},{}],49:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},s=function(e){var t=e;return n.hasOwnProperty(e)&&(t=n[e]),String.fromCharCode(t)},o=15,l=100,u={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},d={17:2,18:4,21:6,22:8,23:10,19:13,20:15},f={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},c={25:2,26:4,29:6,30:8,31:10,27:13,28:15},h=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],g={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(e){this.time=e},log:function(e,t){this.verboseFilter[e];this.verboseLevel}},v=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},p=function(){function e(t,r,a,n,s){i(this,e),this.foreground=t||"white",this.underline=r||!1,this.italics=a||!1,this.background=n||"black",this.flash=s||!1}return a(e,[{key:"reset",value:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}},{key:"setStyles",value:function(e){for(var t=["foreground","underline","italics","background","flash"],r=0;r<t.length;r++){var i=t[r];e.hasOwnProperty(i)&&(this[i]=e[i])}}},{key:"isDefault",value:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}},{key:"equals",value:function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}},{key:"copy",value:function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}},{key:"toString",value:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}]),e}(),y=function(){function e(t,r,a,n,s,o){i(this,e),this.uchar=t||" ",this.penState=new p(r,a,n,s,o)}return a(e,[{key:"reset",value:function(){this.uchar=" ",this.penState.reset()}},{key:"setChar",value:function(e,t){this.uchar=e,this.penState.copy(t)}},{key:"setPenState",value:function(e){this.penState.copy(e)}},{key:"equals",value:function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}},{key:"copy",value:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)}},{key:"isEmpty",value:function(){return" "===this.uchar&&this.penState.isDefault()}}]),e}(),m=function(){function e(){i(this,e),this.chars=[];for(var t=0;t<l;t++)this.chars.push(new y);this.pos=0,this.currPenState=new p}return a(e,[{key:"equals",value:function(e){for(var t=!0,r=0;r<l;r++)if(!this.chars[r].equals(e.chars[r])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<l;t++)this.chars[t].copy(e.chars[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<l;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}},{key:"setCursor",value:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(g.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>l&&(g.log("ERROR","Too large cursor position "+this.pos),this.pos=l)}},{key:"moveCursor",value:function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)}},{key:"backSpace",value:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}},{key:"insertChar",value:function(e){e>=144&&this.backSpace();var t=s(e);if(this.pos>=l)return void g.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}},{key:"clearFromPos",value:function(e){var t;for(t=e;t<l;t++)this.chars[t].reset()}},{key:"clear",value:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}},{key:"clearToEndOfRow",value:function(){this.clearFromPos(this.pos)}},{key:"getTextString",value:function(){for(var e=[],t=!0,r=0;r<l;r++){var i=this.chars[r].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")}},{key:"setPenStyles",value:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}]),e}(),E=function(){function e(){i(this,e),this.rows=[];for(var t=0;t<o;t++)this.rows.push(new m);this.currRow=o-1,this.nrRollUpRows=null,this.reset()}return a(e,[{key:"reset",value:function(){for(var e=0;e<o;e++)this.rows[e].clear();this.currRow=o-1}},{key:"equals",value:function(e){for(var t=!0,r=0;r<o;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<o;t++)this.rows[t].copy(e.rows[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<o;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}},{key:"backSpace",value:function(){this.rows[this.currRow].backSpace()}},{key:"clearToEndOfRow",value:function(){this.rows[this.currRow].clearToEndOfRow()}},{key:"insertChar",value:function(e){this.rows[this.currRow].insertChar(e)}},{key:"setPen",value:function(e){this.rows[this.currRow].setPenStyles(e)}},{key:"moveCursor",value:function(e){this.rows[this.currRow].moveCursor(e)}},{key:"setCursor",value:function(e){g.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)}},{key:"setPAC",value:function(e){g.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var r=0;r<o;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var n=a.rows[i].cueStartTime;if(n&&n<g.time)for(var s=0;s<this.nrRollUpRows;s++)this.rows[t-this.nrRollUpRows+s+1].copy(a.rows[i+s])}}this.currRow=t;var l=this.rows[this.currRow];if(null!==e.indent){var u=e.indent,d=Math.max(u-1,0);l.setCursor(e.indent),e.color=l.chars[d].penState.foreground}var f={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(f)}},{key:"setBkgData",value:function(e){g.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}},{key:"setRollUpRows",value:function(e){this.nrRollUpRows=e}},{key:"rollUp",value:function(){if(null===this.nrRollUpRows)return void g.log("DEBUG","roll_up but nrRollUpRows not set yet");g.log("TEXT",this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),g.log("INFO","Rolling up")}},{key:"getDisplayText",value:function(e){e=e||!1;for(var t=[],r="",i=-1,a=0;a<o;a++){var n=this.rows[a].getTextString();n&&(i=a+1,e?t.push("Row "+i+": '"+n+"'"):t.push(n.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r}},{key:"getTextAndFormat",value:function(){return this.rows}}]),e}(),b=function(){function e(t,r){i(this,e),this.chNr=t,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new E,this.nonDisplayedMemory=new E,this.lastOutputScreen=new E,this.currRollUpRow=this.displayedMemory.rows[o-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}return a(e,[{key:"reset",value:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[o-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null}},{key:"getHandler",value:function(){return this.outputFilter}},{key:"setHandler",value:function(e){this.outputFilter=e}},{key:"setPAC",value:function(e){this.writeScreen.setPAC(e)}},{key:"setBkgData",value:function(e){this.writeScreen.setBkgData(e)}},{key:"setMode",value:function(e){e!==this.mode&&(this.mode=e,g.log("INFO","MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}},{key:"insertChars",value:function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";g.log("INFO",r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(g.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}},{key:"ccRCL",value:function(){g.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}},{key:"ccBS",value:function(){g.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}},{key:"ccAOF",value:function(){}},{key:"ccAON",value:function(){}},{key:"ccDER",value:function(){g.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}},{key:"ccRU",value:function(e){g.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}},{key:"ccFON",value:function(){g.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})}},{key:"ccRDC",value:function(){g.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}},{key:"ccTR",value:function(){g.log("INFO","TR"),this.setMode("MODE_TEXT")}},{key:"ccRTD",value:function(){g.log("INFO","RTD"),this.setMode("MODE_TEXT")}},{key:"ccEDM",value:function(){g.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()}},{key:"ccCR",value:function(){g.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()}},{key:"ccENM",value:function(){g.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}},{key:"ccEOC",value:function(){if(g.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,g.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()}},{key:"ccTO",value:function(e){g.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}},{key:"ccMIDROW",value:function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[r]}g.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}},{key:"outputDataUpdate",value:function(){var e=g.time;null!==e&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(e,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))}},{key:"cueSplitAtTime",value:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}]),e}(),T=function(){function e(t,r,a){i(this,e),this.field=t||1,this.outputs=[r,a],this.channels=[new b(1,r),new b(2,a)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}}return a(e,[{key:"getHandler",value:function(e){return this.channels[e].getHandler()}},{key:"setHandler",value:function(e,t){this.channels[e].setHandler(t)}},{key:"addData",value:function(e,t){var r,i,a,n=!1;this.lastTime=e,g.setTime(e);for(var s=0;s<t.length;s+=2)if(i=127&t[s],a=127&t[s+1],0!==i||0!==a){if(g.log("DATA","["+v([t[s],t[s+1]])+"] -> ("+v([i,a])+")"),r=this.parseCmd(i,a),r||(r=this.parseMidrow(i,a)),r||(r=this.parsePAC(i,a)),r||(r=this.parseBackgroundAttributes(i,a)),!r&&(n=this.parseChars(i,a)))if(this.currChNr&&this.currChNr>=0){var o=this.channels[this.currChNr-1];o.insertChars(n)}else g.log("WARNING","No channel found yet. TEXT-MODE?");r?this.dataCounters.cmd+=2:n?this.dataCounters.char+=2:(this.dataCounters.other+=2,g.log("WARNING","Couldn't parse cleaned data "+v([i,a])+" orig: "+v([t[s],t[s+1]])))}else this.dataCounters.padding+=2}},{key:"parseCmd",value:function(e,t){var r=null,i=(20===e||28===e)&&32<=t&&t<=47,a=(23===e||31===e)&&33<=t&&t<=35;if(!i&&!a)return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,g.log("DEBUG","Repeated command ("+v([e,t])+") is dropped"),!0;r=20===e||23===e?1:2;var n=this.channels[r-1];return 20===e||28===e?32===t?n.ccRCL():33===t?n.ccBS():34===t?n.ccAOF():35===t?n.ccAON():36===t?n.ccDER():37===t?n.ccRU(2):38===t?n.ccRU(3):39===t?n.ccRU(4):40===t?n.ccFON():41===t?n.ccRDC():42===t?n.ccTR():43===t?n.ccRTD():44===t?n.ccEDM():45===t?n.ccCR():46===t?n.ccENM():47===t&&n.ccEOC():n.ccTO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=r,!0}},{key:"parseMidrow",value:function(e,t){var r=null;if((17===e||25===e)&&32<=t&&t<=47){if((r=17===e?1:2)!==this.currChNr)return g.log("ERROR","Mismatch channel in midrow parsing"),!1;return this.channels[r-1].ccMIDROW(t),g.log("DEBUG","MIDROW ("+v([e,t])+")"),!0}return!1}},{key:"parsePAC",value:function(e,t){var r=null,i=null,a=(17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127,n=(16===e||24===e)&&64<=t&&t<=95;if(!a&&!n)return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;r=e<=23?1:2,i=64<=t&&t<=95?1===r?u[e]:f[e]:1===r?d[e]:c[e];var s=this.interpretPAC(i,t);return this.channels[r-1].setPAC(s),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=r,!0}},{key:"interpretPAC",value:function(e,t){var r=t,i={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i}},{key:"parseChars",value:function(e,t){var r=null,i=null,a=null;if(e>=25?(r=2,a=e-8):(r=1,a=e),17<=a&&a<=19){var n=t;n=17===a?t+80:18===a?t+112:t+144,g.log("INFO","Special char '"+s(n)+"' in channel "+r),i=[n]}else 32<=e&&e<=127&&(i=0===t?[e]:[e,t]);if(i){var o=v(i);g.log("DEBUG","Char codes = "+o.join(",")),this.lastCmdA=null,this.lastCmdB=null}return i}},{key:"parseBackgroundAttributes",value:function(e,t){var r,i,a,n,s=(16===e||24===e)&&32<=t&&t<=47,o=(23===e||31===e)&&45<=t&&t<=47;return!(!s&&!o)&&(r={},16===e||24===e?(i=Math.floor((t-32)/2),r.background=h[i],t%2==1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0)),a=e<24?1:2,n=this.channels[a-1],n.setBkgData(r),this.lastCmdA=null,this.lastCmdB=null,!0)}},{key:"reset",value:function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null}},{key:"cueSplitAtTime",value:function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)}}]),e}();r.default=T},{}],50:[function(e,t,r){"use strict";var i=e(56),a={newCue:function(e,t,r,a){for(var n,s,o,l,u,d=window.VTTCue||window.TextTrackCue,f=0;f<a.rows.length;f++)if(n=a.rows[f],o=!0,l=0,u="",!n.isEmpty()){for(var c=0;c<n.chars.length;c++)n.chars[c].uchar.match(/\s/)&&o?l++:(u+=n.chars[c].uchar,o=!1);n.cueStartTime=t,t===r&&(r+=1e-4),s=new d(t,r,(0,i.fixLineBreaks)(u.trim())),l>=16?l--:l++,navigator.userAgent.match(/Firefox\//)?s.line=f+1:s.line=f>7?f-2:f+1,s.align="left",s.position=Math.max(0,Math.min(100,l/32*100+(navigator.userAgent.match(/Firefox\//)?50:0))),e.addCue(s)}}};t.exports=a},{56:56}],51:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(52),s=function(e){return e&&e.__esModule?e:{default:e}}(n),o=function(){function e(t,r,a,n){i(this,e),this.hls=t,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new s.default(r),this.fast_=new s.default(a)}return a(e,[{key:"sample",value:function(e,t){e=Math.max(e,this.minDelayMs_);var r=8e3*t/e,i=e/1e3;this.fast_.sample(i,r),this.slow_.sample(i,r)}},{key:"canEstimate",value:function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_}},{key:"getEstimate",value:function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}},{key:"destroy",value:function(){}}]),e}();r.default=o},{52:52}],52:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){function e(t){i(this,e),this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=0,this.totalWeight_=0}return a(e,[{key:"sample",value:function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_}}]),e}();r.default=n},{}],53:[function(e,t,r){"use strict";function i(){}function a(e,t){return t="["+e+"] > "+t}function n(e){var t=self.console[e];return t?function(){for(var r=arguments.length,i=Array(r),n=0;n<r;n++)i[n]=arguments[n];i[0]&&(i[0]=a(e,i[0])),t.apply(self.console,i)}:i}function s(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r.forEach(function(t){u[t]=e[t]?e[t].bind(e):n(t)})}Object.defineProperty(r,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l={trace:i,debug:i,log:i,warn:i,info:i,error:i},u=l;r.enableLogs=function(e){if(e===!0||"object"===(void 0===e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{u.log()}catch(e){u=l}}else u=l},r.logger=u},{}],54:[function(e,t,r){"use strict";var i={toString:function(e){for(var t="",r=e.length,i=0;i<r;i++)t+="["+e.start(i).toFixed(3)+","+e.end(i).toFixed(3)+"]";return t}};t.exports=i},{}],55:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){function e(e){return"string"==typeof e&&(!!n[e.toLowerCase()]&&e.toLowerCase())}function t(e){return"string"==typeof e&&(!!s[e.toLowerCase()]&&e.toLowerCase())}function r(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]=r[i]}return e}function i(i,n,s){var o=this,l=function(){if("undefined"!=typeof navigator)return/MSIE\s8\.0/.test(navigator.userAgent)}(),u={};l?o=document.createElement("custom"):u.enumerable=!0,o.hasBeenReset=!1;var d="",f=!1,c=i,h=n,g=s,v=null,p="",y=!0,m="auto",E="start",b=50,T="middle",k=50,_="middle";if(Object.defineProperty(o,"id",r({},u,{get:function(){return d},set:function(e){d=""+e}})),Object.defineProperty(o,"pauseOnExit",r({},u,{get:function(){return f},set:function(e){f=!!e}})),Object.defineProperty(o,"startTime",r({},u,{get:function(){return c},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",r({},u,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",r({},u,{get:function(){return g},set:function(e){g=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",r({},u,{get:function(){return v},set:function(e){v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",r({},u,{get:function(){return p},set:function(t){var r=e(t);if(r===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=r,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",r({},u,{get:function(){return y},set:function(e){y=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",r({},u,{get:function(){return m},set:function(e){if("number"!=typeof e&&e!==a)throw new SyntaxError("An invalid number or illegal string was specified.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",r({},u,{get:function(){return E},set:function(e){var r=t(e);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");E=r,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",r({},u,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",r({},u,{get:function(){return T},set:function(e){var r=t(e);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");T=r,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",r({},u,{get:function(){return k},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");k=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",r({},u,{get:function(){return _},set:function(e){var r=t(e);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");_=r,this.hasBeenReset=!0}})),o.displayState=void 0,l)return o}if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var a="auto",n={"":!0,lr:!0,rl:!0},s={start:!0,middle:!0,end:!0,left:!0,right:!0};return i.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},i}()},{}],56:[function(e,t,r){"use strict";function i(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new f,this.regionList=[]}function a(e){function t(e,t,r,i){return 3600*(0|e)+60*(0|t)+(0|r)+(0|i)/1e3}var r=e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return r?r[3]?t(r[1],r[2],r[3].replace(":",""),r[4]):r[1]>59?t(r[1],r[2],0,r[4]):t(0,r[1],r[2],r[4]):null}function n(){this.values=Object.create(null)}function s(e,t,r,i){var a=i?e.split(i):[e];for(var n in a)if("string"==typeof a[n]){var s=a[n].split(r);if(2===s.length){var o=s[0],l=s[1];t(o,l)}}}function o(e,t,r){function i(){var t=a(e);if(null===t)throw new Error("Malformed timestamp: "+l);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function o(){e=e.replace(/^\s+/,"")}var l=e;if(o(),t.startTime=i(),o(),"-->"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);e=e.substr(3),o(),t.endTime=i(),o(),function(e,t){var i=new n;s(e,function(e,t){switch(e){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===t){i.set(e,r[a].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var n=t.split(","),s=n[0];i.integer(e,s),i.percent(e,s)&&i.set("snapToLines",!1),i.alt(e,s,["auto"]),2===n.length&&i.alt("lineAlign",n[1],["start",h,"end"]);break;case"position":n=t.split(","),i.percent(e,n[0]),2===n.length&&i.alt("positionAlign",n[1],["start",h,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",h,"end","left","right"])}},/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var a=i.get("line","auto");"auto"===a&&c.line===-1&&(a=-1),t.line=a,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",h);var o=i.get("position","auto");"auto"===o&&50===c.position&&(o="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=o}(e,t)}function l(e){return e.replace(/<br(?: \/)?>/gi,"\n")}Object.defineProperty(r,"__esModule",{value:!0}),r.fixLineBreaks=void 0;var u=e(55),d=function(e){return e&&e.__esModule?e:{default:e}}(u),f=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};n.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,r){for(var i=0;i<r.length;++i)if(t===r[i]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var c=new d.default(0,0,0),h="middle"===c.align?"middle":"center";i.prototype={parse:function(e){function t(){var e=r.buffer,t=0;for(e=l(e);t<e.length&&"\r"!==e[t]&&"\n"!==e[t];)++t;var i=e.substr(0,t);return"\r"===e[t]&&++t,"\n"===e[t]&&++t,r.buffer=e.substr(t),i}var r=this;e&&(r.buffer+=r.decoder.decode(e,{stream:!0}));try{var i;if("INITIAL"===r.state){if(!/\r\n|\n/.test(r.buffer))return this;i=t();var a=i.match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var n=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;switch(n?n=!1:i=t(),r.state){case"HEADER":/:/.test(i)?function(e){s(e,function(e,t){switch(e){case"Region":}},/:/)}(i):i||(r.state="ID");continue;case"NOTE":i||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){r.state="NOTE";break}if(!i)continue;if(r.cue=new d.default(0,0,""),r.state="CUE",i.indexOf("-->")===-1){r.cue.id=i;continue}case"CUE":try{o(i,r.cue,r.regionList)}catch(e){r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":var u=i.indexOf("-->")!==-1;if(!i||u&&(n=!0)){r.oncue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}r.cue.text&&(r.cue.text+="\n"),r.cue.text+=i;continue;case"BADCUE":i||(r.state="ID");continue}}}catch(e){"CUETEXT"===r.state&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state="INITIAL"===r.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new Error("Malformed WebVTT signature.")}catch(e){throw e}return e.onflush&&e.onflush(),this}},r.fixLineBreaks=l,r.default=i},{55:55}],57:[function(e,t,r){"use strict";var i=e(56),a=function(e){return e&&e.__esModule?e:{default:e}}(i),n=function(e,t,r){return e.substr(r||0,t.length)===t},s=function(e){var t=parseInt(e.substr(-3)),r=parseInt(e.substr(-6,2)),i=parseInt(e.substr(-9,2)),a=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;return isNaN(t)||isNaN(r)||isNaN(i)||isNaN(a)?-1:(t+=1e3*r,t+=6e4*i,t+=36e5*a)},o=function e(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()},l=function(e,t,r){var i=e[t],a=e[i.prevCC];if(!a||!a.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;a&&a.new;)e.ccOffset+=i.start-a.start,i.new=!1,i=a,a=e[i.prevCC];e.presentationOffset=r},u={parse:function(e,t,r,i,u,d){var f=String.fromCharCode.apply(null,new Uint8Array(e)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),c="00:00.000",h=0,g=0,v=0,p=[],y=void 0,m=!0,E=new a.default;E.oncue=function(e){var t=r[i],a=r.ccOffset;t&&t.new&&(void 0!==g?a=r.ccOffset=t.start:l(r,i,v)),v&&(a=v+r.ccOffset-r.presentationOffset),e.startTime+=a-g,e.endTime+=a-g,e.id=o(e.startTime)+o(e.endTime)+o(e.text),e.text=decodeURIComponent(escape(e.text)),e.endTime>0&&p.push(e)},E.onparsingerror=function(e){y=e},E.onflush=function(){if(y&&d)return void d(y);u(p)},f.forEach(function(e){if(m){if(n(e,"X-TIMESTAMP-MAP=")){m=!1,e.substr(16).split(",").forEach(function(e){n(e,"LOCAL:")?c=e.substr(6):n(e,"MPEGTS:")&&(h=parseInt(e.substr(7)))});try{t=t<0?t+8589934592:t,h-=t,g=s(c)/1e3,v=h/9e4,g===-1&&(y=new Error("Malformed X-TIMESTAMP-MAP: "+e))}catch(t){y=new Error("Malformed X-TIMESTAMP-MAP: "+e)}return}""===e&&(m=!1)}E.parse(e+"\n")}),E.flush()}};t.exports=u},{56:56}],58:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(53),s=function(){function e(t){i(this,e),t&&t.xhrSetup&&(this.xhrSetup=t.xhrSetup)}return a(e,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null}},{key:"load",value:function(e,t,r){this.context=e,this.config=t,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},
|
29 |
+
this.retryDelay=t.retryDelay,this.loadInternal()}},{key:"loadInternal",value:function(){var e,t=this.context;e="undefined"!=typeof XDomainRequest?this.loader=new XDomainRequest:this.loader=new XMLHttpRequest;var r=this.stats;r.tfirst=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(e,t.url)}catch(r){e.open("GET",t.url,!0),i(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(r){return void this.callbacks.onError({code:e.status,text:r.message},t)}t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()}},{key:"readystatechange",value:function(e){var t=e.currentTarget,r=t.readyState,i=this.stats,a=this.context,s=this.config;if(!i.aborted&&r>=2)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(performance.now(),i.trequest)),4===r){var o=t.status;if(o>=200&&o<300){i.tload=Math.max(i.tfirst,performance.now());var l=void 0,u=void 0;"arraybuffer"===a.responseType?(l=t.response,u=l.byteLength):(l=t.responseText,u=l.length),i.loaded=i.total=u;var d={url:t.responseURL,data:l};this.callbacks.onSuccess(d,i,a)}else i.retry>=s.maxRetry||o>=400&&o<499?(n.logger.error(o+" while loading "+a.url),this.callbacks.onError({code:o,text:t.statusText},a)):(n.logger.warn(o+" while loading "+a.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),s.timeout)}},{key:"loadtimeout",value:function(){n.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context)}},{key:"loadprogress",value:function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total);var r=this.callbacks.onProgress;r&&r(t,this.context,null)}}]),e}();r.default=s},{53:53}]},{},[40])(40)});
|
30 |
+
!function(){"use strict";var e=function(e,a){var r,t="hlsjs",o=a.common,i=a.extend,n=a.support,s=n.browser,l=a.version,u=0===l.indexOf("6."),d=window,c=d.MediaSource||d.WebKitMediaSource,f=d.performance,p=function(e){return e.toLowerCase().indexOf("mpegurl")>-1},v=function(e){var a=e.clip&&e.clip.hlsQualities||e.hlsQualities;return n.inlineVideo&&(a===!0||a&&a.length)},h=function(s,h){var g,b,m,y,k,E,L,w,C,O=a.bean,T="is-seeking",A="is-poster",q=function(e,a,r){if(e.debug&&console.log("recovery."+t,"<-",a),o.removeClass(h,"is-paused"),o.addClass(h,T),r)b.startLoad();else{var i=f.now();!y||i-y>3e3?(y=f.now(),b.recoverMediaError()):(!k||i-k>3e3)&&(k=f.now(),b.swapAudioCodec(),b.recoverMediaError())}m>0&&(m-=1),O.one(g,"seeked."+t,function(){g.paused&&(o.removeClass(h,A),s.poster=!1,g.play()),o.removeClass(h,T)})},R=function(e,a,r){var t={code:e};return e>2&&(t.video=i(s.video,{src:a,url:r||a})),t},x=function(){O.one(g,"timeupdate."+t,function(){o.addClass(h,A),s.poster=!0})},D=function(){u&&s.poster&&O.one(g,"timeupdate."+t,function(){o.removeClass(h,A),s.poster=!1})},N=0,S=function(e){if(w&&w.length>1){var a=b.audioTracks.filter(function(a){var r=b.levels[e].attrs;return a.autoselect&&r&&a.groupId===r.AUDIO&&a.name===b.audioTracks[b.audioTrack].name}),r=a.length&&a[0].id;void 0!==r&&r!==b.audioTrack&&(b.audioTrack=r)}},M=function(e){o.find(".fp-audio",h)[0].innerHTML=e.lang||e.name,o.find(".fp-audio-menu a",h).forEach(function(a){var r=a.getAttribute("data-audio"),t=r===e.name;o.toggleClass(a,"fp-selected",t),o.toggleClass(a,"fp-color",t)})},P=function(){o.find(".fp-audio-menu",h).forEach(o.removeNode),o.find(".fp-audio",h).forEach(o.removeNode)},I=function(e){w=[],C=[],e.levels.forEach(function(e){var a=e.attrs&&e.attrs.AUDIO;a&&w.indexOf(a)<0&&c.isTypeSupported("video/mp4;codecs="+e.videoCodec+","+e.audioCodec)&&w.push(a)}),w.length&&(C=e.audioTracks.filter(function(e){return e.groupId===w[0]})),!n.inlineVideo||u||C.length<2||(O.on(h,"click."+t,".fp-audio",function(){var e=o.find(".fp-audio-menu",h)[0];o.hasClass(e,"fp-active")?s.hideMenu():s.showMenu(e)}),O.on(h,"click."+t,".fp-audio-menu a",function(e){var a=e.target.getAttribute("data-audio"),r=b.audioTracks[b.audioTrack].groupId,t=b.audioTracks.filter(function(e){return e.groupId===r&&(e.name===a||e.lang===a)})[0];b.audioTrack=t.id,M(t)}),s.on("ready."+t,function(){if(P(),b&&C&&!(C.length<2)){var e=o.find(".fp-ui",h)[0],a=o.find(".fp-controls",e)[0],r=b.audioTracks[b.audioTrack],t=o.createElement("div",{className:"fp-menu fp-audio-menu",css:{width:"auto"}},"<strong>Audio</strong>");C.forEach(function(e){t.appendChild(o.createElement("a",{"data-audio":e.name},e.name))}),e.appendChild(t),a.appendChild(o.createElement("strong",{className:"fp-audio"},r)),M(r)}}))},_="active",W=function(e){return e?s.qualities.indexOf(e)<0&&(e="abr"):e=s.quality,e.toLowerCase().replace(/\ /g,"")},j=function(){var e=s.qualities;e&&(o.removeClass(h,"quality-abr"),e.forEach(function(e){o.removeClass(h,"quality-"+W(e))}))},Q=function(){u&&(delete s.hlsQualities,j(),o.find(".fp-quality-selector",h).forEach(o.removeNode))},F=function(){return s.hlsQualities[s.qualities.indexOf(s.quality)+1]},U=-1,H=function(e,a,r){var i,n,l,d=r.levels,f=function(e){return isNaN(Number(e))?e.level:e};if(Q(),e&&!(d.length<2)){if("drive"===e){switch(d.length){case 4:i=[1,2,3];break;case 5:i=[1,2,3,4];break;case 6:i=[1,3,4,5];break;case 7:i=[1,3,5,6];break;case 8:i=[1,3,6,7];break;default:if(d.length<3||d[0].height&&d[2].height&&d[0].height===d[2].height)return;i=[1,2]}i.unshift(-1)}else switch(typeof e){case"object":i=e.map(f);break;case"string":i=e.split(/\s*,\s*/).map(Number);break;default:i=d.map(function(e){return d.indexOf(e)}),i.unshift(-1)}if(u&&i.indexOf(-1)<0&&i.unshift(-1),i=i.filter(function(e){if(e>-1&&e<d.length){var a=d[e];return!a.videoCodec||a.videoCodec&&c.isTypeSupported("video/mp4;codecs="+a.videoCodec)}return e===-1}),n=i.map(function(a){var r=d[a],t="object"==typeof e?e.filter(function(e){return f(e)===a})[0]:a,o="Level "+(i.indexOf(a)+1);return a<0?o=t.label||"Auto":t.label?o=t.label:(r.width&&r.height&&(o=Math.min(r.width,r.height)+"p"),!u&&"drive"!==e&&r.bitrate&&(o+=" ("+Math.round(r.bitrate/1e3)+"k)")),u?o:{value:a,label:o}}),!u)return s.video.qualities=n,U>-1||i.indexOf(-1)<0?(b.loadLevel=i.indexOf(U)<0?i[0]:U,b.config.startLevel=b.loadLevel,s.video.quality=b.loadLevel):s.video.quality=-1,void(U=s.video.quality);s.hlsQualities=i,s.qualities=n.slice(1),l=o.createElement("ul",{class:"fp-quality-selector"}),o.find(".fp-ui",h)[0].appendChild(l),!s.quality||n.indexOf(s.quality)<1?s.quality="abr":(b.loadLevel=F(),b.config.startLevel=b.loadLevel),n.forEach(function(e){l.appendChild(o.createElement("li",{"data-quality":W(e)},e))}),o.addClass(h,"quality-"+W()),O.on(h,"click."+t,".fp-quality-selector li",function(e){var r=e.currentTarget,i=o.find(".fp-quality-selector li",h),n=a.smoothSwitching,l=g.paused;o.hasClass(r,_)||(l||n||O.one(g,"pause."+t,function(){o.removeClass(h,"is-paused")}),i.forEach(function(e){var a=e===r,t=i.indexOf(e);a&&(s.quality=t>0?s.qualities[t-1]:"abr",n&&!s.poster?b.nextLevel=F():b.currentLevel=F(),o.addClass(r,_),l&&g.play()),o.toggleClass(e,_,a)}),j(),o.addClass(h,"quality-"+W()))})}},G={engineName:t,pick:function(e){var a,r;for(a=0;a<e.length;a+=1)if(r=e[a],p(r.type))return"string"==typeof r.src&&(r.src=o.createAbsoluteUrl(r.src)),r},load:function(a){var l=s.conf,c={ended:"finish",loadeddata:"ready",pause:"pause",play:"resume",progress:"buffer",ratechange:"speed",seeked:"seek",timeupdate:"progress",volumechange:"volume",error:"error"},f=e.Events,p=!!a.autoplay||!!l.autoplay,E=a.hlsQualities||l.hlsQualities,L=i(r,l.hlsjs,a.hlsjs),w=i({},L);if(a.hlsQualities===!1&&(E=!1),b?(b.destroy(),(s.video.src&&a.src!==s.video.src||a.index)&&o.attr(g,"autoplay","autoplay")):(g=o.findDirect("video",h)[0]||o.find(".fp-player > video",h)[0],g&&(o.find("source",g).forEach(function(e){e.removeAttribute("src")}),g.removeAttribute("src"),g.load(),o.removeNode(g)),g=o.createElement("video",{class:"fp-engine "+t+"-engine",autoplay:!!p&&"autoplay"}),Object.keys(c).forEach(function(e){var a,r=c[e],n=e+"."+t;O.on(g,n,function(e){l.debug&&r.indexOf("progress")<0&&console.log(n,"->",r,e.originalEvent);var t,d,c,f=g.currentTime,p=g.seekable,v=s.video,m=v.seekOffset,y=s.live&&b.liveSyncPosition,k=g.buffered,E=0,w=0,C=v.src,O=s.quality;switch(r){case"ready":a=i(v,{duration:g.duration,seekable:p.length&&p.end(null),width:g.videoWidth,height:g.videoHeight,url:C});break;case"resume":D(),L.bufferWhilePaused||b.startLoad(f);break;case"seek":D(),!L.bufferWhilePaused&&g.paused&&(b.stopLoad(),g.pause()),a=f;break;case"pause":L.bufferWhilePaused||b.stopLoad();break;case"progress":y&&(v.duration=y,s.dvr&&(s.trigger("dvrwindow",[s,{start:m,end:y}]),f<m&&(g.currentTime=m))),a=f;break;case"speed":a=g.playbackRate;break;case"volume":a=g.volume;break;case"buffer":try{if(E=k.length&&k.end(null),f&&E)for(t=k.length-1;t>-1;t-=1)w=k.end(t),w>=f&&(E=w)}catch(e){}v.buffer=E,a=E;break;case"finish":L.bufferWhilePaused&&b.autoLevelEnabled&&(v.loop||l.playlist.length<2||l.advance===!1)&&(b.nextLoadLevel=N);break;case"error":if(c=g.error&&g.error.code,L.recoverMediaError&&(3===c||!c)||L.recoverNetworkError&&2===c||L.recover&&(2===c||3===c))return e.preventDefault(),void q(l,r,2===c);a=R(c,C)}s.trigger(r,[s,a]),u&&"ready"===r&&O&&(d="abr"===O?0:s.qualities.indexOf(O)+1,o.addClass(o.find(".fp-quality-selector li",h)[d],_))})}),s.on("error."+t,function(){b&&s.engine.unload()}),L.bufferWhilePaused||s.on("beforeseek."+t,function(e,a,r){a.paused&&(O.one(g,"seeked."+t,function(){g.pause()}),b.startLoad(r))}),u?l.poster&&(s.on("stop."+t,x),!s.live||p||s.video.autoplay||O.one(g,"seeked."+t,x)):s.on("quality."+t,function(e,a,r){L.smoothSwitching?b.nextLevel=r:b.currentLevel=r,U=r}),o.prepend(o.find(".fp-player",h)[0],g)),s.video=a,N=0,Object.keys(L).forEach(function(a){e.DefaultConfig.hasOwnProperty(a)||delete w[a];var r=L[a];switch(a){case"adaptOnStartOnly":r&&(w.startLevel=-1);break;case"autoLevelCapping":r===!1&&(r=-1),w[a]=r;break;case"startLevel":switch(r){case"auto":r=-1;break;case"firstLevel":r=void 0}w[a]=r;break;case"recover":L.recoverMediaError=!1,L.recoverNetworkError=!1,m=r;break;case"strict":r&&(L.recoverMediaError=!1,L.recoverNetworkError=!1,m=0)}}),b=new e(w),s.engine[t]=b,y=null,k=null,Object.keys(f).forEach(function(a){var r=f[a],i=L.listeners,n=i&&i.indexOf(r)>-1;b.on(r,function(r,i){var c,f={},p=e.ErrorTypes,y=e.ErrorDetails,k=s.video,w=k.src;switch(a){case"MANIFEST_PARSED":!v(l)||!u&&s.pluginQualitySelectorEnabled?u&&delete s.quality:H(E,L,i);break;case"MANIFEST_LOADED":I(i);break;case"MEDIA_ATTACHED":b.loadSource(w);break;case"FRAG_LOADED":L.bufferWhilePaused&&!s.live&&b.autoLevelEnabled&&b.nextLoadLevel>N&&(N=b.nextLoadLevel);break;case"FRAG_PARSING_METADATA":if(u)return;i.samples.forEach(function(e){var a;a=function(){if(!(g.currentTime<e.dts)){O.off(g,"timeupdate."+t,a);var r=e.unit||e.data,o=d.TextDecoder;r=o&&"function"==typeof o?new o("utf-8").decode(r):decodeURIComponent(encodeURIComponent(String.fromCharCode.apply(null,r))),s.trigger("metadata",[s,{key:r.substr(10,4),data:r}])}},O.on(g,"timeupdate."+t,a)});break;case"LEVEL_UPDATED":s.live&&(s.video.seekOffset=i.details.fragments[0].start+b.config.nudgeOffset);break;case"LEVEL_SWITCHED":L.audioABR&&s.one("buffer."+t,function(e,a,r){r>a.video.time&&S(i.level)});break;case"BUFFER_APPENDED":o.removeClass(h,T);break;case"ERROR":if(i.fatal||L.strict){switch(i.type){case p.NETWORK_ERROR:L.recoverNetworkError||m?q(l,i.type,!0):i.frag&&i.frag.url?(f.url=i.frag.url,c=2):c=4;break;case p.MEDIA_ERROR:L.recoverMediaError||m?q(l,i.type):c=3;break;default:c=5}void 0!==c&&(f=R(c,w,i.url),s.trigger("error",[s,f]))}else i.details!==y.FRAG_LOOP_LOADING_ERROR&&i.details!==y.BUFFER_STALLED_ERROR||o.addClass(h,T)}n&&s.trigger(r,[s,i])})}),L.adaptOnStartOnly&&O.one(g,"timeupdate."+t,function(){b.loadLevel=b.loadLevel}),b.attachMedia(g),!n.firstframe&&p&&g.paused){var C=g.play();void 0!==C&&C.catch(function(){s.unload(),u||s.message("Please click the play button",3e3)})}},resume:function(){g.play()},pause:function(){g.pause()},seek:function(e){g.currentTime=e},volume:function(e){g&&(g.volume=e)},speed:function(e){g.playbackRate=e,s.trigger("speed",[s,e])},unload:function(){if(b){var e="."+t;b.destroy(),b=0,Q(),P(),s.off(e),O.off(h,e),O.off(g,e),o.removeNode(g),g=0}}};return!/^6\.0\.[0-3]$/.test(l)||s.conf.splash||s.conf.poster||s.conf.autoplay||(E=o.css(h,"backgroundColor"),L="none"!==o.css(h,"backgroundImage")||E&&"rgba(0, 0, 0, 0)"!==E&&"transparent"!==E,L&&(s.conf.poster=!0)),G};e.isSupported()&&0!==l.indexOf("5.")&&(h.engineName=t,h.canPlay=function(e,a){return a[t]!==!1&&a.clip[t]!==!1&&(r=i({bufferWhilePaused:!0,smoothSwitching:!0,recoverMediaError:!0},a[t],a.clip[t]),p(e)&&(!s.safari||r.safari))},a.engines.unshift(h),u&&a(function(e){e.pluginQualitySelectorEnabled=v(e.conf)&&h.canPlay("application/x-mpegurl",e.conf)}))};"object"==typeof module&&module.exports?module.exports=e.bind(void 0,require("hls.js")):window.Hls&&window.flowplayer&&e(window.Hls,window.flowplayer)}();
|
31 |
/*@
|
32 |
@end
|
33 |
@*/
|
flowplayer/fv-flowplayer.min.js
CHANGED
@@ -22,8 +22,13 @@ if( typeof(fv_flowplayer_conf) != "undefined" ) {
|
|
22 |
delete fv_flowplayer_conf.volume;
|
23 |
}
|
24 |
} catch(e) {}
|
|
|
25 |
flowplayer.conf = fv_flowplayer_conf;
|
26 |
|
|
|
|
|
|
|
|
|
27 |
var isOldAndroid = /Android/.test(navigator.userAgent) && parseFloat(/Android\ (\d\.\d)/.exec(window.navigator.userAgent)[1], 10) < 4.4;
|
28 |
var isiPad = /iPad/i.test(navigator.userAgent);
|
29 |
var iOSVersion = isiPad ? parseFloat(/CPU (?:iPhone |iPod )?OS (\d+)/.exec(navigator.userAgent)[1], 10) : 0;
|
@@ -379,7 +384,17 @@ if( typeof(flowplayer.conf.safety_resize) != "undefined" && flowplayer.conf.safe
|
|
379 |
jQuery(document).ready(function() { setTimeout( function() { fv_flowplayer_safety_resize(); }, 10 ); } );
|
380 |
}
|
381 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
jQuery(document).ready( function() {
|
|
|
383 |
jQuery('.fp-playlist-external' ).each( function(i,el) {
|
384 |
if( jQuery('a',el).length == 0 ) return;
|
385 |
jQuery('a',el).click( function(e) {
|
@@ -400,10 +415,26 @@ jQuery(document).ready( function() {
|
|
400 |
}, 300);
|
401 |
}
|
402 |
} );
|
|
|
|
|
403 |
} );
|
404 |
|
405 |
flowplayer( function(api,root) {
|
406 |
root = jQuery(root);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
api.bind('load', function(e,api,video) {
|
408 |
//console.log('playlist mark',video.index);
|
409 |
setTimeout( function() {
|
@@ -443,15 +474,67 @@ jQuery(document).ready( function() {
|
|
443 |
})
|
444 |
}
|
445 |
|
|
|
446 |
if( typeof(fv_flowplayer_playlists) != "undefined" ) {
|
447 |
for( var i in fv_flowplayer_playlists ) {
|
448 |
if( !fv_flowplayer_playlists.hasOwnProperty(i) ) continue;
|
449 |
jQuery('#'+i).flowplayer( { playlist: fv_flowplayer_playlists[i] });
|
450 |
}
|
451 |
-
}
|
452 |
-
|
|
|
|
|
453 |
} );
|
454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
jQuery( function() {
|
456 |
jQuery('.flowplayer').each( function() {
|
457 |
flowplayer.bean.off(jQuery(this)[0],'contextmenu');
|
@@ -472,11 +555,6 @@ if( typeof(fv_flowplayer_browser_chrome_fail_array) != "undefined" ) {
|
|
472 |
fv_flowplayer_browser_chrome_fail( i, fv_flowplayer_browser_chrome_fail_array[i]['attrs'], fv_flowplayer_browser_chrome_fail_array[i]['mp4'], fv_flowplayer_browser_chrome_fail_array[i]['auto_buffer'] );
|
473 |
}
|
474 |
}
|
475 |
-
if( typeof(fv_flowplayer_browser_chrome_mp4_array) != "undefined" ) {
|
476 |
-
for( var i in fv_flowplayer_browser_chrome_mp4_array ) {
|
477 |
-
fv_flowplayer_browser_chrome_mp4( i );
|
478 |
-
}
|
479 |
-
}
|
480 |
|
481 |
if( typeof(fv_flowplayer_browser_ie_array) != "undefined" ) {
|
482 |
for( var i in fv_flowplayer_browser_ie_array ) {
|
@@ -614,7 +692,7 @@ flowplayer(function (api,root) {
|
|
614 |
if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length ) {
|
615 |
if( root.find('.wpfp_custom_popup').length > 0) {
|
616 |
root.find('.wpfp_custom_popup').show();
|
617 |
-
} else {
|
618 |
root.append( '<div id="'+player_id+'_custom_popup" class="wpfp_custom_popup">'+fv_flowplayer_popup[player_id].html+'</div>' );
|
619 |
}
|
620 |
}
|
@@ -926,11 +1004,15 @@ flowplayer(function(player, root) {
|
|
926 |
if( !root.data('fv-embed') ) return;
|
927 |
|
928 |
player.embedCode = function() {
|
929 |
-
var video = player.video;
|
930 |
-
var width =
|
931 |
-
var height =
|
|
|
|
|
|
|
|
|
932 |
height += 2;
|
933 |
-
return '<iframe src="' + root.data('fv-embed') + '" allowfullscreen
|
934 |
};
|
935 |
|
936 |
});
|
@@ -1064,7 +1146,11 @@ function fv_autoplay_init(root, scrollOffset , index ,time){
|
|
1064 |
if (typeof (flowplayer) !== "undefined" && typeof(fv_flowplayer_conf) != "undefined" && fv_flowplayer_conf.video_hash_links ) {
|
1065 |
flowplayer(function (api, root) {
|
1066 |
if( jQuery(root).find('.sharing-link').length > 0 ) {
|
1067 |
-
api.on('progress',function(e){
|
|
|
|
|
|
|
|
|
1068 |
var hash = fv_parse_sharelink(api.video.sources[0].src);
|
1069 |
var sTime = '?t=' + fv_player_time_hms(api.video.time);
|
1070 |
//console.log(sTime);
|
@@ -1310,6 +1396,8 @@ flowplayer(function(api, root) {
|
|
1310 |
});
|
1311 |
|
1312 |
|
|
|
|
|
1313 |
/* *
|
1314 |
* WARNINGS
|
1315 |
*/
|
@@ -1417,9 +1505,10 @@ flowplayer(function(api, root) {
|
|
1417 |
|
1418 |
jQuery('.fp-player',root).css('background-image', jQuery(root).css('background-image') );
|
1419 |
|
|
|
|
|
|
|
1420 |
}
|
1421 |
-
}).on('error', function (e,api, error) {
|
1422 |
-
jQuery('.fp-message',root).html( jQuery('.fp-message',root).html().replace(/video/,'audio') );
|
1423 |
});
|
1424 |
|
1425 |
})
|
@@ -1436,12 +1525,12 @@ function fv_player_notice(root, message, timeout) {
|
|
1436 |
if ( typeof(timeout) == 'string' ) {
|
1437 |
var player = jQuery(root).data('flowplayer');
|
1438 |
player.on(timeout, function() {
|
1439 |
-
notice.fadeOut(
|
1440 |
} );
|
1441 |
}
|
1442 |
if ( timeout > 0 ) {
|
1443 |
setTimeout( function() {
|
1444 |
-
notice.fadeOut(2000,function() {
|
1445 |
}, timeout );
|
1446 |
}
|
1447 |
}
|
@@ -1470,3 +1559,180 @@ function fv_player_doCopy(text) {
|
|
1470 |
if (!success) throw new Error('Unsuccessfull');
|
1471 |
}
|
1472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
delete fv_flowplayer_conf.volume;
|
23 |
}
|
24 |
} catch(e) {}
|
25 |
+
|
26 |
flowplayer.conf = fv_flowplayer_conf;
|
27 |
|
28 |
+
if( flowplayer.conf.mobile_native_fullscreen && ( 'ontouchstart' in window ) && !flowplayer.support.firstframe ) {
|
29 |
+
flowplayer.conf.native_fullscreen = true;
|
30 |
+
}
|
31 |
+
|
32 |
var isOldAndroid = /Android/.test(navigator.userAgent) && parseFloat(/Android\ (\d\.\d)/.exec(window.navigator.userAgent)[1], 10) < 4.4;
|
33 |
var isiPad = /iPad/i.test(navigator.userAgent);
|
34 |
var iOSVersion = isiPad ? parseFloat(/CPU (?:iPhone |iPod )?OS (\d+)/.exec(navigator.userAgent)[1], 10) : 0;
|
384 |
jQuery(document).ready(function() { setTimeout( function() { fv_flowplayer_safety_resize(); }, 10 ); } );
|
385 |
}
|
386 |
|
387 |
+
|
388 |
+
|
389 |
+
|
390 |
+
// did autoplay?
|
391 |
+
var fv_player_did_autoplay = false;
|
392 |
+
|
393 |
+
|
394 |
+
|
395 |
+
|
396 |
jQuery(document).ready( function() {
|
397 |
+
|
398 |
jQuery('.fp-playlist-external' ).each( function(i,el) {
|
399 |
if( jQuery('a',el).length == 0 ) return;
|
400 |
jQuery('a',el).click( function(e) {
|
415 |
}, 300);
|
416 |
}
|
417 |
} );
|
418 |
+
|
419 |
+
|
420 |
} );
|
421 |
|
422 |
flowplayer( function(api,root) {
|
423 |
root = jQuery(root);
|
424 |
+
|
425 |
+
// failsafe is Flowplayer is loaded outside of fv_player_load()
|
426 |
+
var playlist = jQuery('.fp-playlist-external[rel='+root.attr('id')+']');
|
427 |
+
if( !api.conf.playlist && playlist.length && playlist.find('a[data-item]').length > 0 ) {
|
428 |
+
var items = [];
|
429 |
+
playlist.find('a[data-item]').each( function() {
|
430 |
+
items.push( JSON.parse(jQuery(this).attr('data-item')) );
|
431 |
+
});
|
432 |
+
api.conf.playlist = items;
|
433 |
+
api.conf.clip = items[0];
|
434 |
+
} else if( !api.conf.clip ){
|
435 |
+
api.conf.clip = JSON.parse(jQuery(root).attr('data-item'));
|
436 |
+
}
|
437 |
+
|
438 |
api.bind('load', function(e,api,video) {
|
439 |
//console.log('playlist mark',video.index);
|
440 |
setTimeout( function() {
|
474 |
})
|
475 |
}
|
476 |
|
477 |
+
// Playlist - old style
|
478 |
if( typeof(fv_flowplayer_playlists) != "undefined" ) {
|
479 |
for( var i in fv_flowplayer_playlists ) {
|
480 |
if( !fv_flowplayer_playlists.hasOwnProperty(i) ) continue;
|
481 |
jQuery('#'+i).flowplayer( { playlist: fv_flowplayer_playlists[i] });
|
482 |
}
|
483 |
+
}
|
484 |
+
|
485 |
+
fv_player_load();
|
486 |
+
|
487 |
} );
|
488 |
|
489 |
+
|
490 |
+
function fv_player_load() {
|
491 |
+
|
492 |
+
// Sinle videos - new style
|
493 |
+
jQuery('.flowplayer[data-item]' ).each( function(i,el) {
|
494 |
+
var root = jQuery(el);
|
495 |
+
var api = root.data('flowplayer');
|
496 |
+
if( api ) return;
|
497 |
+
|
498 |
+
root.flowplayer( { clip: JSON.parse(root.attr('data-item')) }); // todo: IE6-8
|
499 |
+
} );
|
500 |
+
|
501 |
+
// Playlist - new style
|
502 |
+
jQuery('.fp-playlist-external' ).each( function(i,el) {
|
503 |
+
var playlist = jQuery(el);
|
504 |
+
var player = jQuery( '#' + playlist.attr('rel'));
|
505 |
+
if( player.length ) {
|
506 |
+
var api = player.data('flowplayer');
|
507 |
+
if( api ) return;
|
508 |
+
var items = [];
|
509 |
+
|
510 |
+
if ( playlist.find('a[data-item]').length == 0 ) return; // respect old playlist script setup
|
511 |
+
|
512 |
+
playlist.find('a[data-item]').each( function() {
|
513 |
+
items.push( JSON.parse(jQuery(this).attr('data-item')) );
|
514 |
+
});
|
515 |
+
player.flowplayer( { playlist: items } );
|
516 |
+
}
|
517 |
+
} );
|
518 |
+
|
519 |
+
if( flowplayer.support.firstframe ) {
|
520 |
+
jQuery('.flowplayer[data-fvautoplay]').each( function() {
|
521 |
+
var root = jQuery(this);
|
522 |
+
var api = root.data('flowplayer');
|
523 |
+
if( !fv_player_did_autoplay && root.data('fvautoplay') ) {
|
524 |
+
fv_player_did_autoplay = true;
|
525 |
+
api.load();
|
526 |
+
}
|
527 |
+
});
|
528 |
+
}
|
529 |
+
|
530 |
+
}
|
531 |
+
|
532 |
+
|
533 |
+
jQuery(document).ajaxComplete( function() {
|
534 |
+
fv_player_load();
|
535 |
+
});
|
536 |
+
|
537 |
+
|
538 |
jQuery( function() {
|
539 |
jQuery('.flowplayer').each( function() {
|
540 |
flowplayer.bean.off(jQuery(this)[0],'contextmenu');
|
555 |
fv_flowplayer_browser_chrome_fail( i, fv_flowplayer_browser_chrome_fail_array[i]['attrs'], fv_flowplayer_browser_chrome_fail_array[i]['mp4'], fv_flowplayer_browser_chrome_fail_array[i]['auto_buffer'] );
|
556 |
}
|
557 |
}
|
|
|
|
|
|
|
|
|
|
|
558 |
|
559 |
if( typeof(fv_flowplayer_browser_ie_array) != "undefined" ) {
|
560 |
for( var i in fv_flowplayer_browser_ie_array ) {
|
692 |
if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length ) {
|
693 |
if( root.find('.wpfp_custom_popup').length > 0) {
|
694 |
root.find('.wpfp_custom_popup').show();
|
695 |
+
} else if( typeof(fv_flowplayer_popup) != "undefined" && typeof(fv_flowplayer_popup[player_id]) != "undefined" ) {
|
696 |
root.append( '<div id="'+player_id+'_custom_popup" class="wpfp_custom_popup">'+fv_flowplayer_popup[player_id].html+'</div>' );
|
697 |
}
|
698 |
}
|
1004 |
if( !root.data('fv-embed') ) return;
|
1005 |
|
1006 |
player.embedCode = function() {
|
1007 |
+
var video = player.video;
|
1008 |
+
var width = root.width();
|
1009 |
+
var height = root.height();
|
1010 |
+
if( video.width ) {
|
1011 |
+
width = video.width;
|
1012 |
+
height = width * root.height()/root.width();
|
1013 |
+
}
|
1014 |
height += 2;
|
1015 |
+
return '<iframe src="' + root.data('fv-embed') + '" allowfullscreen width="' + width + '" height="' + height + '" frameborder="0" style="max-width:100%"></iframe>';
|
1016 |
};
|
1017 |
|
1018 |
});
|
1146 |
if (typeof (flowplayer) !== "undefined" && typeof(fv_flowplayer_conf) != "undefined" && fv_flowplayer_conf.video_hash_links ) {
|
1147 |
flowplayer(function (api, root) {
|
1148 |
if( jQuery(root).find('.sharing-link').length > 0 ) {
|
1149 |
+
api.on('progress',function(e,api){
|
1150 |
+
if( !api.video.sources ) {
|
1151 |
+
return;
|
1152 |
+
}
|
1153 |
+
|
1154 |
var hash = fv_parse_sharelink(api.video.sources[0].src);
|
1155 |
var sTime = '?t=' + fv_player_time_hms(api.video.time);
|
1156 |
//console.log(sTime);
|
1396 |
});
|
1397 |
|
1398 |
|
1399 |
+
|
1400 |
+
|
1401 |
/* *
|
1402 |
* WARNINGS
|
1403 |
*/
|
1505 |
|
1506 |
jQuery('.fp-player',root).css('background-image', jQuery(root).css('background-image') );
|
1507 |
|
1508 |
+
api.on('error', function (e,api, error) {
|
1509 |
+
jQuery('.fp-message',root).html( jQuery('.fp-message',root).html().replace(/video/,'audio') );
|
1510 |
+
});
|
1511 |
}
|
|
|
|
|
1512 |
});
|
1513 |
|
1514 |
})
|
1525 |
if ( typeof(timeout) == 'string' ) {
|
1526 |
var player = jQuery(root).data('flowplayer');
|
1527 |
player.on(timeout, function() {
|
1528 |
+
notice.fadeOut(100,function() { jQuery(this).remove(); });
|
1529 |
} );
|
1530 |
}
|
1531 |
if ( timeout > 0 ) {
|
1532 |
setTimeout( function() {
|
1533 |
+
notice.fadeOut(2000,function() { jQuery(this).remove(); });
|
1534 |
}, timeout );
|
1535 |
}
|
1536 |
}
|
1559 |
if (!success) throw new Error('Unsuccessfull');
|
1560 |
}
|
1561 |
|
1562 |
+
|
1563 |
+
|
1564 |
+
|
1565 |
+
/*
|
1566 |
+
* Custom keyboard controls
|
1567 |
+
*/
|
1568 |
+
flowplayer.bean.off(document,'keydown.fp');
|
1569 |
+
|
1570 |
+
flowplayer(function(api, root) {
|
1571 |
+
var bean = flowplayer.bean;
|
1572 |
+
|
1573 |
+
// no keyboard configured
|
1574 |
+
if (!api.conf.keyboard) return;
|
1575 |
+
|
1576 |
+
var help = jQuery(root).find('.fp-help').html();
|
1577 |
+
var playlist_help = api.conf.playlist.length > 0 ? '<p><em>shift</em> + <em>n</em><em>p</em>next / prev video</p>' : '';
|
1578 |
+
help = help.replace(/<p><em>1.*?60% <\/p>/,playlist_help);
|
1579 |
+
jQuery(root).find('.fp-help').html(help);
|
1580 |
+
|
1581 |
+
// hover
|
1582 |
+
bean.on(root, "mouseenter mouseleave", function(e) {
|
1583 |
+
fv_player_focused = !api.disabled && e.type == 'mouseover' ? api : 0;
|
1584 |
+
if (fv_player_focused) fv_player_focusedRoot = root;
|
1585 |
+
});
|
1586 |
+
|
1587 |
+
api.bind('ready', function(e,api,video) {
|
1588 |
+
if( video.subtitles && video.subtitles.length > 0 ) {
|
1589 |
+
var help = jQuery(root).find('.fp-help').html();
|
1590 |
+
help += '<div class="fp-help-section fp-help-subtitles"><p><em>c</em>cycle through subtitles</p></div>';
|
1591 |
+
jQuery(root).find('.fp-help').html(help);
|
1592 |
+
} else {
|
1593 |
+
jQuery(root).find('.fp-help-subtitles').remove();
|
1594 |
+
}
|
1595 |
+
});
|
1596 |
+
});
|
1597 |
+
|
1598 |
+
flowplayer.bean.on(document, "keydown.fp", function(e) {
|
1599 |
+
if( typeof(fv_player_focused) == "undefined" ) return
|
1600 |
+
|
1601 |
+
var api = fv_player_focused,
|
1602 |
+
focusedRoot = api ? fv_player_focusedRoot : false,
|
1603 |
+
common = flowplayer.common;
|
1604 |
+
|
1605 |
+
var el = api && !api.disabled ? api : 0,
|
1606 |
+
metaKeyPressed = e.ctrlKey || e.metaKey || e.altKey,
|
1607 |
+
key = e.which,
|
1608 |
+
conf = el && el.conf;
|
1609 |
+
|
1610 |
+
|
1611 |
+
|
1612 |
+
if (!el || !conf.keyboard || el.disabled) return;
|
1613 |
+
|
1614 |
+
// help dialog (shift key not truly required)
|
1615 |
+
if ([63, 187, 191].indexOf(key) != -1) {
|
1616 |
+
common.toggleClass(focusedRoot, "is-help");
|
1617 |
+
return false;
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
// close help / unload
|
1621 |
+
if (key == 27 && common.hasClass(focusedRoot, "is-help")) {
|
1622 |
+
common.toggleClass(focusedRoot, "is-help");
|
1623 |
+
return false;
|
1624 |
+
}
|
1625 |
+
|
1626 |
+
if (!metaKeyPressed && el.ready) {
|
1627 |
+
|
1628 |
+
e.preventDefault();
|
1629 |
+
|
1630 |
+
// slow motion / fast forward
|
1631 |
+
if (e.shiftKey) {
|
1632 |
+
if (key == 39) el.speed(true);
|
1633 |
+
else if (key == 37) el.speed(false);
|
1634 |
+
else if (key == 78) el.next(); // N
|
1635 |
+
else if (key == 80) el.prev(); // P
|
1636 |
+
return;
|
1637 |
+
}
|
1638 |
+
|
1639 |
+
// 1, 2, 3, 4 ..
|
1640 |
+
if (key < 58 && key > 47) return el.seekTo(key - 48);
|
1641 |
+
|
1642 |
+
|
1643 |
+
|
1644 |
+
switch (key) {
|
1645 |
+
case 38: case 75: el.volume(el.volumeLevel + 0.15); break;
|
1646 |
+
case 40: case 74: el.volume(el.volumeLevel - 0.15); break;
|
1647 |
+
case 39: case 76: el.seeking = true; el.seek(api.video.time+5); break;
|
1648 |
+
case 37: case 72: el.seeking = true; el.seek(api.video.time-5); break;
|
1649 |
+
case 190: el.seekTo(); break;
|
1650 |
+
case 32: el.toggle(); break;
|
1651 |
+
case 70: if(conf.fullscreen) el.fullscreen(); break;
|
1652 |
+
case 77: el.mute(); break;
|
1653 |
+
case 81: el.unload(); break;
|
1654 |
+
case 67: // circle through subtitles
|
1655 |
+
if( !api.video.subtitles || api.video.subtitles.length == 0 ) break;
|
1656 |
+
|
1657 |
+
var current_subtitles = jQuery(focusedRoot).find('.fp-dropdown li.active[data-subtitle-index]').data('subtitle-index');
|
1658 |
+
if( typeof(current_subtitles) == "undefined" ) current_subtitles = -1;
|
1659 |
+
|
1660 |
+
current_subtitles++;
|
1661 |
+
if( current_subtitles > (api.video.subtitles.length - 1) ) {
|
1662 |
+
current_subtitles = -1;
|
1663 |
+
}
|
1664 |
+
|
1665 |
+
api.trigger('fv-subtitles-switched');
|
1666 |
+
|
1667 |
+
if( current_subtitles > -1 ) {
|
1668 |
+
el.loadSubtitles(current_subtitles);
|
1669 |
+
fv_player_notice(focusedRoot,fv_flowplayer_translations.subtitles_switched+' '+api.video.subtitles[current_subtitles].label,'fv-subtitles-switched');
|
1670 |
+
} else {
|
1671 |
+
el.disableSubtitles();
|
1672 |
+
fv_player_notice(focusedRoot,fv_flowplayer_translations.subtitles_disabled,'fv-subtitles-switched');
|
1673 |
+
}
|
1674 |
+
|
1675 |
+
break;
|
1676 |
+
}
|
1677 |
+
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
});
|
1681 |
+
|
1682 |
+
|
1683 |
+
|
1684 |
+
|
1685 |
+
if( flowplayer.conf.mobile_force_fullscreen && ( 'ontouchstart' in window ) && !flowplayer.support.firstframe ) {
|
1686 |
+
flowplayer(function(api, root) {
|
1687 |
+
if( /iPad/.test(navigator.userAgent) ) {
|
1688 |
+
api.bind('ready', function() {
|
1689 |
+
api.fullscreen();
|
1690 |
+
});
|
1691 |
+
} else if( /Android/.test(navigator.userAgent) ) {
|
1692 |
+
jQuery(root).on('click', function() {
|
1693 |
+
if( !api.ready ) api.fullscreen();
|
1694 |
+
});
|
1695 |
+
}
|
1696 |
+
});
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
|
1700 |
+
|
1701 |
+
|
1702 |
+
/*
|
1703 |
+
* MPEG-DASH - improving automated quality switching - ABR
|
1704 |
+
*/
|
1705 |
+
flowplayer( function(api,root) {
|
1706 |
+
root = jQuery(root);
|
1707 |
+
|
1708 |
+
var bitrates = [];
|
1709 |
+
|
1710 |
+
function dash_quality(api) {
|
1711 |
+
var mediaPlayer = api.engine.dash;
|
1712 |
+
mediaPlayer.retrieveManifest(mediaPlayer.getSource(), function(data) {
|
1713 |
+
bitrates = mediaPlayer.getTracksForTypeFromManifest( 'video', data, mediaPlayer.getStreamsFromManifest(data)[0] )[0].bitrateList;
|
1714 |
+
});
|
1715 |
+
}
|
1716 |
+
|
1717 |
+
api.bind('ready', function(e,api) {
|
1718 |
+
if(api.engine.engineName == 'dash' ) {
|
1719 |
+
api.engine.dash.setLimitBitrateByPortal(true);
|
1720 |
+
api.engine.dash.setUsePixelRatioInLimitBitrateByPortal(true);
|
1721 |
+
|
1722 |
+
//api.engine.dash.setQualityFor('video', 0);
|
1723 |
+
// api.engine.dash.getQualityFor('video');
|
1724 |
+
dash_quality(api);
|
1725 |
+
}
|
1726 |
+
});
|
1727 |
+
|
1728 |
+
if( document.location.search.match(/dash_debug/) ) {
|
1729 |
+
var debug_log = jQuery('<div class="fv-debug" style="background: gray; color: white; top: 10%; position: absolute; z-index: 1000">').appendTo(root.find('.fp-player'));
|
1730 |
+
api.bind('progress', function(e,api) {
|
1731 |
+
if(api.engine.engineName == 'dash' ) {
|
1732 |
+
var stream_info = bitrates[api.engine.dash.getQualityFor('video')];
|
1733 |
+
debug_log.html( "Using "+stream_info.width+"x"+stream_info.height+" at "+Math.round(stream_info.bandwidth/1024)+" kbps" );
|
1734 |
+
}
|
1735 |
+
})
|
1736 |
+
}
|
1737 |
+
|
1738 |
+
});
|
images/icon-256x256.png
CHANGED
Binary file
|
images/icon.png
CHANGED
Binary file
|
images/icon@x2.png
CHANGED
Binary file
|
js/lightbox.js
CHANGED
@@ -50,7 +50,8 @@ jQuery(document).ready(function(){
|
|
50 |
scrolling: false,
|
51 |
onLoad: fv_lightbox_flowplayer_shutdown,
|
52 |
onCleanup: fv_lightbox_flowplayer_shutdown,
|
53 |
-
title: function() { return fv_player_colorbox_title(this) }
|
|
|
54 |
} );
|
55 |
|
56 |
//Lightbox external sites href="example.com"
|
@@ -260,3 +261,61 @@ function fv_player_lightbox_width() {
|
|
260 |
var elFlowplayer = jQuery( jQuery(this).data('fv-lightbox') || jQuery(this).attr('href') );
|
261 |
return parseInt(elFlowplayer.css('max-width'));
|
262 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
scrolling: false,
|
51 |
onLoad: fv_lightbox_flowplayer_shutdown,
|
52 |
onCleanup: fv_lightbox_flowplayer_shutdown,
|
53 |
+
title: function() { return fv_player_colorbox_title(this) },
|
54 |
+
href: function() { return fv_player_colorbox_scrset(this) }
|
55 |
} );
|
56 |
|
57 |
//Lightbox external sites href="example.com"
|
261 |
var elFlowplayer = jQuery( jQuery(this).data('fv-lightbox') || jQuery(this).attr('href') );
|
262 |
return parseInt(elFlowplayer.css('max-width'));
|
263 |
}
|
264 |
+
|
265 |
+
/*
|
266 |
+
* https://github.com/albell/parse-srcset, 1.0.2
|
267 |
+
*/
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Srcset Parser
|
271 |
+
*
|
272 |
+
* By Alex Bell | MIT License
|
273 |
+
*
|
274 |
+
* JS Parser for the string value that appears in markup <img srcset="here">
|
275 |
+
*
|
276 |
+
* @returns Array [{url: _, d: _, w: _, h:_}, ...]
|
277 |
+
*
|
278 |
+
* Based super duper closely on the reference algorithm at:
|
279 |
+
* https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-srcset-attribute
|
280 |
+
*
|
281 |
+
* Most comments are copied in directly from the spec
|
282 |
+
* (except for comments in parens).
|
283 |
+
*/
|
284 |
+
if ( typeof(parseSrcset) == "undefined") {
|
285 |
+
|
286 |
+
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof module&&module.exports?module.exports=b():a.parseSrcset=b()}(this,function(){return function(a){function b(a){return" "===a||"\t"===a||"\n"===a||"\f"===a||"\r"===a}function c(b){var c,d=b.exec(a.substring(p));if(d)return c=d[0],p+=c.length,c}function r(){for(c(e),m="",n="in descriptor";;){if(o=a.charAt(p),"in descriptor"===n)if(b(o))m&&(l.push(m),m="",n="after descriptor");else{if(","===o)return p+=1,m&&l.push(m),void s();if("("===o)m+=o,n="in parens";else{if(""===o)return m&&l.push(m),void s();m+=o}}else if("in parens"===n)if(")"===o)m+=o,n="in descriptor";else{if(""===o)return l.push(m),void s();m+=o}else if("after descriptor"===n)if(b(o));else{if(""===o)return void s();n="in descriptor",p-=1}p+=1}}function s(){var c,d,e,f,h,m,n,o,p,b=!1,g={};for(f=0;f<l.length;f++)h=l[f],m=h[h.length-1],n=h.substring(0,h.length-1),o=parseInt(n,10),p=parseFloat(n),i.test(n)&&"w"===m?((c||d)&&(b=!0),0===o?b=!0:c=o):j.test(n)&&"x"===m?((c||d||e)&&(b=!0),p<0?b=!0:d=p):i.test(n)&&"h"===m?((e||d)&&(b=!0),0===o?b=!0:e=o):b=!0;b?console&&console.log&&console.log("Invalid srcset descriptor found in '"+a+"' at '"+h+"'."):(g.url=k,c&&(g.w=c),d&&(g.d=d),e&&(g.h=e),q.push(g))}for(var k,l,m,n,o,d=a.length,e=/^[ \t\n\r\u000c]+/,f=/^[, \t\n\r\u000c]+/,g=/^[^ \t\n\r\u000c]+/,h=/[,]+$/,i=/^\d+$/,j=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,p=0,q=[];;){if(c(f),p>=d)return q;k=c(g),l=[],","===k.slice(-1)?(k=k.replace(h,""),s()):r()}}});
|
287 |
+
|
288 |
+
}
|
289 |
+
|
290 |
+
function fv_player_colorbox_scrset(args) {
|
291 |
+
var src = jQuery(args).attr('href');
|
292 |
+
if( src.match(/\.(png|jpg|jpeg|gif)/i) ){
|
293 |
+
var aSources = false;
|
294 |
+
var srcset = jQuery(args).find('img[srcset]');
|
295 |
+
if ( srcset.length > 0 ) {
|
296 |
+
aSources = parseSrcset(srcset.attr('srcset'));
|
297 |
+
} else {
|
298 |
+
srcset = jQuery(args).find('img[data-lazy-srcset]');
|
299 |
+
if ( srcset.length > 0 ) {
|
300 |
+
aSources = parseSrcset(srcset.attr('data-lazy-srcset'));
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
if( aSources ) {
|
305 |
+
var find = jQuery(window).width() > jQuery(window).height() ? jQuery(window).width() : jQuery(window).height();
|
306 |
+
var ratio = typeof(window.devicePixelRatio) != "undefined" ? window.devicePixelRatio : 1;
|
307 |
+
find = find * ratio;
|
308 |
+
var win = -1;
|
309 |
+
|
310 |
+
jQuery(aSources).each( function(k,v) {
|
311 |
+
if( win == -1 || Math.abs(v.w - find) < Math.abs(aSources[win].w - find) ){
|
312 |
+
win = k;
|
313 |
+
}
|
314 |
+
});
|
315 |
+
|
316 |
+
src = aSources[win].url;
|
317 |
+
}
|
318 |
+
|
319 |
+
}
|
320 |
+
return src;
|
321 |
+
}
|
js/shortcode-editor.js
CHANGED
@@ -104,12 +104,12 @@ jQuery(document).ready(function($){
|
|
104 |
|
105 |
|
106 |
/*
|
107 |
-
* temporary untill we fix subs for playlist
|
108 |
*/
|
109 |
if(new_index > 1){
|
110 |
-
$('
|
111 |
}else{
|
112 |
-
$('
|
113 |
}
|
114 |
|
115 |
fv_player_refresh_tabs();
|
@@ -220,6 +220,7 @@ jQuery(document).ready(function($){
|
|
220 |
});
|
221 |
|
222 |
fv_flowplayer_uploader.on('open', function() {
|
|
|
223 |
jQuery('.media-frame-title h1').text(fv_flowplayer_uploader_button.text());
|
224 |
});
|
225 |
|
@@ -477,7 +478,7 @@ function fv_wp_flowplayer_playlist_remove(link) {
|
|
477 |
* Adds playlist item
|
478 |
* keywords: add playlist item
|
479 |
*/
|
480 |
-
function fv_flowplayer_playlist_add( sInput, sCaption ) {
|
481 |
jQuery('.fv-player-tab-playlist table tbody').append(fv_player_playlist_item_template);
|
482 |
var ids = jQuery('.fv-player-tab-playlist [data-index]').map(function() {
|
483 |
return parseInt(jQuery(this).attr('data-index'), 10);
|
@@ -489,7 +490,12 @@ function fv_flowplayer_playlist_add( sInput, sCaption ) {
|
|
489 |
|
490 |
jQuery('.fv-player-tab-video-files').append(fv_player_playlist_video_template);
|
491 |
var new_item = jQuery('.fv-player-tab-video-files table:last');
|
492 |
-
new_item.hide();
|
|
|
|
|
|
|
|
|
|
|
493 |
//jQuery('.fv-player-tab-video-files table').hover( function() { jQuery(this).find('.fv_wp_flowplayer_playlist_remove').show(); }, function() { jQuery(this).find('.fv_wp_flowplayer_playlist_remove').hide(); } );
|
494 |
|
495 |
if( sInput ) {
|
@@ -510,16 +516,11 @@ function fv_flowplayer_playlist_add( sInput, sCaption ) {
|
|
510 |
if( sCaption ) {
|
511 |
jQuery('[name=fv_wp_flowplayer_field_caption]',new_item).val(sCaption);
|
512 |
}
|
|
|
|
|
|
|
513 |
}
|
514 |
|
515 |
-
/*
|
516 |
-
* temporary untill we fix subs for playlist
|
517 |
-
jQuery('.fv-player-tab-subtitles').append(fv_player_playlist_subtitles_box_template);
|
518 |
-
jQuery('.fv-player-tab-subtitles table:last').hide();
|
519 |
-
jQuery('.fv-player-tab-subtitles table:last').attr('data-index', newIndex);*/
|
520 |
-
|
521 |
-
jQuery('.fv-player-tab-video-files table:last').attr('data-index', newIndex);
|
522 |
-
|
523 |
fv_wp_flowplayer_dialog_resize();
|
524 |
return false;
|
525 |
}
|
@@ -734,11 +735,11 @@ function fv_wp_flowplayer_edit() {
|
|
734 |
var splaylist_advance = fv_wp_flowplayer_shortcode_parse_arg( shortcode, 'playlist_advance' );
|
735 |
|
736 |
var ssubtitles = fv_wp_flowplayer_shortcode_parse_arg( shortcode, 'subtitles' );
|
737 |
-
var
|
738 |
-
for( var i in
|
739 |
-
fv_wp_flowplayer_shortcode_parse_arg( shortcode,
|
740 |
}
|
741 |
-
if(!
|
742 |
fv_flowplayer_language_add(false, false );
|
743 |
}
|
744 |
|
@@ -815,8 +816,12 @@ function fv_wp_flowplayer_edit() {
|
|
815 |
playlist_row.find('.fvp_item_splash').html( '<img width="120" src="'+ssplash[1]+'" />' );
|
816 |
}
|
817 |
|
818 |
-
|
819 |
-
|
|
|
|
|
|
|
|
|
820 |
|
821 |
if( sad != null && sad[1] != null ) {
|
822 |
sad = sad[1].replace(/'/g,'\'').replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>');
|
@@ -914,15 +919,10 @@ function fv_wp_flowplayer_edit() {
|
|
914 |
}
|
915 |
|
916 |
if( sPlaylist ) {
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
} else {
|
922 |
-
fv_flowplayer_playlist_add( aPlaylist[i] );
|
923 |
-
}
|
924 |
-
}
|
925 |
-
|
926 |
}
|
927 |
|
928 |
|
@@ -1104,8 +1104,7 @@ function fv_wp_flowplayer_submit( preview ) {
|
|
1104 |
|
1105 |
jQuery('.fv_wp_flowplayer_field_subtitles').each( function() {
|
1106 |
var lang = jQuery(this).siblings('.fv_wp_flowplayer_field_subtitles_lang').val();
|
1107 |
-
|
1108 |
-
fv_wp_flowplayer_shortcode_write_arg( jQuery(this)[0], field );
|
1109 |
});
|
1110 |
|
1111 |
fv_wp_flowplayer_shortcode_write_arg('fv_wp_flowplayer_field_ad','ad','html');
|
@@ -1118,9 +1117,12 @@ function fv_wp_flowplayer_submit( preview ) {
|
|
1118 |
if( fv_player_preview_single == -1 && jQuery('.fv-player-tab-video-files table').length > 0 ) {
|
1119 |
var aPlaylistItems = new Array();
|
1120 |
var aPlaylistCaptions = new Array();
|
1121 |
-
|
|
|
1122 |
aPlaylistCaptions.push(jQuery('[name=fv_wp_flowplayer_field_caption]',this).attr('value').trim().replace(/\;/gi,'\\;').replace(/"/gi,'&quot;') );
|
1123 |
|
|
|
|
|
1124 |
if( i == 0 ) return;
|
1125 |
var aPlaylistItem = new Array();
|
1126 |
jQuery(this).find('input').each( function() {
|
@@ -1140,6 +1142,7 @@ function fv_wp_flowplayer_submit( preview ) {
|
|
1140 |
);
|
1141 |
var sPlaylistItems = aPlaylistItems.join(';');
|
1142 |
var sPlaylistCaptions = aPlaylistCaptions.join(';');
|
|
|
1143 |
if( sPlaylistItems.length > 0 ) {
|
1144 |
fv_wp_fp_shortcode += ' playlist="'+sPlaylistItems+'"';
|
1145 |
}
|
@@ -1152,7 +1155,11 @@ function fv_wp_flowplayer_submit( preview ) {
|
|
1152 |
}
|
1153 |
if( bPlaylistCaptionExists && sPlaylistCaptions.length > 0 ) {
|
1154 |
fv_wp_fp_shortcode += ' caption="'+sPlaylistCaptions+'"';
|
1155 |
-
}
|
|
|
|
|
|
|
|
|
1156 |
}
|
1157 |
|
1158 |
jQuery(document).trigger('fv_flowplayer_shortcode_create');
|
104 |
|
105 |
|
106 |
/*
|
107 |
+
* temporary untill we fix multilang subs for playlist
|
108 |
*/
|
109 |
if(new_index > 1){
|
110 |
+
$('.fv_wp_flowplayer_field_subtitles_lang, .fv_flowplayer_language_add_link').hide();
|
111 |
}else{
|
112 |
+
$('.fv_wp_flowplayer_field_subtitles_lang, .fv_flowplayer_language_add_link').attr('style',false);
|
113 |
}
|
114 |
|
115 |
fv_player_refresh_tabs();
|
220 |
});
|
221 |
|
222 |
fv_flowplayer_uploader.on('open', function() {
|
223 |
+
jQuery('.media-router .media-menu-item').eq(0).click();
|
224 |
jQuery('.media-frame-title h1').text(fv_flowplayer_uploader_button.text());
|
225 |
});
|
226 |
|
478 |
* Adds playlist item
|
479 |
* keywords: add playlist item
|
480 |
*/
|
481 |
+
function fv_flowplayer_playlist_add( sInput, sCaption, sSubtitles ) {
|
482 |
jQuery('.fv-player-tab-playlist table tbody').append(fv_player_playlist_item_template);
|
483 |
var ids = jQuery('.fv-player-tab-playlist [data-index]').map(function() {
|
484 |
return parseInt(jQuery(this).attr('data-index'), 10);
|
490 |
|
491 |
jQuery('.fv-player-tab-video-files').append(fv_player_playlist_video_template);
|
492 |
var new_item = jQuery('.fv-player-tab-video-files table:last');
|
493 |
+
new_item.hide().attr('data-index', newIndex);
|
494 |
+
|
495 |
+
jQuery('.fv-player-tab-subtitles').append(fv_player_playlist_subtitles_box_template);
|
496 |
+
var new_item_subtitles = jQuery('.fv-player-tab-subtitles table:last');
|
497 |
+
new_item_subtitles.hide().attr('data-index', newIndex);
|
498 |
+
|
499 |
//jQuery('.fv-player-tab-video-files table').hover( function() { jQuery(this).find('.fv_wp_flowplayer_playlist_remove').show(); }, function() { jQuery(this).find('.fv_wp_flowplayer_playlist_remove').hide(); } );
|
500 |
|
501 |
if( sInput ) {
|
516 |
if( sCaption ) {
|
517 |
jQuery('[name=fv_wp_flowplayer_field_caption]',new_item).val(sCaption);
|
518 |
}
|
519 |
+
if( sSubtitles ) {
|
520 |
+
jQuery('[name=fv_wp_flowplayer_field_subtitles]',new_item_subtitles).val(sSubtitles);
|
521 |
+
}
|
522 |
}
|
523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
fv_wp_flowplayer_dialog_resize();
|
525 |
return false;
|
526 |
}
|
735 |
var splaylist_advance = fv_wp_flowplayer_shortcode_parse_arg( shortcode, 'playlist_advance' );
|
736 |
|
737 |
var ssubtitles = fv_wp_flowplayer_shortcode_parse_arg( shortcode, 'subtitles' );
|
738 |
+
var aSubtitlesLangs = shortcode.match(/subtitles_[a-z][a-z]+/g);
|
739 |
+
for( var i in aSubtitlesLangs ){ // move
|
740 |
+
fv_wp_flowplayer_shortcode_parse_arg( shortcode, aSubtitlesLangs[i], false, fv_wp_flowplayer_subtitle_parse_arg );
|
741 |
}
|
742 |
+
if(!aSubtitlesLangs){ // move
|
743 |
fv_flowplayer_language_add(false, false );
|
744 |
}
|
745 |
|
816 |
playlist_row.find('.fvp_item_splash').html( '<img width="120" src="'+ssplash[1]+'" />' );
|
817 |
}
|
818 |
|
819 |
+
var aSubtitles = false;
|
820 |
+
if( ssubtitles != null && ssubtitles[1] != null ) {
|
821 |
+
aSubtitles = ssubtitles[1].split(';');
|
822 |
+
jQuery(".fv_wp_flowplayer_field_subtitles").eq(0).val( aSubtitles[0] );
|
823 |
+
aSubtitles.shift(); // the first item is no longer needed for playlist parsing which will follow
|
824 |
+
}
|
825 |
|
826 |
if( sad != null && sad[1] != null ) {
|
827 |
sad = sad[1].replace(/'/g,'\'').replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>');
|
919 |
}
|
920 |
|
921 |
if( sPlaylist ) {
|
922 |
+
aPlaylist = sPlaylist[1].split(';');
|
923 |
+
for( var i in aPlaylist ) {
|
924 |
+
fv_flowplayer_playlist_add( aPlaylist[i], aCaptions[i], aSubtitles[i] );
|
925 |
+
}
|
|
|
|
|
|
|
|
|
|
|
926 |
}
|
927 |
|
928 |
|
1104 |
|
1105 |
jQuery('.fv_wp_flowplayer_field_subtitles').each( function() {
|
1106 |
var lang = jQuery(this).siblings('.fv_wp_flowplayer_field_subtitles_lang').val();
|
1107 |
+
if( lang ) fv_wp_flowplayer_shortcode_write_arg( jQuery(this)[0], 'subtitles_' + lang ); // non language specific subtitles are handled on playlist level. what?
|
|
|
1108 |
});
|
1109 |
|
1110 |
fv_wp_flowplayer_shortcode_write_arg('fv_wp_flowplayer_field_ad','ad','html');
|
1117 |
if( fv_player_preview_single == -1 && jQuery('.fv-player-tab-video-files table').length > 0 ) {
|
1118 |
var aPlaylistItems = new Array();
|
1119 |
var aPlaylistCaptions = new Array();
|
1120 |
+
var aPlaylistSubtitles = new Array();
|
1121 |
+
jQuery('.fv-player-tab-video-files table').each(function(i,e) {
|
1122 |
aPlaylistCaptions.push(jQuery('[name=fv_wp_flowplayer_field_caption]',this).attr('value').trim().replace(/\;/gi,'\\;').replace(/"/gi,'&quot;') );
|
1123 |
|
1124 |
+
aPlaylistSubtitles.push(jQuery('[name=fv_wp_flowplayer_field_subtitles]', jQuery('.fv-player-tab-subtitles table').eq(i)).attr('value').trim().replace(/\;/gi,'\\;').replace(/"/gi,'&quot;') );
|
1125 |
+
|
1126 |
if( i == 0 ) return;
|
1127 |
var aPlaylistItem = new Array();
|
1128 |
jQuery(this).find('input').each( function() {
|
1142 |
);
|
1143 |
var sPlaylistItems = aPlaylistItems.join(';');
|
1144 |
var sPlaylistCaptions = aPlaylistCaptions.join(';');
|
1145 |
+
var sPlaylistSubtitles = aPlaylistSubtitles.join(';');
|
1146 |
if( sPlaylistItems.length > 0 ) {
|
1147 |
fv_wp_fp_shortcode += ' playlist="'+sPlaylistItems+'"';
|
1148 |
}
|
1155 |
}
|
1156 |
if( bPlaylistCaptionExists && sPlaylistCaptions.length > 0 ) {
|
1157 |
fv_wp_fp_shortcode += ' caption="'+sPlaylistCaptions+'"';
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
if( sPlaylistSubtitles.replace(/[; ]/g,'').length > 0 && sPlaylistSubtitles.length > 0 ) {
|
1161 |
+
fv_wp_fp_shortcode += ' subtitles="'+sPlaylistSubtitles+'"';
|
1162 |
+
}
|
1163 |
}
|
1164 |
|
1165 |
jQuery(document).trigger('fv_flowplayer_shortcode_create');
|
models/flowplayer-frontend.php
CHANGED
@@ -26,8 +26,6 @@ class flowplayer_frontend extends flowplayer
|
|
26 |
|
27 |
var $autobuffer_count = 0;
|
28 |
|
29 |
-
var $autoplay_count = 0;
|
30 |
-
|
31 |
var $expire_time = 0;
|
32 |
|
33 |
var $aAds = array();
|
@@ -62,6 +60,8 @@ class flowplayer_frontend extends flowplayer
|
|
62 |
$vimeo = false;
|
63 |
$scripts_after = '';
|
64 |
|
|
|
|
|
65 |
// returned array with new player's html and javascript content
|
66 |
if( !isset($GLOBALS['fv_fp_scripts']) ) {
|
67 |
$GLOBALS['fv_fp_scripts'] = array();
|
@@ -146,14 +146,19 @@ class flowplayer_frontend extends flowplayer
|
|
146 |
}
|
147 |
|
148 |
|
149 |
-
$aPlaylistItems = array();
|
150 |
$aSplashScreens = array();
|
151 |
$aCaptions = array();
|
152 |
-
if(apply_filters('fv_flowplayer_playlist_items',array(),$this) || isset($this->aCurArgs['playlist']) && strlen(trim($this->aCurArgs['playlist'])) > 0 ) {
|
153 |
|
154 |
list( $playlist_items_external_html, $aPlaylistItems, $aSplashScreens, $aCaptions ) = $this->build_playlist( $this->aCurArgs, $media, $src1, $src2, $rtmp, $splash_img );
|
155 |
}
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
157 |
$this->aCurArgs = apply_filters( 'fv_flowplayer_args', $this->aCurArgs, $this->hash, $media, $aPlaylistItems );
|
158 |
|
159 |
|
@@ -175,19 +180,18 @@ class flowplayer_frontend extends flowplayer
|
|
175 |
|
176 |
if( $player_type == 'video' && $this->aCurArgs['liststyle'] == 'tabs' && count($aPlaylistItems) > 1 ) {
|
177 |
return $this->get_tabs($aPlaylistItems,$aSplashScreens,$aCaptions);
|
178 |
-
}
|
|
|
179 |
|
|
|
|
|
|
|
180 |
$autoplay = false; // todo: should be changed into a property
|
181 |
-
if( $this->
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
}
|
187 |
-
if( isset($this->aCurArgs['autoplay']) && $this->aCurArgs['autoplay'] == 'true') {
|
188 |
-
$this->autoplay_count++;
|
189 |
-
$autoplay = true;
|
190 |
-
}
|
191 |
}
|
192 |
|
193 |
|
@@ -272,10 +276,6 @@ class flowplayer_frontend extends flowplayer
|
|
272 |
if( !$this->_get_option('engine') && stripos( $media_item, '.m4v' ) !== false ) {
|
273 |
$this->ret['script']['fv_flowplayer_browser_ff_m4v'][$this->hash] = true;
|
274 |
}
|
275 |
-
|
276 |
-
if( !$this->_get_option('engine') && preg_match( '~\.(mp4|m4v|mov)~', $media_item ) > 0 ) {
|
277 |
-
$this->ret['script']['fv_flowplayer_browser_chrome_mp4'][$this->hash] = true;
|
278 |
-
}
|
279 |
|
280 |
}
|
281 |
|
@@ -301,12 +301,12 @@ class flowplayer_frontend extends flowplayer
|
|
301 |
|
302 |
|
303 |
|
304 |
-
$attributes = array();
|
305 |
-
$attributes['class'] = 'flowplayer no-brand';
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
|
|
|
|
310 |
|
311 |
if( isset($this->aCurArgs['playlist_hide']) && strcmp($this->aCurArgs['playlist_hide'],'true') == 0 ) {
|
312 |
$attributes['class'] .= ' playlist-hidden';
|
@@ -412,20 +412,24 @@ class flowplayer_frontend extends flowplayer
|
|
412 |
$playlist = '';
|
413 |
$is_preroll = false;
|
414 |
if( isset($playlist_items_external_html) ) {
|
415 |
-
if( $args['liststyle']
|
416 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
}
|
418 |
-
$this->aPlaylists["wpfp_{$this->hash}"] = $aPlaylistItems;
|
419 |
|
420 |
if( !empty($splash_img) ) {
|
421 |
$attributes['style'] .= "background-image: url({$splash_img});";
|
422 |
}
|
423 |
|
424 |
-
if( $autoplay ) {
|
425 |
-
$this->ret['script']['fv_flowplayer_autoplay'][$this->hash] = true; // todo: any better way?
|
426 |
-
$attributes['class'] .= ' is-splash';
|
427 |
-
}
|
428 |
-
|
429 |
} else if( !empty($this->aCurArgs['caption']) ) {
|
430 |
$attributes['class'] .= ' has-caption';
|
431 |
$this->sHTMLAfter = apply_filters( 'fv_player_caption', "<p class='fp-caption'>".$this->aCurArgs['caption']."</p>", $this );
|
@@ -460,7 +464,11 @@ class flowplayer_frontend extends flowplayer
|
|
460 |
$attributes_html = '';
|
461 |
$attributes = apply_filters( 'fv_flowplayer_attributes', $attributes, $media, $this );
|
462 |
foreach( $attributes AS $attr_key => $attr_value ) {
|
463 |
-
|
|
|
|
|
|
|
|
|
464 |
}
|
465 |
|
466 |
$this->ret['html'] .= '<div id="wpfp_' . $this->hash . '"'.$attributes_html.'>'."\n";
|
@@ -468,23 +476,10 @@ class flowplayer_frontend extends flowplayer
|
|
468 |
$this->ret['html'] .= "\t".'<div class="fp-ratio" style="padding-top: '.str_replace(',','.',$this->fRatio * 100).'%"></div>'."\n";
|
469 |
|
470 |
if( count($aPlaylistItems) == 0 ) { // todo: this stops subtitles, mobile video, preload etc.
|
471 |
-
$this->ret['html'] .= "\t".'<video';
|
472 |
-
$this->ret['html'] .= ' class="fp-engine"';
|
473 |
if (isset($splash_img) && !empty($splash_img)) {
|
474 |
$this->ret['html'] .= ' poster="'.flowplayer::get_encoded_url($splash_img).'"';
|
475 |
}
|
476 |
-
if( $autoplay == true ) {
|
477 |
-
$this->ret['script']['fv_flowplayer_autoplay'][$this->hash] = true;
|
478 |
-
$this->ret['html'] .= ' autoplay="autoplay"';
|
479 |
-
}
|
480 |
-
|
481 |
-
if( $this->_get_option('auto_bufferingDISABLED') && $this->autobuffer_count < apply_filters( 'fv_flowplayer_autobuffer_limit', 2 )) {
|
482 |
-
$this->ret['html'] .= ' preload="preload"';
|
483 |
-
//$this->ret['html'] .= ' id="wpfp_'.$this->hash.'_video"';
|
484 |
-
} else if ($autoplay == false) {
|
485 |
-
$this->ret['html'] .= ' preload="none"';
|
486 |
-
}
|
487 |
-
|
488 |
|
489 |
$this->ret['html'] .= ">\n";
|
490 |
|
@@ -898,40 +893,44 @@ class flowplayer_frontend extends flowplayer
|
|
898 |
}
|
899 |
|
900 |
|
901 |
-
function get_subtitles() {
|
902 |
$aSubtitles = array();
|
903 |
-
foreach( $this->aCurArgs AS $key => $subtitles ) {
|
904 |
-
if( stripos($key,'subtitles') !== 0 || empty($subtitles) ) {
|
905 |
-
continue;
|
906 |
-
}
|
907 |
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
|
|
912 |
}
|
913 |
|
914 |
-
$
|
915 |
-
if((
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
if(
|
920 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
921 |
}
|
922 |
else {
|
923 |
-
|
924 |
-
$subtitles = str_replace('//','/',$_SERVER['SERVER_NAME'].'/'.$subtitles);
|
925 |
-
$subtitles = $protocol.'://'.$subtitles;
|
926 |
}
|
927 |
|
|
|
|
|
928 |
}
|
929 |
-
else {
|
930 |
-
$subtitles = trim($subtitles);
|
931 |
-
}
|
932 |
-
|
933 |
-
$aSubtitles[str_replace( 'subtitles_', '', $key )] = $subtitles;
|
934 |
-
|
935 |
}
|
936 |
|
937 |
return $aSubtitles;
|
@@ -1040,6 +1039,8 @@ class flowplayer_frontend extends flowplayer
|
|
1040 |
|
1041 |
if( isset($post) && isset($post->ID) ) {
|
1042 |
$sHTMLVideoLink = $bVideoLink ? '<div><a class="sharing-link" href="' . $sLink . '" target="_blank">Link</a></div>' : '';
|
|
|
|
|
1043 |
}
|
1044 |
|
1045 |
if( $this->aCurArgs['embed'] == 'false' ) {
|
26 |
|
27 |
var $autobuffer_count = 0;
|
28 |
|
|
|
|
|
29 |
var $expire_time = 0;
|
30 |
|
31 |
var $aAds = array();
|
60 |
$vimeo = false;
|
61 |
$scripts_after = '';
|
62 |
|
63 |
+
$attributes = array();
|
64 |
+
|
65 |
// returned array with new player's html and javascript content
|
66 |
if( !isset($GLOBALS['fv_fp_scripts']) ) {
|
67 |
$GLOBALS['fv_fp_scripts'] = array();
|
146 |
}
|
147 |
|
148 |
|
149 |
+
$aPlaylistItems = array(); // todo: remove
|
150 |
$aSplashScreens = array();
|
151 |
$aCaptions = array();
|
152 |
+
if( !$this->_get_option('old_code') || apply_filters('fv_flowplayer_playlist_items',array(),$this) || isset($this->aCurArgs['playlist']) && strlen(trim($this->aCurArgs['playlist'])) > 0 ) {
|
153 |
|
154 |
list( $playlist_items_external_html, $aPlaylistItems, $aSplashScreens, $aCaptions ) = $this->build_playlist( $this->aCurArgs, $media, $src1, $src2, $rtmp, $splash_img );
|
155 |
}
|
156 |
+
|
157 |
+
if( !$this->_get_option('old_code') && count($aPlaylistItems) == 1 ) {
|
158 |
+
$playlist_items_external_html = false;
|
159 |
+
$attributes['data-item'] = json_encode( apply_filters( 'fv_player_item', $aPlaylistItems[0], 0, $this->aCurArgs ) );
|
160 |
+
}
|
161 |
+
|
162 |
$this->aCurArgs = apply_filters( 'fv_flowplayer_args', $this->aCurArgs, $this->hash, $media, $aPlaylistItems );
|
163 |
|
164 |
|
180 |
|
181 |
if( $player_type == 'video' && $this->aCurArgs['liststyle'] == 'tabs' && count($aPlaylistItems) > 1 ) {
|
182 |
return $this->get_tabs($aPlaylistItems,$aSplashScreens,$aCaptions);
|
183 |
+
}
|
184 |
+
|
185 |
|
186 |
+
/*
|
187 |
+
* Autoplay
|
188 |
+
*/
|
189 |
$autoplay = false; // todo: should be changed into a property
|
190 |
+
if( $this->_get_option('autoplay') && $this->aCurArgs['autoplay'] != 'false' ) {
|
191 |
+
$autoplay = true;
|
192 |
+
}
|
193 |
+
if( isset($this->aCurArgs['autoplay']) && $this->aCurArgs['autoplay'] == 'true') {
|
194 |
+
$autoplay = true;
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
|
197 |
|
276 |
if( !$this->_get_option('engine') && stripos( $media_item, '.m4v' ) !== false ) {
|
277 |
$this->ret['script']['fv_flowplayer_browser_ff_m4v'][$this->hash] = true;
|
278 |
}
|
|
|
|
|
|
|
|
|
279 |
|
280 |
}
|
281 |
|
301 |
|
302 |
|
303 |
|
|
|
|
|
304 |
|
305 |
+
$attributes['class'] = 'flowplayer no-brand is-splash';
|
306 |
+
|
307 |
+
if( $autoplay ) {
|
308 |
+
$attributes['data-fvautoplay'] = 'true';
|
309 |
+
}
|
310 |
|
311 |
if( isset($this->aCurArgs['playlist_hide']) && strcmp($this->aCurArgs['playlist_hide'],'true') == 0 ) {
|
312 |
$attributes['class'] .= ' playlist-hidden';
|
412 |
$playlist = '';
|
413 |
$is_preroll = false;
|
414 |
if( isset($playlist_items_external_html) ) {
|
415 |
+
if( $args['liststyle'] == 'prevnext' || ( isset($this->aCurArgs['playlist_hide']) && $this->aCurArgs['playlist_hide']== 'true' ) ) {
|
416 |
+
$playlist_items_external_html = str_replace( 'class="fp-playlist-external', 'style="display: none" class="fp-playlist-external', $playlist_items_external_html );
|
417 |
+
}
|
418 |
+
|
419 |
+
if( count($aPlaylistItems) == 1 && !empty($this->aCurArgs['caption']) ) {
|
420 |
+
$attributes['class'] .= ' has-caption';
|
421 |
+
$this->sHTMLAfter .= apply_filters( 'fv_player_caption', "<p class='fp-caption'>".$this->aCurArgs['caption']."</p>", $this );
|
422 |
+
}
|
423 |
+
$this->sHTMLAfter .= $playlist_items_external_html;
|
424 |
+
|
425 |
+
if( $this->_get_option('old_code') ) {
|
426 |
+
$this->aPlaylists["wpfp_{$this->hash}"] = $aPlaylistItems;
|
427 |
}
|
|
|
428 |
|
429 |
if( !empty($splash_img) ) {
|
430 |
$attributes['style'] .= "background-image: url({$splash_img});";
|
431 |
}
|
432 |
|
|
|
|
|
|
|
|
|
|
|
433 |
} else if( !empty($this->aCurArgs['caption']) ) {
|
434 |
$attributes['class'] .= ' has-caption';
|
435 |
$this->sHTMLAfter = apply_filters( 'fv_player_caption', "<p class='fp-caption'>".$this->aCurArgs['caption']."</p>", $this );
|
464 |
$attributes_html = '';
|
465 |
$attributes = apply_filters( 'fv_flowplayer_attributes', $attributes, $media, $this );
|
466 |
foreach( $attributes AS $attr_key => $attr_value ) {
|
467 |
+
if( $attr_key == 'data-item' ) {
|
468 |
+
$attributes_html .= ' '.$attr_key.'=\''.$attr_value.'\'';
|
469 |
+
} else {
|
470 |
+
$attributes_html .= ' '.$attr_key.'="'.esc_attr( $attr_value ).'"';
|
471 |
+
}
|
472 |
}
|
473 |
|
474 |
$this->ret['html'] .= '<div id="wpfp_' . $this->hash . '"'.$attributes_html.'>'."\n";
|
476 |
$this->ret['html'] .= "\t".'<div class="fp-ratio" style="padding-top: '.str_replace(',','.',$this->fRatio * 100).'%"></div>'."\n";
|
477 |
|
478 |
if( count($aPlaylistItems) == 0 ) { // todo: this stops subtitles, mobile video, preload etc.
|
479 |
+
$this->ret['html'] .= "\t".'<video class="fp-engine" preload="none"';
|
|
|
480 |
if (isset($splash_img) && !empty($splash_img)) {
|
481 |
$this->ret['html'] .= ' poster="'.flowplayer::get_encoded_url($splash_img).'"';
|
482 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
|
484 |
$this->ret['html'] .= ">\n";
|
485 |
|
893 |
}
|
894 |
|
895 |
|
896 |
+
function get_subtitles($index = 0) {
|
897 |
$aSubtitles = array();
|
|
|
|
|
|
|
|
|
898 |
|
899 |
+
if( $this->aCurArgs && count($this->aCurArgs) > 0 ) {
|
900 |
+
$protocol = is_ssl() ? 'https' : 'http';
|
901 |
+
foreach( $this->aCurArgs AS $key => $subtitles ) {
|
902 |
+
if( stripos($key,'subtitles') !== 0 || empty($subtitles) ) {
|
903 |
+
continue;
|
904 |
}
|
905 |
|
906 |
+
$subtitles = explode( ";",$subtitles);
|
907 |
+
if( empty($subtitles[$index]) ) return $aSubtitles;
|
908 |
+
|
909 |
+
$subtitles = $subtitles[$index];
|
910 |
+
|
911 |
+
if( strpos($subtitles,'http://') === false && strpos($subtitles,'https://') === false ) {
|
912 |
+
//$splash_img = VIDEO_PATH.trim($this->aCurArgs['splash']);
|
913 |
+
if($subtitles[0]=='/') $subtitles = substr($subtitles, 1);
|
914 |
+
if((dirname($_SERVER['PHP_SELF'])!='/')&&(file_exists($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']).VIDEO_DIR.$subtitles))){ //if the site does not live in the document root
|
915 |
+
$subtitles = $protocol.'://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).VIDEO_DIR.$subtitles;
|
916 |
+
}
|
917 |
+
else
|
918 |
+
if(file_exists($_SERVER['DOCUMENT_ROOT'].VIDEO_DIR.$subtitles)){ // if the videos folder is in the root
|
919 |
+
$subtitles = $protocol.'://'.$_SERVER['SERVER_NAME'].VIDEO_DIR.$subtitles;//VIDEO_PATH.$media;
|
920 |
+
}
|
921 |
+
else {
|
922 |
+
//if the videos are not in the videos directory but they are adressed relatively
|
923 |
+
$subtitles = str_replace('//','/',$_SERVER['SERVER_NAME'].'/'.$subtitles);
|
924 |
+
$subtitles = $protocol.'://'.$subtitles;
|
925 |
+
}
|
926 |
}
|
927 |
else {
|
928 |
+
$subtitles = trim($subtitles);
|
|
|
|
|
929 |
}
|
930 |
|
931 |
+
$aSubtitles[str_replace( 'subtitles_', '', $key )] = $subtitles;
|
932 |
+
|
933 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
934 |
}
|
935 |
|
936 |
return $aSubtitles;
|
1039 |
|
1040 |
if( isset($post) && isset($post->ID) ) {
|
1041 |
$sHTMLVideoLink = $bVideoLink ? '<div><a class="sharing-link" href="' . $sLink . '" target="_blank">Link</a></div>' : '';
|
1042 |
+
} else {
|
1043 |
+
$sHTMLVideoLink = false;
|
1044 |
}
|
1045 |
|
1046 |
if( $this->aCurArgs['embed'] == 'false' ) {
|
models/flowplayer.php
CHANGED
@@ -60,6 +60,8 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
60 |
|
61 |
public $load_hlsjs = false;
|
62 |
|
|
|
|
|
63 |
|
64 |
public function __construct() {
|
65 |
//load conf data into stack
|
@@ -97,8 +99,8 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
97 |
|
98 |
add_filter('fv_flowplayer_css_writeout', array( $this, 'css_writeout_option' ) );
|
99 |
|
100 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'css_enqueue' )
|
101 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'css_enqueue' )
|
102 |
|
103 |
add_filter( 'rewrite_rules_array', array( $this, 'rewrite_embed' ), 999999 );
|
104 |
add_filter( 'query_vars', array( $this, 'rewrite_vars' ) );
|
@@ -109,6 +111,8 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
109 |
add_action( 'wp_head', array( $this, 'template_embed_buffer' ), 999999);
|
110 |
add_action( 'wp_footer', array( $this, 'template_embed' ), 0 );
|
111 |
|
|
|
|
|
112 |
|
113 |
}
|
114 |
|
@@ -167,7 +171,7 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
167 |
if( !isset( $conf['buttonOverColor'] ) ) $conf['buttonOverColor'] = '#ffffff';*/
|
168 |
if( !isset( $conf['durationColor'] ) ) $conf['durationColor'] = '#eeeeee';
|
169 |
if( !isset( $conf['timeColor'] ) ) $conf['timeColor'] = '#eeeeee';
|
170 |
-
if( !isset( $conf['progressColor'] ) ) $conf['progressColor'] = '#
|
171 |
if( !isset( $conf['bufferColor'] ) ) $conf['bufferColor'] = '#eeeeee';
|
172 |
if( !isset( $conf['timelineColor'] ) ) $conf['timelineColor'] = '#666666';
|
173 |
if( !isset( $conf['borderColor'] ) ) $conf['borderColor'] = '#666666';
|
@@ -181,7 +185,7 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
181 |
//unset( $conf['playlistBgColor'], $conf['playlistFontColor'], $conf['playlistSelectedColor']);
|
182 |
if( !isset( $conf['playlistBgColor'] ) ) $conf['playlistBgColor'] = '#808080';
|
183 |
if( !isset( $conf['playlistFontColor'] ) ) $conf['playlistFontColor'] = '';
|
184 |
-
if( !isset( $conf['playlistSelectedColor'] ) ) $conf['playlistSelectedColor'] = '#
|
185 |
if( !isset( $conf['logoPosition'] ) ) $conf['logoPosition'] = 'bottom-left';
|
186 |
|
187 |
//
|
@@ -249,6 +253,10 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
249 |
$value = false;
|
250 |
else if($value === 'true')
|
251 |
$value = true;
|
|
|
|
|
|
|
|
|
252 |
|
253 |
return $value;
|
254 |
}
|
@@ -307,7 +315,16 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
307 |
$this->conf = $aNewOptions;
|
308 |
|
309 |
$this->css_writeout();
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
return true;
|
312 |
}
|
313 |
/**
|
@@ -320,24 +337,26 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
320 |
}
|
321 |
|
322 |
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
if( $sSplashImage ) {
|
328 |
-
$sHTML = "\t\t<a href='#' onclick='return false'><span style='background-image: url(\"" . $sSplashImage . "\")'></span>$sItemCaption</a>\n";
|
329 |
-
} else {
|
330 |
-
$sHTML = "\t\t<a href='#' onclick='return false'><span></span>$sItemCaption</a>\n";
|
331 |
-
}
|
332 |
-
|
333 |
-
}else{
|
334 |
-
if( $sSplashImage ) {
|
335 |
-
$sHTML = "\t\t<a href='#' onclick='return false'><span style='background-image: url(\"" . $sSplashImage . "\")'></span>$sItemCaption</a>\n";
|
336 |
-
} else {
|
337 |
-
$sHTML = "\t\t<a href='#' onclick='return false'><span></span>$sItemCaption</a>\n";
|
338 |
-
}
|
339 |
}
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
return $sHTML;
|
342 |
}
|
343 |
|
@@ -425,96 +444,97 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
425 |
|
426 |
$sHTML = array();
|
427 |
|
428 |
-
if( $sShortcode && count($sItems) > 0) {
|
429 |
//var_dump($sItemCaption);
|
430 |
|
431 |
if( isset($aArgs['liststyle']) && !empty($aArgs['liststyle']) ){
|
432 |
-
$sHTML[] = $this->build_playlist_html( $aArgs, $splash_img, $sItemCaption );
|
433 |
}else{
|
434 |
$sHTML[] = "<a href='#' class='is-active' onclick='return false'><span ".( (isset($splash_img) && !empty($splash_img)) ? "style='background-image: url(\"".$splash_img."\")' " : "" )."></span>$sItemCaption</a>\n";
|
435 |
-
}
|
436 |
-
|
437 |
-
foreach( $sItems AS $iKey => $sItem ) {
|
438 |
-
$aPlaylist_item = explode( ',', $sItem );
|
439 |
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
$aPlaylist_item[$key] = str_replace( $replace_to, $replace_from, $aPlaylist_item[$key] );
|
447 |
-
}
|
448 |
-
|
449 |
-
$aItem = array();
|
450 |
-
$sSplashImage = false;
|
451 |
-
$flash_media = array();
|
452 |
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
|
|
459 |
}
|
|
|
|
|
|
|
|
|
460 |
|
461 |
-
$
|
462 |
-
|
463 |
-
|
464 |
-
if(
|
465 |
-
$
|
|
|
466 |
}
|
467 |
-
|
468 |
-
$
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
|
|
473 |
} else {
|
474 |
-
$
|
475 |
-
}
|
476 |
-
} else {
|
477 |
-
$aItem[] = array( 'src' => $actual_media_url, 'type' => $this->get_mime_type($aPlaylist_item_i) );
|
478 |
-
}
|
479 |
-
|
480 |
-
}
|
481 |
-
|
482 |
-
if( count($flash_media) ) {
|
483 |
-
$bHaveFlash = false;
|
484 |
-
foreach( $aItem AS $key => $aItemFile ) {
|
485 |
-
if( in_array( 'flash', array_keys($aItemFile) ) ) {
|
486 |
-
$bHaveFlash = true;
|
487 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
}
|
489 |
|
490 |
-
if(
|
491 |
-
|
492 |
-
|
|
|
|
|
|
|
493 |
}
|
494 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
495 |
}
|
496 |
-
|
497 |
-
$aPlayer = array( 'sources' => $aItem );
|
498 |
-
if( $rtmp_server ) $aPlayer['rtmp'] = array( 'url' => $rtmp_server );
|
499 |
-
|
500 |
-
$aPlaylistItems[] = $aPlayer;
|
501 |
-
$sItemCaption = ( isset($aCaption[$iKey]) ) ? __($aCaption[$iKey]) : false;
|
502 |
-
$sItemCaption = apply_filters( 'fv_flowplayer_caption', $sItemCaption, $aItem, $aArgs );
|
503 |
-
|
504 |
-
|
505 |
-
$sHTML[] = $this->build_playlist_html( $aArgs, $sSplashImage, $sItemCaption );
|
506 |
-
if( $sSplashImage ) {
|
507 |
-
$aSplashScreens[] = $sSplashImage;
|
508 |
-
}
|
509 |
-
$aCaptions[] = $sItemCaption;
|
510 |
}
|
511 |
|
512 |
}
|
513 |
|
514 |
-
if( isset($aArgs['liststyle']) && $aArgs['liststyle'] == 'prevnext' ){
|
515 |
-
$sHTML = array();
|
516 |
-
}
|
517 |
-
|
518 |
$sPlaylistClass = '' ;
|
519 |
|
520 |
if( isset($aArgs['liststyle']) && $aArgs['liststyle'] == 'vertical' ){
|
@@ -532,12 +552,19 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
532 |
|
533 |
|
534 |
$sHTML = apply_filters( 'fv_flowplayer_playlist_item_html', $sHTML );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
|
536 |
-
$sHTML = "\t<div
|
537 |
-
|
538 |
-
$jsonPlaylistItems = str_replace( array('\\/', ','), array('/', ",\n\t\t"), json_encode($aPlaylistItems) );
|
539 |
-
//$jsonPlaylistItems = preg_replace( '~"(.*)":"~', '$1:"', $jsonPlaylistItems );
|
540 |
-
|
541 |
return array( $sHTML, $aPlaylistItems, $aSplashScreens, $aCaptions );
|
542 |
}
|
543 |
|
@@ -631,12 +658,54 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
631 |
}
|
632 |
|
633 |
|
634 |
-
function css_enqueue() {
|
635 |
|
636 |
if( is_admin() && !did_action('admin_footer') && ( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) ) {
|
637 |
return;
|
638 |
}
|
639 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
global $fv_wp_flowplayer_ver;
|
641 |
$this->bCSSInline = true;
|
642 |
$sURL = FV_FP_RELATIVE_PATH.'/css/flowplayer.css';
|
@@ -663,7 +732,10 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
663 |
echo "<link rel='stylesheet' id='fv_flowplayer_admin' href='".FV_FP_RELATIVE_PATH."/css/admin.css?ver=".$fv_wp_flowplayer_ver."' type='text/css' media='all' />\n";
|
664 |
|
665 |
} else {
|
666 |
-
|
|
|
|
|
|
|
667 |
|
668 |
if(is_user_logged_in()){
|
669 |
//TODO: is this needed?
|
@@ -1115,12 +1187,8 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
1115 |
$output = $default;
|
1116 |
} else {
|
1117 |
if ($extension == 'm3u8' || $extension == 'm3u') {
|
1118 |
-
global $fv_fp;
|
1119 |
-
$fv_fp->load_hlsjs = true;
|
1120 |
$output = 'x-mpegurl';
|
1121 |
} else if ($extension == 'mpd') {
|
1122 |
-
global $fv_fp;
|
1123 |
-
$fv_fp->load_dash = true;
|
1124 |
$output = 'dash+xml';
|
1125 |
} else if ($extension == 'm4v') {
|
1126 |
$output = 'mp4';
|
@@ -1147,6 +1215,24 @@ class flowplayer extends FV_Wordpress_Flowplayer_Plugin {
|
|
1147 |
}
|
1148 |
}
|
1149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1150 |
if( !$no_video ) {
|
1151 |
switch($extension) {
|
1152 |
case 'dash+xml' :
|
60 |
|
61 |
public $load_hlsjs = false;
|
62 |
|
63 |
+
public $bCSSLoaded = false;
|
64 |
+
|
65 |
|
66 |
public function __construct() {
|
67 |
//load conf data into stack
|
99 |
|
100 |
add_filter('fv_flowplayer_css_writeout', array( $this, 'css_writeout_option' ) );
|
101 |
|
102 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'css_enqueue' ) );
|
103 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'css_enqueue' ) );
|
104 |
|
105 |
add_filter( 'rewrite_rules_array', array( $this, 'rewrite_embed' ), 999999 );
|
106 |
add_filter( 'query_vars', array( $this, 'rewrite_vars' ) );
|
111 |
add_action( 'wp_head', array( $this, 'template_embed_buffer' ), 999999);
|
112 |
add_action( 'wp_footer', array( $this, 'template_embed' ), 0 );
|
113 |
|
114 |
+
add_filter( 'fv_flowplayer_video_src', array( $this, 'add_fake_extension' ) );
|
115 |
+
|
116 |
|
117 |
}
|
118 |
|
171 |
if( !isset( $conf['buttonOverColor'] ) ) $conf['buttonOverColor'] = '#ffffff';*/
|
172 |
if( !isset( $conf['durationColor'] ) ) $conf['durationColor'] = '#eeeeee';
|
173 |
if( !isset( $conf['timeColor'] ) ) $conf['timeColor'] = '#eeeeee';
|
174 |
+
if( !isset( $conf['progressColor'] ) ) $conf['progressColor'] = '#bb0000';
|
175 |
if( !isset( $conf['bufferColor'] ) ) $conf['bufferColor'] = '#eeeeee';
|
176 |
if( !isset( $conf['timelineColor'] ) ) $conf['timelineColor'] = '#666666';
|
177 |
if( !isset( $conf['borderColor'] ) ) $conf['borderColor'] = '#666666';
|
185 |
//unset( $conf['playlistBgColor'], $conf['playlistFontColor'], $conf['playlistSelectedColor']);
|
186 |
if( !isset( $conf['playlistBgColor'] ) ) $conf['playlistBgColor'] = '#808080';
|
187 |
if( !isset( $conf['playlistFontColor'] ) ) $conf['playlistFontColor'] = '';
|
188 |
+
if( !isset( $conf['playlistSelectedColor'] ) ) $conf['playlistSelectedColor'] = '#bb0000';
|
189 |
if( !isset( $conf['logoPosition'] ) ) $conf['logoPosition'] = 'bottom-left';
|
190 |
|
191 |
//
|
253 |
$value = false;
|
254 |
else if($value === 'true')
|
255 |
$value = true;
|
256 |
+
|
257 |
+
if( isset($_GET['old_code']) && $key == 'old_code' ) {
|
258 |
+
return $_GET['old_code'];
|
259 |
+
}
|
260 |
|
261 |
return $value;
|
262 |
}
|
315 |
$this->conf = $aNewOptions;
|
316 |
|
317 |
$this->css_writeout();
|
318 |
+
|
319 |
+
fv_wp_flowplayer_delete_extensions_transients();
|
320 |
+
|
321 |
+
if( $aOldOptions['key'] != $sKey ) {
|
322 |
+
global $FV_Player_Pro_loader;
|
323 |
+
if( isset($FV_Player_Pro_loader) ) {
|
324 |
+
$FV_Player_Pro_loader->license_key = $sKey;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
return true;
|
329 |
}
|
330 |
/**
|
337 |
}
|
338 |
|
339 |
|
340 |
+
public function add_fake_extension( $media ) {
|
341 |
+
if( stripos( $media, '(format=m3u8' ) !== false ) { // http://*.streaming.mediaservices.windows.net/*.ism/manifest(format=m3u8-aapl)
|
342 |
+
$media .= '#.m3u8'; // if this is not added then the Flowpalyer Flash HLS won't play the HLS stream!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
}
|
344 |
+
return $media;
|
345 |
+
}
|
346 |
+
|
347 |
+
|
348 |
+
private function build_playlist_html( $aArgs, $sSplashImage, $sItemCaption, $aPlayer, $index ){
|
349 |
+
|
350 |
+
$aPlayer = apply_filters( 'fv_player_item', $aPlayer, $index, $aArgs );
|
351 |
+
|
352 |
+
$sHTML = "\t\t<a href='#' onclick='return false'";
|
353 |
+
$sHTML .= !$this->_get_option('old_code') ? " data-item='".json_encode($aPlayer)."'" : "";
|
354 |
+
$sHTML .= ">";
|
355 |
+
$sHTML .= $sSplashImage ? "<span style='background-image: url(\"" . $sSplashImage . "\")'></span>" : "<span></span>";
|
356 |
+
$sHTML .= $sItemCaption."</a>\n";
|
357 |
+
|
358 |
+
$sHTML = apply_filters( 'fv_player_item_html', $sHTML, $aArgs, $sSplashImage, $sItemCaption, $aPlayer, $index );
|
359 |
+
|
360 |
return $sHTML;
|
361 |
}
|
362 |
|
444 |
|
445 |
$sHTML = array();
|
446 |
|
447 |
+
if( !$this->_get_option('old_code') || $sShortcode && count($sItems) > 0) {
|
448 |
//var_dump($sItemCaption);
|
449 |
|
450 |
if( isset($aArgs['liststyle']) && !empty($aArgs['liststyle']) ){
|
451 |
+
$sHTML[] = $this->build_playlist_html( $aArgs, $splash_img, $sItemCaption, $aPlayer, 0 );
|
452 |
}else{
|
453 |
$sHTML[] = "<a href='#' class='is-active' onclick='return false'><span ".( (isset($splash_img) && !empty($splash_img)) ? "style='background-image: url(\"".$splash_img."\")' " : "" )."></span>$sItemCaption</a>\n";
|
454 |
+
}
|
|
|
|
|
|
|
455 |
|
456 |
+
if( count($sItems) > 0 ) {
|
457 |
+
foreach( $sItems AS $iKey => $sItem ) {
|
458 |
+
|
459 |
+
if( !$sItem ) continue;
|
460 |
+
|
461 |
+
$aPlaylist_item = explode( ',', $sItem );
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
|
463 |
+
foreach( $aPlaylist_item AS $key => $item ) {
|
464 |
+
if( $key > 0 && ( stripos($item,'http:') !== 0 && stripos($item,'https:') !== 0 && stripos($item,'rtmp:') !== 0 && stripos($item,'/') !== 0 ) ) {
|
465 |
+
$aPlaylist_item[$key-1] .= ','.$item;
|
466 |
+
$aPlaylist_item[$key] = $aPlaylist_item[$key-1];
|
467 |
+
unset($aPlaylist_item[$key-1]);
|
468 |
+
}
|
469 |
+
$aPlaylist_item[$key] = str_replace( $replace_to, $replace_from, $aPlaylist_item[$key] );
|
470 |
}
|
471 |
+
|
472 |
+
$aItem = array();
|
473 |
+
$sSplashImage = false;
|
474 |
+
$flash_media = array();
|
475 |
|
476 |
+
$sSplashImage = apply_filters( 'fv_flowplayer_playlist_splash', $sSplashImage, $this, $aPlaylist_item );
|
477 |
+
|
478 |
+
foreach( apply_filters( 'fv_player_media', $aPlaylist_item, $this ) AS $aPlaylist_item_i ) {
|
479 |
+
if( preg_match('~\.(png|gif|jpg|jpe|jpeg)($|\?)~',$aPlaylist_item_i) ) {
|
480 |
+
$sSplashImage = $aPlaylist_item_i;
|
481 |
+
continue;
|
482 |
}
|
483 |
+
|
484 |
+
$media_url = $this->get_video_src( preg_replace( '~^rtmp:~', '', $aPlaylist_item_i ), array( 'url_only' => true, 'suppress_filters' => $suppress_filters ) );
|
485 |
+
if( is_array($media_url) ) {
|
486 |
+
$actual_media_url = $media_url['media'];
|
487 |
+
if( $this->get_mime_type($actual_media_url) == 'video/mp4' ) {
|
488 |
+
$flash_media[] = $media_url['flash'];
|
489 |
+
}
|
490 |
} else {
|
491 |
+
$actual_media_url = $media_url;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
}
|
493 |
+
if( stripos( $aPlaylist_item_i, 'rtmp:' ) === 0 ) {
|
494 |
+
if( !preg_match( '~^[a-z0-9]+:~', $actual_media_url ) ) {
|
495 |
+
$aItem[] = array( 'src' => $this->get_mime_type($actual_media_url,'mp4',true).':'.str_replace( '+', ' ', $actual_media_url ), 'type' => 'video/flash' );
|
496 |
+
} else {
|
497 |
+
$aItem[] = array( 'src' => str_replace( '+', ' ', $actual_media_url ), 'type' => 'video/flash' );
|
498 |
+
}
|
499 |
+
} else {
|
500 |
+
$aItem[] = array( 'src' => $actual_media_url, 'type' => $this->get_mime_type($aPlaylist_item_i) );
|
501 |
+
}
|
502 |
+
|
503 |
}
|
504 |
|
505 |
+
if( count($flash_media) ) {
|
506 |
+
$bHaveFlash = false;
|
507 |
+
foreach( $aItem AS $key => $aItemFile ) {
|
508 |
+
if( in_array( 'flash', array_keys($aItemFile) ) ) {
|
509 |
+
$bHaveFlash = true;
|
510 |
+
}
|
511 |
}
|
512 |
+
|
513 |
+
if( !$bHaveFlash ) {
|
514 |
+
foreach( $flash_media AS $flash_media_items ) {
|
515 |
+
$aItem[] = array( 'flash' => $flash_media_items );
|
516 |
+
}
|
517 |
+
}
|
518 |
+
}
|
519 |
+
|
520 |
+
$aPlayer = array( 'sources' => $aItem );
|
521 |
+
if( $rtmp_server ) $aPlayer['rtmp'] = array( 'url' => $rtmp_server );
|
522 |
+
|
523 |
+
$aPlaylistItems[] = $aPlayer;
|
524 |
+
$sItemCaption = ( isset($aCaption[$iKey]) ) ? __($aCaption[$iKey]) : false;
|
525 |
+
$sItemCaption = apply_filters( 'fv_flowplayer_caption', $sItemCaption, $aItem, $aArgs );
|
526 |
+
|
527 |
+
|
528 |
+
$sHTML[] = $this->build_playlist_html( $aArgs, $sSplashImage, $sItemCaption, $aPlayer, $iKey + 1 );
|
529 |
+
if( $sSplashImage ) {
|
530 |
+
$aSplashScreens[] = $sSplashImage;
|
531 |
+
}
|
532 |
+
$aCaptions[] = $sItemCaption;
|
533 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
}
|
535 |
|
536 |
}
|
537 |
|
|
|
|
|
|
|
|
|
538 |
$sPlaylistClass = '' ;
|
539 |
|
540 |
if( isset($aArgs['liststyle']) && $aArgs['liststyle'] == 'vertical' ){
|
552 |
|
553 |
|
554 |
$sHTML = apply_filters( 'fv_flowplayer_playlist_item_html', $sHTML );
|
555 |
+
|
556 |
+
$attributes = array();
|
557 |
+
$attributes_html = '';
|
558 |
+
$attributes['class'] = 'fp-playlist-external '.$sPlaylistClass;
|
559 |
+
$attributes['rel'] = 'wpfp_'.$this->hash;
|
560 |
+
|
561 |
+
$attributes = apply_filters( 'fv_player_playlist_attributes', $attributes, $media, $this );
|
562 |
+
foreach( $attributes AS $attr_key => $attr_value ) {
|
563 |
+
$attributes_html .= ' '.$attr_key.'="'.esc_attr( $attr_value ).'"';
|
564 |
+
}
|
565 |
|
566 |
+
$sHTML = "\t<div $attributes_html>\n".implode( '', $sHTML )."\t</div>\n";
|
567 |
+
|
|
|
|
|
|
|
568 |
return array( $sHTML, $aPlaylistItems, $aSplashScreens, $aCaptions );
|
569 |
}
|
570 |
|
658 |
}
|
659 |
|
660 |
|
661 |
+
function css_enqueue( $force = false ) {
|
662 |
|
663 |
if( is_admin() && !did_action('admin_footer') && ( !isset($_GET['page']) || $_GET['page'] != 'fvplayer' ) ) {
|
664 |
return;
|
665 |
}
|
666 |
|
667 |
+
/*
|
668 |
+
* Let's check if FV Player is going to be used before loading CSS!
|
669 |
+
*/
|
670 |
+
global $posts, $post;
|
671 |
+
if( !$posts || empty($posts) ) $posts = array( $post );
|
672 |
+
|
673 |
+
if( !$force && !$this->_get_option('js-everywhere') && isset($posts) && count($posts) > 0 ) {
|
674 |
+
$bFound = false;
|
675 |
+
|
676 |
+
if( $this->_get_option('parse_comments') ) { // if video link parsing is enabled, we need to check if there might be a video somewhere
|
677 |
+
$bFound = true;
|
678 |
+
}
|
679 |
+
|
680 |
+
foreach( $posts AS $objPost ) {
|
681 |
+
if(
|
682 |
+
stripos($objPost->post_content,'[fvplayer') !== false ||
|
683 |
+
stripos($objPost->post_content,'[flowplayer') !== false ||
|
684 |
+
stripos($objPost->post_content,'[video') !== false
|
685 |
+
) {
|
686 |
+
$bFound = true;
|
687 |
+
break;
|
688 |
+
}
|
689 |
+
}
|
690 |
+
|
691 |
+
// also check widgets - is there widget_fvplayer among active widgets?
|
692 |
+
if( !$bFound ) {
|
693 |
+
$aWidgets = get_option('sidebars_widgets');
|
694 |
+
if( isset($aWidgets['wp_inactive_widgets']) ) {
|
695 |
+
unset($aWidgets['wp_inactive_widgets']);
|
696 |
+
}
|
697 |
+
if( stripos(json_encode($aWidgets),'widget_fvplayer') !== false ) {
|
698 |
+
$bFound = true;
|
699 |
+
}
|
700 |
+
}
|
701 |
+
|
702 |
+
if( !$bFound ) {
|
703 |
+
return;
|
704 |
+
}
|
705 |
+
}
|
706 |
+
|
707 |
+
$this->bCSSLoaded = true;
|
708 |
+
|
709 |
global $fv_wp_flowplayer_ver;
|
710 |
$this->bCSSInline = true;
|
711 |
$sURL = FV_FP_RELATIVE_PATH.'/css/flowplayer.css';
|
732 |
echo "<link rel='stylesheet' id='fv_flowplayer_admin' href='".FV_FP_RELATIVE_PATH."/css/admin.css?ver=".$fv_wp_flowplayer_ver."' type='text/css' media='all' />\n";
|
733 |
|
734 |
} else {
|
735 |
+
$aDeps = array();
|
736 |
+
if( class_exists('OptimizePress_Default_Assets') ) $aDeps = array('optimizepress-default'); // make sure the CSS loads after optimizePressPlugin
|
737 |
+
|
738 |
+
wp_enqueue_style( 'fv_flowplayer', $sURL, $aDeps, $sVer );
|
739 |
|
740 |
if(is_user_logged_in()){
|
741 |
//TODO: is this needed?
|
1187 |
$output = $default;
|
1188 |
} else {
|
1189 |
if ($extension == 'm3u8' || $extension == 'm3u') {
|
|
|
|
|
1190 |
$output = 'x-mpegurl';
|
1191 |
} else if ($extension == 'mpd') {
|
|
|
|
|
1192 |
$output = 'dash+xml';
|
1193 |
} else if ($extension == 'm4v') {
|
1194 |
$output = 'mp4';
|
1215 |
}
|
1216 |
}
|
1217 |
|
1218 |
+
if( $output == 'flash' ) {
|
1219 |
+
if( stripos( $media, '(format=m3u8' ) !== false ) { // http://*.streaming.mediaservices.windows.net/*.ism/manifest(format=m3u8-aapl)
|
1220 |
+
$output = 'x-mpegurl';
|
1221 |
+
$extension = 'm3u8';
|
1222 |
+
}
|
1223 |
+
if( stripos( $media, '(format=mpd' ) !== false ) { // http://*.streaming.mediaservices.windows.net/*.ism/manifest(format=mpd-time-csf)
|
1224 |
+
$output = 'dash+xml';
|
1225 |
+
$extension = 'mpd';
|
1226 |
+
}
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
global $fv_fp;
|
1230 |
+
if( $extension == 'mpd' ) {
|
1231 |
+
$fv_fp->load_dash = true;
|
1232 |
+
} else if( $extension == 'm3u8' ) {
|
1233 |
+
$fv_fp->load_hlsjs = true;
|
1234 |
+
}
|
1235 |
+
|
1236 |
if( !$no_video ) {
|
1237 |
switch($extension) {
|
1238 |
case 'dash+xml' :
|
models/lightbox.php
CHANGED
@@ -4,6 +4,8 @@ class FV_Player_lightbox {
|
|
4 |
|
5 |
private $lightboxHtml;
|
6 |
|
|
|
|
|
7 |
public $bLoad = false;
|
8 |
|
9 |
public function __construct() {
|
@@ -31,13 +33,24 @@ class FV_Player_lightbox {
|
|
31 |
|
32 |
add_filter('fv_player_conf_defaults', array( $this, 'conf_defaults' ) );
|
33 |
|
34 |
-
|
35 |
//TODO is this hack needed?
|
36 |
$conf = get_option('fvwpflowplayer');
|
37 |
if(isset($conf['lightbox_images']) && $conf['lightbox_images'] == 'true' &&
|
38 |
(!isset($conf['lightbox_improve_galleries']) || isset($conf['lightbox_improve_galleries']) && $conf['lightbox_improve_galleries'] == 'true')) {
|
39 |
add_filter( 'shortcode_atts_gallery', array( $this, 'improve_galleries' ) );
|
40 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
|
43 |
function conf_defaults($conf){
|
@@ -165,7 +178,8 @@ class FV_Player_lightbox {
|
|
165 |
}
|
166 |
|
167 |
function lightbox_playlist($output, $aCurArgs, $aPlaylistItems, $aSplashScreens, $aCaptions) {
|
168 |
-
|
|
|
169 |
return $output;
|
170 |
}
|
171 |
|
@@ -218,7 +232,7 @@ class FV_Player_lightbox {
|
|
218 |
function html_to_lightbox_videos($content) {
|
219 |
|
220 |
// todo: disabling the option should turn this off
|
221 |
-
if (stripos($content, 'colorbox') !== false) {
|
222 |
$content = preg_replace_callback('~<a[^>]*?class=[\'"][^\'"]*?colorbox[^\'"]*?[\'"][^>]*?>([\s\S]*?)</a>~', array($this, 'html_to_lightbox_videos_callback'), $content);
|
223 |
return $content;
|
224 |
}
|
@@ -275,6 +289,7 @@ class FV_Player_lightbox {
|
|
275 |
} else {
|
276 |
$matches[1] = preg_replace('~(class=[\'"])~', '$1colorbox ', $matches[1]);
|
277 |
}
|
|
|
278 |
return $matches[1] . $matches[2];
|
279 |
}
|
280 |
|
4 |
|
5 |
private $lightboxHtml;
|
6 |
|
7 |
+
public $bCSSLoaded = false;
|
8 |
+
|
9 |
public $bLoad = false;
|
10 |
|
11 |
public function __construct() {
|
33 |
|
34 |
add_filter('fv_player_conf_defaults', array( $this, 'conf_defaults' ) );
|
35 |
|
|
|
36 |
//TODO is this hack needed?
|
37 |
$conf = get_option('fvwpflowplayer');
|
38 |
if(isset($conf['lightbox_images']) && $conf['lightbox_images'] == 'true' &&
|
39 |
(!isset($conf['lightbox_improve_galleries']) || isset($conf['lightbox_improve_galleries']) && $conf['lightbox_improve_galleries'] == 'true')) {
|
40 |
add_filter( 'shortcode_atts_gallery', array( $this, 'improve_galleries' ) );
|
41 |
}
|
42 |
+
|
43 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'css_enqueue' ), 999 );
|
44 |
+
}
|
45 |
+
|
46 |
+
function css_enqueue( $force ) {
|
47 |
+
global $fv_fp;
|
48 |
+
if( !$force && !$fv_fp->_get_option('lightbox_images') ) return;
|
49 |
+
|
50 |
+
$bCSSLoaded = true;
|
51 |
+
|
52 |
+
global $fv_wp_flowplayer_ver;
|
53 |
+
wp_enqueue_style( 'fv_player_lightbox', FV_FP_RELATIVE_PATH.'/css/lightbox.css', array(), $fv_wp_flowplayer_ver );
|
54 |
}
|
55 |
|
56 |
function conf_defaults($conf){
|
178 |
}
|
179 |
|
180 |
function lightbox_playlist($output, $aCurArgs, $aPlaylistItems, $aSplashScreens, $aCaptions) {
|
181 |
+
|
182 |
+
if ($output || empty($aCurArgs['lightbox']) || !count($aPlaylistItems) || count($aPlaylistItems) == 1 ) {
|
183 |
return $output;
|
184 |
}
|
185 |
|
232 |
function html_to_lightbox_videos($content) {
|
233 |
|
234 |
// todo: disabling the option should turn this off
|
235 |
+
if (stripos($content, 'colorbox') !== false) {
|
236 |
$content = preg_replace_callback('~<a[^>]*?class=[\'"][^\'"]*?colorbox[^\'"]*?[\'"][^>]*?>([\s\S]*?)</a>~', array($this, 'html_to_lightbox_videos_callback'), $content);
|
237 |
return $content;
|
238 |
}
|
289 |
} else {
|
290 |
$matches[1] = preg_replace('~(class=[\'"])~', '$1colorbox ', $matches[1]);
|
291 |
}
|
292 |
+
|
293 |
return $matches[1] . $matches[2];
|
294 |
}
|
295 |
|
models/seo.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class FV_Player_SEO {
|
4 |
+
|
5 |
+
var $can_seo = false;
|
6 |
+
|
7 |
+
public function __construct() {
|
8 |
+
add_filter('fv_flowplayer_args_pre', array($this, 'should_i'), 10, 3 );
|
9 |
+
add_filter('fv_flowplayer_attributes', array($this, 'single_attributes'), 10, 3 );
|
10 |
+
add_filter('fv_flowplayer_inner_html', array($this, 'single_video_seo'), 10, 2 );
|
11 |
+
add_filter('fv_player_item_html', array($this, 'playlist_video_seo'), 10, 6 );
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
+
function single_attributes( $attributes, $media, $fv_fp ) {
|
16 |
+
if( !empty($fv_fp->aCurArgs['playlist']) || !$this->can_seo ) {
|
17 |
+
return $attributes;
|
18 |
+
}
|
19 |
+
|
20 |
+
$attributes['itemprop'] = 'video';
|
21 |
+
$attributes['itemscope'] = '';
|
22 |
+
$attributes['itemtype'] = 'http://schema.org/VideoObject';
|
23 |
+
|
24 |
+
return $attributes;
|
25 |
+
}
|
26 |
+
|
27 |
+
function get_markup( $title, $description, $splash, $url ) {
|
28 |
+
if( !$title ) {
|
29 |
+
$title = get_the_title();
|
30 |
+
}
|
31 |
+
|
32 |
+
if( !$description ) { // todo: read this from shortcode
|
33 |
+
$description = get_post_meta(get_the_ID(),'_aioseop_description', true );
|
34 |
+
}
|
35 |
+
$post_content = get_the_content();
|
36 |
+
if( !$description && strlen($post_content) > 0 ) {
|
37 |
+
$post_content = strip_shortcodes( $post_content );
|
38 |
+
$post_content = strip_tags( $post_content );
|
39 |
+
$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
|
40 |
+
$description = wp_trim_words( $post_content, '10', $excerpt_more );
|
41 |
+
}
|
42 |
+
if( !$description ) {
|
43 |
+
$description = get_option('blogdescription');
|
44 |
+
}
|
45 |
+
|
46 |
+
if( !$url ) {
|
47 |
+
$url = get_permalink();
|
48 |
+
}
|
49 |
+
|
50 |
+
if( stripos($splash,'://') === false ) {
|
51 |
+
$splash = home_url($splash);
|
52 |
+
}
|
53 |
+
|
54 |
+
return '<meta itemprop="name" content="'.esc_attr($title).'" />
|
55 |
+
<meta itemprop="description" content="'.esc_attr($description).'" />
|
56 |
+
<meta itemprop="thumbnailUrl" content="'.esc_attr($splash).'" />
|
57 |
+
<meta itemprop="contentURL" content="'.esc_attr($url).'" />
|
58 |
+
<meta itemprop="uploadDate" content="'.esc_attr(get_the_modified_date('Y-m-d')).'" />';
|
59 |
+
}
|
60 |
+
|
61 |
+
function playlist_video_seo( $sHTML, $aArgs, $sSplashImage, $sItemCaption, $aPlayer, $index ) {
|
62 |
+
if( $this->can_seo ) {
|
63 |
+
$sHTML = str_replace( '<a', '<a itemprop="video" itemscope itemtype="http://schema.org/VideoObject" ', $sHTML );
|
64 |
+
$sHTML = str_replace( '</a>', $this->get_markup($sItemCaption,false,$sSplashImage,false).'</a>', $sHTML );
|
65 |
+
}
|
66 |
+
return $sHTML;
|
67 |
+
}
|
68 |
+
|
69 |
+
function should_i( $args ) {
|
70 |
+
global $fv_fp;
|
71 |
+
if( !$fv_fp->_get_option( array( 'integrations', 'schema_org' ) ) ) {
|
72 |
+
$this->can_seo = false;
|
73 |
+
return $args;
|
74 |
+
}
|
75 |
+
|
76 |
+
if( !get_permalink() || !$fv_fp->get_splash() ) {
|
77 |
+
$this->can_seo = false;
|
78 |
+
}
|
79 |
+
|
80 |
+
$this->can_seo = true;
|
81 |
+
return $args;
|
82 |
+
}
|
83 |
+
|
84 |
+
function single_video_seo( $html, $fv_fp ) {
|
85 |
+
if( $this->can_seo ) {
|
86 |
+
if( !$fv_fp->aCurArgs['playlist'] ) {
|
87 |
+
// todo: use iframe or video link URL
|
88 |
+
$html .= "\n".$this->get_markup($fv_fp->aCurArgs['caption'],false,$fv_fp->get_splash(),false)."\n";
|
89 |
+
}
|
90 |
+
}
|
91 |
+
return $html;
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
$FV_Player_SEO = new FV_Player_SEO();
|
models/subtitles.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class FV_Player_Subtitles {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
add_filter('fv_player_item', array($this, 'add_subtitles'), 10, 2 );
|
7 |
+
|
8 |
+
}
|
9 |
+
|
10 |
+
function add_subtitles( $aItem, $index ) {
|
11 |
+
global $fv_fp;
|
12 |
+
|
13 |
+
$aSubtitles = $fv_fp->get_subtitles($index);
|
14 |
+
if( count($aSubtitles) == 0 ) return $aItem;
|
15 |
+
|
16 |
+
$aLangs = flowplayer::get_languages();
|
17 |
+
$countSubtitles = 0;
|
18 |
+
$aOutput = array();
|
19 |
+
|
20 |
+
foreach( $aSubtitles AS $key => $subtitles ) {
|
21 |
+
$objSubtitle = new stdClass;
|
22 |
+
if( $key == 'subtitles' ) {
|
23 |
+
$aLang = explode('-', get_bloginfo('language'));
|
24 |
+
if( !empty($aLang[0]) ) $objSubtitle->srclang = $aLang[0];
|
25 |
+
$sCode = $aLang[0];
|
26 |
+
|
27 |
+
$sCaption = '';
|
28 |
+
if( !empty($sCode) && $sCode == 'en' ) {
|
29 |
+
$sCaption = 'English';
|
30 |
+
|
31 |
+
} elseif( !empty($sCode) ) {
|
32 |
+
$translations = get_site_transient( 'available_translations' );
|
33 |
+
$sLangCode = str_replace( '-', '_', get_bloginfo('language') );
|
34 |
+
if( $translations && isset($translations[$sLangCode]) && !empty($translations[$sLangCode]['native_name']) ) {
|
35 |
+
$sCaption = $translations[$sLangCode]['native_name'];
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
if( $sCaption ) {
|
41 |
+
$objSubtitle->label = $sCaption;
|
42 |
+
}
|
43 |
+
|
44 |
+
} else {
|
45 |
+
$objSubtitle->srclang = $key;
|
46 |
+
$objSubtitle->label = $aLangs[strtoupper($key)];
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
$objSubtitle->src = $subtitles;
|
51 |
+
if( $countSubtitles == 0 && $fv_fp->_get_option('subtitleOn') ) {
|
52 |
+
$objSubtitle->default = true;
|
53 |
+
}
|
54 |
+
$aOutput[] = $objSubtitle;
|
55 |
+
|
56 |
+
$countSubtitles++;
|
57 |
+
}
|
58 |
+
|
59 |
+
if( count($aSubtitles) ) {
|
60 |
+
$aItem['subtitles'] = $aOutput;
|
61 |
+
}
|
62 |
+
|
63 |
+
return $aItem;
|
64 |
+
}
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
$FV_Player_Subtitles = new FV_Player_Subtitles();
|
models/widget.php
CHANGED
@@ -86,8 +86,7 @@ class FV_Player_Widget extends WP_Widget {
|
|
86 |
* @param array $instance Current settings.
|
87 |
*/
|
88 |
public function form($instance) {
|
89 |
-
|
90 |
-
wp_enqueue_media();
|
91 |
|
92 |
$instance = wp_parse_args((array) $instance, array('title' => '', 'text' => ''));
|
93 |
$filter = isset($instance['filter']) ? $instance['filter'] : 0;
|
86 |
* @param array $instance Current settings.
|
87 |
*/
|
88 |
public function form($instance) {
|
89 |
+
add_action('admin_head', 'wp_enqueue_media');
|
|
|
90 |
|
91 |
$instance = wp_parse_args((array) $instance, array('title' => '', 'text' => ''));
|
92 |
$filter = isset($instance['filter']) ? $instance['filter'] : 0;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: FolioVision
|
|
3 |
Donate link: https://foliovision.com/donate
|
4 |
Tags: video player, flowplayer, mobile video, html5 video, Vimeo, html5 player, youtube player, youtube playlist, video playlist, RTMP, Cloudfront, HLS
|
5 |
Requires at least: 3.5
|
6 |
-
Tested up to: 4.
|
7 |
Stable tag: trunk
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -343,9 +343,62 @@ Thank you for being part of the HMTL 5 mobile video revolution!
|
|
343 |
|
344 |
== Changelog ==
|
345 |
|
346 |
-
= 6.
|
347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
* CSS - moving FV Player stylesheet down to increase it's priority over the WP themes. Pro users need to upgrade FV Player Pro as well if they experience slight display issues.
|
|
|
|
|
|
|
349 |
|
350 |
= 6.0.5.24 - 2017/05/09 =
|
351 |
|
@@ -1436,6 +1489,10 @@ On the right side of this screen, you can see the current visual configuration o
|
|
1436 |
|
1437 |
== Upgrade Notice ==
|
1438 |
|
|
|
|
|
|
|
|
|
1439 |
= 6.0.5.13 =
|
1440 |
|
1441 |
* New Shortcode Editor! Better looking, with improved workflow and video preview functionality.
|
3 |
Donate link: https://foliovision.com/donate
|
4 |
Tags: video player, flowplayer, mobile video, html5 video, Vimeo, html5 player, youtube player, youtube playlist, video playlist, RTMP, Cloudfront, HLS
|
5 |
Requires at least: 3.5
|
6 |
+
Tested up to: 4.8
|
7 |
Stable tag: trunk
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
343 |
|
344 |
== Changelog ==
|
345 |
|
346 |
+
= 6.1.6 - 2016/07/?? =
|
347 |
|
348 |
+
* CSS - optimizing the player graphics
|
349 |
+
* Fixing shortcode editor JS glitch with playlist subtitles
|
350 |
+
|
351 |
+
= 6.1.5 - 2016/06/29 =
|
352 |
+
|
353 |
+
* Compatibility - bugfix for FV Player widget as it was breaking Featured Image insertion when also using DesignThemes Core Features Plugin
|
354 |
+
* Iframe embedding - using width and height attributes like YouTube or Vimeo to ensure FV Player Iframe embeds are responsive at least in themes with iframe responsiveness code
|
355 |
+
* Microsoft Smooth Streaming - adding support for http://*.streaming.mediaservices.windows.net/*.ism/manifest(format=mpd-time-csf) and ...(format=m3u8-aapl) kind of URLs
|
356 |
+
* Reverting - Ajax loading - fix for repeated autoplay if your theme loads FV Player using Ajax and uses autoplay for the loaded content. You have to set fv_player_did_autoplay = false in your JavaScript instead.
|
357 |
+
* Bugfix - "audio" errors showing instead of "video" errors
|
358 |
+
|
359 |
+
= 6.1.4 - 2016/06/22 =
|
360 |
+
|
361 |
+
* Ads - close icon size increased and retina version provided
|
362 |
+
* Ajax loading - fix for repeated autoplay if your theme loads FV Player using Ajax and uses autoplay for the loaded content
|
363 |
+
* HLS.js - updated the core library to latest version
|
364 |
+
* Lightbox for image - fix srcset parsing when the first image is the biggest one
|
365 |
+
|
366 |
+
= 6.1.3 - 2017/06/12 =
|
367 |
+
|
368 |
+
* Fix for player loading for WPLMS users
|
369 |
+
|
370 |
+
= 6.1.2 - 2017/06/09 =
|
371 |
+
|
372 |
+
* MPEG-DASH - making sure the automated quality switching respects the player size
|
373 |
+
* Mobile - added "Mobile Settings" box with "Use native fullscreen on mobile" and "Force fullscreen on mobile" (beta) settings
|
374 |
+
* Subtitles - you can not select a single subtitle item for each video in playlist
|
375 |
+
|
376 |
+
= 6.1.1 - 2017/06/05 =
|
377 |
+
|
378 |
+
* Keyboard controls - setting left/right arrow keys to jump 5 seconds back/forward and Shift+n/p keys to go to next/previous playlist item. 'c' will cycle through the subtitles
|
379 |
+
|
380 |
+
= 6.1 - 2017/05/31 =
|
381 |
+
|
382 |
+
* Switching to a more sensible numbering - not using the core Flowplayer version number anymore
|
383 |
+
* Lightbox - moving CSS to another file for optimized loading speeds on mobile if only lightbox is used and no video is on page
|
384 |
+
* Bugfix - JavaScript warnings related to popups
|
385 |
+
* Bugfix - OptimizePress - making sure FV Player CSS loads after OptimizePress CSS
|
386 |
+
|
387 |
+
= 6.0.5.27 - 2017/05/25 =
|
388 |
+
|
389 |
+
* Bugfix - Autoplay breaking mobile playback!
|
390 |
+
|
391 |
+
= 6.0.5.26 - 2017/05/25 =
|
392 |
+
|
393 |
+
* CSS - if it's not loaded but JS is enqueued, we load CSS in footer - safety measure for weird pagebuilder themes.
|
394 |
+
|
395 |
+
= 6.0.5.25 - 2017/05/23 =
|
396 |
+
|
397 |
+
* Markup - getting rid of use of HTML5 video tag to unify the player code of single videos and video playlist
|
398 |
* CSS - moving FV Player stylesheet down to increase it's priority over the WP themes. Pro users need to upgrade FV Player Pro as well if they experience slight display issues.
|
399 |
+
* CSS - only loading if FV Player is found in the posts which are about to display or in any active widget or if there is some image for lightbox. In case of missing player styles use "Load FV Flowplayer JS everywhere" setting.
|
400 |
+
* Lightbox for images - supports srcset to make sure properly sizes images are loaded into lightbox view
|
401 |
+
* SEO - support for Schema.org markup, enable "Use Schema.org markup"
|
402 |
|
403 |
= 6.0.5.24 - 2017/05/09 =
|
404 |
|
1489 |
|
1490 |
== Upgrade Notice ==
|
1491 |
|
1492 |
+
= 6.1 =
|
1493 |
+
|
1494 |
+
* Make sure to clear your CDN of Minify cache after upgrading!
|
1495 |
+
|
1496 |
= 6.0.5.13 =
|
1497 |
|
1498 |
* New Shortcode Editor! Better looking, with improved workflow and video preview functionality.
|
view/admin.php
CHANGED
@@ -617,7 +617,9 @@ function fv_flowplayer_admin_integrations() {
|
|
617 |
</td>
|
618 |
</tr>-->
|
619 |
|
620 |
-
<?php $fv_fp->_get_checkbox(__('Use iframe embedding', 'fv-wordpress-flowplayer')
|
|
|
|
|
621 |
<?php $fv_fp->_get_checkbox(__('Add featured image automatically', 'fv-wordpress-flowplayer'), array( 'integrations', 'featured_img' ), __('If the featured image is not set, splash image of the first player will be used.', 'fv-wordpress-flowplayer') ); ?>
|
622 |
|
623 |
<?php do_action('fv_flowplayer_admin_integration_options_after'); ?>
|
@@ -630,6 +632,23 @@ function fv_flowplayer_admin_integrations() {
|
|
630 |
<?php
|
631 |
}
|
632 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
633 |
function fv_flowplayer_admin_select_popups($aArgs){
|
634 |
global $fv_fp;
|
635 |
|
@@ -1270,6 +1289,7 @@ add_meta_box( 'fv_flowplayer_description', ' ', 'fv_flowplayer_admin_description
|
|
1270 |
add_meta_box( 'fv_flowplayer_interface_options', __('Post Interface Options', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_interface_options', 'fv_flowplayer_settings', 'normal' );
|
1271 |
add_meta_box( 'fv_flowplayer_default_options', __('Sitewide FV Player Defaults', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_default_options', 'fv_flowplayer_settings', 'normal' );
|
1272 |
add_meta_box( 'fv_flowplayer_integrations', __('Integrations/Compatibility', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_integrations', 'fv_flowplayer_settings', 'normal' );
|
|
|
1273 |
if( !class_exists('FV_Player_Pro') ) {
|
1274 |
add_meta_box( 'fv_player_pro', __('Pro Features', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_pro', 'fv_flowplayer_settings', 'normal', 'low' );
|
1275 |
}
|
617 |
</td>
|
618 |
</tr>-->
|
619 |
|
620 |
+
<?php $fv_fp->_get_checkbox(__('Use iframe embedding', 'fv-wordpress-flowplayer'), array( 'integrations', 'embed_iframe' ), __('Beta version! New kind of embedding which supports all the features in embedded player.', 'fv-wordpress-flowplayer') ); ?>
|
621 |
+
<?php $fv_fp->_get_checkbox(__('Use Schema.org markup', 'fv-wordpress-flowplayer'), array( 'integrations', 'schema_org' ), __('Beta version! Adds the meta data information for google.', 'fv-wordpress-flowplayer') ); ?>
|
622 |
+
<?php $fv_fp->_get_checkbox(__('Use old code', 'fv-wordpress-flowplayer'), 'old_code', __('Check this option if your videos suddenly don\'t play and report the issues to <a href="https://foliovision.com/support">Foliovision Support Forums</a> please!', 'fv-wordpress-flowplayer') ); ?>
|
623 |
<?php $fv_fp->_get_checkbox(__('Add featured image automatically', 'fv-wordpress-flowplayer'), array( 'integrations', 'featured_img' ), __('If the featured image is not set, splash image of the first player will be used.', 'fv-wordpress-flowplayer') ); ?>
|
624 |
|
625 |
<?php do_action('fv_flowplayer_admin_integration_options_after'); ?>
|
632 |
<?php
|
633 |
}
|
634 |
|
635 |
+
|
636 |
+
function fv_flowplayer_admin_mobile() {
|
637 |
+
global $fv_fp;
|
638 |
+
?>
|
639 |
+
<table class="form-table2">
|
640 |
+
<?php $fv_fp->_get_checkbox(__('Use native fullscreen on mobile', 'fv-wordpress-flowplayer'), 'mobile_native_fullscreen', __('Stops popups, ads or subtitles from working, but provides faster interface. We set this for Android < 4.4 and iOS < 7 automatically.', 'fv-wordpress-flowplayer') ); ?>
|
641 |
+
<?php $fv_fp->_get_checkbox(__('Force fullscreen on mobile', 'fv-wordpress-flowplayer').' (beta)', 'mobile_force_fullscreen', __('Video playback will start in fullscreen. iPhone with iOS < 10 always forces fullscreen for video playback.', 'fv-wordpress-flowplayer') ); ?>
|
642 |
+
<tr>
|
643 |
+
<td colspan="4">
|
644 |
+
<input type="submit" name="fv-wp-flowplayer-submit" class="button-primary" value="<?php _e('Save All Changes', 'fv-wordpress-flowplayer'); ?>" />
|
645 |
+
</td>
|
646 |
+
</tr>
|
647 |
+
</table>
|
648 |
+
<?php
|
649 |
+
}
|
650 |
+
|
651 |
+
|
652 |
function fv_flowplayer_admin_select_popups($aArgs){
|
653 |
global $fv_fp;
|
654 |
|
1289 |
add_meta_box( 'fv_flowplayer_interface_options', __('Post Interface Options', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_interface_options', 'fv_flowplayer_settings', 'normal' );
|
1290 |
add_meta_box( 'fv_flowplayer_default_options', __('Sitewide FV Player Defaults', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_default_options', 'fv_flowplayer_settings', 'normal' );
|
1291 |
add_meta_box( 'fv_flowplayer_integrations', __('Integrations/Compatibility', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_integrations', 'fv_flowplayer_settings', 'normal' );
|
1292 |
+
add_meta_box( 'fv_flowplayer_mobile', __('Mobile Settings', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_mobile', 'fv_flowplayer_settings', 'normal' );
|
1293 |
if( !class_exists('FV_Player_Pro') ) {
|
1294 |
add_meta_box( 'fv_player_pro', __('Pro Features', 'fv-wordpress-flowplayer'), 'fv_flowplayer_admin_pro', 'fv_flowplayer_settings', 'normal', 'low' );
|
1295 |
}
|
view/wizard.php
CHANGED
@@ -333,7 +333,7 @@ var fv_flowplayer_set_post_thumbnail_nonce = '<?php echo wp_create_nonce( "set_p
|
|
333 |
<td colspan="2">
|
334 |
</td>
|
335 |
<td>
|
336 |
-
<a style="outline: 0" onclick="return fv_flowplayer_language_add(false, <?php echo ( isset($fv_flowplayer_conf["interface"]["playlist_captions"]) && $fv_flowplayer_conf["interface"]["playlist_captions"] == 'true' ) ? 'true' : 'false'; ?>)" class="partial-underline" href="#"><span class="add-subtitle-lang">+</span> <?php _e('Add Another Language', 'fv_flowplayer'); ?></a>
|
337 |
</td>
|
338 |
</tr>
|
339 |
<tr class="submit-button-wrapper">
|
333 |
<td colspan="2">
|
334 |
</td>
|
335 |
<td>
|
336 |
+
<a class="fv_flowplayer_language_add_link" style="outline: 0" onclick="return fv_flowplayer_language_add(false, <?php echo ( isset($fv_flowplayer_conf["interface"]["playlist_captions"]) && $fv_flowplayer_conf["interface"]["playlist_captions"] == 'true' ) ? 'true' : 'false'; ?>)" class="partial-underline" href="#"><span class="add-subtitle-lang">+</span> <?php _e('Add Another Language', 'fv_flowplayer'); ?></a>
|
337 |
</td>
|
338 |
</tr>
|
339 |
<tr class="submit-button-wrapper">
|