diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..08b2553 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 166b0b7..0000000 --- a/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Jan Prochazka - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/README.md b/README.md index 9b7faab..acdb39d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,27 @@ -# Julia player - -![julia-player](https://raw.githubusercontent.com/prochor666/julia-player/master/src/img/brand/julia-logo-128x128.png) - -Responsive, mobile first, HTML5 player with Flash fallback - +Julia player +============= + +How to establish devel environment. + +- Install Node.js. See [Node.js](https://nodejs.org/en/) for more. +- Install Gulp.js. See [Gulp.js](http://gulpjs.com/) for more. +- Install dependecies from gulpfile.js + - SASS package [gulp-sass](https://www.npmjs.com/package/gulp-sass) + - CSS minify package [gulp-clean-css](https://www.npmjs.com/package/gulp-clean-css) + - JavaScript minify package [gulp-minify](https://www.npmjs.com/package/gulp-minify) + - Concat package [gulp-concat](https://www.npmjs.com/package/gulp-concat) + - _optional_, _not-implemented_ Sourcemaps package [gulp-sourcemaps](https://www.npmjs.com/package/gulp-sourcemaps) + +How to start. + +Run: + +```bash +user@host:/your/devel/directory/julia# gulp watch +``` + +Now you can start typing in scss and js files. All needle files are generated on the fly. + +See the _gulp watch_ command console output for more info (error crashes, operation log, etc...). + +> Note that dist/css/ css files are generated automaticaly from src/scss, so do not edit. diff --git a/dist/css/ionicons.css b/dist/css/ionicons.css deleted file mode 100644 index f7678e3..0000000 --- a/dist/css/ionicons.css +++ /dev/null @@ -1,1480 +0,0 @@ -@charset "UTF-8"; -/*! - Ionicons, v2.0.0 - Created by Ben Sperry for the Ionic Framework, http://ionicons.com/ - https://twitter.com/benjsperry https://twitter.com/ionicframework - MIT License: https://github.com/driftyco/ionicons - - Android-style icons originally built by Google’s - Material Design Icons: https://github.com/google/material-design-icons - used under CC BY http://creativecommons.org/licenses/by/4.0/ - Modified icons to fit ionicon’s grid from original. -*/ -@font-face { font-family: "Ionicons"; src: url("../fonts/ionicons.eot?v=2.0.0"); src: url("../fonts/ionicons.eot?v=2.0.0#iefix") format("embedded-opentype"), url("../fonts/ionicons.ttf?v=2.0.0") format("truetype"), url("../fonts/ionicons.woff?v=2.0.0") format("woff"), url("../fonts/ionicons.svg?v=2.0.0#Ionicons") format("svg"); font-weight: normal; font-style: normal; } -.ion, .ionicons, .ion-alert:before, .ion-alert-circled:before, .ion-android-add:before, .ion-android-add-circle:before, .ion-android-alarm-clock:before, .ion-android-alert:before, .ion-android-apps:before, .ion-android-archive:before, .ion-android-arrow-back:before, .ion-android-arrow-down:before, .ion-android-arrow-dropdown:before, .ion-android-arrow-dropdown-circle:before, .ion-android-arrow-dropleft:before, .ion-android-arrow-dropleft-circle:before, .ion-android-arrow-dropright:before, .ion-android-arrow-dropright-circle:before, .ion-android-arrow-dropup:before, .ion-android-arrow-dropup-circle:before, .ion-android-arrow-forward:before, .ion-android-arrow-up:before, .ion-android-attach:before, .ion-android-bar:before, .ion-android-bicycle:before, .ion-android-boat:before, .ion-android-bookmark:before, .ion-android-bulb:before, .ion-android-bus:before, .ion-android-calendar:before, .ion-android-call:before, .ion-android-camera:before, .ion-android-cancel:before, .ion-android-car:before, .ion-android-cart:before, .ion-android-chat:before, .ion-android-checkbox:before, .ion-android-checkbox-blank:before, .ion-android-checkbox-outline:before, .ion-android-checkbox-outline-blank:before, .ion-android-checkmark-circle:before, .ion-android-clipboard:before, .ion-android-close:before, .ion-android-cloud:before, .ion-android-cloud-circle:before, .ion-android-cloud-done:before, .ion-android-cloud-outline:before, .ion-android-color-palette:before, .ion-android-compass:before, .ion-android-contact:before, .ion-android-contacts:before, .ion-android-contract:before, .ion-android-create:before, .ion-android-delete:before, .ion-android-desktop:before, .ion-android-document:before, .ion-android-done:before, .ion-android-done-all:before, .ion-android-download:before, .ion-android-drafts:before, .ion-android-exit:before, .ion-android-expand:before, .ion-android-favorite:before, .ion-android-favorite-outline:before, .ion-android-film:before, .ion-android-folder:before, .ion-android-folder-open:before, .ion-android-funnel:before, .ion-android-globe:before, .ion-android-hand:before, .ion-android-hangout:before, .ion-android-happy:before, .ion-android-home:before, .ion-android-image:before, .ion-android-laptop:before, .ion-android-list:before, .ion-android-locate:before, .ion-android-lock:before, .ion-android-mail:before, .ion-android-map:before, .ion-android-menu:before, .ion-android-microphone:before, .ion-android-microphone-off:before, .ion-android-more-horizontal:before, .ion-android-more-vertical:before, .ion-android-navigate:before, .ion-android-notifications:before, .ion-android-notifications-none:before, .ion-android-notifications-off:before, .ion-android-open:before, .ion-android-options:before, .ion-android-people:before, .ion-android-person:before, .ion-android-person-add:before, .ion-android-phone-landscape:before, .ion-android-phone-portrait:before, .ion-android-pin:before, .ion-android-plane:before, .ion-android-playstore:before, .ion-android-print:before, .ion-android-radio-button-off:before, .ion-android-radio-button-on:before, .ion-android-refresh:before, .ion-android-remove:before, .ion-android-remove-circle:before, .ion-android-restaurant:before, .ion-android-sad:before, .ion-android-search:before, .ion-android-send:before, .ion-android-settings:before, .ion-android-share:before, .ion-android-share-alt:before, .ion-android-star:before, .ion-android-star-half:before, .ion-android-star-outline:before, .ion-android-stopwatch:before, .ion-android-subway:before, .ion-android-sunny:before, .ion-android-sync:before, .ion-android-textsms:before, .ion-android-time:before, .ion-android-train:before, .ion-android-unlock:before, .ion-android-upload:before, .ion-android-volume-down:before, .ion-android-volume-mute:before, .ion-android-volume-off:before, .ion-android-volume-up:before, .ion-android-walk:before, .ion-android-warning:before, .ion-android-watch:before, .ion-android-wifi:before, .ion-aperture:before, .ion-archive:before, .ion-arrow-down-a:before, .ion-arrow-down-b:before, .ion-arrow-down-c:before, .ion-arrow-expand:before, .ion-arrow-graph-down-left:before, .ion-arrow-graph-down-right:before, .ion-arrow-graph-up-left:before, .ion-arrow-graph-up-right:before, .ion-arrow-left-a:before, .ion-arrow-left-b:before, .ion-arrow-left-c:before, .ion-arrow-move:before, .ion-arrow-resize:before, .ion-arrow-return-left:before, .ion-arrow-return-right:before, .ion-arrow-right-a:before, .ion-arrow-right-b:before, .ion-arrow-right-c:before, .ion-arrow-shrink:before, .ion-arrow-swap:before, .ion-arrow-up-a:before, .ion-arrow-up-b:before, .ion-arrow-up-c:before, .ion-asterisk:before, .ion-at:before, .ion-backspace:before, .ion-backspace-outline:before, .ion-bag:before, .ion-battery-charging:before, .ion-battery-empty:before, .ion-battery-full:before, .ion-battery-half:before, .ion-battery-low:before, .ion-beaker:before, .ion-beer:before, .ion-bluetooth:before, .ion-bonfire:before, .ion-bookmark:before, .ion-bowtie:before, .ion-briefcase:before, .ion-bug:before, .ion-calculator:before, .ion-calendar:before, .ion-camera:before, .ion-card:before, .ion-cash:before, .ion-chatbox:before, .ion-chatbox-working:before, .ion-chatboxes:before, .ion-chatbubble:before, .ion-chatbubble-working:before, .ion-chatbubbles:before, .ion-checkmark:before, .ion-checkmark-circled:before, .ion-checkmark-round:before, .ion-chevron-down:before, .ion-chevron-left:before, .ion-chevron-right:before, .ion-chevron-up:before, .ion-clipboard:before, .ion-clock:before, .ion-close:before, .ion-close-circled:before, .ion-close-round:before, .ion-closed-captioning:before, .ion-cloud:before, .ion-code:before, .ion-code-download:before, .ion-code-working:before, .ion-coffee:before, .ion-compass:before, .ion-compose:before, .ion-connection-bars:before, .ion-contrast:before, .ion-crop:before, .ion-cube:before, .ion-disc:before, .ion-document:before, .ion-document-text:before, .ion-drag:before, .ion-earth:before, .ion-easel:before, .ion-edit:before, .ion-egg:before, .ion-eject:before, .ion-email:before, .ion-email-unread:before, .ion-erlenmeyer-flask:before, .ion-erlenmeyer-flask-bubbles:before, .ion-eye:before, .ion-eye-disabled:before, .ion-female:before, .ion-filing:before, .ion-film-marker:before, .ion-fireball:before, .ion-flag:before, .ion-flame:before, .ion-flash:before, .ion-flash-off:before, .ion-folder:before, .ion-fork:before, .ion-fork-repo:before, .ion-forward:before, .ion-funnel:before, .ion-gear-a:before, .ion-gear-b:before, .ion-grid:before, .ion-hammer:before, .ion-happy:before, .ion-happy-outline:before, .ion-headphone:before, .ion-heart:before, .ion-heart-broken:before, .ion-help:before, .ion-help-buoy:before, .ion-help-circled:before, .ion-home:before, .ion-icecream:before, .ion-image:before, .ion-images:before, .ion-information:before, .ion-information-circled:before, .ion-ionic:before, .ion-ios-alarm:before, .ion-ios-alarm-outline:before, .ion-ios-albums:before, .ion-ios-albums-outline:before, .ion-ios-americanfootball:before, .ion-ios-americanfootball-outline:before, .ion-ios-analytics:before, .ion-ios-analytics-outline:before, .ion-ios-arrow-back:before, .ion-ios-arrow-down:before, .ion-ios-arrow-forward:before, .ion-ios-arrow-left:before, .ion-ios-arrow-right:before, .ion-ios-arrow-thin-down:before, .ion-ios-arrow-thin-left:before, .ion-ios-arrow-thin-right:before, .ion-ios-arrow-thin-up:before, .ion-ios-arrow-up:before, .ion-ios-at:before, .ion-ios-at-outline:before, .ion-ios-barcode:before, .ion-ios-barcode-outline:before, .ion-ios-baseball:before, .ion-ios-baseball-outline:before, .ion-ios-basketball:before, .ion-ios-basketball-outline:before, .ion-ios-bell:before, .ion-ios-bell-outline:before, .ion-ios-body:before, .ion-ios-body-outline:before, .ion-ios-bolt:before, .ion-ios-bolt-outline:before, .ion-ios-book:before, .ion-ios-book-outline:before, .ion-ios-bookmarks:before, .ion-ios-bookmarks-outline:before, .ion-ios-box:before, .ion-ios-box-outline:before, .ion-ios-briefcase:before, .ion-ios-briefcase-outline:before, .ion-ios-browsers:before, .ion-ios-browsers-outline:before, .ion-ios-calculator:before, .ion-ios-calculator-outline:before, .ion-ios-calendar:before, .ion-ios-calendar-outline:before, .ion-ios-camera:before, .ion-ios-camera-outline:before, .ion-ios-cart:before, .ion-ios-cart-outline:before, .ion-ios-chatboxes:before, .ion-ios-chatboxes-outline:before, .ion-ios-chatbubble:before, .ion-ios-chatbubble-outline:before, .ion-ios-checkmark:before, .ion-ios-checkmark-empty:before, .ion-ios-checkmark-outline:before, .ion-ios-circle-filled:before, .ion-ios-circle-outline:before, .ion-ios-clock:before, .ion-ios-clock-outline:before, .ion-ios-close:before, .ion-ios-close-empty:before, .ion-ios-close-outline:before, .ion-ios-cloud:before, .ion-ios-cloud-download:before, .ion-ios-cloud-download-outline:before, .ion-ios-cloud-outline:before, .ion-ios-cloud-upload:before, .ion-ios-cloud-upload-outline:before, .ion-ios-cloudy:before, .ion-ios-cloudy-night:before, .ion-ios-cloudy-night-outline:before, .ion-ios-cloudy-outline:before, .ion-ios-cog:before, .ion-ios-cog-outline:before, .ion-ios-color-filter:before, .ion-ios-color-filter-outline:before, .ion-ios-color-wand:before, .ion-ios-color-wand-outline:before, .ion-ios-compose:before, .ion-ios-compose-outline:before, .ion-ios-contact:before, .ion-ios-contact-outline:before, .ion-ios-copy:before, .ion-ios-copy-outline:before, .ion-ios-crop:before, .ion-ios-crop-strong:before, .ion-ios-download:before, .ion-ios-download-outline:before, .ion-ios-drag:before, .ion-ios-email:before, .ion-ios-email-outline:before, .ion-ios-eye:before, .ion-ios-eye-outline:before, .ion-ios-fastforward:before, .ion-ios-fastforward-outline:before, .ion-ios-filing:before, .ion-ios-filing-outline:before, .ion-ios-film:before, .ion-ios-film-outline:before, .ion-ios-flag:before, .ion-ios-flag-outline:before, .ion-ios-flame:before, .ion-ios-flame-outline:before, .ion-ios-flask:before, .ion-ios-flask-outline:before, .ion-ios-flower:before, .ion-ios-flower-outline:before, .ion-ios-folder:before, .ion-ios-folder-outline:before, .ion-ios-football:before, .ion-ios-football-outline:before, .ion-ios-game-controller-a:before, .ion-ios-game-controller-a-outline:before, .ion-ios-game-controller-b:before, .ion-ios-game-controller-b-outline:before, .ion-ios-gear:before, .ion-ios-gear-outline:before, .ion-ios-glasses:before, .ion-ios-glasses-outline:before, .ion-ios-grid-view:before, .ion-ios-grid-view-outline:before, .ion-ios-heart:before, .ion-ios-heart-outline:before, .ion-ios-help:before, .ion-ios-help-empty:before, .ion-ios-help-outline:before, .ion-ios-home:before, .ion-ios-home-outline:before, .ion-ios-infinite:before, .ion-ios-infinite-outline:before, .ion-ios-information:before, .ion-ios-information-empty:before, .ion-ios-information-outline:before, .ion-ios-ionic-outline:before, .ion-ios-keypad:before, .ion-ios-keypad-outline:before, .ion-ios-lightbulb:before, .ion-ios-lightbulb-outline:before, .ion-ios-list:before, .ion-ios-list-outline:before, .ion-ios-location:before, .ion-ios-location-outline:before, .ion-ios-locked:before, .ion-ios-locked-outline:before, .ion-ios-loop:before, .ion-ios-loop-strong:before, .ion-ios-medical:before, .ion-ios-medical-outline:before, .ion-ios-medkit:before, .ion-ios-medkit-outline:before, .ion-ios-mic:before, .ion-ios-mic-off:before, .ion-ios-mic-outline:before, .ion-ios-minus:before, .ion-ios-minus-empty:before, .ion-ios-minus-outline:before, .ion-ios-monitor:before, .ion-ios-monitor-outline:before, .ion-ios-moon:before, .ion-ios-moon-outline:before, .ion-ios-more:before, .ion-ios-more-outline:before, .ion-ios-musical-note:before, .ion-ios-musical-notes:before, .ion-ios-navigate:before, .ion-ios-navigate-outline:before, .ion-ios-nutrition:before, .ion-ios-nutrition-outline:before, .ion-ios-paper:before, .ion-ios-paper-outline:before, .ion-ios-paperplane:before, .ion-ios-paperplane-outline:before, .ion-ios-partlysunny:before, .ion-ios-partlysunny-outline:before, .ion-ios-pause:before, .ion-ios-pause-outline:before, .ion-ios-paw:before, .ion-ios-paw-outline:before, .ion-ios-people:before, .ion-ios-people-outline:before, .ion-ios-person:before, .ion-ios-person-outline:before, .ion-ios-personadd:before, .ion-ios-personadd-outline:before, .ion-ios-photos:before, .ion-ios-photos-outline:before, .ion-ios-pie:before, .ion-ios-pie-outline:before, .ion-ios-pint:before, .ion-ios-pint-outline:before, .ion-ios-play:before, .ion-ios-play-outline:before, .ion-ios-plus:before, .ion-ios-plus-empty:before, .ion-ios-plus-outline:before, .ion-ios-pricetag:before, .ion-ios-pricetag-outline:before, .ion-ios-pricetags:before, .ion-ios-pricetags-outline:before, .ion-ios-printer:before, .ion-ios-printer-outline:before, .ion-ios-pulse:before, .ion-ios-pulse-strong:before, .ion-ios-rainy:before, .ion-ios-rainy-outline:before, .ion-ios-recording:before, .ion-ios-recording-outline:before, .ion-ios-redo:before, .ion-ios-redo-outline:before, .ion-ios-refresh:before, .ion-ios-refresh-empty:before, .ion-ios-refresh-outline:before, .ion-ios-reload:before, .ion-ios-reverse-camera:before, .ion-ios-reverse-camera-outline:before, .ion-ios-rewind:before, .ion-ios-rewind-outline:before, .ion-ios-rose:before, .ion-ios-rose-outline:before, .ion-ios-search:before, .ion-ios-search-strong:before, .ion-ios-settings:before, .ion-ios-settings-strong:before, .ion-ios-shuffle:before, .ion-ios-shuffle-strong:before, .ion-ios-skipbackward:before, .ion-ios-skipbackward-outline:before, .ion-ios-skipforward:before, .ion-ios-skipforward-outline:before, .ion-ios-snowy:before, .ion-ios-speedometer:before, .ion-ios-speedometer-outline:before, .ion-ios-star:before, .ion-ios-star-half:before, .ion-ios-star-outline:before, .ion-ios-stopwatch:before, .ion-ios-stopwatch-outline:before, .ion-ios-sunny:before, .ion-ios-sunny-outline:before, .ion-ios-telephone:before, .ion-ios-telephone-outline:before, .ion-ios-tennisball:before, .ion-ios-tennisball-outline:before, .ion-ios-thunderstorm:before, .ion-ios-thunderstorm-outline:before, .ion-ios-time:before, .ion-ios-time-outline:before, .ion-ios-timer:before, .ion-ios-timer-outline:before, .ion-ios-toggle:before, .ion-ios-toggle-outline:before, .ion-ios-trash:before, .ion-ios-trash-outline:before, .ion-ios-undo:before, .ion-ios-undo-outline:before, .ion-ios-unlocked:before, .ion-ios-unlocked-outline:before, .ion-ios-upload:before, .ion-ios-upload-outline:before, .ion-ios-videocam:before, .ion-ios-videocam-outline:before, .ion-ios-volume-high:before, .ion-ios-volume-low:before, .ion-ios-wineglass:before, .ion-ios-wineglass-outline:before, .ion-ios-world:before, .ion-ios-world-outline:before, .ion-ipad:before, .ion-iphone:before, .ion-ipod:before, .ion-jet:before, .ion-key:before, .ion-knife:before, .ion-laptop:before, .ion-leaf:before, .ion-levels:before, .ion-lightbulb:before, .ion-link:before, .ion-load-a:before, .ion-load-b:before, .ion-load-c:before, .ion-load-d:before, .ion-location:before, .ion-lock-combination:before, .ion-locked:before, .ion-log-in:before, .ion-log-out:before, .ion-loop:before, .ion-magnet:before, .ion-male:before, .ion-man:before, .ion-map:before, .ion-medkit:before, .ion-merge:before, .ion-mic-a:before, .ion-mic-b:before, .ion-mic-c:before, .ion-minus:before, .ion-minus-circled:before, .ion-minus-round:before, .ion-model-s:before, .ion-monitor:before, .ion-more:before, .ion-mouse:before, .ion-music-note:before, .ion-navicon:before, .ion-navicon-round:before, .ion-navigate:before, .ion-network:before, .ion-no-smoking:before, .ion-nuclear:before, .ion-outlet:before, .ion-paintbrush:before, .ion-paintbucket:before, .ion-paper-airplane:before, .ion-paperclip:before, .ion-pause:before, .ion-person:before, .ion-person-add:before, .ion-person-stalker:before, .ion-pie-graph:before, .ion-pin:before, .ion-pinpoint:before, .ion-pizza:before, .ion-plane:before, .ion-planet:before, .ion-play:before, .ion-playstation:before, .ion-plus:before, .ion-plus-circled:before, .ion-plus-round:before, .ion-podium:before, .ion-pound:before, .ion-power:before, .ion-pricetag:before, .ion-pricetags:before, .ion-printer:before, .ion-pull-request:before, .ion-qr-scanner:before, .ion-quote:before, .ion-radio-waves:before, .ion-record:before, .ion-refresh:before, .ion-reply:before, .ion-reply-all:before, .ion-ribbon-a:before, .ion-ribbon-b:before, .ion-sad:before, .ion-sad-outline:before, .ion-scissors:before, .ion-search:before, .ion-settings:before, .ion-share:before, .ion-shuffle:before, .ion-skip-backward:before, .ion-skip-forward:before, .ion-social-android:before, .ion-social-android-outline:before, .ion-social-angular:before, .ion-social-angular-outline:before, .ion-social-apple:before, .ion-social-apple-outline:before, .ion-social-bitcoin:before, .ion-social-bitcoin-outline:before, .ion-social-buffer:before, .ion-social-buffer-outline:before, .ion-social-chrome:before, .ion-social-chrome-outline:before, .ion-social-codepen:before, .ion-social-codepen-outline:before, .ion-social-css3:before, .ion-social-css3-outline:before, .ion-social-designernews:before, .ion-social-designernews-outline:before, .ion-social-dribbble:before, .ion-social-dribbble-outline:before, .ion-social-dropbox:before, .ion-social-dropbox-outline:before, .ion-social-euro:before, .ion-social-euro-outline:before, .ion-social-facebook:before, .ion-social-facebook-outline:before, .ion-social-foursquare:before, .ion-social-foursquare-outline:before, .ion-social-freebsd-devil:before, .ion-social-github:before, .ion-social-github-outline:before, .ion-social-google:before, .ion-social-google-outline:before, .ion-social-googleplus:before, .ion-social-googleplus-outline:before, .ion-social-hackernews:before, .ion-social-hackernews-outline:before, .ion-social-html5:before, .ion-social-html5-outline:before, .ion-social-instagram:before, .ion-social-instagram-outline:before, .ion-social-javascript:before, .ion-social-javascript-outline:before, .ion-social-linkedin:before, .ion-social-linkedin-outline:before, .ion-social-markdown:before, .ion-social-nodejs:before, .ion-social-octocat:before, .ion-social-pinterest:before, .ion-social-pinterest-outline:before, .ion-social-python:before, .ion-social-reddit:before, .ion-social-reddit-outline:before, .ion-social-rss:before, .ion-social-rss-outline:before, .ion-social-sass:before, .ion-social-skype:before, .ion-social-skype-outline:before, .ion-social-snapchat:before, .ion-social-snapchat-outline:before, .ion-social-tumblr:before, .ion-social-tumblr-outline:before, .ion-social-tux:before, .ion-social-twitch:before, .ion-social-twitch-outline:before, .ion-social-twitter:before, .ion-social-twitter-outline:before, .ion-social-usd:before, .ion-social-usd-outline:before, .ion-social-vimeo:before, .ion-social-vimeo-outline:before, .ion-social-whatsapp:before, .ion-social-whatsapp-outline:before, .ion-social-windows:before, .ion-social-windows-outline:before, .ion-social-wordpress:before, .ion-social-wordpress-outline:before, .ion-social-yahoo:before, .ion-social-yahoo-outline:before, .ion-social-yen:before, .ion-social-yen-outline:before, .ion-social-youtube:before, .ion-social-youtube-outline:before, .ion-soup-can:before, .ion-soup-can-outline:before, .ion-speakerphone:before, .ion-speedometer:before, .ion-spoon:before, .ion-star:before, .ion-stats-bars:before, .ion-steam:before, .ion-stop:before, .ion-thermometer:before, .ion-thumbsdown:before, .ion-thumbsup:before, .ion-toggle:before, .ion-toggle-filled:before, .ion-transgender:before, .ion-trash-a:before, .ion-trash-b:before, .ion-trophy:before, .ion-tshirt:before, .ion-tshirt-outline:before, .ion-umbrella:before, .ion-university:before, .ion-unlocked:before, .ion-upload:before, .ion-usb:before, .ion-videocamera:before, .ion-volume-high:before, .ion-volume-low:before, .ion-volume-medium:before, .ion-volume-mute:before, .ion-wand:before, .ion-waterdrop:before, .ion-wifi:before, .ion-wineglass:before, .ion-woman:before, .ion-wrench:before, .ion-xbox:before { display: inline-block; font-family: "Ionicons"; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; text-rendering: auto; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - -.ion-alert:before { content: "\f101"; } - -.ion-alert-circled:before { content: "\f100"; } - -.ion-android-add:before { content: "\f2c7"; } - -.ion-android-add-circle:before { content: "\f359"; } - -.ion-android-alarm-clock:before { content: "\f35a"; } - -.ion-android-alert:before { content: "\f35b"; } - -.ion-android-apps:before { content: "\f35c"; } - -.ion-android-archive:before { content: "\f2c9"; } - -.ion-android-arrow-back:before { content: "\f2ca"; } - -.ion-android-arrow-down:before { content: "\f35d"; } - -.ion-android-arrow-dropdown:before { content: "\f35f"; } - -.ion-android-arrow-dropdown-circle:before { content: "\f35e"; } - -.ion-android-arrow-dropleft:before { content: "\f361"; } - -.ion-android-arrow-dropleft-circle:before { content: "\f360"; } - -.ion-android-arrow-dropright:before { content: "\f363"; } - -.ion-android-arrow-dropright-circle:before { content: "\f362"; } - -.ion-android-arrow-dropup:before { content: "\f365"; } - -.ion-android-arrow-dropup-circle:before { content: "\f364"; } - -.ion-android-arrow-forward:before { content: "\f30f"; } - -.ion-android-arrow-up:before { content: "\f366"; } - -.ion-android-attach:before { content: "\f367"; } - -.ion-android-bar:before { content: "\f368"; } - -.ion-android-bicycle:before { content: "\f369"; } - -.ion-android-boat:before { content: "\f36a"; } - -.ion-android-bookmark:before { content: "\f36b"; } - -.ion-android-bulb:before { content: "\f36c"; } - -.ion-android-bus:before { content: "\f36d"; } - -.ion-android-calendar:before { content: "\f2d1"; } - -.ion-android-call:before { content: "\f2d2"; } - -.ion-android-camera:before { content: "\f2d3"; } - -.ion-android-cancel:before { content: "\f36e"; } - -.ion-android-car:before { content: "\f36f"; } - -.ion-android-cart:before { content: "\f370"; } - -.ion-android-chat:before { content: "\f2d4"; } - -.ion-android-checkbox:before { content: "\f374"; } - -.ion-android-checkbox-blank:before { content: "\f371"; } - -.ion-android-checkbox-outline:before { content: "\f373"; } - -.ion-android-checkbox-outline-blank:before { content: "\f372"; } - -.ion-android-checkmark-circle:before { content: "\f375"; } - -.ion-android-clipboard:before { content: "\f376"; } - -.ion-android-close:before { content: "\f2d7"; } - -.ion-android-cloud:before { content: "\f37a"; } - -.ion-android-cloud-circle:before { content: "\f377"; } - -.ion-android-cloud-done:before { content: "\f378"; } - -.ion-android-cloud-outline:before { content: "\f379"; } - -.ion-android-color-palette:before { content: "\f37b"; } - -.ion-android-compass:before { content: "\f37c"; } - -.ion-android-contact:before { content: "\f2d8"; } - -.ion-android-contacts:before { content: "\f2d9"; } - -.ion-android-contract:before { content: "\f37d"; } - -.ion-android-create:before { content: "\f37e"; } - -.ion-android-delete:before { content: "\f37f"; } - -.ion-android-desktop:before { content: "\f380"; } - -.ion-android-document:before { content: "\f381"; } - -.ion-android-done:before { content: "\f383"; } - -.ion-android-done-all:before { content: "\f382"; } - -.ion-android-download:before { content: "\f2dd"; } - -.ion-android-drafts:before { content: "\f384"; } - -.ion-android-exit:before { content: "\f385"; } - -.ion-android-expand:before { content: "\f386"; } - -.ion-android-favorite:before { content: "\f388"; } - -.ion-android-favorite-outline:before { content: "\f387"; } - -.ion-android-film:before { content: "\f389"; } - -.ion-android-folder:before { content: "\f2e0"; } - -.ion-android-folder-open:before { content: "\f38a"; } - -.ion-android-funnel:before { content: "\f38b"; } - -.ion-android-globe:before { content: "\f38c"; } - -.ion-android-hand:before { content: "\f2e3"; } - -.ion-android-hangout:before { content: "\f38d"; } - -.ion-android-happy:before { content: "\f38e"; } - -.ion-android-home:before { content: "\f38f"; } - -.ion-android-image:before { content: "\f2e4"; } - -.ion-android-laptop:before { content: "\f390"; } - -.ion-android-list:before { content: "\f391"; } - -.ion-android-locate:before { content: "\f2e9"; } - -.ion-android-lock:before { content: "\f392"; } - -.ion-android-mail:before { content: "\f2eb"; } - -.ion-android-map:before { content: "\f393"; } - -.ion-android-menu:before { content: "\f394"; } - -.ion-android-microphone:before { content: "\f2ec"; } - -.ion-android-microphone-off:before { content: "\f395"; } - -.ion-android-more-horizontal:before { content: "\f396"; } - -.ion-android-more-vertical:before { content: "\f397"; } - -.ion-android-navigate:before { content: "\f398"; } - -.ion-android-notifications:before { content: "\f39b"; } - -.ion-android-notifications-none:before { content: "\f399"; } - -.ion-android-notifications-off:before { content: "\f39a"; } - -.ion-android-open:before { content: "\f39c"; } - -.ion-android-options:before { content: "\f39d"; } - -.ion-android-people:before { content: "\f39e"; } - -.ion-android-person:before { content: "\f3a0"; } - -.ion-android-person-add:before { content: "\f39f"; } - -.ion-android-phone-landscape:before { content: "\f3a1"; } - -.ion-android-phone-portrait:before { content: "\f3a2"; } - -.ion-android-pin:before { content: "\f3a3"; } - -.ion-android-plane:before { content: "\f3a4"; } - -.ion-android-playstore:before { content: "\f2f0"; } - -.ion-android-print:before { content: "\f3a5"; } - -.ion-android-radio-button-off:before { content: "\f3a6"; } - -.ion-android-radio-button-on:before { content: "\f3a7"; } - -.ion-android-refresh:before { content: "\f3a8"; } - -.ion-android-remove:before { content: "\f2f4"; } - -.ion-android-remove-circle:before { content: "\f3a9"; } - -.ion-android-restaurant:before { content: "\f3aa"; } - -.ion-android-sad:before { content: "\f3ab"; } - -.ion-android-search:before { content: "\f2f5"; } - -.ion-android-send:before { content: "\f2f6"; } - -.ion-android-settings:before { content: "\f2f7"; } - -.ion-android-share:before { content: "\f2f8"; } - -.ion-android-share-alt:before { content: "\f3ac"; } - -.ion-android-star:before { content: "\f2fc"; } - -.ion-android-star-half:before { content: "\f3ad"; } - -.ion-android-star-outline:before { content: "\f3ae"; } - -.ion-android-stopwatch:before { content: "\f2fd"; } - -.ion-android-subway:before { content: "\f3af"; } - -.ion-android-sunny:before { content: "\f3b0"; } - -.ion-android-sync:before { content: "\f3b1"; } - -.ion-android-textsms:before { content: "\f3b2"; } - -.ion-android-time:before { content: "\f3b3"; } - -.ion-android-train:before { content: "\f3b4"; } - -.ion-android-unlock:before { content: "\f3b5"; } - -.ion-android-upload:before { content: "\f3b6"; } - -.ion-android-volume-down:before { content: "\f3b7"; } - -.ion-android-volume-mute:before { content: "\f3b8"; } - -.ion-android-volume-off:before { content: "\f3b9"; } - -.ion-android-volume-up:before { content: "\f3ba"; } - -.ion-android-walk:before { content: "\f3bb"; } - -.ion-android-warning:before { content: "\f3bc"; } - -.ion-android-watch:before { content: "\f3bd"; } - -.ion-android-wifi:before { content: "\f305"; } - -.ion-aperture:before { content: "\f313"; } - -.ion-archive:before { content: "\f102"; } - -.ion-arrow-down-a:before { content: "\f103"; } - -.ion-arrow-down-b:before { content: "\f104"; } - -.ion-arrow-down-c:before { content: "\f105"; } - -.ion-arrow-expand:before { content: "\f25e"; } - -.ion-arrow-graph-down-left:before { content: "\f25f"; } - -.ion-arrow-graph-down-right:before { content: "\f260"; } - -.ion-arrow-graph-up-left:before { content: "\f261"; } - -.ion-arrow-graph-up-right:before { content: "\f262"; } - -.ion-arrow-left-a:before { content: "\f106"; } - -.ion-arrow-left-b:before { content: "\f107"; } - -.ion-arrow-left-c:before { content: "\f108"; } - -.ion-arrow-move:before { content: "\f263"; } - -.ion-arrow-resize:before { content: "\f264"; } - -.ion-arrow-return-left:before { content: "\f265"; } - -.ion-arrow-return-right:before { content: "\f266"; } - -.ion-arrow-right-a:before { content: "\f109"; } - -.ion-arrow-right-b:before { content: "\f10a"; } - -.ion-arrow-right-c:before { content: "\f10b"; } - -.ion-arrow-shrink:before { content: "\f267"; } - -.ion-arrow-swap:before { content: "\f268"; } - -.ion-arrow-up-a:before { content: "\f10c"; } - -.ion-arrow-up-b:before { content: "\f10d"; } - -.ion-arrow-up-c:before { content: "\f10e"; } - -.ion-asterisk:before { content: "\f314"; } - -.ion-at:before { content: "\f10f"; } - -.ion-backspace:before { content: "\f3bf"; } - -.ion-backspace-outline:before { content: "\f3be"; } - -.ion-bag:before { content: "\f110"; } - -.ion-battery-charging:before { content: "\f111"; } - -.ion-battery-empty:before { content: "\f112"; } - -.ion-battery-full:before { content: "\f113"; } - -.ion-battery-half:before { content: "\f114"; } - -.ion-battery-low:before { content: "\f115"; } - -.ion-beaker:before { content: "\f269"; } - -.ion-beer:before { content: "\f26a"; } - -.ion-bluetooth:before { content: "\f116"; } - -.ion-bonfire:before { content: "\f315"; } - -.ion-bookmark:before { content: "\f26b"; } - -.ion-bowtie:before { content: "\f3c0"; } - -.ion-briefcase:before { content: "\f26c"; } - -.ion-bug:before { content: "\f2be"; } - -.ion-calculator:before { content: "\f26d"; } - -.ion-calendar:before { content: "\f117"; } - -.ion-camera:before { content: "\f118"; } - -.ion-card:before { content: "\f119"; } - -.ion-cash:before { content: "\f316"; } - -.ion-chatbox:before { content: "\f11b"; } - -.ion-chatbox-working:before { content: "\f11a"; } - -.ion-chatboxes:before { content: "\f11c"; } - -.ion-chatbubble:before { content: "\f11e"; } - -.ion-chatbubble-working:before { content: "\f11d"; } - -.ion-chatbubbles:before { content: "\f11f"; } - -.ion-checkmark:before { content: "\f122"; } - -.ion-checkmark-circled:before { content: "\f120"; } - -.ion-checkmark-round:before { content: "\f121"; } - -.ion-chevron-down:before { content: "\f123"; } - -.ion-chevron-left:before { content: "\f124"; } - -.ion-chevron-right:before { content: "\f125"; } - -.ion-chevron-up:before { content: "\f126"; } - -.ion-clipboard:before { content: "\f127"; } - -.ion-clock:before { content: "\f26e"; } - -.ion-close:before { content: "\f12a"; } - -.ion-close-circled:before { content: "\f128"; } - -.ion-close-round:before { content: "\f129"; } - -.ion-closed-captioning:before { content: "\f317"; } - -.ion-cloud:before { content: "\f12b"; } - -.ion-code:before { content: "\f271"; } - -.ion-code-download:before { content: "\f26f"; } - -.ion-code-working:before { content: "\f270"; } - -.ion-coffee:before { content: "\f272"; } - -.ion-compass:before { content: "\f273"; } - -.ion-compose:before { content: "\f12c"; } - -.ion-connection-bars:before { content: "\f274"; } - -.ion-contrast:before { content: "\f275"; } - -.ion-crop:before { content: "\f3c1"; } - -.ion-cube:before { content: "\f318"; } - -.ion-disc:before { content: "\f12d"; } - -.ion-document:before { content: "\f12f"; } - -.ion-document-text:before { content: "\f12e"; } - -.ion-drag:before { content: "\f130"; } - -.ion-earth:before { content: "\f276"; } - -.ion-easel:before { content: "\f3c2"; } - -.ion-edit:before { content: "\f2bf"; } - -.ion-egg:before { content: "\f277"; } - -.ion-eject:before { content: "\f131"; } - -.ion-email:before { content: "\f132"; } - -.ion-email-unread:before { content: "\f3c3"; } - -.ion-erlenmeyer-flask:before { content: "\f3c5"; } - -.ion-erlenmeyer-flask-bubbles:before { content: "\f3c4"; } - -.ion-eye:before { content: "\f133"; } - -.ion-eye-disabled:before { content: "\f306"; } - -.ion-female:before { content: "\f278"; } - -.ion-filing:before { content: "\f134"; } - -.ion-film-marker:before { content: "\f135"; } - -.ion-fireball:before { content: "\f319"; } - -.ion-flag:before { content: "\f279"; } - -.ion-flame:before { content: "\f31a"; } - -.ion-flash:before { content: "\f137"; } - -.ion-flash-off:before { content: "\f136"; } - -.ion-folder:before { content: "\f139"; } - -.ion-fork:before { content: "\f27a"; } - -.ion-fork-repo:before { content: "\f2c0"; } - -.ion-forward:before { content: "\f13a"; } - -.ion-funnel:before { content: "\f31b"; } - -.ion-gear-a:before { content: "\f13d"; } - -.ion-gear-b:before { content: "\f13e"; } - -.ion-grid:before { content: "\f13f"; } - -.ion-hammer:before { content: "\f27b"; } - -.ion-happy:before { content: "\f31c"; } - -.ion-happy-outline:before { content: "\f3c6"; } - -.ion-headphone:before { content: "\f140"; } - -.ion-heart:before { content: "\f141"; } - -.ion-heart-broken:before { content: "\f31d"; } - -.ion-help:before { content: "\f143"; } - -.ion-help-buoy:before { content: "\f27c"; } - -.ion-help-circled:before { content: "\f142"; } - -.ion-home:before { content: "\f144"; } - -.ion-icecream:before { content: "\f27d"; } - -.ion-image:before { content: "\f147"; } - -.ion-images:before { content: "\f148"; } - -.ion-information:before { content: "\f14a"; } - -.ion-information-circled:before { content: "\f149"; } - -.ion-ionic:before { content: "\f14b"; } - -.ion-ios-alarm:before { content: "\f3c8"; } - -.ion-ios-alarm-outline:before { content: "\f3c7"; } - -.ion-ios-albums:before { content: "\f3ca"; } - -.ion-ios-albums-outline:before { content: "\f3c9"; } - -.ion-ios-americanfootball:before { content: "\f3cc"; } - -.ion-ios-americanfootball-outline:before { content: "\f3cb"; } - -.ion-ios-analytics:before { content: "\f3ce"; } - -.ion-ios-analytics-outline:before { content: "\f3cd"; } - -.ion-ios-arrow-back:before { content: "\f3cf"; } - -.ion-ios-arrow-down:before { content: "\f3d0"; } - -.ion-ios-arrow-forward:before { content: "\f3d1"; } - -.ion-ios-arrow-left:before { content: "\f3d2"; } - -.ion-ios-arrow-right:before { content: "\f3d3"; } - -.ion-ios-arrow-thin-down:before { content: "\f3d4"; } - -.ion-ios-arrow-thin-left:before { content: "\f3d5"; } - -.ion-ios-arrow-thin-right:before { content: "\f3d6"; } - -.ion-ios-arrow-thin-up:before { content: "\f3d7"; } - -.ion-ios-arrow-up:before { content: "\f3d8"; } - -.ion-ios-at:before { content: "\f3da"; } - -.ion-ios-at-outline:before { content: "\f3d9"; } - -.ion-ios-barcode:before { content: "\f3dc"; } - -.ion-ios-barcode-outline:before { content: "\f3db"; } - -.ion-ios-baseball:before { content: "\f3de"; } - -.ion-ios-baseball-outline:before { content: "\f3dd"; } - -.ion-ios-basketball:before { content: "\f3e0"; } - -.ion-ios-basketball-outline:before { content: "\f3df"; } - -.ion-ios-bell:before { content: "\f3e2"; } - -.ion-ios-bell-outline:before { content: "\f3e1"; } - -.ion-ios-body:before { content: "\f3e4"; } - -.ion-ios-body-outline:before { content: "\f3e3"; } - -.ion-ios-bolt:before { content: "\f3e6"; } - -.ion-ios-bolt-outline:before { content: "\f3e5"; } - -.ion-ios-book:before { content: "\f3e8"; } - -.ion-ios-book-outline:before { content: "\f3e7"; } - -.ion-ios-bookmarks:before { content: "\f3ea"; } - -.ion-ios-bookmarks-outline:before { content: "\f3e9"; } - -.ion-ios-box:before { content: "\f3ec"; } - -.ion-ios-box-outline:before { content: "\f3eb"; } - -.ion-ios-briefcase:before { content: "\f3ee"; } - -.ion-ios-briefcase-outline:before { content: "\f3ed"; } - -.ion-ios-browsers:before { content: "\f3f0"; } - -.ion-ios-browsers-outline:before { content: "\f3ef"; } - -.ion-ios-calculator:before { content: "\f3f2"; } - -.ion-ios-calculator-outline:before { content: "\f3f1"; } - -.ion-ios-calendar:before { content: "\f3f4"; } - -.ion-ios-calendar-outline:before { content: "\f3f3"; } - -.ion-ios-camera:before { content: "\f3f6"; } - -.ion-ios-camera-outline:before { content: "\f3f5"; } - -.ion-ios-cart:before { content: "\f3f8"; } - -.ion-ios-cart-outline:before { content: "\f3f7"; } - -.ion-ios-chatboxes:before { content: "\f3fa"; } - -.ion-ios-chatboxes-outline:before { content: "\f3f9"; } - -.ion-ios-chatbubble:before { content: "\f3fc"; } - -.ion-ios-chatbubble-outline:before { content: "\f3fb"; } - -.ion-ios-checkmark:before { content: "\f3ff"; } - -.ion-ios-checkmark-empty:before { content: "\f3fd"; } - -.ion-ios-checkmark-outline:before { content: "\f3fe"; } - -.ion-ios-circle-filled:before { content: "\f400"; } - -.ion-ios-circle-outline:before { content: "\f401"; } - -.ion-ios-clock:before { content: "\f403"; } - -.ion-ios-clock-outline:before { content: "\f402"; } - -.ion-ios-close:before { content: "\f406"; } - -.ion-ios-close-empty:before { content: "\f404"; } - -.ion-ios-close-outline:before { content: "\f405"; } - -.ion-ios-cloud:before { content: "\f40c"; } - -.ion-ios-cloud-download:before { content: "\f408"; } - -.ion-ios-cloud-download-outline:before { content: "\f407"; } - -.ion-ios-cloud-outline:before { content: "\f409"; } - -.ion-ios-cloud-upload:before { content: "\f40b"; } - -.ion-ios-cloud-upload-outline:before { content: "\f40a"; } - -.ion-ios-cloudy:before { content: "\f410"; } - -.ion-ios-cloudy-night:before { content: "\f40e"; } - -.ion-ios-cloudy-night-outline:before { content: "\f40d"; } - -.ion-ios-cloudy-outline:before { content: "\f40f"; } - -.ion-ios-cog:before { content: "\f412"; } - -.ion-ios-cog-outline:before { content: "\f411"; } - -.ion-ios-color-filter:before { content: "\f414"; } - -.ion-ios-color-filter-outline:before { content: "\f413"; } - -.ion-ios-color-wand:before { content: "\f416"; } - -.ion-ios-color-wand-outline:before { content: "\f415"; } - -.ion-ios-compose:before { content: "\f418"; } - -.ion-ios-compose-outline:before { content: "\f417"; } - -.ion-ios-contact:before { content: "\f41a"; } - -.ion-ios-contact-outline:before { content: "\f419"; } - -.ion-ios-copy:before { content: "\f41c"; } - -.ion-ios-copy-outline:before { content: "\f41b"; } - -.ion-ios-crop:before { content: "\f41e"; } - -.ion-ios-crop-strong:before { content: "\f41d"; } - -.ion-ios-download:before { content: "\f420"; } - -.ion-ios-download-outline:before { content: "\f41f"; } - -.ion-ios-drag:before { content: "\f421"; } - -.ion-ios-email:before { content: "\f423"; } - -.ion-ios-email-outline:before { content: "\f422"; } - -.ion-ios-eye:before { content: "\f425"; } - -.ion-ios-eye-outline:before { content: "\f424"; } - -.ion-ios-fastforward:before { content: "\f427"; } - -.ion-ios-fastforward-outline:before { content: "\f426"; } - -.ion-ios-filing:before { content: "\f429"; } - -.ion-ios-filing-outline:before { content: "\f428"; } - -.ion-ios-film:before { content: "\f42b"; } - -.ion-ios-film-outline:before { content: "\f42a"; } - -.ion-ios-flag:before { content: "\f42d"; } - -.ion-ios-flag-outline:before { content: "\f42c"; } - -.ion-ios-flame:before { content: "\f42f"; } - -.ion-ios-flame-outline:before { content: "\f42e"; } - -.ion-ios-flask:before { content: "\f431"; } - -.ion-ios-flask-outline:before { content: "\f430"; } - -.ion-ios-flower:before { content: "\f433"; } - -.ion-ios-flower-outline:before { content: "\f432"; } - -.ion-ios-folder:before { content: "\f435"; } - -.ion-ios-folder-outline:before { content: "\f434"; } - -.ion-ios-football:before { content: "\f437"; } - -.ion-ios-football-outline:before { content: "\f436"; } - -.ion-ios-game-controller-a:before { content: "\f439"; } - -.ion-ios-game-controller-a-outline:before { content: "\f438"; } - -.ion-ios-game-controller-b:before { content: "\f43b"; } - -.ion-ios-game-controller-b-outline:before { content: "\f43a"; } - -.ion-ios-gear:before { content: "\f43d"; } - -.ion-ios-gear-outline:before { content: "\f43c"; } - -.ion-ios-glasses:before { content: "\f43f"; } - -.ion-ios-glasses-outline:before { content: "\f43e"; } - -.ion-ios-grid-view:before { content: "\f441"; } - -.ion-ios-grid-view-outline:before { content: "\f440"; } - -.ion-ios-heart:before { content: "\f443"; } - -.ion-ios-heart-outline:before { content: "\f442"; } - -.ion-ios-help:before { content: "\f446"; } - -.ion-ios-help-empty:before { content: "\f444"; } - -.ion-ios-help-outline:before { content: "\f445"; } - -.ion-ios-home:before { content: "\f448"; } - -.ion-ios-home-outline:before { content: "\f447"; } - -.ion-ios-infinite:before { content: "\f44a"; } - -.ion-ios-infinite-outline:before { content: "\f449"; } - -.ion-ios-information:before { content: "\f44d"; } - -.ion-ios-information-empty:before { content: "\f44b"; } - -.ion-ios-information-outline:before { content: "\f44c"; } - -.ion-ios-ionic-outline:before { content: "\f44e"; } - -.ion-ios-keypad:before { content: "\f450"; } - -.ion-ios-keypad-outline:before { content: "\f44f"; } - -.ion-ios-lightbulb:before { content: "\f452"; } - -.ion-ios-lightbulb-outline:before { content: "\f451"; } - -.ion-ios-list:before { content: "\f454"; } - -.ion-ios-list-outline:before { content: "\f453"; } - -.ion-ios-location:before { content: "\f456"; } - -.ion-ios-location-outline:before { content: "\f455"; } - -.ion-ios-locked:before { content: "\f458"; } - -.ion-ios-locked-outline:before { content: "\f457"; } - -.ion-ios-loop:before { content: "\f45a"; } - -.ion-ios-loop-strong:before { content: "\f459"; } - -.ion-ios-medical:before { content: "\f45c"; } - -.ion-ios-medical-outline:before { content: "\f45b"; } - -.ion-ios-medkit:before { content: "\f45e"; } - -.ion-ios-medkit-outline:before { content: "\f45d"; } - -.ion-ios-mic:before { content: "\f461"; } - -.ion-ios-mic-off:before { content: "\f45f"; } - -.ion-ios-mic-outline:before { content: "\f460"; } - -.ion-ios-minus:before { content: "\f464"; } - -.ion-ios-minus-empty:before { content: "\f462"; } - -.ion-ios-minus-outline:before { content: "\f463"; } - -.ion-ios-monitor:before { content: "\f466"; } - -.ion-ios-monitor-outline:before { content: "\f465"; } - -.ion-ios-moon:before { content: "\f468"; } - -.ion-ios-moon-outline:before { content: "\f467"; } - -.ion-ios-more:before { content: "\f46a"; } - -.ion-ios-more-outline:before { content: "\f469"; } - -.ion-ios-musical-note:before { content: "\f46b"; } - -.ion-ios-musical-notes:before { content: "\f46c"; } - -.ion-ios-navigate:before { content: "\f46e"; } - -.ion-ios-navigate-outline:before { content: "\f46d"; } - -.ion-ios-nutrition:before { content: "\f470"; } - -.ion-ios-nutrition-outline:before { content: "\f46f"; } - -.ion-ios-paper:before { content: "\f472"; } - -.ion-ios-paper-outline:before { content: "\f471"; } - -.ion-ios-paperplane:before { content: "\f474"; } - -.ion-ios-paperplane-outline:before { content: "\f473"; } - -.ion-ios-partlysunny:before { content: "\f476"; } - -.ion-ios-partlysunny-outline:before { content: "\f475"; } - -.ion-ios-pause:before { content: "\f478"; } - -.ion-ios-pause-outline:before { content: "\f477"; } - -.ion-ios-paw:before { content: "\f47a"; } - -.ion-ios-paw-outline:before { content: "\f479"; } - -.ion-ios-people:before { content: "\f47c"; } - -.ion-ios-people-outline:before { content: "\f47b"; } - -.ion-ios-person:before { content: "\f47e"; } - -.ion-ios-person-outline:before { content: "\f47d"; } - -.ion-ios-personadd:before { content: "\f480"; } - -.ion-ios-personadd-outline:before { content: "\f47f"; } - -.ion-ios-photos:before { content: "\f482"; } - -.ion-ios-photos-outline:before { content: "\f481"; } - -.ion-ios-pie:before { content: "\f484"; } - -.ion-ios-pie-outline:before { content: "\f483"; } - -.ion-ios-pint:before { content: "\f486"; } - -.ion-ios-pint-outline:before { content: "\f485"; } - -.ion-ios-play:before { content: "\f488"; } - -.ion-ios-play-outline:before { content: "\f487"; } - -.ion-ios-plus:before { content: "\f48b"; } - -.ion-ios-plus-empty:before { content: "\f489"; } - -.ion-ios-plus-outline:before { content: "\f48a"; } - -.ion-ios-pricetag:before { content: "\f48d"; } - -.ion-ios-pricetag-outline:before { content: "\f48c"; } - -.ion-ios-pricetags:before { content: "\f48f"; } - -.ion-ios-pricetags-outline:before { content: "\f48e"; } - -.ion-ios-printer:before { content: "\f491"; } - -.ion-ios-printer-outline:before { content: "\f490"; } - -.ion-ios-pulse:before { content: "\f493"; } - -.ion-ios-pulse-strong:before { content: "\f492"; } - -.ion-ios-rainy:before { content: "\f495"; } - -.ion-ios-rainy-outline:before { content: "\f494"; } - -.ion-ios-recording:before { content: "\f497"; } - -.ion-ios-recording-outline:before { content: "\f496"; } - -.ion-ios-redo:before { content: "\f499"; } - -.ion-ios-redo-outline:before { content: "\f498"; } - -.ion-ios-refresh:before { content: "\f49c"; } - -.ion-ios-refresh-empty:before { content: "\f49a"; } - -.ion-ios-refresh-outline:before { content: "\f49b"; } - -.ion-ios-reload:before { content: "\f49d"; } - -.ion-ios-reverse-camera:before { content: "\f49f"; } - -.ion-ios-reverse-camera-outline:before { content: "\f49e"; } - -.ion-ios-rewind:before { content: "\f4a1"; } - -.ion-ios-rewind-outline:before { content: "\f4a0"; } - -.ion-ios-rose:before { content: "\f4a3"; } - -.ion-ios-rose-outline:before { content: "\f4a2"; } - -.ion-ios-search:before { content: "\f4a5"; } - -.ion-ios-search-strong:before { content: "\f4a4"; } - -.ion-ios-settings:before { content: "\f4a7"; } - -.ion-ios-settings-strong:before { content: "\f4a6"; } - -.ion-ios-shuffle:before { content: "\f4a9"; } - -.ion-ios-shuffle-strong:before { content: "\f4a8"; } - -.ion-ios-skipbackward:before { content: "\f4ab"; } - -.ion-ios-skipbackward-outline:before { content: "\f4aa"; } - -.ion-ios-skipforward:before { content: "\f4ad"; } - -.ion-ios-skipforward-outline:before { content: "\f4ac"; } - -.ion-ios-snowy:before { content: "\f4ae"; } - -.ion-ios-speedometer:before { content: "\f4b0"; } - -.ion-ios-speedometer-outline:before { content: "\f4af"; } - -.ion-ios-star:before { content: "\f4b3"; } - -.ion-ios-star-half:before { content: "\f4b1"; } - -.ion-ios-star-outline:before { content: "\f4b2"; } - -.ion-ios-stopwatch:before { content: "\f4b5"; } - -.ion-ios-stopwatch-outline:before { content: "\f4b4"; } - -.ion-ios-sunny:before { content: "\f4b7"; } - -.ion-ios-sunny-outline:before { content: "\f4b6"; } - -.ion-ios-telephone:before { content: "\f4b9"; } - -.ion-ios-telephone-outline:before { content: "\f4b8"; } - -.ion-ios-tennisball:before { content: "\f4bb"; } - -.ion-ios-tennisball-outline:before { content: "\f4ba"; } - -.ion-ios-thunderstorm:before { content: "\f4bd"; } - -.ion-ios-thunderstorm-outline:before { content: "\f4bc"; } - -.ion-ios-time:before { content: "\f4bf"; } - -.ion-ios-time-outline:before { content: "\f4be"; } - -.ion-ios-timer:before { content: "\f4c1"; } - -.ion-ios-timer-outline:before { content: "\f4c0"; } - -.ion-ios-toggle:before { content: "\f4c3"; } - -.ion-ios-toggle-outline:before { content: "\f4c2"; } - -.ion-ios-trash:before { content: "\f4c5"; } - -.ion-ios-trash-outline:before { content: "\f4c4"; } - -.ion-ios-undo:before { content: "\f4c7"; } - -.ion-ios-undo-outline:before { content: "\f4c6"; } - -.ion-ios-unlocked:before { content: "\f4c9"; } - -.ion-ios-unlocked-outline:before { content: "\f4c8"; } - -.ion-ios-upload:before { content: "\f4cb"; } - -.ion-ios-upload-outline:before { content: "\f4ca"; } - -.ion-ios-videocam:before { content: "\f4cd"; } - -.ion-ios-videocam-outline:before { content: "\f4cc"; } - -.ion-ios-volume-high:before { content: "\f4ce"; } - -.ion-ios-volume-low:before { content: "\f4cf"; } - -.ion-ios-wineglass:before { content: "\f4d1"; } - -.ion-ios-wineglass-outline:before { content: "\f4d0"; } - -.ion-ios-world:before { content: "\f4d3"; } - -.ion-ios-world-outline:before { content: "\f4d2"; } - -.ion-ipad:before { content: "\f1f9"; } - -.ion-iphone:before { content: "\f1fa"; } - -.ion-ipod:before { content: "\f1fb"; } - -.ion-jet:before { content: "\f295"; } - -.ion-key:before { content: "\f296"; } - -.ion-knife:before { content: "\f297"; } - -.ion-laptop:before { content: "\f1fc"; } - -.ion-leaf:before { content: "\f1fd"; } - -.ion-levels:before { content: "\f298"; } - -.ion-lightbulb:before { content: "\f299"; } - -.ion-link:before { content: "\f1fe"; } - -.ion-load-a:before { content: "\f29a"; } - -.ion-load-b:before { content: "\f29b"; } - -.ion-load-c:before { content: "\f29c"; } - -.ion-load-d:before { content: "\f29d"; } - -.ion-location:before { content: "\f1ff"; } - -.ion-lock-combination:before { content: "\f4d4"; } - -.ion-locked:before { content: "\f200"; } - -.ion-log-in:before { content: "\f29e"; } - -.ion-log-out:before { content: "\f29f"; } - -.ion-loop:before { content: "\f201"; } - -.ion-magnet:before { content: "\f2a0"; } - -.ion-male:before { content: "\f2a1"; } - -.ion-man:before { content: "\f202"; } - -.ion-map:before { content: "\f203"; } - -.ion-medkit:before { content: "\f2a2"; } - -.ion-merge:before { content: "\f33f"; } - -.ion-mic-a:before { content: "\f204"; } - -.ion-mic-b:before { content: "\f205"; } - -.ion-mic-c:before { content: "\f206"; } - -.ion-minus:before { content: "\f209"; } - -.ion-minus-circled:before { content: "\f207"; } - -.ion-minus-round:before { content: "\f208"; } - -.ion-model-s:before { content: "\f2c1"; } - -.ion-monitor:before { content: "\f20a"; } - -.ion-more:before { content: "\f20b"; } - -.ion-mouse:before { content: "\f340"; } - -.ion-music-note:before { content: "\f20c"; } - -.ion-navicon:before { content: "\f20e"; } - -.ion-navicon-round:before { content: "\f20d"; } - -.ion-navigate:before { content: "\f2a3"; } - -.ion-network:before { content: "\f341"; } - -.ion-no-smoking:before { content: "\f2c2"; } - -.ion-nuclear:before { content: "\f2a4"; } - -.ion-outlet:before { content: "\f342"; } - -.ion-paintbrush:before { content: "\f4d5"; } - -.ion-paintbucket:before { content: "\f4d6"; } - -.ion-paper-airplane:before { content: "\f2c3"; } - -.ion-paperclip:before { content: "\f20f"; } - -.ion-pause:before { content: "\f210"; } - -.ion-person:before { content: "\f213"; } - -.ion-person-add:before { content: "\f211"; } - -.ion-person-stalker:before { content: "\f212"; } - -.ion-pie-graph:before { content: "\f2a5"; } - -.ion-pin:before { content: "\f2a6"; } - -.ion-pinpoint:before { content: "\f2a7"; } - -.ion-pizza:before { content: "\f2a8"; } - -.ion-plane:before { content: "\f214"; } - -.ion-planet:before { content: "\f343"; } - -.ion-play:before { content: "\f215"; } - -.ion-playstation:before { content: "\f30a"; } - -.ion-plus:before { content: "\f218"; } - -.ion-plus-circled:before { content: "\f216"; } - -.ion-plus-round:before { content: "\f217"; } - -.ion-podium:before { content: "\f344"; } - -.ion-pound:before { content: "\f219"; } - -.ion-power:before { content: "\f2a9"; } - -.ion-pricetag:before { content: "\f2aa"; } - -.ion-pricetags:before { content: "\f2ab"; } - -.ion-printer:before { content: "\f21a"; } - -.ion-pull-request:before { content: "\f345"; } - -.ion-qr-scanner:before { content: "\f346"; } - -.ion-quote:before { content: "\f347"; } - -.ion-radio-waves:before { content: "\f2ac"; } - -.ion-record:before { content: "\f21b"; } - -.ion-refresh:before { content: "\f21c"; } - -.ion-reply:before { content: "\f21e"; } - -.ion-reply-all:before { content: "\f21d"; } - -.ion-ribbon-a:before { content: "\f348"; } - -.ion-ribbon-b:before { content: "\f349"; } - -.ion-sad:before { content: "\f34a"; } - -.ion-sad-outline:before { content: "\f4d7"; } - -.ion-scissors:before { content: "\f34b"; } - -.ion-search:before { content: "\f21f"; } - -.ion-settings:before { content: "\f2ad"; } - -.ion-share:before { content: "\f220"; } - -.ion-shuffle:before { content: "\f221"; } - -.ion-skip-backward:before { content: "\f222"; } - -.ion-skip-forward:before { content: "\f223"; } - -.ion-social-android:before { content: "\f225"; } - -.ion-social-android-outline:before { content: "\f224"; } - -.ion-social-angular:before { content: "\f4d9"; } - -.ion-social-angular-outline:before { content: "\f4d8"; } - -.ion-social-apple:before { content: "\f227"; } - -.ion-social-apple-outline:before { content: "\f226"; } - -.ion-social-bitcoin:before { content: "\f2af"; } - -.ion-social-bitcoin-outline:before { content: "\f2ae"; } - -.ion-social-buffer:before { content: "\f229"; } - -.ion-social-buffer-outline:before { content: "\f228"; } - -.ion-social-chrome:before { content: "\f4db"; } - -.ion-social-chrome-outline:before { content: "\f4da"; } - -.ion-social-codepen:before { content: "\f4dd"; } - -.ion-social-codepen-outline:before { content: "\f4dc"; } - -.ion-social-css3:before { content: "\f4df"; } - -.ion-social-css3-outline:before { content: "\f4de"; } - -.ion-social-designernews:before { content: "\f22b"; } - -.ion-social-designernews-outline:before { content: "\f22a"; } - -.ion-social-dribbble:before { content: "\f22d"; } - -.ion-social-dribbble-outline:before { content: "\f22c"; } - -.ion-social-dropbox:before { content: "\f22f"; } - -.ion-social-dropbox-outline:before { content: "\f22e"; } - -.ion-social-euro:before { content: "\f4e1"; } - -.ion-social-euro-outline:before { content: "\f4e0"; } - -.ion-social-facebook:before { content: "\f231"; } - -.ion-social-facebook-outline:before { content: "\f230"; } - -.ion-social-foursquare:before { content: "\f34d"; } - -.ion-social-foursquare-outline:before { content: "\f34c"; } - -.ion-social-freebsd-devil:before { content: "\f2c4"; } - -.ion-social-github:before { content: "\f233"; } - -.ion-social-github-outline:before { content: "\f232"; } - -.ion-social-google:before { content: "\f34f"; } - -.ion-social-google-outline:before { content: "\f34e"; } - -.ion-social-googleplus:before { content: "\f235"; } - -.ion-social-googleplus-outline:before { content: "\f234"; } - -.ion-social-hackernews:before { content: "\f237"; } - -.ion-social-hackernews-outline:before { content: "\f236"; } - -.ion-social-html5:before { content: "\f4e3"; } - -.ion-social-html5-outline:before { content: "\f4e2"; } - -.ion-social-instagram:before { content: "\f351"; } - -.ion-social-instagram-outline:before { content: "\f350"; } - -.ion-social-javascript:before { content: "\f4e5"; } - -.ion-social-javascript-outline:before { content: "\f4e4"; } - -.ion-social-linkedin:before { content: "\f239"; } - -.ion-social-linkedin-outline:before { content: "\f238"; } - -.ion-social-markdown:before { content: "\f4e6"; } - -.ion-social-nodejs:before { content: "\f4e7"; } - -.ion-social-octocat:before { content: "\f4e8"; } - -.ion-social-pinterest:before { content: "\f2b1"; } - -.ion-social-pinterest-outline:before { content: "\f2b0"; } - -.ion-social-python:before { content: "\f4e9"; } - -.ion-social-reddit:before { content: "\f23b"; } - -.ion-social-reddit-outline:before { content: "\f23a"; } - -.ion-social-rss:before { content: "\f23d"; } - -.ion-social-rss-outline:before { content: "\f23c"; } - -.ion-social-sass:before { content: "\f4ea"; } - -.ion-social-skype:before { content: "\f23f"; } - -.ion-social-skype-outline:before { content: "\f23e"; } - -.ion-social-snapchat:before { content: "\f4ec"; } - -.ion-social-snapchat-outline:before { content: "\f4eb"; } - -.ion-social-tumblr:before { content: "\f241"; } - -.ion-social-tumblr-outline:before { content: "\f240"; } - -.ion-social-tux:before { content: "\f2c5"; } - -.ion-social-twitch:before { content: "\f4ee"; } - -.ion-social-twitch-outline:before { content: "\f4ed"; } - -.ion-social-twitter:before { content: "\f243"; } - -.ion-social-twitter-outline:before { content: "\f242"; } - -.ion-social-usd:before { content: "\f353"; } - -.ion-social-usd-outline:before { content: "\f352"; } - -.ion-social-vimeo:before { content: "\f245"; } - -.ion-social-vimeo-outline:before { content: "\f244"; } - -.ion-social-whatsapp:before { content: "\f4f0"; } - -.ion-social-whatsapp-outline:before { content: "\f4ef"; } - -.ion-social-windows:before { content: "\f247"; } - -.ion-social-windows-outline:before { content: "\f246"; } - -.ion-social-wordpress:before { content: "\f249"; } - -.ion-social-wordpress-outline:before { content: "\f248"; } - -.ion-social-yahoo:before { content: "\f24b"; } - -.ion-social-yahoo-outline:before { content: "\f24a"; } - -.ion-social-yen:before { content: "\f4f2"; } - -.ion-social-yen-outline:before { content: "\f4f1"; } - -.ion-social-youtube:before { content: "\f24d"; } - -.ion-social-youtube-outline:before { content: "\f24c"; } - -.ion-soup-can:before { content: "\f4f4"; } - -.ion-soup-can-outline:before { content: "\f4f3"; } - -.ion-speakerphone:before { content: "\f2b2"; } - -.ion-speedometer:before { content: "\f2b3"; } - -.ion-spoon:before { content: "\f2b4"; } - -.ion-star:before { content: "\f24e"; } - -.ion-stats-bars:before { content: "\f2b5"; } - -.ion-steam:before { content: "\f30b"; } - -.ion-stop:before { content: "\f24f"; } - -.ion-thermometer:before { content: "\f2b6"; } - -.ion-thumbsdown:before { content: "\f250"; } - -.ion-thumbsup:before { content: "\f251"; } - -.ion-toggle:before { content: "\f355"; } - -.ion-toggle-filled:before { content: "\f354"; } - -.ion-transgender:before { content: "\f4f5"; } - -.ion-trash-a:before { content: "\f252"; } - -.ion-trash-b:before { content: "\f253"; } - -.ion-trophy:before { content: "\f356"; } - -.ion-tshirt:before { content: "\f4f7"; } - -.ion-tshirt-outline:before { content: "\f4f6"; } - -.ion-umbrella:before { content: "\f2b7"; } - -.ion-university:before { content: "\f357"; } - -.ion-unlocked:before { content: "\f254"; } - -.ion-upload:before { content: "\f255"; } - -.ion-usb:before { content: "\f2b8"; } - -.ion-videocamera:before { content: "\f256"; } - -.ion-volume-high:before { content: "\f257"; } - -.ion-volume-low:before { content: "\f258"; } - -.ion-volume-medium:before { content: "\f259"; } - -.ion-volume-mute:before { content: "\f25a"; } - -.ion-wand:before { content: "\f358"; } - -.ion-waterdrop:before { content: "\f25b"; } - -.ion-wifi:before { content: "\f25c"; } - -.ion-wineglass:before { content: "\f2b9"; } - -.ion-woman:before { content: "\f25d"; } - -.ion-wrench:before { content: "\f2ba"; } - -.ion-xbox:before { content: "\f30c"; } diff --git a/dist/css/ionicons.min.css b/dist/css/ionicons.min.css deleted file mode 100644 index cdbfa64..0000000 --- a/dist/css/ionicons.min.css +++ /dev/null @@ -1,11 +0,0 @@ -@charset "UTF-8";/*! - Ionicons, v2.0.0 - Created by Ben Sperry for the Ionic Framework, http://ionicons.com/ - https://twitter.com/benjsperry https://twitter.com/ionicframework - MIT License: https://github.com/driftyco/ionicons - - Android-style icons originally built by Google’s - Material Design Icons: https://github.com/google/material-design-icons - used under CC BY http://creativecommons.org/licenses/by/4.0/ - Modified icons to fit ionicon’s grid from original. -*/@font-face{font-family:"Ionicons";src:url("../fonts/ionicons.eot?v=2.0.0");src:url("../fonts/ionicons.eot?v=2.0.0#iefix") format("embedded-opentype"),url("../fonts/ionicons.ttf?v=2.0.0") format("truetype"),url("../fonts/ionicons.woff?v=2.0.0") format("woff"),url("../fonts/ionicons.svg?v=2.0.0#Ionicons") format("svg");font-weight:normal;font-style:normal}.ion,.ionicons,.ion-alert:before,.ion-alert-circled:before,.ion-android-add:before,.ion-android-add-circle:before,.ion-android-alarm-clock:before,.ion-android-alert:before,.ion-android-apps:before,.ion-android-archive:before,.ion-android-arrow-back:before,.ion-android-arrow-down:before,.ion-android-arrow-dropdown:before,.ion-android-arrow-dropdown-circle:before,.ion-android-arrow-dropleft:before,.ion-android-arrow-dropleft-circle:before,.ion-android-arrow-dropright:before,.ion-android-arrow-dropright-circle:before,.ion-android-arrow-dropup:before,.ion-android-arrow-dropup-circle:before,.ion-android-arrow-forward:before,.ion-android-arrow-up:before,.ion-android-attach:before,.ion-android-bar:before,.ion-android-bicycle:before,.ion-android-boat:before,.ion-android-bookmark:before,.ion-android-bulb:before,.ion-android-bus:before,.ion-android-calendar:before,.ion-android-call:before,.ion-android-camera:before,.ion-android-cancel:before,.ion-android-car:before,.ion-android-cart:before,.ion-android-chat:before,.ion-android-checkbox:before,.ion-android-checkbox-blank:before,.ion-android-checkbox-outline:before,.ion-android-checkbox-outline-blank:before,.ion-android-checkmark-circle:before,.ion-android-clipboard:before,.ion-android-close:before,.ion-android-cloud:before,.ion-android-cloud-circle:before,.ion-android-cloud-done:before,.ion-android-cloud-outline:before,.ion-android-color-palette:before,.ion-android-compass:before,.ion-android-contact:before,.ion-android-contacts:before,.ion-android-contract:before,.ion-android-create:before,.ion-android-delete:before,.ion-android-desktop:before,.ion-android-document:before,.ion-android-done:before,.ion-android-done-all:before,.ion-android-download:before,.ion-android-drafts:before,.ion-android-exit:before,.ion-android-expand:before,.ion-android-favorite:before,.ion-android-favorite-outline:before,.ion-android-film:before,.ion-android-folder:before,.ion-android-folder-open:before,.ion-android-funnel:before,.ion-android-globe:before,.ion-android-hand:before,.ion-android-hangout:before,.ion-android-happy:before,.ion-android-home:before,.ion-android-image:before,.ion-android-laptop:before,.ion-android-list:before,.ion-android-locate:before,.ion-android-lock:before,.ion-android-mail:before,.ion-android-map:before,.ion-android-menu:before,.ion-android-microphone:before,.ion-android-microphone-off:before,.ion-android-more-horizontal:before,.ion-android-more-vertical:before,.ion-android-navigate:before,.ion-android-notifications:before,.ion-android-notifications-none:before,.ion-android-notifications-off:before,.ion-android-open:before,.ion-android-options:before,.ion-android-people:before,.ion-android-person:before,.ion-android-person-add:before,.ion-android-phone-landscape:before,.ion-android-phone-portrait:before,.ion-android-pin:before,.ion-android-plane:before,.ion-android-playstore:before,.ion-android-print:before,.ion-android-radio-button-off:before,.ion-android-radio-button-on:before,.ion-android-refresh:before,.ion-android-remove:before,.ion-android-remove-circle:before,.ion-android-restaurant:before,.ion-android-sad:before,.ion-android-search:before,.ion-android-send:before,.ion-android-settings:before,.ion-android-share:before,.ion-android-share-alt:before,.ion-android-star:before,.ion-android-star-half:before,.ion-android-star-outline:before,.ion-android-stopwatch:before,.ion-android-subway:before,.ion-android-sunny:before,.ion-android-sync:before,.ion-android-textsms:before,.ion-android-time:before,.ion-android-train:before,.ion-android-unlock:before,.ion-android-upload:before,.ion-android-volume-down:before,.ion-android-volume-mute:before,.ion-android-volume-off:before,.ion-android-volume-up:before,.ion-android-walk:before,.ion-android-warning:before,.ion-android-watch:before,.ion-android-wifi:before,.ion-aperture:before,.ion-archive:before,.ion-arrow-down-a:before,.ion-arrow-down-b:before,.ion-arrow-down-c:before,.ion-arrow-expand:before,.ion-arrow-graph-down-left:before,.ion-arrow-graph-down-right:before,.ion-arrow-graph-up-left:before,.ion-arrow-graph-up-right:before,.ion-arrow-left-a:before,.ion-arrow-left-b:before,.ion-arrow-left-c:before,.ion-arrow-move:before,.ion-arrow-resize:before,.ion-arrow-return-left:before,.ion-arrow-return-right:before,.ion-arrow-right-a:before,.ion-arrow-right-b:before,.ion-arrow-right-c:before,.ion-arrow-shrink:before,.ion-arrow-swap:before,.ion-arrow-up-a:before,.ion-arrow-up-b:before,.ion-arrow-up-c:before,.ion-asterisk:before,.ion-at:before,.ion-backspace:before,.ion-backspace-outline:before,.ion-bag:before,.ion-battery-charging:before,.ion-battery-empty:before,.ion-battery-full:before,.ion-battery-half:before,.ion-battery-low:before,.ion-beaker:before,.ion-beer:before,.ion-bluetooth:before,.ion-bonfire:before,.ion-bookmark:before,.ion-bowtie:before,.ion-briefcase:before,.ion-bug:before,.ion-calculator:before,.ion-calendar:before,.ion-camera:before,.ion-card:before,.ion-cash:before,.ion-chatbox:before,.ion-chatbox-working:before,.ion-chatboxes:before,.ion-chatbubble:before,.ion-chatbubble-working:before,.ion-chatbubbles:before,.ion-checkmark:before,.ion-checkmark-circled:before,.ion-checkmark-round:before,.ion-chevron-down:before,.ion-chevron-left:before,.ion-chevron-right:before,.ion-chevron-up:before,.ion-clipboard:before,.ion-clock:before,.ion-close:before,.ion-close-circled:before,.ion-close-round:before,.ion-closed-captioning:before,.ion-cloud:before,.ion-code:before,.ion-code-download:before,.ion-code-working:before,.ion-coffee:before,.ion-compass:before,.ion-compose:before,.ion-connection-bars:before,.ion-contrast:before,.ion-crop:before,.ion-cube:before,.ion-disc:before,.ion-document:before,.ion-document-text:before,.ion-drag:before,.ion-earth:before,.ion-easel:before,.ion-edit:before,.ion-egg:before,.ion-eject:before,.ion-email:before,.ion-email-unread:before,.ion-erlenmeyer-flask:before,.ion-erlenmeyer-flask-bubbles:before,.ion-eye:before,.ion-eye-disabled:before,.ion-female:before,.ion-filing:before,.ion-film-marker:before,.ion-fireball:before,.ion-flag:before,.ion-flame:before,.ion-flash:before,.ion-flash-off:before,.ion-folder:before,.ion-fork:before,.ion-fork-repo:before,.ion-forward:before,.ion-funnel:before,.ion-gear-a:before,.ion-gear-b:before,.ion-grid:before,.ion-hammer:before,.ion-happy:before,.ion-happy-outline:before,.ion-headphone:before,.ion-heart:before,.ion-heart-broken:before,.ion-help:before,.ion-help-buoy:before,.ion-help-circled:before,.ion-home:before,.ion-icecream:before,.ion-image:before,.ion-images:before,.ion-information:before,.ion-information-circled:before,.ion-ionic:before,.ion-ios-alarm:before,.ion-ios-alarm-outline:before,.ion-ios-albums:before,.ion-ios-albums-outline:before,.ion-ios-americanfootball:before,.ion-ios-americanfootball-outline:before,.ion-ios-analytics:before,.ion-ios-analytics-outline:before,.ion-ios-arrow-back:before,.ion-ios-arrow-down:before,.ion-ios-arrow-forward:before,.ion-ios-arrow-left:before,.ion-ios-arrow-right:before,.ion-ios-arrow-thin-down:before,.ion-ios-arrow-thin-left:before,.ion-ios-arrow-thin-right:before,.ion-ios-arrow-thin-up:before,.ion-ios-arrow-up:before,.ion-ios-at:before,.ion-ios-at-outline:before,.ion-ios-barcode:before,.ion-ios-barcode-outline:before,.ion-ios-baseball:before,.ion-ios-baseball-outline:before,.ion-ios-basketball:before,.ion-ios-basketball-outline:before,.ion-ios-bell:before,.ion-ios-bell-outline:before,.ion-ios-body:before,.ion-ios-body-outline:before,.ion-ios-bolt:before,.ion-ios-bolt-outline:before,.ion-ios-book:before,.ion-ios-book-outline:before,.ion-ios-bookmarks:before,.ion-ios-bookmarks-outline:before,.ion-ios-box:before,.ion-ios-box-outline:before,.ion-ios-briefcase:before,.ion-ios-briefcase-outline:before,.ion-ios-browsers:before,.ion-ios-browsers-outline:before,.ion-ios-calculator:before,.ion-ios-calculator-outline:before,.ion-ios-calendar:before,.ion-ios-calendar-outline:before,.ion-ios-camera:before,.ion-ios-camera-outline:before,.ion-ios-cart:before,.ion-ios-cart-outline:before,.ion-ios-chatboxes:before,.ion-ios-chatboxes-outline:before,.ion-ios-chatbubble:before,.ion-ios-chatbubble-outline:before,.ion-ios-checkmark:before,.ion-ios-checkmark-empty:before,.ion-ios-checkmark-outline:before,.ion-ios-circle-filled:before,.ion-ios-circle-outline:before,.ion-ios-clock:before,.ion-ios-clock-outline:before,.ion-ios-close:before,.ion-ios-close-empty:before,.ion-ios-close-outline:before,.ion-ios-cloud:before,.ion-ios-cloud-download:before,.ion-ios-cloud-download-outline:before,.ion-ios-cloud-outline:before,.ion-ios-cloud-upload:before,.ion-ios-cloud-upload-outline:before,.ion-ios-cloudy:before,.ion-ios-cloudy-night:before,.ion-ios-cloudy-night-outline:before,.ion-ios-cloudy-outline:before,.ion-ios-cog:before,.ion-ios-cog-outline:before,.ion-ios-color-filter:before,.ion-ios-color-filter-outline:before,.ion-ios-color-wand:before,.ion-ios-color-wand-outline:before,.ion-ios-compose:before,.ion-ios-compose-outline:before,.ion-ios-contact:before,.ion-ios-contact-outline:before,.ion-ios-copy:before,.ion-ios-copy-outline:before,.ion-ios-crop:before,.ion-ios-crop-strong:before,.ion-ios-download:before,.ion-ios-download-outline:before,.ion-ios-drag:before,.ion-ios-email:before,.ion-ios-email-outline:before,.ion-ios-eye:before,.ion-ios-eye-outline:before,.ion-ios-fastforward:before,.ion-ios-fastforward-outline:before,.ion-ios-filing:before,.ion-ios-filing-outline:before,.ion-ios-film:before,.ion-ios-film-outline:before,.ion-ios-flag:before,.ion-ios-flag-outline:before,.ion-ios-flame:before,.ion-ios-flame-outline:before,.ion-ios-flask:before,.ion-ios-flask-outline:before,.ion-ios-flower:before,.ion-ios-flower-outline:before,.ion-ios-folder:before,.ion-ios-folder-outline:before,.ion-ios-football:before,.ion-ios-football-outline:before,.ion-ios-game-controller-a:before,.ion-ios-game-controller-a-outline:before,.ion-ios-game-controller-b:before,.ion-ios-game-controller-b-outline:before,.ion-ios-gear:before,.ion-ios-gear-outline:before,.ion-ios-glasses:before,.ion-ios-glasses-outline:before,.ion-ios-grid-view:before,.ion-ios-grid-view-outline:before,.ion-ios-heart:before,.ion-ios-heart-outline:before,.ion-ios-help:before,.ion-ios-help-empty:before,.ion-ios-help-outline:before,.ion-ios-home:before,.ion-ios-home-outline:before,.ion-ios-infinite:before,.ion-ios-infinite-outline:before,.ion-ios-information:before,.ion-ios-information-empty:before,.ion-ios-information-outline:before,.ion-ios-ionic-outline:before,.ion-ios-keypad:before,.ion-ios-keypad-outline:before,.ion-ios-lightbulb:before,.ion-ios-lightbulb-outline:before,.ion-ios-list:before,.ion-ios-list-outline:before,.ion-ios-location:before,.ion-ios-location-outline:before,.ion-ios-locked:before,.ion-ios-locked-outline:before,.ion-ios-loop:before,.ion-ios-loop-strong:before,.ion-ios-medical:before,.ion-ios-medical-outline:before,.ion-ios-medkit:before,.ion-ios-medkit-outline:before,.ion-ios-mic:before,.ion-ios-mic-off:before,.ion-ios-mic-outline:before,.ion-ios-minus:before,.ion-ios-minus-empty:before,.ion-ios-minus-outline:before,.ion-ios-monitor:before,.ion-ios-monitor-outline:before,.ion-ios-moon:before,.ion-ios-moon-outline:before,.ion-ios-more:before,.ion-ios-more-outline:before,.ion-ios-musical-note:before,.ion-ios-musical-notes:before,.ion-ios-navigate:before,.ion-ios-navigate-outline:before,.ion-ios-nutrition:before,.ion-ios-nutrition-outline:before,.ion-ios-paper:before,.ion-ios-paper-outline:before,.ion-ios-paperplane:before,.ion-ios-paperplane-outline:before,.ion-ios-partlysunny:before,.ion-ios-partlysunny-outline:before,.ion-ios-pause:before,.ion-ios-pause-outline:before,.ion-ios-paw:before,.ion-ios-paw-outline:before,.ion-ios-people:before,.ion-ios-people-outline:before,.ion-ios-person:before,.ion-ios-person-outline:before,.ion-ios-personadd:before,.ion-ios-personadd-outline:before,.ion-ios-photos:before,.ion-ios-photos-outline:before,.ion-ios-pie:before,.ion-ios-pie-outline:before,.ion-ios-pint:before,.ion-ios-pint-outline:before,.ion-ios-play:before,.ion-ios-play-outline:before,.ion-ios-plus:before,.ion-ios-plus-empty:before,.ion-ios-plus-outline:before,.ion-ios-pricetag:before,.ion-ios-pricetag-outline:before,.ion-ios-pricetags:before,.ion-ios-pricetags-outline:before,.ion-ios-printer:before,.ion-ios-printer-outline:before,.ion-ios-pulse:before,.ion-ios-pulse-strong:before,.ion-ios-rainy:before,.ion-ios-rainy-outline:before,.ion-ios-recording:before,.ion-ios-recording-outline:before,.ion-ios-redo:before,.ion-ios-redo-outline:before,.ion-ios-refresh:before,.ion-ios-refresh-empty:before,.ion-ios-refresh-outline:before,.ion-ios-reload:before,.ion-ios-reverse-camera:before,.ion-ios-reverse-camera-outline:before,.ion-ios-rewind:before,.ion-ios-rewind-outline:before,.ion-ios-rose:before,.ion-ios-rose-outline:before,.ion-ios-search:before,.ion-ios-search-strong:before,.ion-ios-settings:before,.ion-ios-settings-strong:before,.ion-ios-shuffle:before,.ion-ios-shuffle-strong:before,.ion-ios-skipbackward:before,.ion-ios-skipbackward-outline:before,.ion-ios-skipforward:before,.ion-ios-skipforward-outline:before,.ion-ios-snowy:before,.ion-ios-speedometer:before,.ion-ios-speedometer-outline:before,.ion-ios-star:before,.ion-ios-star-half:before,.ion-ios-star-outline:before,.ion-ios-stopwatch:before,.ion-ios-stopwatch-outline:before,.ion-ios-sunny:before,.ion-ios-sunny-outline:before,.ion-ios-telephone:before,.ion-ios-telephone-outline:before,.ion-ios-tennisball:before,.ion-ios-tennisball-outline:before,.ion-ios-thunderstorm:before,.ion-ios-thunderstorm-outline:before,.ion-ios-time:before,.ion-ios-time-outline:before,.ion-ios-timer:before,.ion-ios-timer-outline:before,.ion-ios-toggle:before,.ion-ios-toggle-outline:before,.ion-ios-trash:before,.ion-ios-trash-outline:before,.ion-ios-undo:before,.ion-ios-undo-outline:before,.ion-ios-unlocked:before,.ion-ios-unlocked-outline:before,.ion-ios-upload:before,.ion-ios-upload-outline:before,.ion-ios-videocam:before,.ion-ios-videocam-outline:before,.ion-ios-volume-high:before,.ion-ios-volume-low:before,.ion-ios-wineglass:before,.ion-ios-wineglass-outline:before,.ion-ios-world:before,.ion-ios-world-outline:before,.ion-ipad:before,.ion-iphone:before,.ion-ipod:before,.ion-jet:before,.ion-key:before,.ion-knife:before,.ion-laptop:before,.ion-leaf:before,.ion-levels:before,.ion-lightbulb:before,.ion-link:before,.ion-load-a:before,.ion-load-b:before,.ion-load-c:before,.ion-load-d:before,.ion-location:before,.ion-lock-combination:before,.ion-locked:before,.ion-log-in:before,.ion-log-out:before,.ion-loop:before,.ion-magnet:before,.ion-male:before,.ion-man:before,.ion-map:before,.ion-medkit:before,.ion-merge:before,.ion-mic-a:before,.ion-mic-b:before,.ion-mic-c:before,.ion-minus:before,.ion-minus-circled:before,.ion-minus-round:before,.ion-model-s:before,.ion-monitor:before,.ion-more:before,.ion-mouse:before,.ion-music-note:before,.ion-navicon:before,.ion-navicon-round:before,.ion-navigate:before,.ion-network:before,.ion-no-smoking:before,.ion-nuclear:before,.ion-outlet:before,.ion-paintbrush:before,.ion-paintbucket:before,.ion-paper-airplane:before,.ion-paperclip:before,.ion-pause:before,.ion-person:before,.ion-person-add:before,.ion-person-stalker:before,.ion-pie-graph:before,.ion-pin:before,.ion-pinpoint:before,.ion-pizza:before,.ion-plane:before,.ion-planet:before,.ion-play:before,.ion-playstation:before,.ion-plus:before,.ion-plus-circled:before,.ion-plus-round:before,.ion-podium:before,.ion-pound:before,.ion-power:before,.ion-pricetag:before,.ion-pricetags:before,.ion-printer:before,.ion-pull-request:before,.ion-qr-scanner:before,.ion-quote:before,.ion-radio-waves:before,.ion-record:before,.ion-refresh:before,.ion-reply:before,.ion-reply-all:before,.ion-ribbon-a:before,.ion-ribbon-b:before,.ion-sad:before,.ion-sad-outline:before,.ion-scissors:before,.ion-search:before,.ion-settings:before,.ion-share:before,.ion-shuffle:before,.ion-skip-backward:before,.ion-skip-forward:before,.ion-social-android:before,.ion-social-android-outline:before,.ion-social-angular:before,.ion-social-angular-outline:before,.ion-social-apple:before,.ion-social-apple-outline:before,.ion-social-bitcoin:before,.ion-social-bitcoin-outline:before,.ion-social-buffer:before,.ion-social-buffer-outline:before,.ion-social-chrome:before,.ion-social-chrome-outline:before,.ion-social-codepen:before,.ion-social-codepen-outline:before,.ion-social-css3:before,.ion-social-css3-outline:before,.ion-social-designernews:before,.ion-social-designernews-outline:before,.ion-social-dribbble:before,.ion-social-dribbble-outline:before,.ion-social-dropbox:before,.ion-social-dropbox-outline:before,.ion-social-euro:before,.ion-social-euro-outline:before,.ion-social-facebook:before,.ion-social-facebook-outline:before,.ion-social-foursquare:before,.ion-social-foursquare-outline:before,.ion-social-freebsd-devil:before,.ion-social-github:before,.ion-social-github-outline:before,.ion-social-google:before,.ion-social-google-outline:before,.ion-social-googleplus:before,.ion-social-googleplus-outline:before,.ion-social-hackernews:before,.ion-social-hackernews-outline:before,.ion-social-html5:before,.ion-social-html5-outline:before,.ion-social-instagram:before,.ion-social-instagram-outline:before,.ion-social-javascript:before,.ion-social-javascript-outline:before,.ion-social-linkedin:before,.ion-social-linkedin-outline:before,.ion-social-markdown:before,.ion-social-nodejs:before,.ion-social-octocat:before,.ion-social-pinterest:before,.ion-social-pinterest-outline:before,.ion-social-python:before,.ion-social-reddit:before,.ion-social-reddit-outline:before,.ion-social-rss:before,.ion-social-rss-outline:before,.ion-social-sass:before,.ion-social-skype:before,.ion-social-skype-outline:before,.ion-social-snapchat:before,.ion-social-snapchat-outline:before,.ion-social-tumblr:before,.ion-social-tumblr-outline:before,.ion-social-tux:before,.ion-social-twitch:before,.ion-social-twitch-outline:before,.ion-social-twitter:before,.ion-social-twitter-outline:before,.ion-social-usd:before,.ion-social-usd-outline:before,.ion-social-vimeo:before,.ion-social-vimeo-outline:before,.ion-social-whatsapp:before,.ion-social-whatsapp-outline:before,.ion-social-windows:before,.ion-social-windows-outline:before,.ion-social-wordpress:before,.ion-social-wordpress-outline:before,.ion-social-yahoo:before,.ion-social-yahoo-outline:before,.ion-social-yen:before,.ion-social-yen-outline:before,.ion-social-youtube:before,.ion-social-youtube-outline:before,.ion-soup-can:before,.ion-soup-can-outline:before,.ion-speakerphone:before,.ion-speedometer:before,.ion-spoon:before,.ion-star:before,.ion-stats-bars:before,.ion-steam:before,.ion-stop:before,.ion-thermometer:before,.ion-thumbsdown:before,.ion-thumbsup:before,.ion-toggle:before,.ion-toggle-filled:before,.ion-transgender:before,.ion-trash-a:before,.ion-trash-b:before,.ion-trophy:before,.ion-tshirt:before,.ion-tshirt-outline:before,.ion-umbrella:before,.ion-university:before,.ion-unlocked:before,.ion-upload:before,.ion-usb:before,.ion-videocamera:before,.ion-volume-high:before,.ion-volume-low:before,.ion-volume-medium:before,.ion-volume-mute:before,.ion-wand:before,.ion-waterdrop:before,.ion-wifi:before,.ion-wineglass:before,.ion-woman:before,.ion-wrench:before,.ion-xbox:before{display:inline-block;font-family:"Ionicons";speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;text-rendering:auto;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ion-alert:before{content:"\f101"}.ion-alert-circled:before{content:"\f100"}.ion-android-add:before{content:"\f2c7"}.ion-android-add-circle:before{content:"\f359"}.ion-android-alarm-clock:before{content:"\f35a"}.ion-android-alert:before{content:"\f35b"}.ion-android-apps:before{content:"\f35c"}.ion-android-archive:before{content:"\f2c9"}.ion-android-arrow-back:before{content:"\f2ca"}.ion-android-arrow-down:before{content:"\f35d"}.ion-android-arrow-dropdown:before{content:"\f35f"}.ion-android-arrow-dropdown-circle:before{content:"\f35e"}.ion-android-arrow-dropleft:before{content:"\f361"}.ion-android-arrow-dropleft-circle:before{content:"\f360"}.ion-android-arrow-dropright:before{content:"\f363"}.ion-android-arrow-dropright-circle:before{content:"\f362"}.ion-android-arrow-dropup:before{content:"\f365"}.ion-android-arrow-dropup-circle:before{content:"\f364"}.ion-android-arrow-forward:before{content:"\f30f"}.ion-android-arrow-up:before{content:"\f366"}.ion-android-attach:before{content:"\f367"}.ion-android-bar:before{content:"\f368"}.ion-android-bicycle:before{content:"\f369"}.ion-android-boat:before{content:"\f36a"}.ion-android-bookmark:before{content:"\f36b"}.ion-android-bulb:before{content:"\f36c"}.ion-android-bus:before{content:"\f36d"}.ion-android-calendar:before{content:"\f2d1"}.ion-android-call:before{content:"\f2d2"}.ion-android-camera:before{content:"\f2d3"}.ion-android-cancel:before{content:"\f36e"}.ion-android-car:before{content:"\f36f"}.ion-android-cart:before{content:"\f370"}.ion-android-chat:before{content:"\f2d4"}.ion-android-checkbox:before{content:"\f374"}.ion-android-checkbox-blank:before{content:"\f371"}.ion-android-checkbox-outline:before{content:"\f373"}.ion-android-checkbox-outline-blank:before{content:"\f372"}.ion-android-checkmark-circle:before{content:"\f375"}.ion-android-clipboard:before{content:"\f376"}.ion-android-close:before{content:"\f2d7"}.ion-android-cloud:before{content:"\f37a"}.ion-android-cloud-circle:before{content:"\f377"}.ion-android-cloud-done:before{content:"\f378"}.ion-android-cloud-outline:before{content:"\f379"}.ion-android-color-palette:before{content:"\f37b"}.ion-android-compass:before{content:"\f37c"}.ion-android-contact:before{content:"\f2d8"}.ion-android-contacts:before{content:"\f2d9"}.ion-android-contract:before{content:"\f37d"}.ion-android-create:before{content:"\f37e"}.ion-android-delete:before{content:"\f37f"}.ion-android-desktop:before{content:"\f380"}.ion-android-document:before{content:"\f381"}.ion-android-done:before{content:"\f383"}.ion-android-done-all:before{content:"\f382"}.ion-android-download:before{content:"\f2dd"}.ion-android-drafts:before{content:"\f384"}.ion-android-exit:before{content:"\f385"}.ion-android-expand:before{content:"\f386"}.ion-android-favorite:before{content:"\f388"}.ion-android-favorite-outline:before{content:"\f387"}.ion-android-film:before{content:"\f389"}.ion-android-folder:before{content:"\f2e0"}.ion-android-folder-open:before{content:"\f38a"}.ion-android-funnel:before{content:"\f38b"}.ion-android-globe:before{content:"\f38c"}.ion-android-hand:before{content:"\f2e3"}.ion-android-hangout:before{content:"\f38d"}.ion-android-happy:before{content:"\f38e"}.ion-android-home:before{content:"\f38f"}.ion-android-image:before{content:"\f2e4"}.ion-android-laptop:before{content:"\f390"}.ion-android-list:before{content:"\f391"}.ion-android-locate:before{content:"\f2e9"}.ion-android-lock:before{content:"\f392"}.ion-android-mail:before{content:"\f2eb"}.ion-android-map:before{content:"\f393"}.ion-android-menu:before{content:"\f394"}.ion-android-microphone:before{content:"\f2ec"}.ion-android-microphone-off:before{content:"\f395"}.ion-android-more-horizontal:before{content:"\f396"}.ion-android-more-vertical:before{content:"\f397"}.ion-android-navigate:before{content:"\f398"}.ion-android-notifications:before{content:"\f39b"}.ion-android-notifications-none:before{content:"\f399"}.ion-android-notifications-off:before{content:"\f39a"}.ion-android-open:before{content:"\f39c"}.ion-android-options:before{content:"\f39d"}.ion-android-people:before{content:"\f39e"}.ion-android-person:before{content:"\f3a0"}.ion-android-person-add:before{content:"\f39f"}.ion-android-phone-landscape:before{content:"\f3a1"}.ion-android-phone-portrait:before{content:"\f3a2"}.ion-android-pin:before{content:"\f3a3"}.ion-android-plane:before{content:"\f3a4"}.ion-android-playstore:before{content:"\f2f0"}.ion-android-print:before{content:"\f3a5"}.ion-android-radio-button-off:before{content:"\f3a6"}.ion-android-radio-button-on:before{content:"\f3a7"}.ion-android-refresh:before{content:"\f3a8"}.ion-android-remove:before{content:"\f2f4"}.ion-android-remove-circle:before{content:"\f3a9"}.ion-android-restaurant:before{content:"\f3aa"}.ion-android-sad:before{content:"\f3ab"}.ion-android-search:before{content:"\f2f5"}.ion-android-send:before{content:"\f2f6"}.ion-android-settings:before{content:"\f2f7"}.ion-android-share:before{content:"\f2f8"}.ion-android-share-alt:before{content:"\f3ac"}.ion-android-star:before{content:"\f2fc"}.ion-android-star-half:before{content:"\f3ad"}.ion-android-star-outline:before{content:"\f3ae"}.ion-android-stopwatch:before{content:"\f2fd"}.ion-android-subway:before{content:"\f3af"}.ion-android-sunny:before{content:"\f3b0"}.ion-android-sync:before{content:"\f3b1"}.ion-android-textsms:before{content:"\f3b2"}.ion-android-time:before{content:"\f3b3"}.ion-android-train:before{content:"\f3b4"}.ion-android-unlock:before{content:"\f3b5"}.ion-android-upload:before{content:"\f3b6"}.ion-android-volume-down:before{content:"\f3b7"}.ion-android-volume-mute:before{content:"\f3b8"}.ion-android-volume-off:before{content:"\f3b9"}.ion-android-volume-up:before{content:"\f3ba"}.ion-android-walk:before{content:"\f3bb"}.ion-android-warning:before{content:"\f3bc"}.ion-android-watch:before{content:"\f3bd"}.ion-android-wifi:before{content:"\f305"}.ion-aperture:before{content:"\f313"}.ion-archive:before{content:"\f102"}.ion-arrow-down-a:before{content:"\f103"}.ion-arrow-down-b:before{content:"\f104"}.ion-arrow-down-c:before{content:"\f105"}.ion-arrow-expand:before{content:"\f25e"}.ion-arrow-graph-down-left:before{content:"\f25f"}.ion-arrow-graph-down-right:before{content:"\f260"}.ion-arrow-graph-up-left:before{content:"\f261"}.ion-arrow-graph-up-right:before{content:"\f262"}.ion-arrow-left-a:before{content:"\f106"}.ion-arrow-left-b:before{content:"\f107"}.ion-arrow-left-c:before{content:"\f108"}.ion-arrow-move:before{content:"\f263"}.ion-arrow-resize:before{content:"\f264"}.ion-arrow-return-left:before{content:"\f265"}.ion-arrow-return-right:before{content:"\f266"}.ion-arrow-right-a:before{content:"\f109"}.ion-arrow-right-b:before{content:"\f10a"}.ion-arrow-right-c:before{content:"\f10b"}.ion-arrow-shrink:before{content:"\f267"}.ion-arrow-swap:before{content:"\f268"}.ion-arrow-up-a:before{content:"\f10c"}.ion-arrow-up-b:before{content:"\f10d"}.ion-arrow-up-c:before{content:"\f10e"}.ion-asterisk:before{content:"\f314"}.ion-at:before{content:"\f10f"}.ion-backspace:before{content:"\f3bf"}.ion-backspace-outline:before{content:"\f3be"}.ion-bag:before{content:"\f110"}.ion-battery-charging:before{content:"\f111"}.ion-battery-empty:before{content:"\f112"}.ion-battery-full:before{content:"\f113"}.ion-battery-half:before{content:"\f114"}.ion-battery-low:before{content:"\f115"}.ion-beaker:before{content:"\f269"}.ion-beer:before{content:"\f26a"}.ion-bluetooth:before{content:"\f116"}.ion-bonfire:before{content:"\f315"}.ion-bookmark:before{content:"\f26b"}.ion-bowtie:before{content:"\f3c0"}.ion-briefcase:before{content:"\f26c"}.ion-bug:before{content:"\f2be"}.ion-calculator:before{content:"\f26d"}.ion-calendar:before{content:"\f117"}.ion-camera:before{content:"\f118"}.ion-card:before{content:"\f119"}.ion-cash:before{content:"\f316"}.ion-chatbox:before{content:"\f11b"}.ion-chatbox-working:before{content:"\f11a"}.ion-chatboxes:before{content:"\f11c"}.ion-chatbubble:before{content:"\f11e"}.ion-chatbubble-working:before{content:"\f11d"}.ion-chatbubbles:before{content:"\f11f"}.ion-checkmark:before{content:"\f122"}.ion-checkmark-circled:before{content:"\f120"}.ion-checkmark-round:before{content:"\f121"}.ion-chevron-down:before{content:"\f123"}.ion-chevron-left:before{content:"\f124"}.ion-chevron-right:before{content:"\f125"}.ion-chevron-up:before{content:"\f126"}.ion-clipboard:before{content:"\f127"}.ion-clock:before{content:"\f26e"}.ion-close:before{content:"\f12a"}.ion-close-circled:before{content:"\f128"}.ion-close-round:before{content:"\f129"}.ion-closed-captioning:before{content:"\f317"}.ion-cloud:before{content:"\f12b"}.ion-code:before{content:"\f271"}.ion-code-download:before{content:"\f26f"}.ion-code-working:before{content:"\f270"}.ion-coffee:before{content:"\f272"}.ion-compass:before{content:"\f273"}.ion-compose:before{content:"\f12c"}.ion-connection-bars:before{content:"\f274"}.ion-contrast:before{content:"\f275"}.ion-crop:before{content:"\f3c1"}.ion-cube:before{content:"\f318"}.ion-disc:before{content:"\f12d"}.ion-document:before{content:"\f12f"}.ion-document-text:before{content:"\f12e"}.ion-drag:before{content:"\f130"}.ion-earth:before{content:"\f276"}.ion-easel:before{content:"\f3c2"}.ion-edit:before{content:"\f2bf"}.ion-egg:before{content:"\f277"}.ion-eject:before{content:"\f131"}.ion-email:before{content:"\f132"}.ion-email-unread:before{content:"\f3c3"}.ion-erlenmeyer-flask:before{content:"\f3c5"}.ion-erlenmeyer-flask-bubbles:before{content:"\f3c4"}.ion-eye:before{content:"\f133"}.ion-eye-disabled:before{content:"\f306"}.ion-female:before{content:"\f278"}.ion-filing:before{content:"\f134"}.ion-film-marker:before{content:"\f135"}.ion-fireball:before{content:"\f319"}.ion-flag:before{content:"\f279"}.ion-flame:before{content:"\f31a"}.ion-flash:before{content:"\f137"}.ion-flash-off:before{content:"\f136"}.ion-folder:before{content:"\f139"}.ion-fork:before{content:"\f27a"}.ion-fork-repo:before{content:"\f2c0"}.ion-forward:before{content:"\f13a"}.ion-funnel:before{content:"\f31b"}.ion-gear-a:before{content:"\f13d"}.ion-gear-b:before{content:"\f13e"}.ion-grid:before{content:"\f13f"}.ion-hammer:before{content:"\f27b"}.ion-happy:before{content:"\f31c"}.ion-happy-outline:before{content:"\f3c6"}.ion-headphone:before{content:"\f140"}.ion-heart:before{content:"\f141"}.ion-heart-broken:before{content:"\f31d"}.ion-help:before{content:"\f143"}.ion-help-buoy:before{content:"\f27c"}.ion-help-circled:before{content:"\f142"}.ion-home:before{content:"\f144"}.ion-icecream:before{content:"\f27d"}.ion-image:before{content:"\f147"}.ion-images:before{content:"\f148"}.ion-information:before{content:"\f14a"}.ion-information-circled:before{content:"\f149"}.ion-ionic:before{content:"\f14b"}.ion-ios-alarm:before{content:"\f3c8"}.ion-ios-alarm-outline:before{content:"\f3c7"}.ion-ios-albums:before{content:"\f3ca"}.ion-ios-albums-outline:before{content:"\f3c9"}.ion-ios-americanfootball:before{content:"\f3cc"}.ion-ios-americanfootball-outline:before{content:"\f3cb"}.ion-ios-analytics:before{content:"\f3ce"}.ion-ios-analytics-outline:before{content:"\f3cd"}.ion-ios-arrow-back:before{content:"\f3cf"}.ion-ios-arrow-down:before{content:"\f3d0"}.ion-ios-arrow-forward:before{content:"\f3d1"}.ion-ios-arrow-left:before{content:"\f3d2"}.ion-ios-arrow-right:before{content:"\f3d3"}.ion-ios-arrow-thin-down:before{content:"\f3d4"}.ion-ios-arrow-thin-left:before{content:"\f3d5"}.ion-ios-arrow-thin-right:before{content:"\f3d6"}.ion-ios-arrow-thin-up:before{content:"\f3d7"}.ion-ios-arrow-up:before{content:"\f3d8"}.ion-ios-at:before{content:"\f3da"}.ion-ios-at-outline:before{content:"\f3d9"}.ion-ios-barcode:before{content:"\f3dc"}.ion-ios-barcode-outline:before{content:"\f3db"}.ion-ios-baseball:before{content:"\f3de"}.ion-ios-baseball-outline:before{content:"\f3dd"}.ion-ios-basketball:before{content:"\f3e0"}.ion-ios-basketball-outline:before{content:"\f3df"}.ion-ios-bell:before{content:"\f3e2"}.ion-ios-bell-outline:before{content:"\f3e1"}.ion-ios-body:before{content:"\f3e4"}.ion-ios-body-outline:before{content:"\f3e3"}.ion-ios-bolt:before{content:"\f3e6"}.ion-ios-bolt-outline:before{content:"\f3e5"}.ion-ios-book:before{content:"\f3e8"}.ion-ios-book-outline:before{content:"\f3e7"}.ion-ios-bookmarks:before{content:"\f3ea"}.ion-ios-bookmarks-outline:before{content:"\f3e9"}.ion-ios-box:before{content:"\f3ec"}.ion-ios-box-outline:before{content:"\f3eb"}.ion-ios-briefcase:before{content:"\f3ee"}.ion-ios-briefcase-outline:before{content:"\f3ed"}.ion-ios-browsers:before{content:"\f3f0"}.ion-ios-browsers-outline:before{content:"\f3ef"}.ion-ios-calculator:before{content:"\f3f2"}.ion-ios-calculator-outline:before{content:"\f3f1"}.ion-ios-calendar:before{content:"\f3f4"}.ion-ios-calendar-outline:before{content:"\f3f3"}.ion-ios-camera:before{content:"\f3f6"}.ion-ios-camera-outline:before{content:"\f3f5"}.ion-ios-cart:before{content:"\f3f8"}.ion-ios-cart-outline:before{content:"\f3f7"}.ion-ios-chatboxes:before{content:"\f3fa"}.ion-ios-chatboxes-outline:before{content:"\f3f9"}.ion-ios-chatbubble:before{content:"\f3fc"}.ion-ios-chatbubble-outline:before{content:"\f3fb"}.ion-ios-checkmark:before{content:"\f3ff"}.ion-ios-checkmark-empty:before{content:"\f3fd"}.ion-ios-checkmark-outline:before{content:"\f3fe"}.ion-ios-circle-filled:before{content:"\f400"}.ion-ios-circle-outline:before{content:"\f401"}.ion-ios-clock:before{content:"\f403"}.ion-ios-clock-outline:before{content:"\f402"}.ion-ios-close:before{content:"\f406"}.ion-ios-close-empty:before{content:"\f404"}.ion-ios-close-outline:before{content:"\f405"}.ion-ios-cloud:before{content:"\f40c"}.ion-ios-cloud-download:before{content:"\f408"}.ion-ios-cloud-download-outline:before{content:"\f407"}.ion-ios-cloud-outline:before{content:"\f409"}.ion-ios-cloud-upload:before{content:"\f40b"}.ion-ios-cloud-upload-outline:before{content:"\f40a"}.ion-ios-cloudy:before{content:"\f410"}.ion-ios-cloudy-night:before{content:"\f40e"}.ion-ios-cloudy-night-outline:before{content:"\f40d"}.ion-ios-cloudy-outline:before{content:"\f40f"}.ion-ios-cog:before{content:"\f412"}.ion-ios-cog-outline:before{content:"\f411"}.ion-ios-color-filter:before{content:"\f414"}.ion-ios-color-filter-outline:before{content:"\f413"}.ion-ios-color-wand:before{content:"\f416"}.ion-ios-color-wand-outline:before{content:"\f415"}.ion-ios-compose:before{content:"\f418"}.ion-ios-compose-outline:before{content:"\f417"}.ion-ios-contact:before{content:"\f41a"}.ion-ios-contact-outline:before{content:"\f419"}.ion-ios-copy:before{content:"\f41c"}.ion-ios-copy-outline:before{content:"\f41b"}.ion-ios-crop:before{content:"\f41e"}.ion-ios-crop-strong:before{content:"\f41d"}.ion-ios-download:before{content:"\f420"}.ion-ios-download-outline:before{content:"\f41f"}.ion-ios-drag:before{content:"\f421"}.ion-ios-email:before{content:"\f423"}.ion-ios-email-outline:before{content:"\f422"}.ion-ios-eye:before{content:"\f425"}.ion-ios-eye-outline:before{content:"\f424"}.ion-ios-fastforward:before{content:"\f427"}.ion-ios-fastforward-outline:before{content:"\f426"}.ion-ios-filing:before{content:"\f429"}.ion-ios-filing-outline:before{content:"\f428"}.ion-ios-film:before{content:"\f42b"}.ion-ios-film-outline:before{content:"\f42a"}.ion-ios-flag:before{content:"\f42d"}.ion-ios-flag-outline:before{content:"\f42c"}.ion-ios-flame:before{content:"\f42f"}.ion-ios-flame-outline:before{content:"\f42e"}.ion-ios-flask:before{content:"\f431"}.ion-ios-flask-outline:before{content:"\f430"}.ion-ios-flower:before{content:"\f433"}.ion-ios-flower-outline:before{content:"\f432"}.ion-ios-folder:before{content:"\f435"}.ion-ios-folder-outline:before{content:"\f434"}.ion-ios-football:before{content:"\f437"}.ion-ios-football-outline:before{content:"\f436"}.ion-ios-game-controller-a:before{content:"\f439"}.ion-ios-game-controller-a-outline:before{content:"\f438"}.ion-ios-game-controller-b:before{content:"\f43b"}.ion-ios-game-controller-b-outline:before{content:"\f43a"}.ion-ios-gear:before{content:"\f43d"}.ion-ios-gear-outline:before{content:"\f43c"}.ion-ios-glasses:before{content:"\f43f"}.ion-ios-glasses-outline:before{content:"\f43e"}.ion-ios-grid-view:before{content:"\f441"}.ion-ios-grid-view-outline:before{content:"\f440"}.ion-ios-heart:before{content:"\f443"}.ion-ios-heart-outline:before{content:"\f442"}.ion-ios-help:before{content:"\f446"}.ion-ios-help-empty:before{content:"\f444"}.ion-ios-help-outline:before{content:"\f445"}.ion-ios-home:before{content:"\f448"}.ion-ios-home-outline:before{content:"\f447"}.ion-ios-infinite:before{content:"\f44a"}.ion-ios-infinite-outline:before{content:"\f449"}.ion-ios-information:before{content:"\f44d"}.ion-ios-information-empty:before{content:"\f44b"}.ion-ios-information-outline:before{content:"\f44c"}.ion-ios-ionic-outline:before{content:"\f44e"}.ion-ios-keypad:before{content:"\f450"}.ion-ios-keypad-outline:before{content:"\f44f"}.ion-ios-lightbulb:before{content:"\f452"}.ion-ios-lightbulb-outline:before{content:"\f451"}.ion-ios-list:before{content:"\f454"}.ion-ios-list-outline:before{content:"\f453"}.ion-ios-location:before{content:"\f456"}.ion-ios-location-outline:before{content:"\f455"}.ion-ios-locked:before{content:"\f458"}.ion-ios-locked-outline:before{content:"\f457"}.ion-ios-loop:before{content:"\f45a"}.ion-ios-loop-strong:before{content:"\f459"}.ion-ios-medical:before{content:"\f45c"}.ion-ios-medical-outline:before{content:"\f45b"}.ion-ios-medkit:before{content:"\f45e"}.ion-ios-medkit-outline:before{content:"\f45d"}.ion-ios-mic:before{content:"\f461"}.ion-ios-mic-off:before{content:"\f45f"}.ion-ios-mic-outline:before{content:"\f460"}.ion-ios-minus:before{content:"\f464"}.ion-ios-minus-empty:before{content:"\f462"}.ion-ios-minus-outline:before{content:"\f463"}.ion-ios-monitor:before{content:"\f466"}.ion-ios-monitor-outline:before{content:"\f465"}.ion-ios-moon:before{content:"\f468"}.ion-ios-moon-outline:before{content:"\f467"}.ion-ios-more:before{content:"\f46a"}.ion-ios-more-outline:before{content:"\f469"}.ion-ios-musical-note:before{content:"\f46b"}.ion-ios-musical-notes:before{content:"\f46c"}.ion-ios-navigate:before{content:"\f46e"}.ion-ios-navigate-outline:before{content:"\f46d"}.ion-ios-nutrition:before{content:"\f470"}.ion-ios-nutrition-outline:before{content:"\f46f"}.ion-ios-paper:before{content:"\f472"}.ion-ios-paper-outline:before{content:"\f471"}.ion-ios-paperplane:before{content:"\f474"}.ion-ios-paperplane-outline:before{content:"\f473"}.ion-ios-partlysunny:before{content:"\f476"}.ion-ios-partlysunny-outline:before{content:"\f475"}.ion-ios-pause:before{content:"\f478"}.ion-ios-pause-outline:before{content:"\f477"}.ion-ios-paw:before{content:"\f47a"}.ion-ios-paw-outline:before{content:"\f479"}.ion-ios-people:before{content:"\f47c"}.ion-ios-people-outline:before{content:"\f47b"}.ion-ios-person:before{content:"\f47e"}.ion-ios-person-outline:before{content:"\f47d"}.ion-ios-personadd:before{content:"\f480"}.ion-ios-personadd-outline:before{content:"\f47f"}.ion-ios-photos:before{content:"\f482"}.ion-ios-photos-outline:before{content:"\f481"}.ion-ios-pie:before{content:"\f484"}.ion-ios-pie-outline:before{content:"\f483"}.ion-ios-pint:before{content:"\f486"}.ion-ios-pint-outline:before{content:"\f485"}.ion-ios-play:before{content:"\f488"}.ion-ios-play-outline:before{content:"\f487"}.ion-ios-plus:before{content:"\f48b"}.ion-ios-plus-empty:before{content:"\f489"}.ion-ios-plus-outline:before{content:"\f48a"}.ion-ios-pricetag:before{content:"\f48d"}.ion-ios-pricetag-outline:before{content:"\f48c"}.ion-ios-pricetags:before{content:"\f48f"}.ion-ios-pricetags-outline:before{content:"\f48e"}.ion-ios-printer:before{content:"\f491"}.ion-ios-printer-outline:before{content:"\f490"}.ion-ios-pulse:before{content:"\f493"}.ion-ios-pulse-strong:before{content:"\f492"}.ion-ios-rainy:before{content:"\f495"}.ion-ios-rainy-outline:before{content:"\f494"}.ion-ios-recording:before{content:"\f497"}.ion-ios-recording-outline:before{content:"\f496"}.ion-ios-redo:before{content:"\f499"}.ion-ios-redo-outline:before{content:"\f498"}.ion-ios-refresh:before{content:"\f49c"}.ion-ios-refresh-empty:before{content:"\f49a"}.ion-ios-refresh-outline:before{content:"\f49b"}.ion-ios-reload:before{content:"\f49d"}.ion-ios-reverse-camera:before{content:"\f49f"}.ion-ios-reverse-camera-outline:before{content:"\f49e"}.ion-ios-rewind:before{content:"\f4a1"}.ion-ios-rewind-outline:before{content:"\f4a0"}.ion-ios-rose:before{content:"\f4a3"}.ion-ios-rose-outline:before{content:"\f4a2"}.ion-ios-search:before{content:"\f4a5"}.ion-ios-search-strong:before{content:"\f4a4"}.ion-ios-settings:before{content:"\f4a7"}.ion-ios-settings-strong:before{content:"\f4a6"}.ion-ios-shuffle:before{content:"\f4a9"}.ion-ios-shuffle-strong:before{content:"\f4a8"}.ion-ios-skipbackward:before{content:"\f4ab"}.ion-ios-skipbackward-outline:before{content:"\f4aa"}.ion-ios-skipforward:before{content:"\f4ad"}.ion-ios-skipforward-outline:before{content:"\f4ac"}.ion-ios-snowy:before{content:"\f4ae"}.ion-ios-speedometer:before{content:"\f4b0"}.ion-ios-speedometer-outline:before{content:"\f4af"}.ion-ios-star:before{content:"\f4b3"}.ion-ios-star-half:before{content:"\f4b1"}.ion-ios-star-outline:before{content:"\f4b2"}.ion-ios-stopwatch:before{content:"\f4b5"}.ion-ios-stopwatch-outline:before{content:"\f4b4"}.ion-ios-sunny:before{content:"\f4b7"}.ion-ios-sunny-outline:before{content:"\f4b6"}.ion-ios-telephone:before{content:"\f4b9"}.ion-ios-telephone-outline:before{content:"\f4b8"}.ion-ios-tennisball:before{content:"\f4bb"}.ion-ios-tennisball-outline:before{content:"\f4ba"}.ion-ios-thunderstorm:before{content:"\f4bd"}.ion-ios-thunderstorm-outline:before{content:"\f4bc"}.ion-ios-time:before{content:"\f4bf"}.ion-ios-time-outline:before{content:"\f4be"}.ion-ios-timer:before{content:"\f4c1"}.ion-ios-timer-outline:before{content:"\f4c0"}.ion-ios-toggle:before{content:"\f4c3"}.ion-ios-toggle-outline:before{content:"\f4c2"}.ion-ios-trash:before{content:"\f4c5"}.ion-ios-trash-outline:before{content:"\f4c4"}.ion-ios-undo:before{content:"\f4c7"}.ion-ios-undo-outline:before{content:"\f4c6"}.ion-ios-unlocked:before{content:"\f4c9"}.ion-ios-unlocked-outline:before{content:"\f4c8"}.ion-ios-upload:before{content:"\f4cb"}.ion-ios-upload-outline:before{content:"\f4ca"}.ion-ios-videocam:before{content:"\f4cd"}.ion-ios-videocam-outline:before{content:"\f4cc"}.ion-ios-volume-high:before{content:"\f4ce"}.ion-ios-volume-low:before{content:"\f4cf"}.ion-ios-wineglass:before{content:"\f4d1"}.ion-ios-wineglass-outline:before{content:"\f4d0"}.ion-ios-world:before{content:"\f4d3"}.ion-ios-world-outline:before{content:"\f4d2"}.ion-ipad:before{content:"\f1f9"}.ion-iphone:before{content:"\f1fa"}.ion-ipod:before{content:"\f1fb"}.ion-jet:before{content:"\f295"}.ion-key:before{content:"\f296"}.ion-knife:before{content:"\f297"}.ion-laptop:before{content:"\f1fc"}.ion-leaf:before{content:"\f1fd"}.ion-levels:before{content:"\f298"}.ion-lightbulb:before{content:"\f299"}.ion-link:before{content:"\f1fe"}.ion-load-a:before{content:"\f29a"}.ion-load-b:before{content:"\f29b"}.ion-load-c:before{content:"\f29c"}.ion-load-d:before{content:"\f29d"}.ion-location:before{content:"\f1ff"}.ion-lock-combination:before{content:"\f4d4"}.ion-locked:before{content:"\f200"}.ion-log-in:before{content:"\f29e"}.ion-log-out:before{content:"\f29f"}.ion-loop:before{content:"\f201"}.ion-magnet:before{content:"\f2a0"}.ion-male:before{content:"\f2a1"}.ion-man:before{content:"\f202"}.ion-map:before{content:"\f203"}.ion-medkit:before{content:"\f2a2"}.ion-merge:before{content:"\f33f"}.ion-mic-a:before{content:"\f204"}.ion-mic-b:before{content:"\f205"}.ion-mic-c:before{content:"\f206"}.ion-minus:before{content:"\f209"}.ion-minus-circled:before{content:"\f207"}.ion-minus-round:before{content:"\f208"}.ion-model-s:before{content:"\f2c1"}.ion-monitor:before{content:"\f20a"}.ion-more:before{content:"\f20b"}.ion-mouse:before{content:"\f340"}.ion-music-note:before{content:"\f20c"}.ion-navicon:before{content:"\f20e"}.ion-navicon-round:before{content:"\f20d"}.ion-navigate:before{content:"\f2a3"}.ion-network:before{content:"\f341"}.ion-no-smoking:before{content:"\f2c2"}.ion-nuclear:before{content:"\f2a4"}.ion-outlet:before{content:"\f342"}.ion-paintbrush:before{content:"\f4d5"}.ion-paintbucket:before{content:"\f4d6"}.ion-paper-airplane:before{content:"\f2c3"}.ion-paperclip:before{content:"\f20f"}.ion-pause:before{content:"\f210"}.ion-person:before{content:"\f213"}.ion-person-add:before{content:"\f211"}.ion-person-stalker:before{content:"\f212"}.ion-pie-graph:before{content:"\f2a5"}.ion-pin:before{content:"\f2a6"}.ion-pinpoint:before{content:"\f2a7"}.ion-pizza:before{content:"\f2a8"}.ion-plane:before{content:"\f214"}.ion-planet:before{content:"\f343"}.ion-play:before{content:"\f215"}.ion-playstation:before{content:"\f30a"}.ion-plus:before{content:"\f218"}.ion-plus-circled:before{content:"\f216"}.ion-plus-round:before{content:"\f217"}.ion-podium:before{content:"\f344"}.ion-pound:before{content:"\f219"}.ion-power:before{content:"\f2a9"}.ion-pricetag:before{content:"\f2aa"}.ion-pricetags:before{content:"\f2ab"}.ion-printer:before{content:"\f21a"}.ion-pull-request:before{content:"\f345"}.ion-qr-scanner:before{content:"\f346"}.ion-quote:before{content:"\f347"}.ion-radio-waves:before{content:"\f2ac"}.ion-record:before{content:"\f21b"}.ion-refresh:before{content:"\f21c"}.ion-reply:before{content:"\f21e"}.ion-reply-all:before{content:"\f21d"}.ion-ribbon-a:before{content:"\f348"}.ion-ribbon-b:before{content:"\f349"}.ion-sad:before{content:"\f34a"}.ion-sad-outline:before{content:"\f4d7"}.ion-scissors:before{content:"\f34b"}.ion-search:before{content:"\f21f"}.ion-settings:before{content:"\f2ad"}.ion-share:before{content:"\f220"}.ion-shuffle:before{content:"\f221"}.ion-skip-backward:before{content:"\f222"}.ion-skip-forward:before{content:"\f223"}.ion-social-android:before{content:"\f225"}.ion-social-android-outline:before{content:"\f224"}.ion-social-angular:before{content:"\f4d9"}.ion-social-angular-outline:before{content:"\f4d8"}.ion-social-apple:before{content:"\f227"}.ion-social-apple-outline:before{content:"\f226"}.ion-social-bitcoin:before{content:"\f2af"}.ion-social-bitcoin-outline:before{content:"\f2ae"}.ion-social-buffer:before{content:"\f229"}.ion-social-buffer-outline:before{content:"\f228"}.ion-social-chrome:before{content:"\f4db"}.ion-social-chrome-outline:before{content:"\f4da"}.ion-social-codepen:before{content:"\f4dd"}.ion-social-codepen-outline:before{content:"\f4dc"}.ion-social-css3:before{content:"\f4df"}.ion-social-css3-outline:before{content:"\f4de"}.ion-social-designernews:before{content:"\f22b"}.ion-social-designernews-outline:before{content:"\f22a"}.ion-social-dribbble:before{content:"\f22d"}.ion-social-dribbble-outline:before{content:"\f22c"}.ion-social-dropbox:before{content:"\f22f"}.ion-social-dropbox-outline:before{content:"\f22e"}.ion-social-euro:before{content:"\f4e1"}.ion-social-euro-outline:before{content:"\f4e0"}.ion-social-facebook:before{content:"\f231"}.ion-social-facebook-outline:before{content:"\f230"}.ion-social-foursquare:before{content:"\f34d"}.ion-social-foursquare-outline:before{content:"\f34c"}.ion-social-freebsd-devil:before{content:"\f2c4"}.ion-social-github:before{content:"\f233"}.ion-social-github-outline:before{content:"\f232"}.ion-social-google:before{content:"\f34f"}.ion-social-google-outline:before{content:"\f34e"}.ion-social-googleplus:before{content:"\f235"}.ion-social-googleplus-outline:before{content:"\f234"}.ion-social-hackernews:before{content:"\f237"}.ion-social-hackernews-outline:before{content:"\f236"}.ion-social-html5:before{content:"\f4e3"}.ion-social-html5-outline:before{content:"\f4e2"}.ion-social-instagram:before{content:"\f351"}.ion-social-instagram-outline:before{content:"\f350"}.ion-social-javascript:before{content:"\f4e5"}.ion-social-javascript-outline:before{content:"\f4e4"}.ion-social-linkedin:before{content:"\f239"}.ion-social-linkedin-outline:before{content:"\f238"}.ion-social-markdown:before{content:"\f4e6"}.ion-social-nodejs:before{content:"\f4e7"}.ion-social-octocat:before{content:"\f4e8"}.ion-social-pinterest:before{content:"\f2b1"}.ion-social-pinterest-outline:before{content:"\f2b0"}.ion-social-python:before{content:"\f4e9"}.ion-social-reddit:before{content:"\f23b"}.ion-social-reddit-outline:before{content:"\f23a"}.ion-social-rss:before{content:"\f23d"}.ion-social-rss-outline:before{content:"\f23c"}.ion-social-sass:before{content:"\f4ea"}.ion-social-skype:before{content:"\f23f"}.ion-social-skype-outline:before{content:"\f23e"}.ion-social-snapchat:before{content:"\f4ec"}.ion-social-snapchat-outline:before{content:"\f4eb"}.ion-social-tumblr:before{content:"\f241"}.ion-social-tumblr-outline:before{content:"\f240"}.ion-social-tux:before{content:"\f2c5"}.ion-social-twitch:before{content:"\f4ee"}.ion-social-twitch-outline:before{content:"\f4ed"}.ion-social-twitter:before{content:"\f243"}.ion-social-twitter-outline:before{content:"\f242"}.ion-social-usd:before{content:"\f353"}.ion-social-usd-outline:before{content:"\f352"}.ion-social-vimeo:before{content:"\f245"}.ion-social-vimeo-outline:before{content:"\f244"}.ion-social-whatsapp:before{content:"\f4f0"}.ion-social-whatsapp-outline:before{content:"\f4ef"}.ion-social-windows:before{content:"\f247"}.ion-social-windows-outline:before{content:"\f246"}.ion-social-wordpress:before{content:"\f249"}.ion-social-wordpress-outline:before{content:"\f248"}.ion-social-yahoo:before{content:"\f24b"}.ion-social-yahoo-outline:before{content:"\f24a"}.ion-social-yen:before{content:"\f4f2"}.ion-social-yen-outline:before{content:"\f4f1"}.ion-social-youtube:before{content:"\f24d"}.ion-social-youtube-outline:before{content:"\f24c"}.ion-soup-can:before{content:"\f4f4"}.ion-soup-can-outline:before{content:"\f4f3"}.ion-speakerphone:before{content:"\f2b2"}.ion-speedometer:before{content:"\f2b3"}.ion-spoon:before{content:"\f2b4"}.ion-star:before{content:"\f24e"}.ion-stats-bars:before{content:"\f2b5"}.ion-steam:before{content:"\f30b"}.ion-stop:before{content:"\f24f"}.ion-thermometer:before{content:"\f2b6"}.ion-thumbsdown:before{content:"\f250"}.ion-thumbsup:before{content:"\f251"}.ion-toggle:before{content:"\f355"}.ion-toggle-filled:before{content:"\f354"}.ion-transgender:before{content:"\f4f5"}.ion-trash-a:before{content:"\f252"}.ion-trash-b:before{content:"\f253"}.ion-trophy:before{content:"\f356"}.ion-tshirt:before{content:"\f4f7"}.ion-tshirt-outline:before{content:"\f4f6"}.ion-umbrella:before{content:"\f2b7"}.ion-university:before{content:"\f357"}.ion-unlocked:before{content:"\f254"}.ion-upload:before{content:"\f255"}.ion-usb:before{content:"\f2b8"}.ion-videocamera:before{content:"\f256"}.ion-volume-high:before{content:"\f257"}.ion-volume-low:before{content:"\f258"}.ion-volume-medium:before{content:"\f259"}.ion-volume-mute:before{content:"\f25a"}.ion-wand:before{content:"\f358"}.ion-waterdrop:before{content:"\f25b"}.ion-wifi:before{content:"\f25c"}.ion-wineglass:before{content:"\f2b9"}.ion-woman:before{content:"\f25d"}.ion-wrench:before{content:"\f2ba"}.ion-xbox:before{content:"\f30c"} diff --git a/dist/css/julia-player.css b/dist/css/julia-player.css new file mode 100644 index 0000000..75c619b --- /dev/null +++ b/dist/css/julia-player.css @@ -0,0 +1,454 @@ +@font-face { + font-family: "Julia"; + src: url("../fonts/Julia.eot"); + src: url("../fonts/Julia.eot?#iefix") format("embedded-opentype"), url("../fonts/Julia.woff") format("woff"), url("../fonts/Julia.ttf") format("truetype"), url("../fonts/Julia.svg#Julia") format("svg"); + font-weight: normal; + font-style: normal; } + +@media screen and (-webkit-min-device-pixel-ratio: 0) { + @font-face { + font-family: "Julia"; + src: url("../fonts/Julia.svg#Julia") format("svg"); } } + +.julia-icon { + font-family: "Julia"; + font-style: normal; + display: inline; } + +.julia-refresh:before { + content: "\f100"; } + +.julia-close:before { + content: "\f101"; } + +.julia-download:before { + content: "\f102"; } + +.julia-fullscreen-exit:before { + content: "\f103"; } + +.julia-subtitles:before { + content: "\f104"; } + +.julia-menu:before { + content: "\f105"; } + +.julia-fullscreen:before { + content: "\f106"; } + +.julia-dot-menu:before { + content: "\f107"; } + +.julia-play-circle:before { + content: "\f108"; } + +.julia-play-circle-inverse:before { + content: "\f109"; } + +.julia-play:before { + content: "\f10a"; } + +.julia-pause:before { + content: "\f10b"; } + +.julia-sound-off:before { + content: "\f10c"; } + +.julia-sound-on:before { + content: "\f10d"; } + +.julia-sound-min:before { + content: "\f10e"; } + +.julia-list:before { + content: "\f10f"; } + +/* ***************************** +* FIX! +* Hide default controls +* in fullscreen mode +***************************** */ +video::-webkit-media-controls { + display: none !important; } + +/* ***************************** +* FIX! +* 4/5px gap bellow resizable +* inline media elements +***************************** */ +video, audio, canvas { + vertical-align: top; } + +/* ***************************** +* === PRELOADER EFFECT === +* change to CSS loader +***************************** */ +@keyframes julia-preload-spin { + 100% { + transform: rotate(360deg); + transform: rotate(360deg); } } + +@-o-keyframes julia-preload-spin { + 100% { + -o-transform: rotate(360deg); + transform: rotate(360deg); } } + +@-ms-keyframes julia-preload-spin { + 100% { + -ms-transform: rotate(360deg); + transform: rotate(360deg); } } + +@-webkit-keyframes julia-preload-spin { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); } } + +@-moz-keyframes julia-preload-spin { + 100% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); } } + +/* ***************************** +* Julia player style +* === CONTAINER === +***************************** */ +div.julia-player { + padding: 0; + margin: 0; + position: relative; + display: inline-block; + background: black; + box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); + /* ***************************** + * Julia player style + * Keep UI unselectable + ***************************** */ + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + /* ***************************** + * === VIDEO ELEMENT === + ****************************** */ + /* ***************************** + * === FULLSCREEN MODE === + ****************************** */ + /* ***************************** + * === SHIELD === + ***************************** */ + /* ***************************** + * === SUGGEST === + ***************************** */ + /* ***************************** + * === BASE TOOLBAR === + ***************************** */ + /* ***************************** + * === BUTTONS === + ***************************** */ } + div.julia-player div, div.julia-player video, div.julia-player canvas { + padding: 0; + margin: 0; } + div.julia-player video { + min-width: 100%; + height: auto; + min-height: 100%; } + div.julia-player.julia-fullscreen-on { + position: relative; + min-width: 100%; + min-height: 100%; + width: 100vw; + height: 100vh; + background: #000; + display: block; } + div.julia-player.julia-fullscreen-on video { + width: auto; + height: 100%; } + div.julia-player > div.julia-shield { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: transparent; + z-index: 73; + /* ***************************** + * === PRELOADER === + ***************************** */ } + div.julia-player > div.julia-shield > img { + z-index: 75; } + div.julia-player > div.julia-shield > div.julia-preloader { + display: none; + width: 100%; + height: 100%; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + padding: 0; + margin: 0; + background-color: rgba(0, 0, 0, 0.7); + z-index: 79; } + div.julia-player > div.julia-shield > div.julia-preloader.on { + display: block; } + div.julia-player > div.julia-shield > div.julia-preloader > div.julia-preloader-run { + width: 64px; + height: 64px; + line-height: 64px; + border: 2px solid #777; + padding: 0; + margin: 0; + display: block; + font-size: 1px; + position: absolute; + bottom: 50%; + left: 50%; + border-radius: 50%; + border-left-color: transparent; + border-right-color: transparent; + animation: julia-preload-spin 800ms infinite linear; + -o-animation: julia-preload-spin 800ms infinite linear; + -ms-animation: julia-preload-spin 800ms infinite linear; + -webkit-animation: julia-preload-spin 800ms infinite linear; + -moz-animation: julia-preload-spin 800ms infinite linear; + margin-left: -32px; + margin-bottom: -32px; + z-index: 80; } + div.julia-player > div.julia-suggest { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: black; + z-index: 77; + display: none; + /* ***************************** + * Julia player style + * === SUGGEST ITEMS === + ***************************** */ } + div.julia-player > div.julia-suggest.on { + display: block; } + div.julia-player > div.julia-suggest > div.julia-suggest-item { + width: 42.5%; + height: 50%; + min-height: 80px; + font-size: 1.2em; + border: 1px solid #444; + color: #ABABAB; + background: black; + float: left; + margin: 5% 0 0 5%; + padding: 2%; + cursor: pointer; + position: relative; + overflow: hidden; } + div.julia-player > div.julia-suggest > div.julia-suggest-item > img { + position: absolute; + top: 0; + left: 0; } + div.julia-player > div.julia-suggest > div.julia-suggest-item:hover { + border: 1px solid #FFCC00; } + div.julia-player > div.julia-suggest > div.julia-suggest-item > div.julia-suggest-item-title { + position: absolute; + top: 0; + left: 0; + right: 0; + background: rgba(0, 0, 0, 0.8); + padding: 10px; + text-align: left; } + div.julia-player > div.julia-toolbar { + background: rgba(0, 0, 0, 0.7); + height: 44px; + position: absolute; + bottom: 0; + left: 0; + right: 0; + z-index: 70; + opacity: .0; + /* ***************************** + * === PANELS === + ***************************** */ + /* ***************************** + * === BARS === + ***************************** */ + /* ***************************** + * === TOOLBAR VISIBLE MODE === + ***************************** */ + /* ***************************** + * Rangeslider polyfill styles + * Progress bars + ******************************* */ } + div.julia-player > div.julia-toolbar div.julia-panel { + display: inline-block; + border: 0; + outline: 0; + height: 20px; + font-size: 12px; + color: #DDD; + position: absolute; + bottom: 6px; + font-family: sans-serif; } + div.julia-player > div.julia-toolbar div.julia-panel.julia-currentTime { + width: 60px; + left: 40px; + text-align: right; } + div.julia-player > div.julia-toolbar div.julia-panel.julia-live-indicator { + left: 50px; + text-align: left; + display: none; + font-weight: bold; + text-transform: uppercase; } + div.julia-player > div.julia-toolbar div.julia-panel.julia-duration { + left: 105px; } + div.julia-player > div.julia-toolbar div.julia-progress { + height: 12px; + position: absolute; + left: 0; + right: 0; + top: 0; } + div.julia-player > div.julia-toolbar div.julia-volume { + width: 80px; + border: 0; + outline: 0; + height: 16px; + position: absolute; + right: 50px; + bottom: 5px; } + div.julia-player > div.julia-toolbar.live { + height: 38px; } + div.julia-player > div.julia-toolbar.live div.julia-progress { + display: none; } + div.julia-player > div.julia-toolbar.live div.julia-currentTime, + div.julia-player > div.julia-toolbar.live div.julia-duration { + display: none; } + div.julia-player > div.julia-toolbar.live div.julia-live-indicator { + display: inline-block; } + div.julia-player > div.julia-toolbar.julia-toolbar-visible { + opacity: 1; + z-index: 80; } + div.julia-player > div.julia-toolbar div.julia-progress .julia-rangeslider, + div.julia-player > div.julia-toolbar div.julia-volume .julia-rangeslider { + display: block; + background: #777; + position: relative; } + div.julia-player > div.julia-toolbar div.julia-progress .julia-rangeslider .julia-rangeslider__fill, + div.julia-player > div.julia-toolbar div.julia-volume .julia-rangeslider .julia-rangeslider__fill { + display: block; + background: #FFCC00; + position: absolute; } + div.julia-player > div.julia-toolbar div.julia-progress .julia-rangeslider .julia-rangeslider__handle, + div.julia-player > div.julia-toolbar div.julia-volume .julia-rangeslider .julia-rangeslider__handle { + background-color: #F9F9F9; + cursor: pointer; + display: inline-block; + width: 8px; + height: 8px; + position: absolute; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; } + div.julia-player > div.julia-toolbar div.julia-progress .julia-rangeslider .julia-rangeslider__handle:after, + div.julia-player > div.julia-toolbar div.julia-volume .julia-rangeslider .julia-rangeslider__handle:after { + content: ""; + display: block; + width: 8px; + height: 8px; + margin: auto; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; } + div.julia-player > div.julia-toolbar div.julia-progress .julia-rangeslider .julia-rangeslider__handle:active, + div.julia-player > div.julia-toolbar div.julia-volume .julia-rangeslider .julia-rangeslider__handle:active { + background-color: #FFCC00; } + div.julia-player > div.julia-toolbar div.julia-progress > .julia-rangeslider--horizontal, + div.julia-player > div.julia-toolbar div.julia-volume > .julia-rangeslider--horizontal { + height: 6px; + width: 100%; + cursor: pointer; } + div.julia-player > div.julia-toolbar div.julia-progress > .julia-rangeslider--horizontal > .julia-rangeslider__fill, + div.julia-player > div.julia-toolbar div.julia-volume > .julia-rangeslider--horizontal > .julia-rangeslider__fill { + top: 0; + height: 100%; } + div.julia-player > div.julia-toolbar div.julia-progress > .julia-rangeslider--horizontal > .julia-rangeslider__handle, + div.julia-player > div.julia-toolbar div.julia-volume > .julia-rangeslider--horizontal > .julia-rangeslider__handle { + top: -1px; + touch-action: pan-y; + -ms-touch-action: pan-y; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; } + div.julia-player > div.julia-toolbar div.julia-progress > .julia-rangeslider--horizontal:hover .julia-rangeslider__handle:after, + div.julia-player > div.julia-toolbar div.julia-volume > .julia-rangeslider--horizontal:hover .julia-rangeslider__handle:after { + width: 16px; + height: 16px; + background-color: inherit; } + div.julia-player > div.julia-toolbar div.julia-progress .julia-rangeslider--disabled, + div.julia-player > div.julia-toolbar div.julia-volume .julia-rangeslider--disabled { + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); + opacity: 0.4; } + div.julia-player button.julia-btn { + color: #F9F9F9; + background: transparent; + border: 0; + outline: 0; + font-size: 20px; + width: 30px; + height: 25px; + line-height: 25px; + position: absolute; + bottom: 7px; + padding: 0; + margin: 0; } + div.julia-player button.julia-btn:hover { + color: #FFCC00; } + div.julia-player button.julia-btn.julia-playback { + left: 5px; } + div.julia-player button.julia-btn.julia-sound { + right: 140px; } + div.julia-player button.julia-btn.julia-fullscreen-toggle { + right: 5px; } + div.julia-player button.julia-btn.julia-big-play { + width: 72px; + height: 72px; + line-height: 72px; + text-align: center; + bottom: 50%; + left: 50%; + font-size: 72px; + margin-left: -36px; + margin-bottom: -36px; + z-index: 74; } + +@media (max-width: 480px) { + div.julia-player div.julia-suggest div.julia-suggest-item { + font-size: 12px; } } + +/* ***************************** +* === TRANSITIONS === +****************************** */ +div.julia-player, +div.julia-player > div.julia-toolbar, +div.julia-player > div.julia-shield > button.julia-btn.julia-big-play, +div.julia-player > div.julia-suggest > div.julia-suggest-item, +.julia-rangeslider__handle:after { + -webkit-transition: all 250ms; + -moz-transition: all 250ms; + -o-transition: all 250ms; + transition: all 250ms; } + +/* ***************************** +* === BACKDROP === +****************************** */ +::backdrop { + background-color: #000; } + +::-ms-backdrop { + background-color: #000; } diff --git a/dist/css/julia-player.min.css b/dist/css/julia-player.min.css new file mode 100644 index 0000000..5e1f1c1 --- /dev/null +++ b/dist/css/julia-player.min.css @@ -0,0 +1 @@ +div.julia-player,div.julia-player canvas,div.julia-player div,div.julia-player video{margin:0;padding:0}@font-face{font-family:Julia;src:url(../fonts/Julia.eot);src:url(../fonts/Julia.eot?#iefix) format("embedded-opentype"),url(../fonts/Julia.woff) format("woff"),url(../fonts/Julia.ttf) format("truetype"),url(../fonts/Julia.svg#Julia) format("svg");font-weight:400;font-style:normal}@media screen and (-webkit-min-device-pixel-ratio:0){@font-face{font-family:Julia;src:url(../fonts/Julia.svg#Julia) format("svg")}}.julia-icon{font-family:Julia;font-style:normal;display:inline}.julia-refresh:before{content:"\f100"}.julia-close:before{content:"\f101"}.julia-download:before{content:"\f102"}.julia-fullscreen-exit:before{content:"\f103"}.julia-subtitles:before{content:"\f104"}.julia-menu:before{content:"\f105"}.julia-fullscreen:before{content:"\f106"}.julia-dot-menu:before{content:"\f107"}.julia-play-circle:before{content:"\f108"}.julia-play-circle-inverse:before{content:"\f109"}.julia-play:before{content:"\f10a"}.julia-pause:before{content:"\f10b"}.julia-sound-off:before{content:"\f10c"}.julia-sound-on:before{content:"\f10d"}.julia-sound-min:before{content:"\f10e"}.julia-list:before{content:"\f10f"}video::-webkit-media-controls{display:none!important}audio,canvas,video{vertical-align:top}@keyframes julia-preload-spin{100%{transform:rotate(360deg)}}@-o-keyframes julia-preload-spin{100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes julia-preload-spin{100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes julia-preload-spin{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes julia-preload-spin{100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}div.julia-player{position:relative;display:inline-block;background:#000;box-shadow:0 0 10px rgba(0,0,0,.9);-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.julia-player video{min-width:100%;height:auto;min-height:100%}div.julia-player.julia-fullscreen-on{position:relative;min-width:100%;min-height:100%;width:100vw;height:100vh;background:#000;display:block}div.julia-player.julia-fullscreen-on video{width:auto;height:100%}div.julia-player>div.julia-shield{position:absolute;top:0;bottom:0;right:0;left:0;background:0 0;z-index:73}div.julia-player>div.julia-shield>img{z-index:75}div.julia-player>div.julia-shield>div.julia-preloader{display:none;width:100%;height:100%;position:absolute;top:0;bottom:0;left:0;right:0;padding:0;margin:0;background-color:rgba(0,0,0,.7);z-index:79}div.julia-player>div.julia-shield>div.julia-preloader.on{display:block}div.julia-player>div.julia-shield>div.julia-preloader>div.julia-preloader-run{width:64px;height:64px;line-height:64px;border:2px solid #777;padding:0;margin:0 0 -32px -32px;display:block;font-size:1px;position:absolute;bottom:50%;left:50%;border-radius:50%;border-left-color:transparent;border-right-color:transparent;animation:julia-preload-spin .8s infinite linear;-o-animation:julia-preload-spin .8s infinite linear;-ms-animation:julia-preload-spin .8s infinite linear;-webkit-animation:julia-preload-spin .8s infinite linear;-moz-animation:julia-preload-spin .8s infinite linear;z-index:80}div.julia-player>div.julia-suggest{position:absolute;top:0;bottom:0;right:0;left:0;background:#000;z-index:77;display:none}div.julia-player>div.julia-suggest.on{display:block}div.julia-player>div.julia-suggest>div.julia-suggest-item{width:42.5%;height:50%;min-height:80px;font-size:1.2em;border:1px solid #444;color:#ABABAB;background:#000;float:left;margin:5% 0 0 5%;padding:2%;cursor:pointer;position:relative;overflow:hidden}div.julia-player>div.julia-suggest>div.julia-suggest-item>img{position:absolute;top:0;left:0}div.julia-player>div.julia-suggest>div.julia-suggest-item:hover{border:1px solid #FC0}div.julia-player>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title{position:absolute;top:0;left:0;right:0;background:rgba(0,0,0,.8);padding:10px;text-align:left}div.julia-player>div.julia-toolbar{background:rgba(0,0,0,.7);height:44px;position:absolute;bottom:0;left:0;right:0;z-index:70;opacity:0}div.julia-player>div.julia-toolbar div.julia-panel{display:inline-block;border:0;outline:0;height:20px;font-size:12px;color:#DDD;position:absolute;bottom:6px;font-family:sans-serif}div.julia-player>div.julia-toolbar div.julia-panel.julia-currentTime{width:60px;left:40px;text-align:right}div.julia-player>div.julia-toolbar div.julia-panel.julia-live-indicator{left:50px;text-align:left;display:none;font-weight:700;text-transform:uppercase}div.julia-player>div.julia-toolbar div.julia-panel.julia-duration{left:105px}div.julia-player>div.julia-toolbar div.julia-progress{height:12px;position:absolute;left:0;right:0;top:0}div.julia-player>div.julia-toolbar div.julia-volume{width:80px;border:0;outline:0;height:16px;position:absolute;right:50px;bottom:5px}div.julia-player>div.julia-toolbar.live{height:38px}div.julia-player>div.julia-toolbar.live div.julia-currentTime,div.julia-player>div.julia-toolbar.live div.julia-duration,div.julia-player>div.julia-toolbar.live div.julia-progress{display:none}div.julia-player>div.julia-toolbar.live div.julia-live-indicator{display:inline-block}div.julia-player>div.julia-toolbar.julia-toolbar-visible{opacity:1;z-index:80}div.julia-player>div.julia-toolbar div.julia-progress .julia-rangeslider,div.julia-player>div.julia-toolbar div.julia-volume .julia-rangeslider{display:block;background:#777;position:relative}div.julia-player>div.julia-toolbar div.julia-progress .julia-rangeslider .julia-rangeslider__fill,div.julia-player>div.julia-toolbar div.julia-volume .julia-rangeslider .julia-rangeslider__fill{display:block;background:#FC0;position:absolute}div.julia-player>div.julia-toolbar div.julia-progress .julia-rangeslider .julia-rangeslider__handle,div.julia-player>div.julia-toolbar div.julia-volume .julia-rangeslider .julia-rangeslider__handle{background-color:#F9F9F9;cursor:pointer;display:inline-block;width:8px;height:8px;position:absolute;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}div.julia-player>div.julia-toolbar div.julia-progress .julia-rangeslider .julia-rangeslider__handle:after,div.julia-player>div.julia-toolbar div.julia-volume .julia-rangeslider .julia-rangeslider__handle:after{content:"";display:block;width:8px;height:8px;margin:auto;position:absolute;top:0;right:0;bottom:0;left:0;-moz-border-radius:50%;-webkit-border-radius:50%;border-radius:50%}div.julia-player>div.julia-toolbar div.julia-progress .julia-rangeslider .julia-rangeslider__handle:active,div.julia-player>div.julia-toolbar div.julia-volume .julia-rangeslider .julia-rangeslider__handle:active{background-color:#FC0}div.julia-player>div.julia-toolbar div.julia-progress>.julia-rangeslider--horizontal,div.julia-player>div.julia-toolbar div.julia-volume>.julia-rangeslider--horizontal{height:6px;width:100%;cursor:pointer}div.julia-player>div.julia-toolbar div.julia-progress>.julia-rangeslider--horizontal>.julia-rangeslider__fill,div.julia-player>div.julia-toolbar div.julia-volume>.julia-rangeslider--horizontal>.julia-rangeslider__fill{top:0;height:100%}div.julia-player>div.julia-toolbar div.julia-progress>.julia-rangeslider--horizontal>.julia-rangeslider__handle,div.julia-player>div.julia-toolbar div.julia-volume>.julia-rangeslider--horizontal>.julia-rangeslider__handle{top:-1px;touch-action:pan-y;-ms-touch-action:pan-y;-moz-border-radius:50%;-webkit-border-radius:50%;border-radius:50%}div.julia-player>div.julia-toolbar div.julia-progress>.julia-rangeslider--horizontal:hover .julia-rangeslider__handle:after,div.julia-player>div.julia-toolbar div.julia-volume>.julia-rangeslider--horizontal:hover .julia-rangeslider__handle:after{width:16px;height:16px;background-color:inherit}div.julia-player>div.julia-toolbar div.julia-progress .julia-rangeslider--disabled,div.julia-player>div.julia-toolbar div.julia-volume .julia-rangeslider--disabled{filter:alpha(Opacity=40);opacity:.4}div.julia-player button.julia-btn{color:#F9F9F9;background:0 0;border:0;outline:0;font-size:20px;width:30px;height:25px;line-height:25px;position:absolute;bottom:7px;padding:0;margin:0}div.julia-player button.julia-btn:hover{color:#FC0}div.julia-player button.julia-btn.julia-playback{left:5px}div.julia-player button.julia-btn.julia-sound{right:140px}div.julia-player button.julia-btn.julia-fullscreen-toggle{right:5px}div.julia-player button.julia-btn.julia-big-play{width:72px;height:72px;line-height:72px;text-align:center;bottom:50%;left:50%;font-size:72px;margin-left:-36px;margin-bottom:-36px;z-index:74}@media (max-width:480px){div.julia-player div.julia-suggest div.julia-suggest-item{font-size:12px}}.julia-rangeslider__handle:after,div.julia-player,div.julia-player>div.julia-shield>button.julia-btn.julia-big-play,div.julia-player>div.julia-suggest>div.julia-suggest-item,div.julia-player>div.julia-toolbar{-webkit-transition:all 250ms;-moz-transition:all 250ms;-o-transition:all 250ms;transition:all 250ms}::backdrop{background-color:#000}::-ms-backdrop{background-color:#000} \ No newline at end of file diff --git a/dist/css/themes/aqua/julia.css b/dist/css/themes/aqua/julia.css index 64fd155..1de4715 100644 --- a/dist/css/themes/aqua/julia.css +++ b/dist/css/themes/aqua/julia.css @@ -1,322 +1,87 @@ /* ***************************** -* FIX! -* Hide default controls -* in fullscreen mode +* Julia player base color theme ***************************** */ -video::-webkit-media-controls { - display:none !important; -} - -/* ***************************** -* FIX! -* 4/5px gap bellow resizable -* inline media elements -***************************** */ -video, audio, canvas { - vertical-align: top; -} - -/* ***************************** -* Julia player style -* === CONTAINER === -***************************** */ -div.julia-player.julia-theme-aqua, div.julia-player.julia-theme-aqua * { - padding: 0; - margin: 0; -} - div.julia-player.julia-theme-aqua { - position: relative; - display: inline-block; background: rgba(0,0,0,1); - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); - /* ***************************** - * Julia player style - * Keep UI unselectable - ***************************** */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } -/* ***************************** -* === SHIELD === -***************************** */ -div.julia-player.julia-theme-aqua>div.julia-shield { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - background: rgba(0,0,0,0); - z-index: 73; -} -div.julia-player.julia-theme-aqua>div.julia-shield>img { - z-index: 75; -} + /* ***************************** * === SUGGEST === ***************************** */ div.julia-player.julia-theme-aqua>div.julia-suggest { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; background: rgba(0,0,0,1); - z-index: 77; - display: none; } -div.julia-player.julia-theme-aqua>div.julia-suggest.on { - display: block; -} -/* ***************************** -* === REMOTE TOOLBAR === -***************************** */ -div.julia-player.julia-theme-aqua>div.julia-toolbar { - background: rgba(0,0,0,.7); - height: 50px; - position: absolute; - bottom: 0; - left: 0; - right: 0; - z-index: 70; - opacity: .0; -} -div.julia-player.julia-theme-aqua>div.julia-toolbar.live { - height: 38px; -} /* ***************************** -* === PRELOADER === +* === TOOLBAR === ***************************** */ -@-webkit-keyframes rotating { -from { - -webkit-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -@keyframes rotating { - from { - -ms-transform: rotate(0deg); - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -ms-transform: rotate(360deg); - -moz-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } +div.julia-player.julia-theme-aqua>div.julia-toolbar { + background: rgba(0,0,0,.7); } div.julia-player.julia-theme-aqua>div.julia-shield>div.julia-preloader { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - padding: 0; - margin: 0; background-color: rgba(0,0,0,.7); - z-index: 79; -} - -div.julia-player.julia-theme-aqua>div.julia-shield>div.julia-preloader.on { - display: block; } div.julia-player.julia-theme-aqua>div.julia-shield>div.julia-preloader>i { color: #777; - padding: 0; - margin: 0; - display: block; - width: 64px; - height: 64px; - line-height: 64px; - text-align: center; - font-size: 64px; - position: absolute; - bottom: 50%; - left: 50%; - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -32px; - margin-bottom: -32px; - z-index: 80; - -webkit-animation: rotating 2s linear infinite; - -moz-animation: rotating 2s linear infinite; - -ms-animation: rotating 2s linear infinite; - -o-animation: rotating 2s linear infinite; - animation: rotating 2s linear infinite; } + + + /* ***************************** * === BUTTONS === ***************************** */ div.julia-player.julia-theme-aqua button.julia-btn { color: #F9F9F9; - background: transparent; - border: 0; - outline: 0; - font-size: 25px; - width: 30px; - height: 25px; - position: absolute; - bottom: 9px; } div.julia-player.julia-theme-aqua button.julia-btn:hover { color: #00FFFF; } -div.julia-player.julia-theme-aqua div.julia-toolbar>button.julia-btn.julia-playback { - left: 5px; -} - -div.julia-player.julia-theme-aqua div.julia-toolbar>button.julia-btn.julia-sound { - right: 140px; -} - -div.julia-player.julia-theme-aqua div.julia-toolbar>button.julia-btn.julia-fullscreen-toggle { - right: 5px; -} - -div.julia-player.julia-theme-aqua>div.julia-shield>button.julia-btn.julia-big-play { - width: 72px; - height: 72px; - text-align: center; - bottom: 50%; - left: 50%; - padding: 4px 0 0 8px; - background-color: rgba(0,0,0,.7); - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -36px; - margin-bottom: -36px; - z-index: 74; -} - -div.julia-player.julia-theme-aqua>div.julia-shield>button.julia-btn.julia-big-play>i { - display: inline-block; - height: 48px; - line-height: 48px; - font-size: 48px; -} - -/* ***************************** -* === BARS === -***************************** */ -div.julia-player.julia-theme-aqua>div.julia-toolbar>div.julia-progress { - height: 12px; - position: absolute; - left: 0; - right: 0; - top: 0; -} -div.julia-player.julia-theme-aqua>div.julia-toolbar.live>div.julia-progress { - display: none; -} -div.julia-player.julia-theme-aqua>div.julia-toolbar>div.julia-volume { - width: 80px; - border: 0; - outline: 0; - height: 16px; - position: absolute; - right: 50px; - bottom: 5px; -} /* ***************************** -* Julia player style * === PANELS === ***************************** */ div.julia-player.julia-theme-aqua>div.julia-toolbar>div.julia-panel { - display: inline-block; - border: 0; - outline: 0; - height: 20px; - font-size: 12px; color: #DDD; - position: absolute; - bottom: 6px; - font-family: sans-serif; } div.julia-player.julia-theme-aqua>div.julia-toolbar>div.julia-panel.julia-currentTime { - width: 60px; - left: 40px; - text-align: right; } div.julia-player.julia-theme-aqua>div.julia-toolbar>div.julia-panel.julia-live-indicator { - left: 50px; - text-align: left; - display: none; - font-weight: bold; - text-transform: uppercase; } div.julia-player.julia-theme-aqua>div.julia-toolbar>div.julia-panel.julia-duration { - left: 105px; -} - -div.julia-player.julia-theme-aqua>div.julia-toolbar.live>div.julia-currentTime, -div.julia-player.julia-theme-aqua>div.julia-toolbar.live>div.julia-duration { - display: none; } div.julia-player.julia-theme-aqua>div.julia-toolbar.live>div.julia-panel.julia-live-indicator { - display: inline-block; } + + + /* ***************************** -* Julia player style * === SUGGEST ITEMS === ***************************** */ div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item { - width: 42.5%; - height: 50%; - min-height: 80px; - font-size: 1.2em; border: 1px solid #444; color: #ABABAB; background: rgba(0,0,0,1); - float: left; - margin: 5% 0 0 5%; - padding: 2%; - cursor: pointer; - position: relative; - overflow: hidden; } div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; - left: 0; } div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item:hover { @@ -324,180 +89,46 @@ div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item:hover } div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; - left: 0; - right: 0; background: rgba(0,0,0,.8); - padding: 10px; - text-align: left; } @media (max-width: 480px) { div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item { - font-size: 12px; - } -} - -/* ***************************** -* === TOOLBAR VISIBLE MODE === -***************************** */ -div.julia-player.julia-theme-aqua>div.julia-toolbar.julia-toolbar-visible { - opacity: 1; - z-index: 80; -} - -/* ***************************** -* === FULLSCREEN MODE === -****************************** */ -div.julia-player.julia-theme-aqua.julia-fullscreen-on { - position: relative; - min-width: 100%; - min-height: 100%; - width: 100vw; - height: 100vh; - background: #000; - display: block; -} - -/* ***************************** -* === VIDEO ELEMENT === -****************************** */ -div.julia-player.julia-theme-aqua>video { - min-width: 100%; - height: auto; - min-height: 100%; -} - -/* ***************************** -* === TRANSITIONS === -****************************** */ -div.julia-player.julia-theme-aqua, -div.julia-player.julia-theme-aqua>div.julia-toolbar, -div.julia-player.julia-theme-aqua>div.julia-shield>button.julia-btn.julia-big-play, -div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item -{ - -webkit-transition: all 250ms; - -moz-transition: all 250ms; - -ms-transition: all 250ms; - -o-transition: all 250ms; - transition: all 250ms; -} - -/* ***************************** -* === BACKDROP === -****************************** */ -::backdrop { - background-color: #000; -} - -::-ms-backdrop { - background-color: #000; + } } - /* ***************************** * Rangeslider polyfill styles ****************************** */ -div.julia-player.julia-theme-aqua .julia-rangeslider, -div.julia-player.julia-theme-aqua .julia-rangeslider__fill { - display: block; -} - -div.julia-player.julia-theme-aqua .julia-rangeslider { +div.julia-player.julia-theme-aqua>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider { background: #777; - position: relative; } -div.julia-player.julia-theme-aqua .julia-rangeslider--horizontal { - height: 6px; - width: 100%; - cursor: pointer; +div.julia-player.julia-theme-aqua>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__fill { + background: #00FFFF; } -div.julia-player.julia-theme-aqua .julia-rangeslider--vertical { - width: 6px; - min-height: 150px; - max-height: 100%; - cursor: pointer; +div.julia-player.julia-theme-aqua>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle { + background-color: #F9F9F9; } -div.julia-player.julia-theme-aqua .julia-rangeslider--disabled { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - opacity: 0.4; +div.julia-player.julia-theme-aqua>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle:active { + background-color: #00FFFF; } -div.julia-player.julia-theme-aqua .julia-rangeslider__fill { - background: #00FFFF; - position: absolute; -} -div.julia-player.julia-theme-aqua .julia-rangeslider--horizontal .julia-rangeslider__fill { - top: 0; - height: 100%; -} -div.julia-player.julia-theme-aqua .julia-rangeslider--vertical .julia-rangeslider__fill { - bottom: 0; - width: 100%; +input[type="range"]:focus + div.julia-player.julia-theme-aqua>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider .julia-rangeslider__handle { } -div.julia-player.julia-theme-aqua .julia-rangeslider__handle { - background-color: #F9F9F9; - cursor: pointer; - display: inline-block; - width: 8px; - height: 17px; - position: absolute; - -moz-border-radius:0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-aqua .julia-rangeslider__handle:after { - content: ""; - display: block; - width: 8px; - height: 17px; - margin: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-aqua .julia-rangeslider__handle:active { - /*background-color: #F00;*/ -} -div.julia-player.julia-theme-aqua .julia-rangeslider--horizontal .julia-rangeslider__handle { - top: -6px; - touch-action: pan-y; - -ms-touch-action: pan-y; -} -div.julia-player.julia-theme-aqua .julia-rangeslider--vertical .julia-rangeslider__handle { - left: -6px; - touch-action: pan-x; - -ms-touch-action: pan-x; -} -input[type="range"]:focus + div.julia-player.julia-theme-aqua .julia-rangeslider .julia-rangeslider__handle { -} /* ************** * Progress bar ************** */ -div.julia-player.julia-theme-aqua .julia-progress .julia-rangeslider--horizontal { - height: 12px; -} - div.julia-player.julia-theme-aqua .julia-progress .julia-rangeslider__handle { - width: 6px; - height: 12px; - top: 0; background-color: #FFF; } diff --git a/dist/css/themes/aquamarine/julia.css b/dist/css/themes/aquamarine/julia.css index 1cc98de..cbd7766 100644 --- a/dist/css/themes/aquamarine/julia.css +++ b/dist/css/themes/aquamarine/julia.css @@ -1,322 +1,87 @@ /* ***************************** -* FIX! -* Hide default controls -* in fullscreen mode +* Julia player base color theme ***************************** */ -video::-webkit-media-controls { - display:none !important; -} - -/* ***************************** -* FIX! -* 4/5px gap bellow resizable -* inline media elements -***************************** */ -video, audio, canvas { - vertical-align: top; -} - -/* ***************************** -* Julia player style -* === CONTAINER === -***************************** */ -div.julia-player.julia-theme-aquamarine, div.julia-player.julia-theme-aquamarine * { - padding: 0; - margin: 0; -} - div.julia-player.julia-theme-aquamarine { - position: relative; - display: inline-block; background: rgba(0,0,0,1); - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); - /* ***************************** - * Julia player style - * Keep UI unselectable - ***************************** */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } -/* ***************************** -* === SHIELD === -***************************** */ -div.julia-player.julia-theme-aquamarine>div.julia-shield { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - background: rgba(0,0,0,0); - z-index: 73; -} -div.julia-player.julia-theme-aqumarine>div.julia-shield>img { - z-index: 75; -} + /* ***************************** * === SUGGEST === ***************************** */ div.julia-player.julia-theme-aquamarine>div.julia-suggest { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; background: rgba(0,0,0,1); - z-index: 77; - display: none; } -div.julia-player.julia-theme-aquamarine>div.julia-suggest.on { - display: block; -} -/* ***************************** -* === REMOTE TOOLBAR === -***************************** */ -div.julia-player.julia-theme-aquamarine>div.julia-toolbar { - background: rgba(0,0,0,.7); - height: 50px; - position: absolute; - bottom: 0; - left: 0; - right: 0; - z-index: 70; - opacity: .0; -} -div.julia-player.julia-theme-aquamarine>div.julia-toolbar.live { - height: 38px; -} /* ***************************** -* === PRELOADER === +* === TOOLBAR === ***************************** */ -@-webkit-keyframes rotating { -from { - -webkit-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -@keyframes rotating { - from { - -ms-transform: rotate(0deg); - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -ms-transform: rotate(360deg); - -moz-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } +div.julia-player.julia-theme-aquamarine>div.julia-toolbar { + background: rgba(0,0,0,.7); } div.julia-player.julia-theme-aquamarine>div.julia-shield>div.julia-preloader { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - padding: 0; - margin: 0; background-color: rgba(0,0,0,.7); - z-index: 79; -} - -div.julia-player.julia-theme-aquamarine>div.julia-shield>div.julia-preloader.on { - display: block; } div.julia-player.julia-theme-aquamarine>div.julia-shield>div.julia-preloader>i { color: #777; - padding: 0; - margin: 0; - display: block; - width: 64px; - height: 64px; - line-height: 64px; - text-align: center; - font-size: 64px; - position: absolute; - bottom: 50%; - left: 50%; - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -32px; - margin-bottom: -32px; - z-index: 80; - -webkit-animation: rotating 2s linear infinite; - -moz-animation: rotating 2s linear infinite; - -ms-animation: rotating 2s linear infinite; - -o-animation: rotating 2s linear infinite; - animation: rotating 2s linear infinite; } + + + /* ***************************** * === BUTTONS === ***************************** */ div.julia-player.julia-theme-aquamarine button.julia-btn { color: #F9F9F9; - background: transparent; - border: 0; - outline: 0; - font-size: 25px; - width: 30px; - height: 25px; - position: absolute; - bottom: 9px; } div.julia-player.julia-theme-aquamarine button.julia-btn:hover { color: #7FFFD4; } -div.julia-player.julia-theme-aquamarine div.julia-toolbar>button.julia-btn.julia-playback { - left: 5px; -} - -div.julia-player.julia-theme-aquamarine div.julia-toolbar>button.julia-btn.julia-sound { - right: 140px; -} - -div.julia-player.julia-theme-aquamarine div.julia-toolbar>button.julia-btn.julia-fullscreen-toggle { - right: 5px; -} -div.julia-player.julia-theme-aquamarine>div.julia-shield>button.julia-btn.julia-big-play { - width: 72px; - height: 72px; - text-align: center; - bottom: 50%; - left: 50%; - padding: 4px 0 0 8px; - background-color: rgba(0,0,0,.7); - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -36px; - margin-bottom: -36px; - z-index: 74; -} -div.julia-player.julia-theme-aquamarine>div.julia-shield>button.julia-btn.julia-big-play>i { - display: inline-block; - height: 48px; - line-height: 48px; - font-size: 48px; -} /* ***************************** -* === BARS === -***************************** */ -div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div.julia-progress { - height: 12px; - position: absolute; - left: 0; - right: 0; - top: 0; -} - -div.julia-player.julia-theme-aquamarine>div.julia-toolbar.live>div.julia-progress { - display: none; -} - -div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div.julia-volume { - width: 80px; - border: 0; - outline: 0; - height: 16px; - position: absolute; - right: 50px; - bottom: 5px; -} - -/* ***************************** -* Julia player style * === PANELS === ***************************** */ div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div.julia-panel { - display: inline-block; - border: 0; - outline: 0; - height: 20px; - font-size: 12px; color: #DDD; - position: absolute; - bottom: 6px; - font-family: sans-serif; } div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div.julia-panel.julia-currentTime { - width: 60px; - left: 40px; - text-align: right; } div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div.julia-panel.julia-live-indicator { - left: 50px; - text-align: left; - display: none; - font-weight: bold; - text-transform: uppercase; } div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div.julia-panel.julia-duration { - left: 105px; -} - -div.julia-player.julia-theme-aquamarine>div.julia-toolbar.live>div.julia-currentTime, -div.julia-player.julia-theme-aquamarine>div.julia-toolbar.live>div.julia-duration { - display: none; } div.julia-player.julia-theme-aquamarine>div.julia-toolbar.live>div.julia-panel.julia-live-indicator { - display: inline-block; } + + + /* ***************************** -* Julia player style * === SUGGEST ITEMS === ***************************** */ div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item { - width: 42.5%; - height: 50%; - min-height: 80px; - font-size: 1.2em; border: 1px solid #444; color: #ABABAB; background: rgba(0,0,0,1); - float: left; - margin: 5% 0 0 5%; - padding: 2%; - cursor: pointer; - position: relative; - overflow: hidden; } div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; - left: 0; } div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item:hover { @@ -324,181 +89,46 @@ div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item } div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; - left: 0; - right: 0; background: rgba(0,0,0,.8); - padding: 10px; - text-align: left; } @media (max-width: 480px) { div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item { - font-size: 12px; - } -} - - -/* ***************************** -* === TOOLBAR VISIBLE MODE === -***************************** */ -div.julia-player.julia-theme-aquamarine>div.julia-toolbar.julia-toolbar-visible { - opacity: 1; - z-index: 80; -} - -/* ***************************** -* === FULLSCREEN MODE === -****************************** */ -div.julia-player.julia-theme-aquamarine.julia-fullscreen-on { - position: relative; - min-width: 100%; - min-height: 100%; - width: 100vw; - height: 100vh; - background: #000; - display: block; -} - -/* ***************************** -* === VIDEO ELEMENT === -****************************** */ -div.julia-player.julia-theme-aquamarine>video { - min-width: 100%; - height: auto; - min-height: 100%; -} - -/* ***************************** -* === TRANSITIONS === -****************************** */ -div.julia-player.julia-theme-aquamarine, -div.julia-player.julia-theme-aquamarine>div.julia-toolbar, -div.julia-player.julia-theme-aquamarine>div.julia-shield>button.julia-btn.julia-big-play, -div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item -{ - -webkit-transition: all 250ms; - -moz-transition: all 250ms; - -ms-transition: all 250ms; - -o-transition: all 250ms; - transition: all 250ms; -} - -/* ***************************** -* === BACKDROP === -****************************** */ -::backdrop { - background-color: #000; -} - -::-ms-backdrop { - background-color: #000; + } } - /* ***************************** * Rangeslider polyfill styles ****************************** */ -div.julia-player.julia-theme-aquamarine .julia-rangeslider, -div.julia-player.julia-theme-aquamarine .julia-rangeslider__fill { - display: block; -} - -div.julia-player.julia-theme-aquamarine .julia-rangeslider { +div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider { background: #777; - position: relative; } -div.julia-player.julia-theme-aquamarine .julia-rangeslider--horizontal { - height: 6px; - width: 100%; - cursor: pointer; +div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__fill { + background: #7FFFD4; } -div.julia-player.julia-theme-aquamarine .julia-rangeslider--vertical { - width: 6px; - min-height: 150px; - max-height: 100%; - cursor: pointer; +div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle { + background-color: #F9F9F9; } -div.julia-player.julia-theme-aquamarine .julia-rangeslider--disabled { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - opacity: 0.4; +div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle:active { + background-color: #7FFFD4; } -div.julia-player.julia-theme-aquamarine .julia-rangeslider__fill { - background: #7FFFD4; - position: absolute; -} -div.julia-player.julia-theme-aquamarine .julia-rangeslider--horizontal .julia-rangeslider__fill { - top: 0; - height: 100%; -} -div.julia-player.julia-theme-aquamarine .julia-rangeslider--vertical .julia-rangeslider__fill { - bottom: 0; - width: 100%; +input[type="range"]:focus + div.julia-player.julia-theme-aquamarine>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider .julia-rangeslider__handle { } -div.julia-player.julia-theme-aquamarine .julia-rangeslider__handle { - background-color: #F9F9F9; - cursor: pointer; - display: inline-block; - width: 8px; - height: 17px; - position: absolute; - -moz-border-radius:0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-aquamarine .julia-rangeslider__handle:after { - content: ""; - display: block; - width: 8px; - height: 17px; - margin: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-aquamarine .julia-rangeslider__handle:active { - /*background-color: #F00;*/ -} -div.julia-player.julia-theme-aquamarine .julia-rangeslider--horizontal .julia-rangeslider__handle { - top: -6px; - touch-action: pan-y; - -ms-touch-action: pan-y; -} -div.julia-player.julia-theme-aquamarine .julia-rangeslider--vertical .julia-rangeslider__handle { - left: -6px; - touch-action: pan-x; - -ms-touch-action: pan-x; -} -input[type="range"]:focus + div.julia-player.julia-theme-aquamarine .julia-rangeslider .julia-rangeslider__handle { -} /* ************** * Progress bar ************** */ -div.julia-player.julia-theme-aquamarine .julia-progress .julia-rangeslider--horizontal { - height: 12px; -} - div.julia-player.julia-theme-aquamarine .julia-progress .julia-rangeslider__handle { - width: 6px; - height: 12px; - top: 0; background-color: #FFF; } diff --git a/dist/css/themes/crimson/julia.css b/dist/css/themes/crimson/julia.css index 30f140c..5e8443c 100644 --- a/dist/css/themes/crimson/julia.css +++ b/dist/css/themes/crimson/julia.css @@ -1,322 +1,87 @@ /* ***************************** -* FIX! -* Hide default controls -* in fullscreen mode +* Julia player base color theme ***************************** */ -video::-webkit-media-controls { - display:none !important; -} - -/* ***************************** -* FIX! -* 4/5px gap bellow resizable -* inline media elements -***************************** */ -video, audio, canvas { - vertical-align: top; -} - -/* ***************************** -* Julia player style -* === CONTAINER === -***************************** */ -div.julia-player.julia-theme-crimson, div.julia-player.julia-theme-crimson * { - padding: 0; - margin: 0; -} - div.julia-player.julia-theme-crimson { - position: relative; - display: inline-block; background: rgba(0,0,0,1); - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); - /* ***************************** - * Julia player style - * Keep UI unselectable - ***************************** */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } -/* ***************************** -* === SHIELD === -***************************** */ -div.julia-player.julia-theme-crimson>div.julia-shield { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - background: rgba(0,0,0,0); - z-index: 73; -} -div.julia-player.julia-theme-crimson>div.julia-shield>img { - z-index: 75; -} + /* ***************************** * === SUGGEST === ***************************** */ div.julia-player.julia-theme-crimson>div.julia-suggest { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; background: rgba(0,0,0,1); - z-index: 77; - display: none; } -div.julia-player.julia-theme-crimson>div.julia-suggest.on { - display: block; -} -/* ***************************** -* === REMOTE TOOLBAR === -***************************** */ -div.julia-player.julia-theme-crimson>div.julia-toolbar { - background: rgba(0,0,0,.7); - height: 50px; - position: absolute; - bottom: 0; - left: 0; - right: 0; - z-index: 70; - opacity: .0; -} -div.julia-player.julia-theme-crimson>div.julia-toolbar.live { - height: 38px; -} /* ***************************** -* === PRELOADER === +* === TOOLBAR === ***************************** */ -@-webkit-keyframes rotating { -from { - -webkit-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -@keyframes rotating { - from { - -ms-transform: rotate(0deg); - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -ms-transform: rotate(360deg); - -moz-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } +div.julia-player.julia-theme-crimson>div.julia-toolbar { + background: rgba(0,0,0,.7); } div.julia-player.julia-theme-crimson>div.julia-shield>div.julia-preloader { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - padding: 0; - margin: 0; background-color: rgba(0,0,0,.7); - z-index: 79; -} - -div.julia-player.julia-theme-crimson>div.julia-shield>div.julia-preloader.on { - display: block; } div.julia-player.julia-theme-crimson>div.julia-shield>div.julia-preloader>i { color: #777; - padding: 0; - margin: 0; - display: block; - width: 64px; - height: 64px; - line-height: 64px; - text-align: center; - font-size: 64px; - position: absolute; - bottom: 50%; - left: 50%; - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -32px; - margin-bottom: -32px; - z-index: 80; - -webkit-animation: rotating 2s linear infinite; - -moz-animation: rotating 2s linear infinite; - -ms-animation: rotating 2s linear infinite; - -o-animation: rotating 2s linear infinite; - animation: rotating 2s linear infinite; } + + + /* ***************************** * === BUTTONS === ***************************** */ div.julia-player.julia-theme-crimson button.julia-btn { color: #F9F9F9; - background: transparent; - border: 0; - outline: 0; - font-size: 25px; - width: 30px; - height: 25px; - position: absolute; - bottom: 9px; } div.julia-player.julia-theme-crimson button.julia-btn:hover { color: #DC143C; } -div.julia-player.julia-theme-crimson div.julia-toolbar>button.julia-btn.julia-playback { - left: 5px; -} - -div.julia-player.julia-theme-crimson div.julia-toolbar>button.julia-btn.julia-sound { - right: 140px; -} - -div.julia-player.julia-theme-crimson div.julia-toolbar>button.julia-btn.julia-fullscreen-toggle { - right: 5px; -} - -div.julia-player.julia-theme-crimson>div.julia-shield>button.julia-btn.julia-big-play { - width: 72px; - height: 72px; - text-align: center; - bottom: 50%; - left: 50%; - padding: 4px 0 0 8px; - background-color: rgba(0,0,0,.7); - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -36px; - margin-bottom: -36px; - z-index: 74; -} - -div.julia-player.julia-theme-crimson>div.julia-shield>button.julia-btn.julia-big-play>i { - display: inline-block; - height: 48px; - line-height: 48px; - font-size: 48px; -} - -/* ***************************** -* === BARS === -***************************** */ -div.julia-player.julia-theme-crimson>div.julia-toolbar>div.julia-progress { - height: 12px; - position: absolute; - left: 0; - right: 0; - top: 0; -} -div.julia-player.julia-theme-crimson>div.julia-toolbar.live>div.julia-progress { - display: none; -} -div.julia-player.julia-theme-crimson>div.julia-toolbar>div.julia-volume { - width: 80px; - border: 0; - outline: 0; - height: 16px; - position: absolute; - right: 50px; - bottom: 5px; -} /* ***************************** -* Julia player style * === PANELS === ***************************** */ div.julia-player.julia-theme-crimson>div.julia-toolbar>div.julia-panel { - display: inline-block; - border: 0; - outline: 0; - height: 20px; - font-size: 12px; color: #DDD; - position: absolute; - bottom: 6px; - font-family: sans-serif; } div.julia-player.julia-theme-crimson>div.julia-toolbar>div.julia-panel.julia-currentTime { - width: 60px; - left: 40px; - text-align: right; } div.julia-player.julia-theme-crimson>div.julia-toolbar>div.julia-panel.julia-live-indicator { - left: 50px; - text-align: left; - display: none; - font-weight: bold; - text-transform: uppercase; } div.julia-player.julia-theme-crimson>div.julia-toolbar>div.julia-panel.julia-duration { - left: 105px; -} - -div.julia-player.julia-theme-crimson>div.julia-toolbar.live>div.julia-currentTime, -div.julia-player.julia-theme-crimson>div.julia-toolbar.live>div.julia-duration { - display: none; } div.julia-player.julia-theme-crimson>div.julia-toolbar.live>div.julia-panel.julia-live-indicator { - display: inline-block; } + + + /* ***************************** -* Julia player style * === SUGGEST ITEMS === ***************************** */ div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item { - width: 42.5%; - height: 50%; - min-height: 80px; - font-size: 1.2em; border: 1px solid #444; color: #ABABAB; background: rgba(0,0,0,1); - float: left; - margin: 5% 0 0 5%; - padding: 2%; - cursor: pointer; - position: relative; - overflow: hidden; } div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; - left: 0; } div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item:hover { @@ -324,181 +89,46 @@ div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item:ho } div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; - left: 0; - right: 0; background: rgba(0,0,0,.8); - padding: 10px; - text-align: left; } @media (max-width: 480px) { div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item { - font-size: 12px; - } -} - - -/* ***************************** -* === TOOLBAR VISIBLE MODE === -***************************** */ -div.julia-player.julia-theme-crimson>div.julia-toolbar.julia-toolbar-visible { - opacity: 1; - z-index: 80; -} - -/* ***************************** -* === FULLSCREEN MODE === -****************************** */ -div.julia-player.julia-theme-crimson.julia-fullscreen-on { - position: relative; - min-width: 100%; - min-height: 100%; - width: 100vw; - height: 100vh; - background: #000; - display: block; -} - -/* ***************************** -* === VIDEO ELEMENT === -****************************** */ -div.julia-player.julia-theme-crimson>video { - min-width: 100%; - height: auto; - min-height: 100%; -} - -/* ***************************** -* === TRANSITIONS === -****************************** */ -div.julia-player.julia-theme-crimson, -div.julia-player.julia-theme-crimson>div.julia-toolbar, -div.julia-player.julia-theme-crimson>div.julia-shield>button.julia-btn.julia-big-play, -div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item -{ - -webkit-transition: all 250ms; - -moz-transition: all 250ms; - -ms-transition: all 250ms; - -o-transition: all 250ms; - transition: all 250ms; -} - -/* ***************************** -* === BACKDROP === -****************************** */ -::backdrop { - background-color: #000; -} - -::-ms-backdrop { - background-color: #000; + } } - /* ***************************** * Rangeslider polyfill styles ****************************** */ -div.julia-player.julia-theme-crimson .julia-rangeslider, -div.julia-player.julia-theme-crimson .julia-rangeslider__fill { - display: block; -} - -div.julia-player.julia-theme-crimson .julia-rangeslider { +div.julia-player.julia-theme-crimson>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider { background: #777; - position: relative; } -div.julia-player.julia-theme-crimson .julia-rangeslider--horizontal { - height: 6px; - width: 100%; - cursor: pointer; +div.julia-player.julia-theme-crimson>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__fill { + background: #DC143C; } -div.julia-player.julia-theme-crimson .julia-rangeslider--vertical { - width: 6px; - min-height: 150px; - max-height: 100%; - cursor: pointer; +div.julia-player.julia-theme-crimson>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle { + background-color: #F9F9F9; } -div.julia-player.julia-theme-crimson .julia-rangeslider--disabled { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - opacity: 0.4; +div.julia-player.julia-theme-crimson>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle:active { + background-color: #DC143C; } -div.julia-player.julia-theme-crimson .julia-rangeslider__fill { - background: #DC143C; - position: absolute; -} -div.julia-player.julia-theme-crimson .julia-rangeslider--horizontal .julia-rangeslider__fill { - top: 0; - height: 100%; -} -div.julia-player.julia-theme-crimson .julia-rangeslider--vertical .julia-rangeslider__fill { - bottom: 0; - width: 100%; +input[type="range"]:focus + div.julia-player.julia-theme-crimson>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider .julia-rangeslider__handle { } -div.julia-player.julia-theme-crimson .julia-rangeslider__handle { - background-color: #F9F9F9; - cursor: pointer; - display: inline-block; - width: 8px; - height: 17px; - position: absolute; - -moz-border-radius:0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-crimson .julia-rangeslider__handle:after { - content: ""; - display: block; - width: 8px; - height: 17px; - margin: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-crimson .julia-rangeslider__handle:active { - /*background-color: #F00;*/ -} -div.julia-player.julia-theme-crimson .julia-rangeslider--horizontal .julia-rangeslider__handle { - top: -6px; - touch-action: pan-y; - -ms-touch-action: pan-y; -} -div.julia-player.julia-theme-crimson .julia-rangeslider--vertical .julia-rangeslider__handle { - left: -6px; - touch-action: pan-x; - -ms-touch-action: pan-x; -} -input[type="range"]:focus + div.julia-player.julia-theme-crimson .julia-rangeslider .julia-rangeslider__handle { -} /* ************** * Progress bar ************** */ -div.julia-player.julia-theme-crimson .julia-progress .julia-rangeslider--horizontal { - height: 12px; -} - div.julia-player.julia-theme-crimson .julia-progress .julia-rangeslider__handle { - width: 6px; - height: 12px; - top: 0; background-color: #FFF; } diff --git a/dist/css/themes/deeppink/julia.css b/dist/css/themes/deeppink/julia.css index 8fa03ba..fcf6cb2 100644 --- a/dist/css/themes/deeppink/julia.css +++ b/dist/css/themes/deeppink/julia.css @@ -1,322 +1,87 @@ /* ***************************** -* FIX! -* Hide default controls -* in fullscreen mode +* Julia player base color theme ***************************** */ -video::-webkit-media-controls { - display:none !important; -} - -/* ***************************** -* FIX! -* 4/5px gap bellow resizable -* inline media elements -***************************** */ -video, audio, canvas { - vertical-align: top; -} - -/* ***************************** -* Julia player style -* === CONTAINER === -***************************** */ -div.julia-player.julia-theme-deeppink, div.julia-player.julia-theme-deeppink * { - padding: 0; - margin: 0; -} - div.julia-player.julia-theme-deeppink { - position: relative; - display: inline-block; background: rgba(0,0,0,1); - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); - /* ***************************** - * Julia player style - * Keep UI unselectable - ***************************** */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } -/* ***************************** -* === SHIELD === -***************************** */ -div.julia-player.julia-theme-deeppink>div.julia-shield { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - background: rgba(0,0,0,0); - z-index: 73; -} -div.julia-player.julia-theme-deeppink>div.julia-shield>img { - z-index: 75; -} + /* ***************************** * === SUGGEST === ***************************** */ div.julia-player.julia-theme-deeppink>div.julia-suggest { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; background: rgba(0,0,0,1); - z-index: 77; - display: none; } -div.julia-player.julia-theme-deeppink>div.julia-suggest.on { - display: block; -} -/* ***************************** -* === REMOTE TOOLBAR === -***************************** */ -div.julia-player.julia-theme-deeppink>div.julia-toolbar { - background: rgba(0,0,0,.7); - height: 50px; - position: absolute; - bottom: 0; - left: 0; - right: 0; - z-index: 70; - opacity: .0; -} -div.julia-player.julia-theme-deeppink>div.julia-toolbar.live { - height: 38px; -} /* ***************************** -* === PRELOADER === +* === TOOLBAR === ***************************** */ -@-webkit-keyframes rotating { -from { - -webkit-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -@keyframes rotating { - from { - -ms-transform: rotate(0deg); - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -ms-transform: rotate(360deg); - -moz-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } +div.julia-player.julia-theme-deeppink>div.julia-toolbar { + background: rgba(0,0,0,.7); } div.julia-player.julia-theme-deeppink>div.julia-shield>div.julia-preloader { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - padding: 0; - margin: 0; background-color: rgba(0,0,0,.7); - z-index: 79; -} - -div.julia-player.julia-theme-deeppink>div.julia-shield>div.julia-preloader.on { - display: block; } div.julia-player.julia-theme-deeppink>div.julia-shield>div.julia-preloader>i { color: #777; - padding: 0; - margin: 0; - display: block; - width: 64px; - height: 64px; - line-height: 64px; - text-align: center; - font-size: 64px; - position: absolute; - bottom: 50%; - left: 50%; - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -32px; - margin-bottom: -32px; - z-index: 80; - -webkit-animation: rotating 2s linear infinite; - -moz-animation: rotating 2s linear infinite; - -ms-animation: rotating 2s linear infinite; - -o-animation: rotating 2s linear infinite; - animation: rotating 2s linear infinite; } + + + /* ***************************** * === BUTTONS === ***************************** */ div.julia-player.julia-theme-deeppink button.julia-btn { color: #F9F9F9; - background: transparent; - border: 0; - outline: 0; - font-size: 25px; - width: 30px; - height: 25px; - position: absolute; - bottom: 9px; } div.julia-player.julia-theme-deeppink button.julia-btn:hover { color: #FF1493; } -div.julia-player.julia-theme-deeppink div.julia-toolbar>button.julia-btn.julia-playback { - left: 5px; -} - -div.julia-player.julia-theme-deeppink div.julia-toolbar>button.julia-btn.julia-sound { - right: 140px; -} - -div.julia-player.julia-theme-deeppink div.julia-toolbar>button.julia-btn.julia-fullscreen-toggle { - right: 5px; -} -div.julia-player.julia-theme-deeppink>div.julia-shield>button.julia-btn.julia-big-play { - width: 72px; - height: 72px; - text-align: center; - bottom: 50%; - left: 50%; - padding: 4px 0 0 8px; - background-color: rgba(0,0,0,.7); - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -36px; - margin-bottom: -36px; - z-index: 74; -} -div.julia-player.julia-theme-deeppink>div.julia-shield>button.julia-btn.julia-big-play>i { - display: inline-block; - height: 48px; - line-height: 48px; - font-size: 48px; -} /* ***************************** -* === BARS === -***************************** */ -div.julia-player.julia-theme-deeppink>div.julia-toolbar>div.julia-progress { - height: 12px; - position: absolute; - left: 0; - right: 0; - top: 0; -} - -div.julia-player.julia-theme-deeppink>div.julia-toolbar.live>div.julia-progress { - display: none; -} - -div.julia-player.julia-theme-deeppink>div.julia-toolbar>div.julia-volume { - width: 80px; - border: 0; - outline: 0; - height: 16px; - position: absolute; - right: 50px; - bottom: 5px; -} - -/* ***************************** -* Julia player style * === PANELS === ***************************** */ div.julia-player.julia-theme-deeppink>div.julia-toolbar>div.julia-panel { - display: inline-block; - border: 0; - outline: 0; - height: 20px; - font-size: 12px; color: #DDD; - position: absolute; - bottom: 6px; - font-family: sans-serif; } div.julia-player.julia-theme-deeppink>div.julia-toolbar>div.julia-panel.julia-currentTime { - width: 60px; - left: 40px; - text-align: right; } div.julia-player.julia-theme-deeppink>div.julia-toolbar>div.julia-panel.julia-live-indicator { - left: 50px; - text-align: left; - display: none; - font-weight: bold; - text-transform: uppercase; } div.julia-player.julia-theme-deeppink>div.julia-toolbar>div.julia-panel.julia-duration { - left: 105px; -} - -div.julia-player.julia-theme-deeppink>div.julia-toolbar.live>div.julia-currentTime, -div.julia-player.julia-theme-deeppink>div.julia-toolbar.live>div.julia-duration { - display: none; } div.julia-player.julia-theme-deeppink>div.julia-toolbar.live>div.julia-panel.julia-live-indicator { - display: inline-block; } + + + /* ***************************** -* Julia player style * === SUGGEST ITEMS === ***************************** */ div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item { - width: 42.5%; - height: 50%; - min-height: 80px; - font-size: 1.2em; border: 1px solid #444; color: #ABABAB; background: rgba(0,0,0,1); - float: left; - margin: 5% 0 0 5%; - padding: 2%; - cursor: pointer; - position: relative; - overflow: hidden; } div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; - left: 0; } div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item:hover { @@ -324,181 +89,46 @@ div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item:h } div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; - left: 0; - right: 0; background: rgba(0,0,0,.8); - padding: 10px; - text-align: left; } @media (max-width: 480px) { div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item { - font-size: 12px; - } -} - - -/* ***************************** -* === TOOLBAR VISIBLE MODE === -***************************** */ -div.julia-player.julia-theme-deeppink>div.julia-toolbar.julia-toolbar-visible { - opacity: 1; - z-index: 80; -} - -/* ***************************** -* === FULLSCREEN MODE === -****************************** */ -div.julia-player.julia-theme-deeppink.julia-fullscreen-on { - position: relative; - min-width: 100%; - min-height: 100%; - width: 100vw; - height: 100vh; - background: #000; - display: block; -} - -/* ***************************** -* === VIDEO ELEMENT === -****************************** */ -div.julia-player.julia-theme-deeppink>video { - min-width: 100%; - height: auto; - min-height: 100%; -} - -/* ***************************** -* === TRANSITIONS === -****************************** */ -div.julia-player.julia-theme-deeppink, -div.julia-player.julia-theme-deeppink>div.julia-toolbar, -div.julia-player.julia-theme-deeppink>div.julia-shield>button.julia-btn.julia-big-play, -div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item -{ - -webkit-transition: all 250ms; - -moz-transition: all 250ms; - -ms-transition: all 250ms; - -o-transition: all 250ms; - transition: all 250ms; -} - -/* ***************************** -* === BACKDROP === -****************************** */ -::backdrop { - background-color: #000; -} - -::-ms-backdrop { - background-color: #000; + } } - /* ***************************** * Rangeslider polyfill styles ****************************** */ -div.julia-player.julia-theme-deeppink .julia-rangeslider, -div.julia-player.julia-theme-deeppink .julia-rangeslider__fill { - display: block; -} - -div.julia-player.julia-theme-deeppink .julia-rangeslider { +div.julia-player.julia-theme-deeppink>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider { background: #777; - position: relative; } -div.julia-player.julia-theme-deeppink .julia-rangeslider--horizontal { - height: 6px; - width: 100%; - cursor: pointer; +div.julia-player.julia-theme-deeppink>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__fill { + background: #FF1493; } -div.julia-player.julia-theme-deeppink .julia-rangeslider--vertical { - width: 6px; - min-height: 150px; - max-height: 100%; - cursor: pointer; +div.julia-player.julia-theme-deeppink>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle { + background-color: #F9F9F9; } -div.julia-player.julia-theme-deeppink .julia-rangeslider--disabled { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - opacity: 0.4; +div.julia-player.julia-theme-deeppink>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle:active { + background-color: #FF1493; } -div.julia-player.julia-theme-deeppink .julia-rangeslider__fill { - background: #FF1493; - position: absolute; -} -div.julia-player.julia-theme-deeppink .julia-rangeslider--horizontal .julia-rangeslider__fill { - top: 0; - height: 100%; -} -div.julia-player.julia-theme-deeppink .julia-rangeslider--vertical .julia-rangeslider__fill { - bottom: 0; - width: 100%; +input[type="range"]:focus + div.julia-player.julia-theme-deeppink>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider .julia-rangeslider__handle { } -div.julia-player.julia-theme-deeppink .julia-rangeslider__handle { - background-color: #F9F9F9; - cursor: pointer; - display: inline-block; - width: 8px; - height: 17px; - position: absolute; - -moz-border-radius:0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-deeppink .julia-rangeslider__handle:after { - content: ""; - display: block; - width: 8px; - height: 17px; - margin: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-deeppink .julia-rangeslider__handle:active { - /*background-color: #F00;*/ -} -div.julia-player.julia-theme-deeppink .julia-rangeslider--horizontal .julia-rangeslider__handle { - top: -6px; - touch-action: pan-y; - -ms-touch-action: pan-y; -} -div.julia-player.julia-theme-deeppink .julia-rangeslider--vertical .julia-rangeslider__handle { - left: -6px; - touch-action: pan-x; - -ms-touch-action: pan-x; -} -input[type="range"]:focus + div.julia-player.julia-theme-deeppink .julia-rangeslider .julia-rangeslider__handle { -} /* ************** * Progress bar ************** */ -div.julia-player.julia-theme-deeppink .julia-progress .julia-rangeslider--horizontal { - height: 12px; -} - div.julia-player.julia-theme-deeppink .julia-progress .julia-rangeslider__handle { - width: 6px; - height: 12px; - top: 0; background-color: #FFF; } diff --git a/dist/css/themes/default/julia.css b/dist/css/themes/default/julia.css index 3706c84..b8c4e49 100644 --- a/dist/css/themes/default/julia.css +++ b/dist/css/themes/default/julia.css @@ -1,322 +1,87 @@ /* ***************************** -* FIX! -* Hide default controls -* in fullscreen mode +* Julia player base color theme ***************************** */ -video::-webkit-media-controls { - display:none !important; -} - -/* ***************************** -* FIX! -* 4/5px gap bellow resizable -* inline media elements -***************************** */ -video, audio, canvas { - vertical-align: top; -} - -/* ***************************** -* Julia player style -* === CONTAINER === -***************************** */ -div.julia-player.julia-theme-default, div.julia-player.julia-theme-default * { - padding: 0; - margin: 0; -} - div.julia-player.julia-theme-default { - position: relative; - display: inline-block; background: rgba(0,0,0,1); - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); - /* ***************************** - * Julia player style - * Keep UI unselectable - ***************************** */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } -/* ***************************** -* === SHIELD === -***************************** */ -div.julia-player.julia-theme-default>div.julia-shield { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - background: rgba(0,0,0,0); - z-index: 73; -} -div.julia-player.julia-theme-default>div.julia-shield>img { - z-index: 75; -} + /* ***************************** * === SUGGEST === ***************************** */ div.julia-player.julia-theme-default>div.julia-suggest { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; background: rgba(0,0,0,1); - z-index: 77; - display: none; } -div.julia-player.julia-theme-default>div.julia-suggest.on { - display: block; -} -/* ***************************** -* === REMOTE TOOLBAR === -***************************** */ -div.julia-player.julia-theme-default>div.julia-toolbar { - background: rgba(0,0,0,.7); - height: 50px; - position: absolute; - bottom: 0; - left: 0; - right: 0; - z-index: 70; - opacity: .0; -} -div.julia-player.julia-theme-default>div.julia-toolbar.live { - height: 38px; -} /* ***************************** -* === PRELOADER === +* === TOOLBAR === ***************************** */ -@-webkit-keyframes rotating { -from { - -webkit-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -@keyframes rotating { - from { - -ms-transform: rotate(0deg); - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -ms-transform: rotate(360deg); - -moz-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } +div.julia-player.julia-theme-default>div.julia-toolbar { + background: rgba(0,0,0,.7); } div.julia-player.julia-theme-default>div.julia-shield>div.julia-preloader { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - padding: 0; - margin: 0; background-color: rgba(0,0,0,.7); - z-index: 79; -} - -div.julia-player.julia-theme-default>div.julia-shield>div.julia-preloader.on { - display: block; } div.julia-player.julia-theme-default>div.julia-shield>div.julia-preloader>i { color: #777; - padding: 0; - margin: 0; - display: block; - width: 64px; - height: 64px; - line-height: 64px; - text-align: center; - font-size: 64px; - position: absolute; - bottom: 50%; - left: 50%; - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -32px; - margin-bottom: -32px; - z-index: 80; - -webkit-animation: rotating 2s linear infinite; - -moz-animation: rotating 2s linear infinite; - -ms-animation: rotating 2s linear infinite; - -o-animation: rotating 2s linear infinite; - animation: rotating 2s linear infinite; } + + + /* ***************************** * === BUTTONS === ***************************** */ div.julia-player.julia-theme-default button.julia-btn { color: #F9F9F9; - background: transparent; - border: 0; - outline: 0; - font-size: 25px; - width: 30px; - height: 25px; - position: absolute; - bottom: 9px; } div.julia-player.julia-theme-default button.julia-btn:hover { color: #FFCC00; } -div.julia-player.julia-theme-default div.julia-toolbar>button.julia-btn.julia-playback { - left: 5px; -} - -div.julia-player.julia-theme-default div.julia-toolbar>button.julia-btn.julia-sound { - right: 140px; -} - -div.julia-player.julia-theme-default div.julia-toolbar>button.julia-btn.julia-fullscreen-toggle { - right: 5px; -} - -div.julia-player.julia-theme-default>div.julia-shield>button.julia-btn.julia-big-play { - width: 72px; - height: 72px; - text-align: center; - bottom: 50%; - left: 50%; - padding: 4px 0 0 8px; - background-color: rgba(0,0,0,.7); - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -36px; - margin-bottom: -36px; - z-index: 74; -} - -div.julia-player.julia-theme-default>div.julia-shield>button.julia-btn.julia-big-play>i { - display: inline-block; - height: 48px; - line-height: 48px; - font-size: 48px; -} - -/* ***************************** -* === BARS === -***************************** */ -div.julia-player.julia-theme-default>div.julia-toolbar>div.julia-progress { - height: 12px; - position: absolute; - left: 0; - right: 0; - top: 0; -} -div.julia-player.julia-theme-default>div.julia-toolbar.live>div.julia-progress { - display: none; -} -div.julia-player.julia-theme-default>div.julia-toolbar>div.julia-volume { - width: 80px; - border: 0; - outline: 0; - height: 16px; - position: absolute; - right: 50px; - bottom: 5px; -} /* ***************************** -* Julia player style * === PANELS === ***************************** */ div.julia-player.julia-theme-default>div.julia-toolbar>div.julia-panel { - display: inline-block; - border: 0; - outline: 0; - height: 20px; - font-size: 12px; color: #DDD; - position: absolute; - bottom: 6px; - font-family: sans-serif; } div.julia-player.julia-theme-default>div.julia-toolbar>div.julia-panel.julia-currentTime { - width: 60px; - left: 40px; - text-align: right; } div.julia-player.julia-theme-default>div.julia-toolbar>div.julia-panel.julia-live-indicator { - left: 50px; - text-align: left; - display: none; - font-weight: bold; - text-transform: uppercase; } div.julia-player.julia-theme-default>div.julia-toolbar>div.julia-panel.julia-duration { - left: 105px; -} - -div.julia-player.julia-theme-default>div.julia-toolbar.live>div.julia-currentTime, -div.julia-player.julia-theme-default>div.julia-toolbar.live>div.julia-duration { - display: none; } div.julia-player.julia-theme-default>div.julia-toolbar.live>div.julia-panel.julia-live-indicator { - display: inline-block; } + + + /* ***************************** -* Julia player style * === SUGGEST ITEMS === ***************************** */ div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item { - width: 42.5%; - height: 50%; - min-height: 80px; - font-size: 1.2em; border: 1px solid #444; color: #ABABAB; background: rgba(0,0,0,1); - float: left; - margin: 5% 0 0 5%; - padding: 2%; - cursor: pointer; - position: relative; - overflow: hidden; } div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; - left: 0; } div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item:hover { @@ -324,181 +89,46 @@ div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item:ho } div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; - left: 0; - right: 0; background: rgba(0,0,0,.8); - padding: 10px; - text-align: left; } @media (max-width: 480px) { div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item { - font-size: 12px; - } -} - - -/* ***************************** -* === TOOLBAR VISIBLE MODE === -***************************** */ -div.julia-player.julia-theme-default>div.julia-toolbar.julia-toolbar-visible { - opacity: 1; - z-index: 80; -} - -/* ***************************** -* === FULLSCREEN MODE === -****************************** */ -div.julia-player.julia-theme-default.julia-fullscreen-on { - position: relative; - min-width: 100%; - min-height: 100%; - width: 100vw; - height: 100vh; - background: #000; - display: block; -} - -/* ***************************** -* === VIDEO ELEMENT === -****************************** */ -div.julia-player.julia-theme-default>video { - min-width: 100%; - height: auto; - min-height: 100%; -} - -/* ***************************** -* === TRANSITIONS === -****************************** */ -div.julia-player.julia-theme-default, -div.julia-player.julia-theme-default>div.julia-toolbar, -div.julia-player.julia-theme-default>div.julia-shield>button.julia-btn.julia-big-play, -div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item -{ - -webkit-transition: all 250ms; - -moz-transition: all 250ms; - -ms-transition: all 250ms; - -o-transition: all 250ms; - transition: all 250ms; -} - -/* ***************************** -* === BACKDROP === -****************************** */ -::backdrop { - background-color: #000; -} - -::-ms-backdrop { - background-color: #000; + } } - /* ***************************** * Rangeslider polyfill styles ****************************** */ -div.julia-player.julia-theme-default .julia-rangeslider, -div.julia-player.julia-theme-default .julia-rangeslider__fill { - display: block; -} - -div.julia-player.julia-theme-default .julia-rangeslider { +div.julia-player.julia-theme-default>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider { background: #777; - position: relative; } -div.julia-player.julia-theme-default .julia-rangeslider--horizontal { - height: 6px; - width: 100%; - cursor: pointer; +div.julia-player.julia-theme-default>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__fill { + background: #FFCC00; } -div.julia-player.julia-theme-default .julia-rangeslider--vertical { - width: 6px; - min-height: 150px; - max-height: 100%; - cursor: pointer; +div.julia-player.julia-theme-default>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle { + background-color: #F9F9F9; } -div.julia-player.julia-theme-default .julia-rangeslider--disabled { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - opacity: 0.4; +div.julia-player.julia-theme-default>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle:active { + background-color: #FFCC00; } -div.julia-player.julia-theme-default .julia-rangeslider__fill { - background: #FFCC00; - position: absolute; -} -div.julia-player.julia-theme-default .julia-rangeslider--horizontal .julia-rangeslider__fill { - top: 0; - height: 100%; -} -div.julia-player.julia-theme-default .julia-rangeslider--vertical .julia-rangeslider__fill { - bottom: 0; - width: 100%; +input[type="range"]:focus + div.julia-player.julia-theme-default>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider .julia-rangeslider__handle { } -div.julia-player.julia-theme-default .julia-rangeslider__handle { - background-color: #F9F9F9; - cursor: pointer; - display: inline-block; - width: 8px; - height: 17px; - position: absolute; - -moz-border-radius:0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-default .julia-rangeslider__handle:after { - content: ""; - display: block; - width: 8px; - height: 17px; - margin: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-default .julia-rangeslider__handle:active { - /*background-color: #F00;*/ -} -div.julia-player.julia-theme-default .julia-rangeslider--horizontal .julia-rangeslider__handle { - top: -6px; - touch-action: pan-y; - -ms-touch-action: pan-y; -} -div.julia-player.julia-theme-default .julia-rangeslider--vertical .julia-rangeslider__handle { - left: -6px; - touch-action: pan-x; - -ms-touch-action: pan-x; -} -input[type="range"]:focus + div.julia-player.julia-theme-default .julia-rangeslider .julia-rangeslider__handle { -} /* ************** * Progress bar ************** */ -div.julia-player.julia-theme-default .julia-progress .julia-rangeslider--horizontal { - height: 12px; -} - div.julia-player.julia-theme-default .julia-progress .julia-rangeslider__handle { - width: 6px; - height: 12px; - top: 0; background-color: #FFF; } diff --git a/dist/css/themes/lime/julia.css b/dist/css/themes/lime/julia.css index f79798d..786479b 100644 --- a/dist/css/themes/lime/julia.css +++ b/dist/css/themes/lime/julia.css @@ -1,322 +1,87 @@ /* ***************************** -* FIX! -* Hide default controls -* in fullscreen mode +* Julia player base color theme ***************************** */ -video::-webkit-media-controls { - display:none !important; -} - -/* ***************************** -* FIX! -* 4/5px gap bellow resizable -* inline media elements -***************************** */ -video, audio, canvas { - vertical-align: top; -} - -/* ***************************** -* Julia player style -* === CONTAINER === -***************************** */ -div.julia-player.julia-theme-lime, div.julia-player.julia-theme-lime * { - padding: 0; - margin: 0; -} - div.julia-player.julia-theme-lime { - position: relative; - display: inline-block; background: rgba(0,0,0,1); - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); - /* ***************************** - * Julia player style - * Keep UI unselectable - ***************************** */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } -/* ***************************** -* === SHIELD === -***************************** */ -div.julia-player.julia-theme-lime>div.julia-shield { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - background: rgba(0,0,0,0); - z-index: 73; -} -div.julia-player.julia-theme-lime>div.julia-shield>img { - z-index: 75; -} + /* ***************************** * === SUGGEST === ***************************** */ div.julia-player.julia-theme-lime>div.julia-suggest { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; background: rgba(0,0,0,1); - z-index: 77; - display: none; } -div.julia-player.julia-theme-lime>div.julia-suggest.on { - display: block; -} -/* ***************************** -* === REMOTE TOOLBAR === -***************************** */ -div.julia-player.julia-theme-lime>div.julia-toolbar { - background: rgba(0,0,0,.7); - height: 50px; - position: absolute; - bottom: 0; - left: 0; - right: 0; - z-index: 70; - opacity: .0; -} -div.julia-player.julia-theme-lime>div.julia-toolbar.live { - height: 38px; -} /* ***************************** -* === PRELOADER === +* === TOOLBAR === ***************************** */ -@-webkit-keyframes rotating { -from { - -webkit-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -@keyframes rotating { - from { - -ms-transform: rotate(0deg); - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -ms-transform: rotate(360deg); - -moz-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } +div.julia-player.julia-theme-lime>div.julia-toolbar { + background: rgba(0,0,0,.7); } div.julia-player.julia-theme-lime>div.julia-shield>div.julia-preloader { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - padding: 0; - margin: 0; background-color: rgba(0,0,0,.7); - z-index: 79; -} - -div.julia-player.julia-theme-lime>div.julia-shield>div.julia-preloader.on { - display: block; } div.julia-player.julia-theme-lime>div.julia-shield>div.julia-preloader>i { color: #777; - padding: 0; - margin: 0; - display: block; - width: 64px; - height: 64px; - line-height: 64px; - text-align: center; - font-size: 64px; - position: absolute; - bottom: 50%; - left: 50%; - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -32px; - margin-bottom: -32px; - z-index: 80; - -webkit-animation: rotating 2s linear infinite; - -moz-animation: rotating 2s linear infinite; - -ms-animation: rotating 2s linear infinite; - -o-animation: rotating 2s linear infinite; - animation: rotating 2s linear infinite; } + + + /* ***************************** * === BUTTONS === ***************************** */ div.julia-player.julia-theme-lime button.julia-btn { color: #F9F9F9; - background: transparent; - border: 0; - outline: 0; - font-size: 25px; - width: 30px; - height: 25px; - position: absolute; - bottom: 9px; } div.julia-player.julia-theme-lime button.julia-btn:hover { color: #00FF00; } -div.julia-player.julia-theme-lime div.julia-toolbar>button.julia-btn.julia-playback { - left: 5px; -} - -div.julia-player.julia-theme-lime div.julia-toolbar>button.julia-btn.julia-sound { - right: 140px; -} - -div.julia-player.julia-theme-lime div.julia-toolbar>button.julia-btn.julia-fullscreen-toggle { - right: 5px; -} -div.julia-player.julia-theme-lime>div.julia-shield>button.julia-btn.julia-big-play { - width: 72px; - height: 72px; - text-align: center; - bottom: 50%; - left: 50%; - padding: 4px 0 0 8px; - background-color: rgba(0,0,0,.7); - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -36px; - margin-bottom: -36px; - z-index: 74; -} -div.julia-player.julia-theme-lime>div.julia-shield>button.julia-btn.julia-big-play>i { - display: inline-block; - height: 48px; - line-height: 48px; - font-size: 48px; -} /* ***************************** -* === BARS === -***************************** */ -div.julia-player.julia-theme-lime>div.julia-toolbar>div.julia-progress { - height: 12px; - position: absolute; - left: 0; - right: 0; - top: 0; -} - -div.julia-player.julia-theme-lime>div.julia-toolbar.live>div.julia-progress { - display: none; -} - -div.julia-player.julia-theme-lime>div.julia-toolbar>div.julia-volume { - width: 80px; - border: 0; - outline: 0; - height: 16px; - position: absolute; - right: 50px; - bottom: 5px; -} - -/* ***************************** -* Julia player style * === PANELS === ***************************** */ div.julia-player.julia-theme-lime>div.julia-toolbar>div.julia-panel { - display: inline-block; - border: 0; - outline: 0; - height: 20px; - font-size: 12px; color: #DDD; - position: absolute; - bottom: 6px; - font-family: sans-serif; } div.julia-player.julia-theme-lime>div.julia-toolbar>div.julia-panel.julia-currentTime { - width: 60px; - left: 40px; - text-align: right; } div.julia-player.julia-theme-lime>div.julia-toolbar>div.julia-panel.julia-live-indicator { - left: 50px; - text-align: left; - display: none; - font-weight: bold; - text-transform: uppercase; } div.julia-player.julia-theme-lime>div.julia-toolbar>div.julia-panel.julia-duration { - left: 105px; -} - -div.julia-player.julia-theme-lime>div.julia-toolbar.live>div.julia-currentTime, -div.julia-player.julia-theme-lime>div.julia-toolbar.live>div.julia-duration { - display: none; } div.julia-player.julia-theme-lime>div.julia-toolbar.live>div.julia-panel.julia-live-indicator { - display: inline-block; } + + + /* ***************************** -* Julia player style * === SUGGEST ITEMS === ***************************** */ div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item { - width: 42.5%; - height: 50%; - min-height: 80px; - font-size: 1.2em; border: 1px solid #444; color: #ABABAB; background: rgba(0,0,0,1); - float: left; - margin: 5% 0 0 5%; - padding: 2%; - cursor: pointer; - position: relative; - overflow: hidden; } div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; - left: 0; } div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item:hover { @@ -324,181 +89,46 @@ div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item:hover } div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; - left: 0; - right: 0; background: rgba(0,0,0,.8); - padding: 10px; - text-align: left; } @media (max-width: 480px) { div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item { - font-size: 12px; - } -} - - -/* ***************************** -* === TOOLBAR VISIBLE MODE === -***************************** */ -div.julia-player.julia-theme-lime>div.julia-toolbar.julia-toolbar-visible { - opacity: 1; - z-index: 80; -} - -/* ***************************** -* === FULLSCREEN MODE === -****************************** */ -div.julia-player.julia-theme-lime.julia-fullscreen-on { - position: relative; - min-width: 100%; - min-height: 100%; - width: 100vw; - height: 100vh; - background: #000; - display: block; -} - -/* ***************************** -* === VIDEO ELEMENT === -****************************** */ -div.julia-player.julia-theme-lime>video { - min-width: 100%; - height: auto; - min-height: 100%; -} - -/* ***************************** -* === TRANSITIONS === -****************************** */ -div.julia-player.julia-theme-lime, -div.julia-player.julia-theme-lime>div.julia-toolbar, -div.julia-player.julia-theme-lime>div.julia-shield>button.julia-btn.julia-big-play, -div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item -{ - -webkit-transition: all 250ms; - -moz-transition: all 250ms; - -ms-transition: all 250ms; - -o-transition: all 250ms; - transition: all 250ms; -} - -/* ***************************** -* === BACKDROP === -****************************** */ -::backdrop { - background-color: #000; -} - -::-ms-backdrop { - background-color: #000; + } } - /* ***************************** * Rangeslider polyfill styles ****************************** */ -div.julia-player.julia-theme-lime .julia-rangeslider, -div.julia-player.julia-theme-lime .julia-rangeslider__fill { - display: block; -} - -div.julia-player.julia-theme-lime .julia-rangeslider { +div.julia-player.julia-theme-lime>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider { background: #777; - position: relative; } -div.julia-player.julia-theme-lime .julia-rangeslider--horizontal { - height: 6px; - width: 100%; - cursor: pointer; +div.julia-player.julia-theme-lime>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__fill { + background: #00FF00; } -div.julia-player.julia-theme-lime .julia-rangeslider--vertical { - width: 6px; - min-height: 150px; - max-height: 100%; - cursor: pointer; +div.julia-player.julia-theme-lime>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle { + background-color: #F9F9F9; } -div.julia-player.julia-theme-lime .julia-rangeslider--disabled { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - opacity: 0.4; +div.julia-player.julia-theme-lime>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle:active { + background-color: #00FF00; } -div.julia-player.julia-theme-lime .julia-rangeslider__fill { - background: #00FF00; - position: absolute; -} -div.julia-player.julia-theme-lime .julia-rangeslider--horizontal .julia-rangeslider__fill { - top: 0; - height: 100%; -} -div.julia-player.julia-theme-lime .julia-rangeslider--vertical .julia-rangeslider__fill { - bottom: 0; - width: 100%; +input[type="range"]:focus + div.julia-player.julia-theme-lime>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider .julia-rangeslider__handle { } -div.julia-player.julia-theme-lime .julia-rangeslider__handle { - background-color: #F9F9F9; - cursor: pointer; - display: inline-block; - width: 8px; - height: 17px; - position: absolute; - -moz-border-radius:0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-lime .julia-rangeslider__handle:after { - content: ""; - display: block; - width: 8px; - height: 17px; - margin: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-lime .julia-rangeslider__handle:active { - /*background-color: #F00;*/ -} -div.julia-player.julia-theme-lime .julia-rangeslider--horizontal .julia-rangeslider__handle { - top: -6px; - touch-action: pan-y; - -ms-touch-action: pan-y; -} -div.julia-player.julia-theme-lime .julia-rangeslider--vertical .julia-rangeslider__handle { - left: -6px; - touch-action: pan-x; - -ms-touch-action: pan-x; -} -input[type="range"]:focus + div.julia-player.julia-theme-lime .julia-rangeslider .julia-rangeslider__handle { -} /* ************** * Progress bar ************** */ -div.julia-player.julia-theme-lime .julia-progress .julia-rangeslider--horizontal { - height: 12px; -} - div.julia-player.julia-theme-lime .julia-progress .julia-rangeslider__handle { - width: 6px; - height: 12px; - top: 0; background-color: #FFF; } diff --git a/dist/css/themes/mediumspringgreen/julia.css b/dist/css/themes/mediumspringgreen/julia.css index c9c3370..15e2fe7 100644 --- a/dist/css/themes/mediumspringgreen/julia.css +++ b/dist/css/themes/mediumspringgreen/julia.css @@ -1,322 +1,87 @@ /* ***************************** -* FIX! -* Hide default controls -* in fullscreen mode +* Julia player base color theme ***************************** */ -video::-webkit-media-controls { - display:none !important; -} - -/* ***************************** -* FIX! -* 4/5px gap bellow resizable -* inline media elements -***************************** */ -video, audio, canvas { - vertical-align: top; -} - -/* ***************************** -* Julia player style -* === CONTAINER === -***************************** */ -div.julia-player.julia-theme-mediumspringgreen, div.julia-player.julia-theme-mediumspringgreen * { - padding: 0; - margin: 0; -} - div.julia-player.julia-theme-mediumspringgreen { - position: relative; - display: inline-block; background: rgba(0,0,0,1); - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); - /* ***************************** - * Julia player style - * Keep UI unselectable - ***************************** */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } -/* ***************************** -* === SHIELD === -***************************** */ -div.julia-player.julia-theme-mediumspringgreen>div.julia-shield { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - background: rgba(0,0,0,0); - z-index: 73; -} -div.julia-player.julia-theme-mediumspringgreen>div.julia-shield>img { - z-index: 75; -} + /* ***************************** * === SUGGEST === ***************************** */ div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; background: rgba(0,0,0,1); - z-index: 77; - display: none; } -div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest.on { - display: block; -} -/* ***************************** -* === REMOTE TOOLBAR === -***************************** */ -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar { - background: rgba(0,0,0,.7); - height: 50px; - position: absolute; - bottom: 0; - left: 0; - right: 0; - z-index: 70; - opacity: .0; -} -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar.live { - height: 38px; -} /* ***************************** -* === PRELOADER === +* === TOOLBAR === ***************************** */ -@-webkit-keyframes rotating { -from { - -webkit-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -@keyframes rotating { - from { - -ms-transform: rotate(0deg); - -moz-transform: rotate(0deg); - -o-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -ms-transform: rotate(360deg); - -moz-transform: rotate(360deg); - -o-transform: rotate(360deg); - transform: rotate(360deg); - } +div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar { + background: rgba(0,0,0,.7); } div.julia-player.julia-theme-mediumspringgreen>div.julia-shield>div.julia-preloader { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - padding: 0; - margin: 0; background-color: rgba(0,0,0,.7); - z-index: 79; -} - -div.julia-player.julia-theme-mediumspringgreen>div.julia-shield>div.julia-preloader.on { - display: block; } div.julia-player.julia-theme-mediumspringgreen>div.julia-shield>div.julia-preloader>i { color: #777; - padding: 0; - margin: 0; - display: block; - width: 64px; - height: 64px; - line-height: 64px; - text-align: center; - font-size: 64px; - position: absolute; - bottom: 50%; - left: 50%; - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -32px; - margin-bottom: -32px; - z-index: 80; - -webkit-animation: rotating 2s linear infinite; - -moz-animation: rotating 2s linear infinite; - -ms-animation: rotating 2s linear infinite; - -o-animation: rotating 2s linear infinite; - animation: rotating 2s linear infinite; } + + + /* ***************************** * === BUTTONS === ***************************** */ div.julia-player.julia-theme-mediumspringgreen button.julia-btn { color: #F9F9F9; - background: transparent; - border: 0; - outline: 0; - font-size: 25px; - width: 30px; - height: 25px; - position: absolute; - bottom: 9px; } div.julia-player.julia-theme-mediumspringgreen button.julia-btn:hover { color: #00FA9A; } -div.julia-player.julia-theme-mediumspringgreen div.julia-toolbar>button.julia-btn.julia-playback { - left: 5px; -} - -div.julia-player.julia-theme-mediumspringgreen div.julia-toolbar>button.julia-btn.julia-sound { - right: 140px; -} - -div.julia-player.julia-theme-mediumspringgreen div.julia-toolbar>button.julia-btn.julia-fullscreen-toggle { - right: 5px; -} -div.julia-player.julia-theme-mediumspringgreen>div.julia-shield>button.julia-btn.julia-big-play { - width: 72px; - height: 72px; - text-align: center; - bottom: 50%; - left: 50%; - padding: 4px 0 0 8px; - background-color: rgba(0,0,0,.7); - -moz-border-radius: 50%; - -webkit-border-radius: 50%; - border-radius: 50%; - margin-left: -36px; - margin-bottom: -36px; - z-index: 74; -} -div.julia-player.julia-theme-mediumspringgreen>div.julia-shield>button.julia-btn.julia-big-play>i { - display: inline-block; - height: 48px; - line-height: 48px; - font-size: 48px; -} /* ***************************** -* === BARS === -***************************** */ -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div.julia-progress { - height: 12px; - position: absolute; - left: 0; - right: 0; - top: 0; -} - -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar.live>div.julia-progress { - display: none; -} - -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div.julia-volume { - width: 80px; - border: 0; - outline: 0; - height: 16px; - position: absolute; - right: 50px; - bottom: 5px; -} - -/* ***************************** -* Julia player style * === PANELS === ***************************** */ div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div.julia-panel { - display: inline-block; - border: 0; - outline: 0; - height: 20px; - font-size: 12px; color: #DDD; - position: absolute; - bottom: 6px; - font-family: sans-serif; } div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div.julia-panel.julia-currentTime { - width: 60px; - left: 40px; - text-align: right; } div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div.julia-panel.julia-live-indicator { - left: 50px; - text-align: left; - display: none; - font-weight: bold; - text-transform: uppercase; } div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div.julia-panel.julia-duration { - left: 105px; -} - -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar.live>div.julia-currentTime, -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar.live>div.julia-duration { - display: none; } div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar.live>div.julia-panel.julia-live-indicator { - display: inline-block; } + + + /* ***************************** -* Julia player style * === SUGGEST ITEMS === ***************************** */ div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item { - width: 42.5%; - height: 50%; - min-height: 80px; - font-size: 1.2em; border: 1px solid #444; color: #ABABAB; background: rgba(0,0,0,1); - float: left; - margin: 5% 0 0 5%; - padding: 2%; - cursor: pointer; - position: relative; - overflow: hidden; } div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; - left: 0; } div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item:hover { @@ -324,181 +89,46 @@ div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-sugge } div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; - left: 0; - right: 0; background: rgba(0,0,0,.8); - padding: 10px; - text-align: left; } @media (max-width: 480px) { div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item { - font-size: 12px; - } -} - - -/* ***************************** -* === TOOLBAR VISIBLE MODE === -***************************** */ -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar.julia-toolbar-visible { - opacity: 1; - z-index: 80; -} - -/* ***************************** -* === FULLSCREEN MODE === -****************************** */ -div.julia-player.julia-theme-mediumspringgreen.julia-fullscreen-on { - position: relative; - min-width: 100%; - min-height: 100%; - width: 100vw; - height: 100vh; - background: #000; - display: block; -} - -/* ***************************** -* === VIDEO ELEMENT === -****************************** */ -div.julia-player.julia-theme-mediumspringgreen>video { - min-width: 100%; - height: auto; - min-height: 100%; -} - -/* ***************************** -* === TRANSITIONS === -****************************** */ -div.julia-player.julia-theme-mediumspringgreen, -div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar, -div.julia-player.julia-theme-mediumspringgreen>div.julia-shield>button.julia-btn.julia-big-play, -div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item -{ - -webkit-transition: all 250ms; - -moz-transition: all 250ms; - -ms-transition: all 250ms; - -o-transition: all 250ms; - transition: all 250ms; -} - -/* ***************************** -* === BACKDROP === -****************************** */ -::backdrop { - background-color: #000; -} - -::-ms-backdrop { - background-color: #000; + } } - /* ***************************** * Rangeslider polyfill styles ****************************** */ -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider, -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider__fill { - display: block; -} - -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider { +div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider { background: #777; - position: relative; } -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider--horizontal { - height: 6px; - width: 100%; - cursor: pointer; +div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__fill { + background: #00FA9A; } -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider--vertical { - width: 6px; - min-height: 150px; - max-height: 100%; - cursor: pointer; +div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle { + background-color: #F9F9F9; } -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider--disabled { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - opacity: 0.4; +div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider>.julia-rangeslider__handle:active { + background-color: #00FA9A; } -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider__fill { - background: #00FA9A; - position: absolute; -} -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider--horizontal .julia-rangeslider__fill { - top: 0; - height: 100%; -} -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider--vertical .julia-rangeslider__fill { - bottom: 0; - width: 100%; +input[type="range"]:focus + div.julia-player.julia-theme-mediumspringgreen>div.julia-toolbar>div[class*="julia"]>.julia-rangeslider .julia-rangeslider__handle { } -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider__handle { - background-color: #F9F9F9; - cursor: pointer; - display: inline-block; - width: 8px; - height: 17px; - position: absolute; - -moz-border-radius:0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider__handle:after { - content: ""; - display: block; - width: 8px; - height: 17px; - margin: auto; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider__handle:active { - /*background-color: #F00;*/ -} -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider--horizontal .julia-rangeslider__handle { - top: -6px; - touch-action: pan-y; - -ms-touch-action: pan-y; -} -div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider--vertical .julia-rangeslider__handle { - left: -6px; - touch-action: pan-x; - -ms-touch-action: pan-x; -} -input[type="range"]:focus + div.julia-player.julia-theme-mediumspringgreen .julia-rangeslider .julia-rangeslider__handle { -} /* ************** * Progress bar ************** */ -div.julia-player.julia-theme-mediumspringgreen .julia-progress .julia-rangeslider--horizontal { - height: 12px; -} - div.julia-player.julia-theme-mediumspringgreen .julia-progress .julia-rangeslider__handle { - width: 6px; - height: 12px; - top: 0; background-color: #FFF; } diff --git a/dist/fonts/Julia.eot b/dist/fonts/Julia.eot new file mode 100644 index 0000000..357bf64 Binary files /dev/null and b/dist/fonts/Julia.eot differ diff --git a/dist/fonts/Julia.svg b/dist/fonts/Julia.svg new file mode 100644 index 0000000..12561a0 --- /dev/null +++ b/dist/fonts/Julia.svg @@ -0,0 +1,73 @@ + + + + + +Created by FontForge 20120731 at Tue Aug 16 20:52:28 2016 + By Apache +Created by Apache with FontForge 2.0 (http://fontforge.sf.net) + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dist/fonts/Julia.ttf b/dist/fonts/Julia.ttf new file mode 100644 index 0000000..94d24f2 Binary files /dev/null and b/dist/fonts/Julia.ttf differ diff --git a/dist/fonts/Julia.woff b/dist/fonts/Julia.woff new file mode 100644 index 0000000..b35cf52 Binary files /dev/null and b/dist/fonts/Julia.woff differ diff --git a/dist/fonts/ionicons.eot b/dist/fonts/ionicons.eot deleted file mode 100644 index 92a3f20..0000000 Binary files a/dist/fonts/ionicons.eot and /dev/null differ diff --git a/dist/fonts/ionicons.svg b/dist/fonts/ionicons.svg deleted file mode 100644 index 49fc8f3..0000000 --- a/dist/fonts/ionicons.svg +++ /dev/null @@ -1,2230 +0,0 @@ - - - - - -Created by FontForge 20120731 at Thu Dec 4 09:51:48 2014 - By Adam Bradley -Created by Adam Bradley with FontForge 2.0 (http://fontforge.sf.net) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dist/fonts/ionicons.ttf b/dist/fonts/ionicons.ttf deleted file mode 100644 index c4e4632..0000000 Binary files a/dist/fonts/ionicons.ttf and /dev/null differ diff --git a/dist/fonts/ionicons.woff b/dist/fonts/ionicons.woff deleted file mode 100644 index 5f3a14e..0000000 Binary files a/dist/fonts/ionicons.woff and /dev/null differ diff --git a/dist/js/julia-player.js b/dist/js/julia-player.js index b524272..bca2e92 100644 --- a/dist/js/julia-player.js +++ b/dist/js/julia-player.js @@ -1,2220 +1,11255 @@ -/* *********************************** -* Julia player -* -* @author prochor666@gmail.com -* version: 0.9.10 -* build: 2016-04-21 -* licensed under the MIT License -* -* @requires: -* hls.js [required] -* jquery [required] -* ionicons [required] -* rangeslider.js [required] -* -************************************* */ - -// Support libs -if(!window.jQuery) -{ - alert('jQuery is required'); - window.stop(); +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Hls = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } -(function($) -{ - // Root path workaround - var __JULIA_ROOT_PATH__ = 'julia'; - dir = document.querySelector('script[src*="julia-player"]').getAttribute('src'); - name = dir.split('/').pop(); - __JULIA_ROOT_PATH__ = dir.replace('/js/'+name,""); - $('head').append(''); + return this; +}; - // Support libs - try { - h = new Hls; +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; - }catch(err) - { - /*! hls.js 0.5.22, handle error or insert source */ - !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(){return function s(e,t,r){function i(n,d){if(!t[n]){if(!e[n]){var l="function"==typeof require&&require;if(!d&&l)return l(n,!0);if(a)return a(n,!0);var u=new Error("Cannot find module '"+n+"'");throw u.code="MODULE_NOT_FOUND",u}var o=t[n]={exports:{}};e[n][0].call(o.exports,function(t){var r=e[n][1][t];return i(r?r:t)},o,o.exports,s,e,t,r)}return t[n].exports}for(var a="function"==typeof require&&require,n=0;ne||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},e.prototype.emit=function(l){var s,e,u,n,a,o;if(this._events||(this._events={}),"error"===l&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(s=arguments[1],s instanceof Error)throw s;throw TypeError('Uncaught, unspecified "error" event.')}if(e=this._events[l],i(e))return!1;if(t(e))switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),e.apply(this,n)}else if(r(e))for(n=Array.prototype.slice.call(arguments,1),o=e.slice(),u=o.length,a=0;u>a;a++)o[a].apply(this,n);return!0},e.prototype.addListener=function(n,a){var s;if(!t(a))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",n,t(a.listener)?a.listener:a),this._events[n]?r(this._events[n])?this._events[n].push(a):this._events[n]=[this._events[n],a]:this._events[n]=a,r(this._events[n])&&!this._events[n].warned&&(s=i(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[n].length>s&&(this._events[n].warned=!0,"function"==typeof console.trace)),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(i,e){function r(){this.removeListener(i,r),n||(n=!0,e.apply(this,arguments))}if(!t(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(i,r),this},e.prototype.removeListener=function(n,i){var e,s,o,a;if(!t(i))throw TypeError("listener must be a function");if(!this._events||!this._events[n])return this;if(e=this._events[n],o=e.length,s=-1,e===i||t(e.listener)&&e.listener===i)delete this._events[n],this._events.removeListener&&this.emit("removeListener",n,i);else if(r(e)){for(a=o;a-- >0;)if(e[a]===i||e[a].listener&&e[a].listener===i){s=a;break}if(0>s)return this;1===e.length?(e.length=0,delete this._events[n]):e.splice(s,1),this._events.removeListener&&this.emit("removeListener",n,i)}return this},e.prototype.removeAllListeners=function(r){var i,e;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[r]&&delete this._events[r],this;if(0===arguments.length){for(i in this._events)"removeListener"!==i&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[r],t(e))this.removeListener(r,e);else if(e)for(;e.length;)this.removeListener(r,e[e.length-1]);return delete this._events[r],this},e.prototype.listeners=function(e){var r;return r=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(t(e))return 1;if(e)return e.length}return 0},e.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(a,i,s){var n=arguments[3],e=arguments[4],r=arguments[5],t=JSON.stringify;i.exports=function(l){for(var i,s=Object.keys(r),a=0,d=s.length;d>a;a++){var o=s[a],u=r[o].exports;if(u===l||u.default===l){i=o;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},a=0,d=s.length;d>a;a++){var o=s[a];f[o]=o}e[i]=[Function(["require","module","exports"],"("+l+")(self)"),f]}var h=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[i]=i,e[h]=[Function(["require"],"var f = require("+t(i)+");(f.default ? f.default : f)(self);"),c];var v="("+n+")({"+Object.keys(e).map(function(r){return t(r)+":["+e[r][0]+","+t(e[r][1])+"]"}).join(",")+"},{},["+t(h)+"])",g=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(g.createObjectURL(new Blob([v],{type:"text/javascript"})))}},{}],3:[function(e,p,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;t500*e.duration){var d=Math.max(1,1e3*e.loaded/u);e.expectedLens){var o=void 0,r=void 0;for(r=e.level-1;r>=0&&(o=e.duration*n.levels[r].bitrate/(6.4*d),i.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+r+"] :"+l.toFixed(1)+"/"+s.toFixed(1)+"/"+o.toFixed(1)),!(s>o));r--);l>o&&(r=Math.max(0,r),n.nextLoadLevel=r,i.logger.warn("loading too slow, abort fragment loading and switch to level "+r),e.loader.abort(),this.clearTimer(),n.trigger(t.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e}))}}}}},{key:"onFragLoaded",value:function(e){this.clearTimer(),this.lastLoadedFragLevel=e.frag.level,this._nextAutoLevel=-1}},{key:"onError",value:function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var i,e,r,n=this.lastbw,t=this.hls;if(r=-1===this._autoLevelCapping&&t.levels&&t.levels.length?t.levels.length-1:this._autoLevelCapping,-1!==this._nextAutoLevel)return Math.min(this._nextAutoLevel,r);for(e=0;r>=e;e++)if(i=e<=this.lastLoadedFragLevel?.8*n:.7*n,ia.config.appendErrorMaxRetry)return t.logger.log("fail "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),n=[],i.fatal=!0,void a.trigger(e.default.ERROR,i);i.fatal=!1,a.trigger(e.default.ERROR,i)}else n=[],i.details=r.ErrorDetails.BUFFER_FULL_ERROR,a.trigger(e.default.ERROR,i)}}}}},{key:"flushBuffer",value:function(l,s){var e,r,o,a,i,n;if(this.flushBufferCounter.5)return this.flushBufferCounter++,t.logger.log("flush "+u+" ["+i+","+n+"], of ["+o+","+a+"], pos:"+this.media.currentTime),e.remove(i,n),!1}else t.logger.warn("abort flushing too many retries");return t.logger.log("buffer flushed"),!0}}]),i}(s.default);n.default=o},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],5:[function(e,h,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;tthis.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(a){var r=void 0,e=void 0,t=void 0,s=this.mediaWidth,o=this.mediaHeight,i=0,n=0;for(e=0;a>=e&&(t=this.levels[e],r=e,i=t.width,n=t.height,!(i>=s||n>=o));e++);return r}},{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}}]),e}(s.default);t.default=u},{"../event-handler":21,"../events":22}],6:[function(i,v,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;t=0&&i1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var m,l,a,_=this,f=this.hls,o=f.config;switch(this.state){case e.ERROR:case e.PAUSED:break;case e.STARTING:this.startLevel=f.startLevel,-1===this.startLevel&&(this.startLevel=0,this.fragBitrateTest=!0),this.level=f.nextLoadLevel=this.startLevel,this.state=e.WAITING_LEVEL,this.loadedmetadata=!1;break;case e.IDLE:if(!this.media&&(this.startFragRequested||!o.startFragPrefetch))break;m=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition,l=this.startFragRequested===!1?this.startLevel:f.nextLoadLevel;var c,b=s.default.bufferInfo(this.media,m,o.maxBufferHole),k=b.len,u=b.end,v=this.fragPrevious;if(this.levels[l].hasOwnProperty("bitrate")?(c=Math.max(8*o.maxBufferSize/this.levels[l].bitrate,o.maxBufferLength),c=Math.min(c,o.maxMaxBufferLength)):c=o.maxBufferLength,c>k){if(f.nextLoadLevel=l,this.level=l,a=this.levels[l].details,"undefined"==typeof a||a.live&&this.levelLastLoaded!==l){this.state=e.WAITING_LEVEL;break}var d=a.fragments,h=d.length,g=d[0].start,y=d[h-1].start+d[h-1].duration,n=void 0;if(a.live){var T=void 0!==o.liveMaxLatencyDuration?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*a.targetduration;if(uy)break;if(this.startFragRequested&&!a.PTSKnown){if(v){var E=v.sn+1;E>=a.startSN&&E<=a.endSN&&(n=d[E-a.startSN],t.logger.log("live playlist, switching playlist, load frag with next SN: "+n.sn))}n||(n=d[Math.min(h-1,Math.round(h/2))],t.logger.log("live playlist, switching playlist, unknown, load middle frag : "+n.sn))}}else g>u&&(n=d[0]);if(n||!function(){var i=void 0,s=o.maxFragLookUpTolerance;y>u?(u>y-s&&(s=0),i=p.default.search(d,function(e){return e.start+e.duration-s<=u?1:e.start-s>u?-1:0})):i=d[h-1],i&&(n=i,g=i.start,v&&n.level===v.level&&n.sn===v.sn&&(n.sn1&&(n.expectedLen=Math.round(n.duration*this.levels[l].bitrate/8),n.trequest=performance.now()),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,n.loadCounter){n.loadCounter++;var R=o.fragLoadingLoopThreshold;if(n.loadCounter>R&&Math.abs(this.fragLoadIdx-n.loadIdx)=A||O)&&(t.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;case e.STOPPED:case e.FRAG_LOADING:case e.PARSING:case e.PARSED:case e.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(i){var e,t,r=this.bufferRange;if(r)for(e=r.length-1;e>=0;e--)if(t=r[e],i>=t.start&&i<=t.end)return t;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(r){for(var i=this.media,t=i.buffered,e=0;e=t.start(e)&&r<=t.end(e))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var t,e,i=this.media;if(i&&i.seeking===!1&&(e=i.currentTime,e>i.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),this.isBuffered(e)?t=this.getBufferRange(e):this.isBuffered(e+.1)&&(t=this.getBufferRange(e+.1)),t)){var n=t.frag;n!==this.fragPlaying&&(this.fragPlaying=n,this.hls.trigger(r.default.FRAG_CHANGED,{frag:n}))}}},{key:"immediateLevelSwitch",value:function(){t.logger.log("immediateLevelSwitch"),this.immediateSwitch||(this.immediateSwitch=!0,this.previouslyPaused=this.media.paused,this.media.pause());var i=this.fragCurrent;i&&i.loader&&i.loader.abort(),this.fragCurrent=null,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0, -endOffset:Number.POSITIVE_INFINITY}),this.state=e.PAUSED,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.tick()}},{key:"immediateLevelSwitchEnd",value:function(){this.immediateSwitch=!1,this.media.currentTime-=1e-4,this.previouslyPaused||this.media.play()}},{key:"nextLevelSwitch",value:function(){var n,i,t;if(i=this.getBufferRange(this.media.currentTime),i&&i.start>1&&(this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:i.start-1}),this.state=e.PAUSED),this.media.paused)n=0;else{var o=this.hls.nextLoadLevel,l=this.levels[o],s=this.fragLastKbps;n=s&&this.fragCurrent?this.fragCurrent.duration*l.bitrate/(1e3*s)+1:0}if(t=this.getBufferRange(this.media.currentTime+n),t&&(t=this.followingBufferRange(t))){this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:t.start,endOffset:Number.POSITIVE_INFINITY}),this.state=e.PAUSED;var a=this.fragCurrent;a&&a.loader&&a.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold}}},{key:"onMediaAttached",value:function(t){var e=this.media=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("seeked",this.onvseeked),e.addEventListener("ended",this.onvended),this.levels&&this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(t.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var r=this.levels;r&&r.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(){if(this.state===e.FRAG_LOADING){if(0===s.default.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len){t.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load");var r=this.fragCurrent;r&&(r.loader&&r.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.state=e.IDLE}}else this.state===e.ENDED&&(this.state=e.IDLE);this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){this.tick()}},{key:"onMediaEnded",value:function(){t.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){t.logger.log("trigger BUFFER_RESET"),this.hls.trigger(r.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(r){var e,i=!1,n=!1;r.levels.forEach(function(t){e=t.audioCodec,e&&(-1!==e.indexOf("mp4a.40.2")&&(i=!0),-1!==e.indexOf("mp4a.40.5")&&(n=!0))}),this.audioCodecSwitch=i&&n,this.audioCodecSwitch&&t.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startLevelLoaded=!1,this.startFragRequested=!1,this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onLevelLoaded",value:function(s){var i=s.details,n=s.level,o=this.levels[n],l=i.totalduration,a=0;if(t.logger.log("level "+n+" loaded ["+i.startSN+","+i.endSN+"],duration:"+l),this.levelLastLoaded=n,i.live){var d=o.details;d?(u.default.mergeDetails(d,i),a=i.fragments[0].start,i.PTSKnown?t.logger.log("live playlist sliding:"+a.toFixed(3)):t.logger.log("live playlist - outdated PTS, unknown sliding")):(i.PTSKnown=!1,t.logger.log("live playlist - first load, unknown sliding"))}else i.PTSKnown=!1;if(o.details=i,this.hls.trigger(r.default.LEVEL_UPDATED,{details:i,level:n}),this.startFragRequested===!1){if(i.live){var f=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*i.targetduration;this.startPosition=Math.max(0,a+l-f)}this.nextLoadPosition=this.startPosition}this.state===e.WAITING_LEVEL&&(this.state=e.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===e.KEY_LOADING&&(this.state=e.IDLE,this.tick())}},{key:"onFragLoaded",value:function(n){var i=this.fragCurrent;if(this.state===e.FRAG_LOADING&&i&&n.frag.level===i.level&&n.frag.sn===i.sn)if(this.fragBitrateTest===!0)this.state=e.IDLE,this.fragBitrateTest=!1,n.stats.tparsed=n.stats.tbuffered=performance.now(),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:n.stats,frag:i});else{this.state=e.PARSING,this.stats=n.stats;var s=this.levels[this.level],o=s.details,d=o.totalduration,f=i.start,l=i.level,u=i.sn,a=s.audioCodec||this.config.defaultAudioCodec;this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),void 0===a&&(a=this.lastAudioCodec),a&&(a=-1!==a.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,t.logger.log("Demuxing "+u+" of ["+o.startSN+" ,"+o.endSN+"],level "+l),this.demuxer.push(n.payload,a,s.videoCodec,f,i.cc,l,u,d,i.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(l){if(this.state===e.PARSING){var o,i,n=l.tracks;if(i=n.audio){var a=this.levels[this.level].audioCodec,u=navigator.userAgent.toLowerCase();a&&this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),a=-1!==a.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&-1===u.indexOf("firefox")&&(a="mp4a.40.5"),-1!==u.indexOf("android")&&(a="mp4a.40.2",t.logger.log("Android: force audio codec to"+a)),i.levelCodec=a}if(i=n.video,i&&(i.levelCodec=this.levels[this.level].videoCodec),l.unique){var s={codec:"",levelCodec:""};for(o in l.tracks)i=n[o],s.container=i.container,s.codec&&(s.codec+=",",s.levelCodec+=","),i.codec&&(s.codec+=i.codec),i.levelCodec&&(s.levelCodec+=i.levelCodec);n={audiovideo:s}}this.hls.trigger(r.default.BUFFER_CODECS,n);for(o in n){i=n[o],t.logger.log("track:"+o+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var d=i.initSegment;d&&(this.pendingAppending++,this.hls.trigger(r.default.BUFFER_APPENDING,{type:o,data:d}))}this.tick()}}},{key:"onFragParsingData",value:function(i){var o=this;if(this.state===e.PARSING){this.tparse2=Date.now();var n=this.levels[this.level],a=this.fragCurrent;t.logger.log("parsed "+i.type+",PTS:["+i.startPTS.toFixed(3)+","+i.endPTS.toFixed(3)+"],DTS:["+i.startDTS.toFixed(3)+"/"+i.endDTS.toFixed(3)+"],nb:"+i.nb);var l=u.default.updateFragPTS(n.details,a.sn,i.startPTS,i.endPTS),s=this.hls;s.trigger(r.default.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:l}),[i.data1,i.data2].forEach(function(e){e&&(o.pendingAppending++,s.trigger(r.default.BUFFER_APPENDING,{type:i.type,data:e}))}),this.nextLoadPosition=i.endPTS,this.bufferRange.push({type:i.type,start:i.startPTS,end:i.endPTS,frag:a}),this.tick()}else t.logger.warn("not in PARSING state but "+this.state+", ignoring FRAG_PARSING_DATA event")}},{key:"onFragParsed",value:function(){this.state===e.PARSING&&(this.stats.tparsed=performance.now(),this.state=e.PARSED,this._checkAppendedParsed())}},{key:"onBufferAppended",value:function(){switch(this.state){case e.PARSING:case e.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===e.PARSED&&0===this.pendingAppending){var n=this.fragCurrent,i=this.stats;n&&(this.fragPrevious=n,i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.length/(i.tbuffered-i.tfirst)),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:i,frag:n}),t.logger.log("media buffered : "+this.timeRangesToString(this.media.buffered)),this.state=e.IDLE),this.tick()}}},{key:"onError",value:function(n){switch(n.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!n.fatal){var a=this.fragLoadError;if(a?a++:a=1,a<=this.config.fragLoadingMaxRetry){this.fragLoadError=a,n.frag.loadCounter=0;var s=Math.min(Math.pow(2,a-1)*this.config.fragLoadingRetryDelay,64e3);t.logger.warn("mediaController: frag loading failed, retry in "+s+" ms"),this.retryDate=performance.now()+s,this.state=e.FRAG_LOADING_WAITING_RETRY}else t.logger.error("mediaController: "+n.details+" reaches max retry, redispatch as fatal ..."),n.fatal=!0,this.hls.trigger(r.default.ERROR,n),this.state=e.ERROR}break;case i.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case i.ErrorDetails.LEVEL_LOAD_ERROR:case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==e.ERROR&&(this.state=n.fatal?e.ERROR:e.IDLE,t.logger.warn("mediaController: "+n.details+" while loading frag,switch to "+this.state+" state ..."));break;case i.ErrorDetails.BUFFER_FULL_ERROR:this.config.maxMaxBufferLength/=2,t.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError"),this.nextLevelSwitch()}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e){var f=e.readyState;if(f){var n,a,l=this.seekAfterBuffered;if(l)e.duration>=l&&(n=l,this.seekAfterBuffered=void 0);else{a=e.currentTime;var g=this.loadedmetadata;!g&&e.buffered.length&&(this.loadedmetadata=!0,a||a===this.startPosition||(n=this.startPosition))}n&&(a=n,t.logger.log("target seek position:"+n));var u=s.default.bufferInfo(e,a,0),v=!(e.paused||e.ended||e.seeking||2>f),d=.4,h=a>e.playbackRate*this.lastCurrentTime;if(this.stalled&&h&&(this.stalled=!1,t.logger.log("playback not stuck anymore @"+a)),v&&u.len<=d){if(h?(d=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,t.logger.log("playback seems stuck @"+a),this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),u.len<=d){var o=u.nextStart,c=o-a;o&&c0&&!e.seeking&&(t.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+o+" + nudge "+this.seekHoleNudgeDuration),e.currentTime=o+this.seekHoleNudgeDuration,this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1}))}}else n&&e.currentTime!==n&&(t.logger.log("adjust currentTime from "+e.currentTime+" to "+n),e.currentTime=n)}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=e.IDLE,this.tick()}},{key:"onBufferFlushed",value:function(){var t,r,i=[];for(r=0;re;e++)r+="["+t.start(e)+","+t.end(e)+"]";return r}},{key:"currentLevel",get:function(){if(this.media){var e=this.getBufferRange(this.media.currentTime);if(e)return e.frag.level}return-1}},{key:"nextBufferRange",get:function(){return this.media?this.followingBufferRange(this.getBufferRange(this.media.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferRange;return e?e.frag.level:-1}}]),n}(l.default);o.default=f},{"../demux/demuxer":16,"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../helper/level-helper":24,"../utils/binary-search":34,"../utils/logger":36}],8:[function(t,v,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;te;e++)c[(n[e]=e<<1^283*(e>>7))^e]=e;for(i=r=0;!h[i];i^=u||1,r=c[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^255&t^99,h[i]=t,v[t]=i,d=n[f=n[u=n[i]]],l=16843009*d^65537*f^257*u^16843008*i,s=257*n[t]^16843008*t,e=0;4>e;e++)a[e][i]=s=s<<24^s>>>8,o[e][t]=l=l<<24^l>>>8;for(e=0;5>e;e++)a[e]=a[e].slice(0),o[e]=o[e].slice(0)}},{key:"decrypt",value:function(R,p,_,b,E,m){var h,g,v,a,e=this._key[1],t=R^e[0],i=b^e[1],n=_^e[2],r=p^e[3],y=e.length/4-2,s=4,o=this._tables[1],f=o[0],d=o[1],u=o[2],l=o[3],c=o[4];for(a=0;y>a;a++)h=f[t>>>24]^d[i>>16&255]^u[n>>8&255]^l[255&r]^e[s],g=f[i>>>24]^d[n>>16&255]^u[r>>8&255]^l[255&t]^e[s+1],v=f[n>>>24]^d[r>>16&255]^u[t>>8&255]^l[255&i]^e[s+2],r=f[r>>>24]^d[t>>16&255]^u[i>>8&255]^l[255&n]^e[s+3],s+=4,t=h,i=g,n=v;for(a=0;4>a;a++)E[(3&-a)+m]=c[t>>>24]<<24^c[i>>16&255]<<16^c[n>>8&255]<<8^c[255&r]^e[s++],h=t,t=i,i=n,n=r,r=h}}]),e}();e.default=i},{}],10:[function(t,l,e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t>8|e>>>24}},{key:"doDecrypt",value:function(i,g,n){var u,h,o,f,l,c,d,a,e,r=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>2),p=new s.default(Array.prototype.slice.call(g)),v=new Uint8Array(i.byteLength),t=new Int32Array(v.buffer);for(u=~~n[0],h=~~n[1],o=~~n[2],f=~~n[3],e=0;ee&&(255!==t[e]||240!==(240&t[e+1]));e++);for(r.audiosamplerate||(n=o.default.getAudioConfig(this.observer,t,e,p),r.config=n.config,r.audiosamplerate=n.samplerate,r.channelCount=n.channelCount,r.codec=n.codec,r.duration=y,l.logger.log("parsed codec:"+r.codec+",rate:"+n.samplerate+",nb channel:"+n.channelCount)),c=0,g=9216e4/r.audiosamplerate;u>e+5&&(s=1&t[e+1]?7:9,a=(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5,a-=s,a>0&&u>=e+s+a);)for(f=h+c*g,v={unit:t.subarray(e+s,e+s+a),pts:f,dts:f},r.samples.push(v),r.len+=a,e+=a+s,c++;u-1>e&&(255!==t[e]||240!==(240&t[e+1]));e++);this.remuxer.remux(this._aacTrack,{samples:[]},{samples:[{pts:h,dts:h,unit:d.payload}]},{samples:[]},m)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){var e,r,n=new i.default(t);if(n.hasTimeStamp)for(e=n.length,r=t.length;r-1>e;e++)if(255===t[e]&&240===(240&t[e+1]))return!0;return!1}}]),e}();t.default=s},{"../demux/id3":18,"../utils/logger":36,"./adts":13}],13:[function(e,o,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t>>6)+1,e=(60&u[l+2])>>>2,e>d.length-1?void h.trigger(Event.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+e}):(o=(1&u[l+2])<<2,o|=(192&u[l+3])>>>6,a.logger.log("manifest codec:"+n+",ADTS data:type:"+i+",sampleingIndex:"+e+"["+d[e]+"Hz],channelConfig:"+o),-1!==f.indexOf("firefox")?e>=6?(i=5,t=new Array(4),s=e-3):(i=2,t=new Array(2),s=e):-1!==f.indexOf("android")?(i=2,t=new Array(2),s=e):(i=5,t=new Array(4),n&&(-1!==n.indexOf("mp4a.40.29")||-1!==n.indexOf("mp4a.40.5"))||!n&&e>=6?s=e-3:((n&&-1!==n.indexOf("mp4a.40.2")&&e>=6&&1===o||!n&&1===o)&&(i=2,t=new Array(2)),s=e)),t[0]=i<<3,t[0]|=(14&e)>>1,t[1]|=(1&e)<<7,t[1]|=o<<3,5===i&&(t[1]|=(14&s)>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),{config:t,samplerate:d[e],channelCount:o,codec:"mp4a.40."+i})}}]),e}();t.default=s},{"../errors":20,"../utils/logger":36}],14:[function(e,y,i){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t1?r-1:0),e=1;r>e;e++)n[e-1]=arguments[e];t.emit.apply(t,[i,i].concat(n))},t.off=function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),e=1;r>e;e++)i[e-1]=arguments[e];t.removeListener.apply(t,[n].concat(i))},r.addEventListener("message",function(i){var e=i.data;switch(e.cmd){case"init":r.demuxer=new u.default(t,e.typeSupported);break;case"demux":r.demuxer.push(new Uint8Array(e.data),e.audioCodec,e.videoCodec,e.timeOffset,e.cc,e.level,e.sn,e.duration)}}),t.on(e.default.FRAG_PARSING_INIT_SEGMENT,function(t,e){r.postMessage({event:t,tracks:e.tracks,unique:e.unique})}),t.on(e.default.FRAG_PARSING_DATA,function(i,e){var t={event:i,type:e.type,startPTS:e.startPTS,endPTS:e.endPTS,startDTS:e.startDTS,endDTS:e.endDTS,data1:e.data1.buffer,data2:e.data2.buffer,nb:e.nb};r.postMessage(t,[t.data1,t.data2])}),t.on(e.default.FRAG_PARSED,function(e){r.postMessage({event:e})}),t.on(e.default.ERROR,function(e,t){r.postMessage({event:e,data:t})}),t.on(e.default.FRAG_PARSING_METADATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)}),t.on(e.default.FRAG_PARSING_USERDATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)})};i.default=o},{"../demux/demuxer-inline":14,"../events":22,events:1}],16:[function(t,g,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t0&&null!=e&&null!=e.key&&"AES-128"===e.method){null==this.decrypter&&(this.decrypter=new l.default(this.hls));var d=this;this.decrypter.decrypt(t,e.key,e.iv,function(e){d.pushDecrypted(e,r,i,n,a,s,o,u)})}else this.pushDecrypted(t,r,i,n,a,s,o,u)}},{key:"onWorkerMessage",value:function(i){var t=i.data;switch(t.event){case e.default.FRAG_PARSING_INIT_SEGMENT:var r={};r.tracks=t.tracks,r.unique=t.unique,this.hls.trigger(e.default.FRAG_PARSING_INIT_SEGMENT,r);break;case e.default.FRAG_PARSING_DATA:this.hls.trigger(e.default.FRAG_PARSING_DATA,{data1:new Uint8Array(t.data1),data2:new Uint8Array(t.data2),startPTS:t.startPTS,endPTS:t.endPTS,startDTS:t.startDTS,endDTS:t.endDTS,type:t.type,nb:t.nb});break;case e.default.FRAG_PARSING_METADATA:this.hls.trigger(e.default.FRAG_PARSING_METADATA,{samples:t.samples});break;case e.default.FRAG_PARSING_USERDATA:this.hls.trigger(e.default.FRAG_PARSING_USERDATA,{samples:t.samples});break;default:this.hls.trigger(t.event,t.data)}}}]),r}();i.default=o},{"../crypt/decrypter":11,"../demux/demuxer-inline":14,"../demux/demuxer-worker":15,"../events":22,"../utils/logger":36,webworkify:2}],17:[function(t,s,e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function e(i,r){for(var t=0;te?(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(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0?r<>>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(n){var t,i,r=8,e=8;for(t=0;n>t;t++)0!==e&&(i=this.readEG(),e=(r+i+256)%256),r=0===e?r:e}},{key:"readSPS",value:function(){var t,g,p,l,n,a,i,o,r,s=0,d=0,f=0,h=0,c=1;if(this.readUByte(),t=this.readUByte(),g=this.readBits(5),this.skipBits(3),p=this.readUByte(),this.skipUEG(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){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,r=0;o>r;r++)this.readBoolean()&&(6>r?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var u=this.readUEG();if(0===u)this.readUEG();else if(1===u)for(this.skipBits(1),this.skipEG(),this.skipEG(),l=this.readUEG(),r=0;l>r;r++)this.skipEG();if(this.skipUEG(),this.skipBits(1),n=this.readUEG(),a=this.readUEG(),i=this.readBits(1),0===i&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(s=this.readUEG(),d=this.readUEG(),f=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){var e=void 0,y=this.readUByte();switch(y){case 1:e=[1,1];break; -case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}e&&(c=e[0]/e[1])}return{width:Math.ceil((16*(n+1)-2*s-2*d)*c),height:(2-i)*(a+1)*16-(i?2:4)*(f+h)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();e.default=a},{"../utils/logger":36}],18:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;tr);return t}},{key:"_parseID3Frames",value:function(r,t,a){for(var n,s,o,l,i;a>=t+8;)switch(n=this.readUTF(r,t,4),t+=4,s=r[t++]<<24+r[t++]<<16+r[t++]<<8+r[t++],l=r[t++]<<8+r[t++],o=t,n){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(r,t,44)){t+=44,t+=4;var u=1&r[t++];this._hasTimeStamp=!0,i=((r[t++]<<23)+(r[t++]<<15)+(r[t++]<<7)+r[t++])/45,u&&(i+=47721858.84),i=Math.round(i),e.logger.trace("ID3 timestamp found: "+i),this._timeStamp=i}}}},{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}}]),t}();t.default=a},{"../utils/logger":36}],19:[function(t,v,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var f=function(){function e(i,r){for(var t=0;tt;t+=188)if(71===i[t]){if(d=!!(64&i[t+1]),u=((31&i[t+1])<<8)+i[t+2],y=(48&i[t+3])>>4,y>1){if(n=t+5+i[t+4],n===t+188)continue}else n=t+4;if(g)if(u===h){if(d){if(s&&(this._parseAVCPES(this._parsePES(s)),b&&this._avcTrack.codec&&(-1===f||this._aacTrack.codec)))return void this.remux(i);s={data:[],size:0}}s&&(s.data.push(i.subarray(n,t+188)),s.size+=t+188-n)}else if(u===f){if(d){if(o&&(this._parseAACPES(this._parsePES(o)),b&&this._aacTrack.codec&&(-1===h||this._avcTrack.codec)))return void this.remux(i);o={data:[],size:0}}o&&(o.data.push(i.subarray(n,t+188)),o.size+=t+188-n)}else u===v&&(d&&(l&&this._parseID3PES(this._parsePES(l)),l={data:[],size:0}),l&&(l.data.push(i.subarray(n,t+188)),l.size+=t+188-n));else d&&(n+=i[n]+1),0===u?this._parsePAT(i,n):u===this._pmtId&&(this._parsePMT(i,n),g=this.pmtParsed=!0,h=this._avcTrack.id,f=this._aacTrack.id,v=this._id3Track.id)}else this.observer.trigger(a.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s&&this._parseAVCPES(this._parsePES(s)),o&&this._parseAACPES(this._parsePES(o)),l&&this._parseID3PES(this._parsePES(l)),this.remux(null)}},{key:"remux",value:function(e){this.remuxer.remux(this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,e)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){this._pmtId=(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(r,t){var n,a,s,i;for(n=(15&r[t+1])<<8|r[t+2],a=t+3+n-4,s=(15&r[t+10])<<8|r[t+11],t+=12+s;a>t;){switch(i=(31&r[t+1])<<8|r[t+2],r[t]){case 15:this._aacTrack.id=i;break;case 21:this._id3Track.id=i;break;case 27:this._avcTrack.id=i;break;default:e.logger.log("unkown stream type:"+r[t])}t+=((15&r[t+3])<<8|r[t+4])+5}}},{key:"_parsePES",value:function(o){var e,a,h,d,u,l,i,r,t,f=0,s=o.data;if(e=s[0],h=(e[0]<<16)+(e[1]<<8)+e[2],1===h){for(d=(e[4]<<8)+e[5],a=e[7],192&a&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,i>4294967295&&(i-=8589934592),64&a?(r=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r>4294967295&&(r-=8589934592)):r=i),u=e[8],t=u+9,o.size-=t,l=new Uint8Array(o.size);s.length;){e=s.shift();var n=e.byteLength;if(t){if(t>n){t-=n;continue}e=e.subarray(t),n-=t,t=0}l.set(e,f),f+=n}return{data:l,pts:i,dts:r,len:d}}return null}},{key:"_parseAVCPES",value:function(i){var t,p,a,l,y=this,r=this._avcTrack,u=r.samples,m=this._parseAVCNALu(i.data),d=[],o=!1,h=!1,c=0;if(0===m.length&&u.length>0){var v=u[u.length-1],f=v.units.units[v.units.units.length-1],g=new Uint8Array(f.data.byteLength+i.data.byteLength);g.set(f.data,0),g.set(i.data,f.data.byteLength),f.data=g,v.units.length+=i.data.byteLength,r.len+=i.data.byteLength}i.data=null;var n="";m.forEach(function(e){switch(e.type){case 1:a=!0,o&&(n+="NDR ");break;case 5:a=!0,o&&(n+="IDR "),h=!0;break;case 6:a=!0,o&&(n+="SEI "),t=new s.default(e.data),t.readUByte();var E=t.readUByte();if(4===E){var g=0;do g=t.readUByte();while(255===g);var R=t.readUByte();if(181===R){var _=t.readUShort();if(49===_){var A=t.readUInt();if(1195456820===A){var k=t.readUByte();if(3===k){var v=t.readUByte(),b=t.readUByte(),T=31&v,f=[v,b];for(l=0;T>l;l++)f.push(t.readUByte()),f.push(t.readUByte()),f.push(t.readUByte());y._txtTrack.samples.push({type:3,pts:i.pts,bytes:f})}}}}}break;case 7:if(a=!0,o&&(n+="SPS "),!r.sps){t=new s.default(e.data);var p=t.readSPS();r.width=p.width,r.height=p.height,r.sps=[e.data],r.duration=y._duration;var L=e.data.subarray(1,4),m="avc1.";for(l=0;3>l;l++){var u=L[l].toString(16);u.length<2&&(u="0"+u),m+=u}r.codec=m}break;case 8:a=!0,o&&(n+="PPS "),r.pps||(r.pps=[e.data]);break;case 9:a=!1,o&&(n+="AUD ");break;default:a=!1,n+="unknown NAL "+e.type+" "}a&&(d.push(e),c+=e.data.byteLength)}),(o||n.length)&&e.logger.log(n),d.length&&(h===!0||r.sps)&&(p={units:{units:d,length:c},pts:i.pts,dts:i.dts,key:h},u.push(p),r.len+=c,r.nbNalu+=d.length)}},{key:"_parseAVCNALu",value:function(r){for(var a,i,s,p,n,l,t=0,h=r.byteLength,e=0,d=[];h>t;)switch(a=r[t++],e){case 0:0===a&&(e=1);break;case 1:e=0===a?2:0;break;case 2:case 3:if(0===a)e=3;else if(1===a&&h>t){if(p=31&r[t],n)s={data:r.subarray(n,t-e-1),type:l},d.push(s);else if(i=t-e-1){var c=this._avcTrack,f=c.samples;if(f.length){var v=f[f.length-1],g=v.units.units,o=g[g.length-1],u=new Uint8Array(o.data.byteLength+i);u.set(o.data,0),u.set(r.subarray(0,i),o.data.byteLength),o.data=u,v.units.length+=i,c.len+=i}}n=t,l=p,e=0}else e=0}return n&&(s={data:r.subarray(n,h),type:l},d.push(s)),d}},{key:"_parseAACPES",value:function(R){var l,o,p,E,t,d,f,s,_,n=this._aacTrack,i=R.data,v=R.pts,k=0,L=this._duration,A=this.audioCodec,u=this.aacOverFlow,b=this.lastAacPTS;if(u){var m=new Uint8Array(u.byteLength+i.byteLength);m.set(u,0),m.set(i,u.byteLength),i=m}for(t=k,s=i.length;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);if(t){var y,h;if(s-1>t?(y="AAC PES did not start with ADTS header,offset:"+t,h=!1):(y="no ADTS header found in AAC PES",h=!0),this.observer.trigger(a.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:h,reason:y}),h)return}if(n.audiosamplerate||(l=c.default.getAudioConfig(this.observer,i,t,A),n.config=l.config,n.audiosamplerate=l.samplerate,n.channelCount=l.channelCount,n.codec=l.codec,n.duration=L,e.logger.log("parsed codec:"+n.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)),E=0,p=9216e4/n.audiosamplerate,u&&b){var g=b+p;Math.abs(g-v)>1&&(e.logger.log("AAC: align PTS for overlapping frames by "+Math.round((g-v)/90)),v=g)}for(;s>t+5&&(d=1&i[t+1]?7:9,o=(3&i[t+3])<<11|i[t+4]<<3|(224&i[t+5])>>>5,o-=d,o>0&&s>=t+d+o);)for(f=v+E*p,_={unit:i.subarray(t+d,t+d+o),pts:f,dts:f},n.samples.push(_),n.len+=o,t+=o+d,E++;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);u=s>t?i.subarray(t,s):null,this.aacOverFlow=u,this.lastAacPTS=f}},{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]}}]),t}();n.default=o},{"../errors":20,"../events":22,"../utils/logger":36,"./adts":13,"./exp-golomb":17}],20:[function(t,r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},e.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",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_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],21:[function(e,l,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__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?"symbol":typeof e},a=function(){function e(i,r){for(var t=0;t1?r-1:0),t=1;r>t;t++)n[t-1]=arguments[t];this.handledEvents=n,this.useGenericHandler=!0,this.registerListeners()}return a(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 i=function(t,r){var e="on"+t.replace("hls","");if("function"!=typeof this[e])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+e+")");return this[e].bind(this,r)};try{i.call(this,e,t).call()}catch(t){s.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(Event.ERROR,{type:r.ErrorTypes.OTHER_ERROR,details:r.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();t.default=o},{"./errors":20,"./utils/logger":36}],22:[function(t,e,r){"use strict";e.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",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",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",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",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded"}},{}],23:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;td&&(t[u-1].end=r[e].end):t.push(r[e])}else t.push(r[e])}for(e=0,o=0,l=n=i;e=a&&f>i)l=a,n=f,o=n-i;else if(a>i+s){h=a;break}}return{len:o,start:l,end:n,nextStart:h}}}]),e}();e.default=i},{}],24:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;th)return void(i.PTSKnown=!1);for(var r=c;h>=r;r++){var o=f[u+r],n=l[r];d=o.cc-n.cc,isNaN(o.startPTS)||(n.start=n.startPTS=o.startPTS,n.endPTS=o.endPTS,n.duration=o.duration,s=n)}if(d)for(e.logger.log("discontinuity sliding from playlist, take drift into account"),r=0;r=0&&ui.endSN)return 0;o=l-i.startSN,a=i.fragments,r=a[o],isNaN(r.startPTS)||(n=Math.min(n,r.startPTS),s=Math.max(s,r.endPTS));var u=n-r.start;for(r.start=r.startPTS=n,r.endPTS=s,r.duration=s-n,e=o;e>0;e--)t.updatePTS(a,e,e-1);for(e=o;ei?r.start=t.start+t.duration:r.start=t.start-r.duration:n>i?(t.duration=a-t.start,t.duration<0&&e.logger.error("negative duration computed for frag "+t.sn+",level "+t.level+", there should be some duration drift between playlist and fragment!")):(r.duration=t.start-a,r.duration<0&&e.logger.error("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!"))}}]),t}();t.default=a},{"../utils/logger":36}],25:[function(t,I,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t1?t-1:0),e=1;t>e;e++)n[e-1]=arguments[e];i.emit.apply(i,[r,r].concat(n))},i.off=function(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];i.removeListener.apply(i,[n].concat(r))},this.on=i.on.bind(i),this.off=i.off.bind(i),this.trigger=i.trigger.bind(i),this.playlistLoader=new d.default(this),this.fragmentLoader=new h.default(this),this.levelController=new R.default(this),this.abrController=new r.abrController(this),this.bufferController=new r.bufferController(this),this.capLevelController=new r.capLevelController(this),this.streamController=new r.streamController(this),this.timelineController=new r.timelineController(this),this.keyLoader=new p.default(this)}return a(t,null,[{key:"isSupported",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"Events",get:function(){return i.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig||(t.defaultConfig={autoStartLoad:!0,debug:!1,capLevelToPlayerSize:!1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,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,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,abrController:v.default,bufferController:P.default,capLevelController:m.default,streamController:b.default,timelineController:L.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1}),t.defaultConfig},set:function(e){t.defaultConfig=e}}]),a(t,[{key:"destroy",value:function(){e.logger.log("destroy"),this.trigger(i.default.DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.streamController.destroy(),this.timelineController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(t){e.logger.log("attachMedia"),this.media=t,this.trigger(i.default.MEDIA_ATTACHING,{media:t})}},{key:"detachMedia",value:function(){e.logger.log("detachMedia"),this.trigger(i.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(t){e.logger.log("loadSource:"+t),this.url=t,this.trigger(i.default.MANIFEST_LOADING,{url:t})}},{key:"startLoad",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0];e.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(t)}},{key:"stopLoad",value:function(){e.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad()}},{key:"swapAudioCodec",value:function(){e.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){e.logger.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){e.logger.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){e.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){e.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return this.levelController.firstLevel},set:function(t){e.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){e.logger.log("set startLevel:"+t),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(t){e.logger.log("set autoLevelCapping:"+t),this.abrController.autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}}]),t}();n.default=l},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":6,"./controller/stream-controller":7,"./controller/timeline-controller":8,"./errors":20,"./events":22,"./loader/fragment-loader":27,"./loader/key-loader":28,"./loader/playlist-loader":29,"./utils/logger":36,"./utils/xhr-loader":38,events:1}],26:[function(e,t,r){"use strict";t.exports=e("./hls.js").default},{"./hls.js":25}],27:[function(r,c,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t2?(e=t.shift()+".",e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).substr(-4)):e=r,e}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(L,l,A){var e,b,s,a,g=0,o=0,i={url:l,fragments:[],live:!0,startSN:0},r={method:null,key:null,iv:null,uri:null},E=0,f=null,t=null;for(b=/(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*))/g;null!==(e=b.exec(L));)switch(e.shift(),e=e.filter(function(e){return void 0!==e}),e[0]){case"MEDIA-SEQUENCE":g=i.startSN=parseInt(e[1]);break;case"TARGETDURATION":i.targetduration=parseFloat(e[1]);break;case"ENDLIST":i.live=!1;break;case"DIS":E++;break;case"BYTERANGE":var c=e[1].split("@");a=1===c.length?s:parseInt(c[1]),s=parseInt(c[0])+a,t&&!t.url&&(t.byteRangeStartOffset=a,t.byteRangeEndOffset=s,t.url=this.resolve(e[2],l));break;case"INF":var v=parseFloat(e[1]);if(!isNaN(v)){var u,m=g++;if(r.method&&r.uri&&!r.iv){u=this.cloneObj(r);for(var y=new Uint8Array(16),d=12;16>d;d++)y[d]=m>>8*(15-d)&255;u.iv=y}else u=r;var k=e[2]?this.resolve(e[2],l):null;t={url:k,duration:v,start:o,sn:m,level:A,cc:E,byteRangeStartOffset:a,byteRangeEndOffset:s,decryptdata:u,programDateTime:f},i.fragments.push(t),o+=v,a=null,f=null}break;case"KEY":var R=e[1],p=new n.default(R),h=p.enumeratedString("METHOD"),_=p.URI,T=p.hexadecimalInteger("IV");h&&(r={method:null,key:null,iv:null,uri:null},_&&"AES-128"===h&&(r.method=h,r.uri=this.resolve(_,l),r.key=null,r.iv=T));break;case"PROGRAM-DATE-TIME":f=new Date(Date.parse(e[1]))}return t&&!t.url&&(i.fragments.pop(),o-=t.duration),i.totalduration=o,i.endSN=g-1,i}},{key:"loadsuccess",value:function(u,i){var s,o=u.currentTarget,a=o.responseText,r=o.responseURL,l=this.id,d=this.id2,n=this.hls;if(void 0===r&&(r=this.url),i.tload=performance.now(),i.mtime=new Date(o.getResponseHeader("Last-Modified")),0===a.indexOf("#EXTM3U"))if(a.indexOf("#EXTINF:")>0)if(null===this.id)n.trigger(t.default.MANIFEST_LOADED,{levels:[{url:r}],url:r,stats:i});else{var f=this.parseLevelPlaylist(a,r,l);i.tparsed=performance.now(),n.trigger(t.default.LEVEL_LOADED,{details:f,level:l,id:d,stats:i})}else s=this.parseMasterPlaylist(a,r),s.length?n.trigger(t.default.MANIFEST_LOADED,{levels:s,url:r,stats:i}):n.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no level found in manifest"});else n.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(n){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_ERROR,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_ERROR,i=!1),this.loader&&this.loader.abort(),this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,response:n.currentTarget,level:this.id,id:this.id2})}},{key:"loadtimeout",value:function(){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_TIMEOUT,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_TIMEOUT,i=!1),this.loader&&this.loader.abort(),this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,level:this.id,id:this.id2})}}]),r}(a.default);s.default=u},{"../errors":20,"../event-handler":21,"../events":22,"../utils/attr-list":33,"../utils/url":37}],30:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t.set(n,4),r=0,e=8;a>r;r++)t.set(i[r],e),e+=i[r].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(r){for(var t=r.length,i=[];t--;)i[t]=e.trex(r[t]);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(a){var r,t,i=a.samples||[],n=new Uint8Array(4+i.length);for(t=0;t>>8&255),i.push(255&a),i=i.concat(Array.prototype.slice.call(n));for(r=0;r>>8&255),s.push(255&a),s=s.concat(Array.prototype.slice.call(n));var u=e.box(e.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),o=t.width,l=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,o>>8&255,255&o,l>>8&255,255&l,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]),u,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.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:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(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,n=t.width,a=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,n>>8&255,255&n,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(i,t){var n=e.sdtp(i),r=i.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),e.trun(i,n.length+16+16+8+16+8+8),n)}},{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(r){var t=r.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(h,o){var i,n,a,s,t,l,d=h.samples||[],r=d.length,f=12+16*r,u=new Uint8Array(f);for(o+=8+f,u.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o],0),i=0;r>i;i++)n=d[i],a=n.duration,s=n.size,t=n.flags,l=n.cts,u.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,61440&t.degradPrio,15&t.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,u)}},{key:"initSegment",value:function(i){e.types||e.init();var t,r=e.moov(i);return t=new Uint8Array(e.FTYP.byteLength+r.byteLength),t.set(e.FTYP),t.set(r,e.FTYP.byteLength),t}}]),e}();e.default=i},{}],31:[function(i,h,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(i,r){for(var t=0;tMath.pow(2,32)&&!function(){var e=function r(t,e){return e?r(e,t%e):t};i.timescale=i.audiosamplerate/e(i.audiosamplerate,1024)}(),e.logger.log("audio mp4 timescale :"+i.timescale),l.audio={container:"audio/mp4",codec:i.codec,initSegment:r.default.initSegment([i]),metadata:{channelCount:i.channelCount}},u&&(a=o=v[0].pts-f*h)),n.sps&&n.pps&&d.length&&(n.timescale=this.MP4_TIMESCALE,l.video={container:"video/mp4",codec:n.codec,initSegment:r.default.initSegment([n]),metadata:{width:n.width,height:n.height}},u&&(a=Math.min(a,d[0].pts-f*h),o=Math.min(o,d[0].dts-f*h))),Object.keys(l).length?(c.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,g),this.ISGenerated=!0,u&&(this._initPTS=a,this._initDTS=o)):c.trigger(t.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(n,w,S){var L,s,p,A,f,d,T,k,R,v,_,g,o,i,l,E=8,c=this.PES_TIMESCALE,h=this.PES2MP4SCALEFACTOR,u=[];for(d=new Uint8Array(n.len+4*n.nbNalu+8),L=new DataView(d.buffer),L.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4);n.samples.length;){for(s=n.samples.shift(),A=0;s.units.units.length;)f=s.units.units.shift(),L.setUint32(E,f.data.byteLength),E+=4,d.set(f.data,E),E+=f.data.byteLength,A+=4+f.data.byteLength;if(_=s.pts-this._initDTS,g=s.dts-this._initDTS,g=Math.min(_,g),void 0!==v){o=this._PTSNormalize(_,v),i=this._PTSNormalize(g,v);var m=(i-v)/h;0>=m&&(e.logger.log("invalid sample duration at PTS/DTS: "+s.pts+"/"+s.dts+":"+m),m=1),p.duration=m}else{var y=void 0,a=void 0;y=S?this.nextAvcDts:w*c,o=this._PTSNormalize(_,y),i=this._PTSNormalize(g,y),a=Math.round((i-y)/90),(S||Math.abs(a)>1e4)&&a&&(a>1?e.logger.log("AVC:"+a+" ms hole between fragments detected,filling it"):-1>a&&e.logger.log("AVC:"+-a+" ms overlapping between fragments detected"),i=y,o=Math.max(o-a,i),e.logger.log("Video/PTS/DTS adjusted: "+o+"/"+i+",delta:"+a)),k=Math.max(0,o),R=Math.max(0,i)}p={size:A,duration:0,cts:(o-i)/h,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0}},l=p.flags,s.key===!0?(l.dependsOn=2,l.isNonSync=0):(l.dependsOn=1,l.isNonSync=1),u.push(p),v=i}var b=0;u.length>=2&&(b=u[u.length-2].duration,p.duration=b),this.nextAvcDts=i+b*h,n.len=0,n.nbNalu=0,u.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&(l=u[0].flags,l.dependsOn=2,l.isNonSync=0),n.samples=u,T=r.default.moof(n.sequenceNumber++,R/h,n),n.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:T,data2:d,startPTS:k/c,endPTS:(o+h*b)/c,startDTS:R/c,endDTS:this.nextAvcDts/c,type:"video",nb:u.length})}},{key:"remuxAudio",value:function(i,O,S){var T,p,a,h,l,k,L,b,u,g,R,d,n,A=8,s=this.PES_TIMESCALE,w=i.timescale,f=s/w,E=1024*i.timescale/i.audiosamplerate,m=[],_=[];for(i.samples.sort(function(e,t){return e.pts-t.pts}),_=i.samples;_.length;){if(p=_.shift(),h=p.unit,g=p.pts-this._initDTS,R=p.dts-this._initDTS,void 0!==u)d=this._PTSNormalize(g,u),n=this._PTSNormalize(R,u),a.duration=(n-u)/f,Math.abs(a.duration-E)>E/10&&e.logger.log("invalid AAC sample duration at PTS "+Math.round(g/90)+",should be 1024,found :"+Math.round(a.duration*i.audiosamplerate/i.timescale)),a.duration=E,n=E*f+u;else{var c=void 0,o=void 0;if(c=S?this.nextAacPts:O*s,d=this._PTSNormalize(g,c),n=this._PTSNormalize(R,c),o=Math.round(1e3*(d-c)/s),(S||Math.abs(o)>1e4)&&o){if(o>0)e.logger.log(o+" ms hole between AAC samples detected,filling it");else if(-12>o){e.logger.log(-o+" ms overlapping between AAC samples detected, drop frame"),i.len-=h.byteLength;continue}d=n=c}if(L=Math.max(0,d),b=Math.max(0,n),!(i.len>0))return;l=new Uint8Array(i.len+8),T=new DataView(l.buffer),T.setUint32(0,l.byteLength),l.set(r.default.types.mdat,4)}l.set(h,A),A+=h.byteLength,a={size:h.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},m.push(a),u=n}var y=0,v=m.length;v>=2&&(y=m[v-2].duration,a.duration=y),v&&(this.nextAacPts=d+f*y,i.len=0,i.samples=m,k=r.default.moof(i.sequenceNumber++,b/f,i),i.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:k,data2:l,startPTS:L/s,endPTS:this.nextAacPts/s,startDTS:b/s,endDTS:(n+f*y)/s,type:"audio",nb:v}))}},{key:"remuxID3",value:function(r,n){var e,a=r.samples.length;if(a){for(var i=0;a>i;i++)e=r.samples[i],e.pts=(e.pts-this._initPTS)/this.PES_TIMESCALE,e.dts=(e.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_METADATA,{samples:r.samples})}r.samples=[],n=n}},{key:"remuxText",value:function(e,n){e.samples.sort(function(e,t){return e.pts-t.pts});var r,a=e.samples.length;if(a){for(var i=0;a>i;i++)r=e.samples[i],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[],n=n}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=e>t?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),i}();n.default=d},{"../errors":20,"../events":22,"../remux/mp4-generator":30,"../utils/logger":36}],32:[function(r,l,e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(r){if(this[r]){var e=(this[r]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var i=new Uint8Array(e.length/2),t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(t){var e=/^(\d+)x(\d+)$/.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(n){for(var t,a=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(t=a.exec(n));){var e=t[2],i='"';0===e.indexOf(i)&&e.lastIndexOf(i)===e.length-1&&(e=e.slice(1,-1)),r[t[1]]=e}return r}}]),e}();e.default=i},{}],34:[function(r,e,i){"use strict";var t={search:function(n,s){for(var t=0,r=n.length-1,e=null,i=null;r>=t;){e=(t+r)/2|0,i=n[e];var a=s(i);if(a>0)t=e+1;else{if(!(0>a))return i;r=e-1}}return null}};e.exports=t},{}],35:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t0;)e.removeCue(e.cues[0])}},{key:"push",value:function(r,i){this.cue||this._createCue();for(var n,t,e,s,o,u=31&i[0],a=2,l=0;u>l;l++)if(n=i[a++],t=127&i[a++],e=127&i[a++],s=0!==(4&n),o=3&n,(0!==t||0!==e)&&s&&0===o){if(32&t||64&t)this.cue.text+=this._fromCharCode(t)+this._fromCharCode(e);else if((17===t||25===t)&&e>=48&&63>=e)switch(e){case 48:this.cue.text+="®";break;case 49:this.cue.text+="°";break;case 50:this.cue.text+="½";break;case 51:this.cue.text+="¿";break;case 52:this.cue.text+="™";break;case 53:this.cue.text+="¢";break;case 54:this.cue.text+="";break;case 55:this.cue.text+="£";break;case 56:this.cue.text+="♪";break;case 57:this.cue.text+=" ";break;case 58:this.cue.text+="è";break;case 59:this.cue.text+="â";break;case 60:this.cue.text+="ê";break;case 61:this.cue.text+="î";break;case 62:this.cue.text+="ô";break;case 63:this.cue.text+="û"}if((17===t||25===t)&&e>=32&&47>=e)switch(e){case 32:break;case 33:break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:break;case 42:break;case 43:break;case 44:break;case 45:break;case 46:break;case 47:}if((20===t||28===t)&&e>=32&&47>=e)switch(e){case 32:this._clearActiveCues(r);break;case 33:this.cue.text=this.cue.text.substr(0,this.cue.text.length-1);break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:this._clearActiveCues(r);break;case 42:break;case 43:break;case 44:this._clearActiveCues(r);break;case 45:break;case 46:this._text="";break;case 47:this._flipMemory(r)}if((23===t||31===t)&&e>=33&&35>=e)switch(e){case 33:break;case 34:break;case 35:}}}},{key:"_fromCharCode",value:function(e){switch(e){case 42:return"á";case 2:return"á";case 2:return"é";case 4:return"í";case 5:return"ó";case 6:return"ú";case 3:return"ç";case 4:return"÷";case 5:return"Ñ";case 6:return"ñ";case 7:return"█";default:return String.fromCharCode(e)}}},{key:"_flipMemory",value:function(e){this._clearActiveCues(e),this._flushCaptions(e)}},{key:"_flushCaptions",value:function(s){this._has708||(this._textTrack=this.media.addTextTrack("captions","English","en"),this._has708=!0);var e=!0,i=!1,n=void 0;try{for(var a,t=this.memory[Symbol.iterator]();!(e=(a=t.next()).done);e=!0){var r=a.value;r.startTime=s,this._textTrack.addCue(r),this.display.push(r)}}catch(e){i=!0,n=e}finally{try{!e&&t.return&&t.return()}finally{if(i)throw n}}this.memory=[],this.cue=null}},{key:"_clearActiveCues",value:function(a){var e=!0,r=!1,i=void 0;try{for(var n,t=this.display[Symbol.iterator]();!(e=(n=t.next()).done);e=!0){var s=n.value;s.endTime=a}}catch(e){r=!0,i=e}finally{try{!e&&t.return&&t.return()}finally{if(r)throw i}}this.display=[]}},{key:"_clearBufferedCues",value:function(){}}]),e}();e.default=i},{}],36:[function(l,u,r){"use strict";function e(){}function n(t,e){return e="["+t+"] > "+e}function a(t){var r=window.console[t];return r?function(){for(var a=arguments.length,e=Array(a),i=0;a>i;i++)e[i]=arguments[i];e[0]&&(e[0]=n(t,e[0])),r.apply(window.console,e)}:e}function s(r){for(var i=arguments.length,n=Array(i>1?i-1:0),e=1;i>e;e++)n[e-1]=arguments[e];n.forEach(function(e){t[e]=r[e]?r[e].bind(r):a(e)})}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?"symbol":typeof e},i={trace:e,debug:e,log:e,warn:e,info:e,error:e},t=i;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{t.log()}catch(e){t=i}}else t=i},r.logger=t},{}],37:[function(r,t,i){"use strict";var e={buildAbsoluteURL:function(r,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var o=null,n=null,a=/^([^#]*)(.*)$/.exec(t);a&&(n=a[2],t=a[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(o=s[2],t=s[1]);var f=/^([^#]*)(.*)$/.exec(r);f&&(r=f[1]);var u=/^([^\?]*)(.*)$/.exec(r);u&&(r=u[1]);var l=/^((([a-z]+):)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?\/)(.*)$/i.exec(r),h=l[3],d=l[1],c=l[5],i=null;return i=/^\/\//.test(t)?h+"://"+e.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?d+e.buildAbsolutePath("",t.substring(1)):e.buildAbsolutePath(d+c,t),o&&(i+=o),n&&(i+=n),i},buildAbsolutePath:function(a,s){for(var i,e,o=s,n="",t=a.replace(/[^\/]*$/,o.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),r=0;e=t.indexOf("/../",r),e>-1;r=e+i)i=/^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length,n=(n+t.substring(r,e)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");return n+t.substr(r)}};t.exports=e},{}],38:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t=200&&300>r?(window.clearTimeout(this.timeoutHandle),t.tload=performance.now(),this.onSuccess(i,t)):t.retryi;i++)g[i]=d[i].style.cssText,d[i].style.setProperty?d[i].style.setProperty("display","block","important"):d[i].style.cssText+=";display: block !important",d[i].style.height="0",d[i].style.overflow="hidden",d[i].style.visibility="hidden",c(d[i]);h=a[b];for(var j=0;e>j;j++)d[j].style.cssText=g[j],c(d[j])}return h}function h(a,b){var c=parseFloat(a);return Number.isNaN(c)?b:c}function i(a){return a.charAt(0).toUpperCase()+a.substr(1)}function j(b,e){if(this.$window=a(window),this.$document=a(document),this.$element=a(b),this.options=a.extend({},n,e),this.polyfill=this.options.polyfill,this.orientation=this.$element[0].getAttribute("data-orientation")||this.options.orientation,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.DIMENSION=o.orientation[this.orientation].dimension,this.DIRECTION=o.orientation[this.orientation].direction,this.DIRECTION_STYLE=o.orientation[this.orientation].directionStyle,this.COORDINATE=o.orientation[this.orientation].coordinate,this.polyfill&&m)return!1;this.identifier="js-"+k+"-"+l++,this.startEvent=this.options.startEvent.join("."+this.identifier+" ")+"."+this.identifier,this.moveEvent=this.options.moveEvent.join("."+this.identifier+" ")+"."+this.identifier,this.endEvent=this.options.endEvent.join("."+this.identifier+" ")+"."+this.identifier,this.toFixed=(this.step+"").replace(".","").length-1,this.$fill=a('
'),this.$handle=a('
'),this.$range=a('
').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var f=this;this.$window.on("resize."+this.identifier,d(function(){c(function(){f.update(!1,!1)},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+this.identifier,function(a,b){if(!b||b.origin!==f.identifier){var c=a.target.value,d=f.getPositionFromValue(c);f.setPosition(d)}})}Number.isNaN=Number.isNaN||function(a){return"number"==typeof a&&a!==a};var k="rangeslider",l=0,m=b(),n={polyfill:!0,orientation:"horizontal",rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",horizontalClass:"rangeslider--horizontal",verticalClass:"rangeslider--vertical",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]},o={orientation:{horizontal:{dimension:"width",direction:"left",directionStyle:"left",coordinate:"x"},vertical:{dimension:"height",direction:"top",directionStyle:"bottom",coordinate:"y"}}};return j.prototype.init=function(){this.update(!0,!1),this.onInit&&"function"==typeof this.onInit&&this.onInit()},j.prototype.update=function(a,b){a=a||!1,a&&(this.min=h(this.$element[0].getAttribute("min"),0),this.max=h(this.$element[0].getAttribute("max"),100),this.value=h(this.$element[0].value,Math.round(this.min+(this.max-this.min)/2)),this.step=h(this.$element[0].getAttribute("step"),1)),this.handleDimension=g(this.$handle[0],"offset"+i(this.DIMENSION)),this.rangeDimension=g(this.$range[0],"offset"+i(this.DIMENSION)),this.maxHandlePos=this.rangeDimension-this.handleDimension,this.grabPos=this.handleDimension/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position,b)},j.prototype.handleDown=function(a){if(this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+a.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var b=this.getRelativePosition(a),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=this.getPositionFromNode(this.$handle[0])-c,e="vertical"===this.orientation?this.maxHandlePos-(b-this.grabPos):b-this.grabPos;this.setPosition(e),b>=d&&ba?b:a>c?c:a},j.prototype.setPosition=function(a,b){var c,d;void 0===b&&(b=!0),c=this.getValueFromPosition(this.cap(a,0,this.maxHandlePos)),d=this.getPositionFromValue(c),this.$fill[0].style[this.DIMENSION]=d+this.grabPos+"px",this.$handle[0].style[this.DIRECTION_STYLE]=d+"px",this.setValue(c),this.position=d,this.value=c,b&&this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(d,c)},j.prototype.getPositionFromNode=function(a){for(var b=0;null!==a;)b+=a.offsetLeft,a=a.offsetParent;return b},j.prototype.getRelativePosition=function(a){var b=i(this.COORDINATE),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=0;return"undefined"!=typeof a["page"+b]?d=a["client"+b]:"undefined"!=typeof a.originalEvent["client"+b]?d=a.originalEvent["client"+b]:a.originalEvent.touches&&a.originalEvent.touches[0]&&"undefined"!=typeof a.originalEvent.touches[0]["client"+b]?d=a.originalEvent.touches[0]["client"+b]:a.currentPoint&&"undefined"!=typeof a.currentPoint[this.COORDINATE]&&(d=a.currentPoint[this.COORDINATE]),d-c},j.prototype.getPositionFromValue=function(a){var b,c;return b=(a-this.min)/(this.max-this.min),c=Number.isNaN(b)?0:b*this.maxHandlePos},j.prototype.getValueFromPosition=function(a){var b,c;return b=a/(this.maxHandlePos||1),c=this.step*Math.round(b*(this.max-this.min)/this.step)+this.min,Number(c.toFixed(this.toFixed))},j.prototype.setValue=function(a){(a!==this.value||""===this.$element[0].value)&&this.$element.val(a).trigger("input",{origin:this.identifier})},j.prototype.destroy=function(){this.$document.off("."+this.identifier),this.$window.off("."+this.identifier),this.$element.off("."+this.identifier).removeAttr("style").removeData("plugin_"+k),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0])},a.fn[k]=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),e=d.data("plugin_"+k);e||d.data("plugin_"+k,e=new j(this,b)),"string"==typeof b&&e[b].apply(e,c)})},"rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);"}); - } - - // Julia main class - _julia = function(el, opts) - { - // Custom options - var options = typeof opts === 'undefined' ? {}: opts; - var _element = typeof el === 'undefined' ? $('video'): el; - - // Default options - var _options = { - source: false, - autoplay: false, - volume: 25, - muted: false, - width: 512, - height: 288, - debug: false, - debugPlayback: false, - forceHls: false, - live: false, - responsive: true, - dimensions: [ - [1920, 1080], - [1280,720], - [960,540], - [640,360], - [512,288] - ], - pauseOnClick: false, - poster: '', - hlsConfig: { - debug : false, - autoStartLoad : true, - maxBufferLength : 60, - maxBufferSize : 120*1000*1000, - liveSyncDurationCount : 5, // D: 3 - liveMaxLatencyDurationCount: 20, - enableWorker : true, - fragLoadingTimeOut : 5000, - fragLoadingMaxRetry : 6, - fragLoadingRetryDelay : 100, - manifestLoadingTimeOut : 10000, - manifestLoadingMaxRetry : 6, - manifestLoadingRetryDelay : 500, - fpsDroppedMonitoringPeriod : 5000, - fpsDroppedMonitoringThreshold : 0.2, - appendErrorMaxRetry : 200, - }, - suggest: [], - suggestLimit: 2, - suggestTimeout: 10000, - swf: __JULIA_ROOT_PATH__+'/swf/flashlsChromeless.swf', - themePath: __JULIA_ROOT_PATH__+'/css/themes', - pluginPath: __JULIA_ROOT_PATH__+'/js/plugins', - theme: 'default', - i18n: { - liveText: 'Live' - }, - onTime: {}, - triggerHls: {}, - onPlay: false, - onPause: false, - onStop: false, - onPosition: false, - onSuggest: false, - }; + g.listener = listener; + this.on(type, g); + return this; +}; - // UI & behavior globals - var _env = { - shield: '', - element: _element, - suggest: '', - toolbar: '', - poster: '', - api: '', - apiId: Math.floor((Math.random()*10000000)+1), // Create a shadow api unique ID - player: '', - isLive: false, - hls: {}, - canPlayMedia: '', - canPlayMediaString: '', - isHls: false, - useHlsLib: false, - tries: 0, - source: '', - flashApi: false, - duration: 0, - apiOk: false, - onTimeRised: [], - seeking: false, - dimensions: { - width: 0, - height: 0, - }, - flashCallbackName: '', - started: false, - publicApi: {}, - suggestPointer: 0, - suggestClicked: false, - progressStep: 0.01, // Full sense: 100, so .01 is enough accurate - } - - // Extend options - var _system = { - - extend: function() - { - for(o in _options) - { - if(options.hasOwnProperty(o)) - { - _options[o] = options[o]; - } - } +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; - options = _options; - } - }; + if (!isFunction(listener)) + throw TypeError('listener must be a function'); - // Console debug - var _debug = { + if (!this._events || !this._events[type]) + return this; - run: function(data) - { - if(options.debug === true) - { - if(window.console) - { - for(d in data) - { - console.log(' - [instance: '+_env.apiId+'] '+d+' ['+(typeof data[d])+']', data[d]); - } - } - } - } - }; + list = this._events[type]; + length = list.length; + position = -1; - // Persistent user data in cookies - var _persist = { + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); - set: function(name, value, days) - { - dateObj = new Date(); - dateObj.setTime(dateObj.getTime() + (days*24*60*60*1000)); - var expires = 'expires=' + dateObj.toUTCString(); - document.cookie = name + '=' + value + '; ' + expires + '; path=/'; - }, + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } - get: function(name) - { - var name = name + '='; - var ca = document.cookie.split(';'); + if (position < 0) + return this; - for(var i=0; i'); - _env.player.prepend(apiElement); - _env.api = document.getElementById('julia-api-'+_env.apiId); - _env.api.controls = false; - _env.apiOk = true; - - }else{ - - var flash = _flash.detect(); - var flashOk = flash.installed; - - if( (flash.major==11 && flash.minor>=2) || flash.major>11 ) - { - _debug.run({ - 'apiType': 'flashls', - }); - - _env.apiOk = true; - _env.flashCallbackName = 'flashlsCallback'+_env.apiId; - - apiElement = $('' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +''); - - _env.player.prepend(apiElement); - - flashlsAPI = function(flashObject) - { - this.constructor = function(flashObject) - { - this.flashObject = flashObject; - } - - this.constructor(flashObject); - - this.load = function(url) - { - this.flashObject.playerLoad(url); - } - - this.play = function(offset) - { - started = true; - this.flashObject.playerPlay(offset); - } - - this.pause = function() - { - this.flashObject.playerPause(); - } - - this.resume = function() { - this.flashObject.playerResume(); - } - - this.seek = function(offset) { - this.flashObject.playerSeek(offset); - } - - this.stop = function() { - this.flashObject.playerStop(); - } - - this.volume = function(volume) { - this.flashObject.playerVolume(volume); - } - - this.setCurrentLevel = function(level) { - this.flashObject.playerSetCurrentLevel(level); - } - - this.setNextLevel = function(level) { - this.flashObject.playerSetNextLevel(level); - } - - this.setLoadLevel = function(level) { - this.flashObject.playerSetLoadLevel(level); - } - - this.setMaxBufferLength = function(len) { - this.flashObject.playerSetmaxBufferLength(len); - } - - this.getPosition = function() { - return this.flashObject.getPosition(); - } - - this.getDuration = function() { - return this.flashObject.getDuration(); - } - - this.getbufferLength = function() { - return this.flashObject.getbufferLength(); - } - - this.getbackBufferLength = function() { - return this.flashObject.getbackBufferLength(); - } - - this.getLowBufferLength = function() { - return this.flashObject.getlowBufferLength(); - } - - this.getMinBufferLength = function() { - return this.flashObject.getminBufferLength(); - } - - this.getMaxBufferLength = function() { - return this.flashObject.getmaxBufferLength(); - } - - this.getLevels = function() { - return this.flashObject.getLevels(); - } - - this.getAutoLevel = function() { - return this.flashObject.getAutoLevel(); - } - - this.getCurrentLevel = function() { - return this.flashObject.getCurrentLevel(); - } - - this.getNextLevel = function() { - return this.flashObject.getNextLevel(); - } - - this.getLoadLevel = function() { - return this.flashObject.getLoadLevel(); - } - - this.getAudioTrackList = function() { - return this.flashObject.getAudioTrackList(); - } - - this.getStats = function() { - return this.flashObject.getStats(); - } - - this.setAudioTrack = function(trackId) { - this.flashObject.playerSetAudioTrack(trackId); - } - - this.playerSetLogDebug = function(state) { - this.flashObject.playerSetLogDebug(state); - } - - this.getLogDebug = function() { - return this.flashObject.getLogDebug(); - } - - this.playerSetLogDebug2 = function(state) { - this.flashObject.playerSetLogDebug2(state); - } - - this.getLogDebug2 = function() { - return this.flashObject.getLogDebug2(); - } - - this.playerSetUseHardwareVideoDecoder = function(state) { - this.flashObject.playerSetUseHardwareVideoDecoder(state); - } - - this.getUseHardwareVideoDecoder = function() { - return this.flashObject.getUseHardwareVideoDecoder(); - } - - this.playerSetflushLiveURLCache = function(state) { - this.flashObject.playerSetflushLiveURLCache(state); - } - - this.getflushLiveURLCache = function() { - return this.flashObject.getflushLiveURLCache(); - } - - this.playerSetJSURLStream = function(state) { - this.flashObject.playerSetJSURLStream(state); - } - - this.getJSURLStream = function() { - return this.flashObject.getJSURLStream(); - } - - this.playerCapLeveltoStage = function(state) { - this.flashObject.playerCapLeveltoStage(state); - } - - this.getCapLeveltoStage = function() { - return this.flashObject.getCapLeveltoStage(); - } - - this.playerSetAutoLevelCapping = function(level) { - this.flashObject.playerSetAutoLevelCapping(level); - } - - this.getAutoLevelCapping = function() { - return this.flashObject.getAutoLevelCapping(); - } - }; - - getFlashMovieObject = function(movieName) - { - if (window.document[movieName]) - { - return window.document[movieName]; - } - if (navigator.appName.indexOf("Microsoft Internet")==-1) - { - if (document.embeds && document.embeds[movieName]) - { - return document.embeds[movieName]; - }else // if (navigator.appName.indexOf("Microsoft Internet")!=-1) - { - return document.getElementById(movieName); - } - } - } - - _env.api = new flashlsAPI(getFlashMovieObject('julia-api-'+_env.apiId)); - - }else{ - - _env.api = {}; - _env.shield.find('.julia-preloader').html('
Adobe Flash Player is required
'); - _env.api.flashObject = $('
'); - _env.player.prepend(_env.api.flashObject); - } - } + if (!wkey) { + wkey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); + var wcache = {}; + for (var i = 0, l = cacheKeys.length; i < l; i++) { + var key = cacheKeys[i]; + wcache[key] = key; + } + sources[wkey] = [ + Function(['require','module','exports'], '(' + fn + ')(self)'), + wcache + ]; + } + var skey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); - _debug.run({ - 'apiId': _env.apiId, - 'api': _env.api, - }); - } - }; + var scache = {}; scache[wkey] = wkey; + sources[skey] = [ + Function(['require'], ( + // try to call default if defined to also support babel esmodule + // exports + 'var f = require(' + stringify(wkey) + ');' + + '(f.default ? f.default : f)(self);' + )), + scache + ]; + var src = '(' + bundleFn + ')({' + + Object.keys(sources).map(function (key) { + return stringify(key) + ':[' + + sources[key][0] + + ',' + stringify(sources[key][1]) + ']' + ; + }).join(',') + + '},{},[' + stringify(skey) + '])' + ; - var _flash = { + var URL = window.URL || window.webkitURL || window.mozURL || window.msURL; - detect: function() - { - var self = this; - self.installed = false; - self.raw = ""; - self.major = -1; - self.minor = -1; - self.revision = -1; - self.revisionStr = ""; - var activeXDetectRules = [ - { - "name":"ShockwaveFlash.ShockwaveFlash.7", - "version":function(obj){ - return getActiveXVersion(obj); - } - }, - { - "name":"ShockwaveFlash.ShockwaveFlash.6", - "version":function(obj){ - var version = "6,0,21"; - try{ - obj.AllowScriptAccess = "always"; - version = getActiveXVersion(obj); - }catch(err){} - return version; - } - }, - { - "name":"ShockwaveFlash.ShockwaveFlash", - "version":function(obj){ - return getActiveXVersion(obj); - } - } - ]; - - /** - * Extract the ActiveX version of the plugin. - * - * @param {Object} The flash ActiveX object. - * @type String - */ - var getActiveXVersion = function(activeXObj) - { - var version = -1; - try - { - version = activeXObj.GetVariable("$version"); - }catch(err) - {} - return version; - }; - - /** - * Try and retrieve an ActiveX object having a specified name. - * - * @param {String} name The ActiveX object name lookup. - * @return One of ActiveX object or a simple object having an attribute of activeXError with a value of true. - * @type Object - */ - var getActiveXObject = function(name) - { - var obj = -1; - try - { - obj = new ActiveXObject(name); - }catch(err) - { - obj = {activeXError:true}; - } - return obj; - }; - - /** - * Parse an ActiveX $version string into an object. - * - * @param {String} str The ActiveX Object GetVariable($version) return value. - * @return An object having raw, major, minor, revision and revisionStr attributes. - * @type Object - */ - var parseActiveXVersion = function(str) - { - var versionArray = str.split(",");//replace with regex - return { - "raw":str, - "major":parseInt(versionArray[0].split(" ")[1], 10), - "minor":parseInt(versionArray[1], 10), - "revision":parseInt(versionArray[2], 10), - "revisionStr":versionArray[2] - }; - }; - - /** - * Parse a standard enabledPlugin.description into an object. - * - * @param {String} str The enabledPlugin.description value. - * @return An object having raw, major, minor, revision and revisionStr attributes. - * @type Object - */ - var parseStandardVersion = function(str) - { - var descParts = str.split(/ +/); - var majorMinor = descParts[2].split(/\./); - var revisionStr = descParts[3]; - return { - "raw":str, - "major":parseInt(majorMinor[0], 10), - "minor":parseInt(majorMinor[1], 10), - "revisionStr":revisionStr, - "revision":parseRevisionStrToInt(revisionStr) - }; - }; - - /** - * Parse the plugin revision string into an integer. - * - * @param {String} The revision in string format. - * @type Number - */ - var parseRevisionStrToInt = function(str) - { - return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision; - }; - - /** - * Constructor, sets raw, major, minor, revisionStr, revision and installed public properties. - */ - if(navigator.plugins && navigator.plugins.length>0) - { - var type = 'application/x-shockwave-flash'; - var mimeTypes = navigator.mimeTypes; - if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description) - { - var version = mimeTypes[type].enabledPlugin.description; - var versionObj = parseStandardVersion(version); - self.raw = versionObj.raw; - self.major = versionObj.major; - self.minor = versionObj.minor; - self.revisionStr = versionObj.revisionStr; - self.revision = versionObj.revision; - self.installed = true; - } - }else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript) - { - var version = -1; - for(var i=0; i' - +' ' - +'
' - +'
' - ); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - _env.suggest = $('
'); - }, +var _events = require('../events'); - posterSet: function() - { - _ui.posterUnset(); - if(_env.poster.length > 0) - { - img = $('') +var _events2 = _interopRequireDefault(_events); - _env.shield.append(img); +var _eventHandler = require('../event-handler'); - _debug.run({ - poster: _env.poster, - }) - } - }, +var _eventHandler2 = _interopRequireDefault(_eventHandler); - posterUnset: function() - { - _env.shield.find('img').remove(); - }, +var _bufferHelper = require('../helper/buffer-helper'); - // Button toolbar - toolbar: function() - { - _env.toolbar = $('
' - +'
' - +' ' - +'
' - +'
' - +' '+options.i18n.liveText+'' - +'
' - +'
' - +' 00:00:00 / ' - +'
' - +'
' - +' 00:00:00' - +'
' - +'' - +'' - +'
' - +' ' - +'
' - +'' - +'
'); - }, - - // Create player object - player: function() - { - _ui.shield(); - _ui.toolbar(); - - _env.player = $('
' - +'
'); - - _env.player.append(_env.shield); - _env.player.append(_env.suggest); - _env.player.append(_env.toolbar); - - _env.element.hide(); - _env.player.insertAfter(_env.element); - - // Simulate preload - _env.shield.find('.julia-big-play').hide(); - _env.toolbar.hide(); - - // Rangeslider polyfill - $('#julia-toolbar-'+_env.apiId+'>div.julia-progress>input, #julia-toolbar-'+_env.apiId+'>div.julia-volume>input').rangeslider({ - polyfill: false, - rangeClass: 'julia-rangeslider', - disabledClass: 'julia-rangeslider--disabled', - horizontalClass: 'julia-rangeslider--horizontal', - verticalClass: 'julia-rangeslider--vertical', - fillClass: 'julia-rangeslider__fill', - handleClass: 'julia-rangeslider__handle', - onInit: function(){}, - onSlide : function(position, value){}, - onSlideEnd : function(position, value){} - }); - - _debug.run({ - 'element': _env.element, - 'toolbar': _env.toolbar, - 'shield': _env.shield, - 'player': _env.player, - }); - } - }; +var _bufferHelper2 = _interopRequireDefault(_bufferHelper); - // Fullscreen on - var _fullscreen = { +var _errors = require('../errors'); - on: function() - { - var videoFrame = document.querySelector('#julia-player-'+_env.apiId); - - if(videoFrame.requestFullscreen) - { - videoFrame.requestFullscreen(); - } else if (videoFrame.msRequestFullscreen) - { - videoFrame.msRequestFullscreen(); - } else if (videoFrame.mozRequestFullScreen) - { - videoFrame.mozRequestFullScreen(); - } else if(videoFrame.webkitRequestFullscreen) - { - videoFrame.webkitRequestFullscreen(); - } - }, +var _logger = require('../utils/logger'); - // Fullscreen off - off: function() - { - if(document.exitFullscreen) - { - document.exitFullscreen(); - }else if(document.msExitFullscreen) - { - document.msExitFullscreen(); - } else if(document.mozCancelFullScreen) - { - document.mozCancelFullScreen(); - } else if(document.webkitExitFullscreen) - { - document.webkitExitFullscreen(); - } +var _ewmaBandwidthEstimator = require('./ewma-bandwidth-estimator'); + +var _ewmaBandwidthEstimator2 = _interopRequireDefault(_ewmaBandwidthEstimator); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* + * simple ABR Controller + * - compute next level based on last fragment bw heuristics + * - implement an abandon rules triggered if we have less than 2 frag buffered and if computed bw shows that we risk buffer stalling + */ + +var AbrController = function (_EventHandler) { + _inherits(AbrController, _EventHandler); + + function AbrController(hls) { + _classCallCheck(this, AbrController); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AbrController).call(this, hls, _events2.default.FRAG_LOADING, _events2.default.FRAG_LOADED, _events2.default.ERROR)); + + _this.lastLoadedFragLevel = 0; + _this._autoLevelCapping = -1; + _this._nextAutoLevel = -1; + _this.hls = hls; + _this.onCheck = _this.abandonRulesCheck.bind(_this); + return _this; + } + + _createClass(AbrController, [{ + key: 'destroy', + value: function destroy() { + this.clearTimer(); + _eventHandler2.default.prototype.destroy.call(this); + } + }, { + key: 'onFragLoading', + value: function onFragLoading(data) { + if (!this.timer) { + this.timer = setInterval(this.onCheck, 100); + } + + // lazy init of bw Estimator, rationale is that we use different params for Live/VoD + // so we need to wait for stream manifest / playlist type to instantiate it. + if (!this.bwEstimator) { + var hls = this.hls, + level = data.frag.level, + isLive = hls.levels[level].details.live, + config = hls.config, + ewmaFast = void 0, + ewmaSlow = void 0; + + if (isLive) { + ewmaFast = config.abrEwmaFastLive; + ewmaSlow = config.abrEwmaSlowLive; + } else { + ewmaFast = config.abrEwmaFastVoD; + ewmaSlow = config.abrEwmaSlowVoD; + } + this.bwEstimator = new _ewmaBandwidthEstimator2.default(hls, ewmaSlow, ewmaFast, config.abrEwmaDefaultEstimate); + } + + var frag = data.frag; + frag.trequest = performance.now(); + this.fragCurrent = frag; + } + }, { + key: 'abandonRulesCheck', + value: function abandonRulesCheck() { + /* + monitor fragment retrieval time... + we compute expected time of arrival of the complete fragment. + we compare it to expected time of buffer starvation + */ + var hls = this.hls, + v = hls.media, + frag = this.fragCurrent; + + // if loader has been destroyed or loading has been aborted, stop timer and return + if (!frag.loader || frag.loader.stats && frag.loader.stats.aborted) { + _logger.logger.warn('frag loader destroy or aborted, disarm abandonRulesCheck'); + this.clearTimer(); + return; + } + /* only monitor frag retrieval time if + (video not paused OR first fragment being loaded(ready state === HAVE_NOTHING = 0)) AND autoswitching enabled AND not lowest level (=> means that we have several levels) */ + if (v && (!v.paused || !v.readyState) && frag.autoLevel && frag.level) { + var requestDelay = performance.now() - frag.trequest; + // monitor fragment load progress after half of expected fragment duration,to stabilize bitrate + if (requestDelay > 500 * frag.duration) { + var levels = hls.levels, + loadRate = Math.max(1, frag.loaded * 1000 / requestDelay), + // byte/s; at least 1 byte/s to avoid division by zero + // compute expected fragment length using frag duration and level bitrate. also ensure that expected len is gte than already loaded size + expectedLen = Math.max(frag.loaded, Math.round(frag.duration * levels[frag.level].bitrate / 8)); + + var pos = v.currentTime; + var fragLoadedDelay = (expectedLen - frag.loaded) / loadRate; + var bufferStarvationDelay = _bufferHelper2.default.bufferInfo(v, pos, hls.config.maxBufferHole).end - pos; + // consider emergency switch down only if we have less than 2 frag buffered AND + // time to finish loading current fragment is bigger than buffer starvation delay + // ie if we risk buffer starvation if bw does not increase quickly + if (bufferStarvationDelay < 2 * frag.duration && fragLoadedDelay > bufferStarvationDelay) { + var fragLevelNextLoadedDelay = void 0, + nextLoadLevel = void 0; + // lets iterate through lower level and try to find the biggest one that could avoid rebuffering + // we start from current level - 1 and we step down , until we find a matching level + for (nextLoadLevel = frag.level - 1; nextLoadLevel >= 0; nextLoadLevel--) { + // compute time to load next fragment at lower level + // 0.8 : consider only 80% of current bw to be conservative + // 8 = bits per byte (bps/Bps) + fragLevelNextLoadedDelay = frag.duration * levels[nextLoadLevel].bitrate / (8 * 0.8 * loadRate); + _logger.logger.log('fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay[' + nextLoadLevel + '] :' + fragLoadedDelay.toFixed(1) + '/' + bufferStarvationDelay.toFixed(1) + '/' + fragLevelNextLoadedDelay.toFixed(1)); + if (fragLevelNextLoadedDelay < bufferStarvationDelay) { + // we found a lower level that be rebuffering free with current estimated bw ! + break; + } } - }; + // only emergency switch down if it takes less time to load new fragment at lowest level instead + // of finishing loading current one ... + if (fragLevelNextLoadedDelay < fragLoadedDelay) { + // ensure nextLoadLevel is not negative + nextLoadLevel = Math.max(0, nextLoadLevel); + // force next load level in auto mode + hls.nextLoadLevel = nextLoadLevel; + // update bw estimate for this fragment before cancelling load (this will help reducing the bw) + this.bwEstimator.sample(requestDelay, frag.loaded); + // abort fragment loading ... + _logger.logger.warn('loading too slow, abort fragment loading and switch to level ' + nextLoadLevel); + //abort fragment loading + frag.loader.abort(); + this.clearTimer(); + hls.trigger(_events2.default.FRAG_LOAD_EMERGENCY_ABORTED, { frag: frag }); + } + } + } + } + } + }, { + key: 'onFragLoaded', + value: function onFragLoaded(data) { + var stats = data.stats; + // only update stats on first frag loading + // if same frag is loaded multiple times, it might be in browser cache, and loaded quickly + // and leading to wrong bw estimation + if (stats.aborted === undefined && data.frag.loadCounter === 1) { + this.bwEstimator.sample(performance.now() - stats.trequest, stats.loaded); + } + + // stop monitoring bw once frag loaded + this.clearTimer(); + // store level id after successful fragment load + this.lastLoadedFragLevel = data.frag.level; + // reset forced auto level value so that next level will be selected + this._nextAutoLevel = -1; + } + }, { + key: 'onError', + value: function onError(data) { + // stop timer in case of frag loading error + switch (data.details) { + case _errors.ErrorDetails.FRAG_LOAD_ERROR: + case _errors.ErrorDetails.FRAG_LOAD_TIMEOUT: + this.clearTimer(); + break; + default: + break; + } + } + }, { + key: 'clearTimer', + value: function clearTimer() { + if (this.timer) { + clearInterval(this.timer); + this.timer = null; + } + } - // Timeline numbers coonversion - var _timeline = { + /** Return the capping/max level value that could be used by automatic level selection algorithm **/ - toPercents: function(currentTime) - { - p = (currentTime/_env.duration)*100; - return p; - }, + }, { + key: 'autoLevelCapping', + get: function get() { + return this._autoLevelCapping; + } - toSeconds: function(percent) - { - t = (_env.duration/100)*percent; - return t; - }, + /** set the capping/max level value that could be used by automatic level selection algorithm **/ + , + set: function set(newLevel) { + this._autoLevelCapping = newLevel; + } + }, { + key: 'nextAutoLevel', + get: function get() { + var hls = this.hls, + i, + maxAutoLevel, + levels = hls.levels, + config = hls.config; + if (this._autoLevelCapping === -1 && levels && levels.length) { + maxAutoLevel = levels.length - 1; + } else { + maxAutoLevel = this._autoLevelCapping; + } + + // in case next auto level has been forced, return it straight-away (but capped) + if (this._nextAutoLevel !== -1) { + return Math.min(this._nextAutoLevel, maxAutoLevel); + } + + var avgbw = this.bwEstimator ? this.bwEstimator.getEstimate() : config.abrEwmaDefaultEstimate, + adjustedbw = void 0; + // follow algorithm captured from stagefright : + // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp + // Pick the highest bandwidth stream below or equal to estimated bandwidth. + for (i = 0; i <= maxAutoLevel; i++) { + // consider only 80% of the available bandwidth, but if we are switching up, + // be even more conservative (70%) to avoid overestimating and immediately + // switching back. + if (i <= this.lastLoadedFragLevel) { + adjustedbw = config.abrBandWidthFactor * avgbw; + } else { + adjustedbw = config.abrBandWidthUpFactor * avgbw; + } + if (adjustedbw < levels[i].bitrate) { + return Math.max(0, i - 1); + } + } + return i - 1; + }, + set: function set(nextLevel) { + this._nextAutoLevel = nextLevel; + } + }]); - toNum: function(human) - { - human = human.split(':'); - human.reverse(); - s = parseInt(human[0]); - m = human.length>1 ? parseInt(human[1]): 0; - h = human.length>2 ? parseInt(human[3]): 0; - t = s + m*60 + h*60*60; - return t; - }, - - toHuman: function(time) - { - time = time.toString().split('.'); - s = time[0]; - H = Math.floor(s/3600); - M = Math.floor( ( s - (H*3600) ) / 60 ); - S = Math.floor( ( s - (H*3600) - (M*60) ) ); + return AbrController; +}(_eventHandler2.default); + +exports.default = AbrController; + +},{"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../utils/logger":38,"./ewma-bandwidth-estimator":6}],4:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); - H = ('0'+H.toString()).slice(-2); - M = ('0'+M.toString()).slice(-2); - S = ('0'+S.toString()).slice(-2); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _eventHandler = require('../event-handler'); + +var _eventHandler2 = _interopRequireDefault(_eventHandler); + +var _logger = require('../utils/logger'); + +var _errors = require('../errors'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* + * Buffer Controller + */ + +var BufferController = function (_EventHandler) { + _inherits(BufferController, _EventHandler); + + function BufferController(hls) { + _classCallCheck(this, BufferController); + + // the value that we have set mediasource.duration to + // (the actual duration may be tweaked slighly by the browser) + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(BufferController).call(this, hls, _events2.default.MEDIA_ATTACHING, _events2.default.MEDIA_DETACHING, _events2.default.BUFFER_RESET, _events2.default.BUFFER_APPENDING, _events2.default.BUFFER_CODECS, _events2.default.BUFFER_EOS, _events2.default.BUFFER_FLUSHING, _events2.default.LEVEL_UPDATED)); + + _this._msDuration = null; + // the value that we want to set mediaSource.duration to + _this._levelDuration = null; + + // Source Buffer listeners + _this.onsbue = _this.onSBUpdateEnd.bind(_this); + _this.onsbe = _this.onSBUpdateError.bind(_this); + return _this; + } + + _createClass(BufferController, [{ + key: 'destroy', + value: function destroy() { + _eventHandler2.default.prototype.destroy.call(this); + } + }, { + key: 'onMediaAttaching', + value: function onMediaAttaching(data) { + var media = this.media = data.media; + if (media) { + // setup the media source + var ms = this.mediaSource = new MediaSource(); + //Media Source listeners + this.onmso = this.onMediaSourceOpen.bind(this); + this.onmse = this.onMediaSourceEnded.bind(this); + this.onmsc = this.onMediaSourceClose.bind(this); + ms.addEventListener('sourceopen', this.onmso); + ms.addEventListener('sourceended', this.onmse); + ms.addEventListener('sourceclose', this.onmsc); + // link video and media Source + media.src = URL.createObjectURL(ms); + } + } + }, { + key: 'onMediaDetaching', + value: function onMediaDetaching() { + var ms = this.mediaSource; + if (ms) { + if (ms.readyState === 'open') { + try { + // endOfStream could trigger exception if any sourcebuffer is in updating state + // we don't really care about checking sourcebuffer state here, + // as we are anyway detaching the MediaSource + // let's just avoid this exception to propagate + ms.endOfStream(); + } catch (err) { + _logger.logger.warn('onMediaDetaching:' + err.message + ' while calling endOfStream'); + } + } + ms.removeEventListener('sourceopen', this.onmso); + ms.removeEventListener('sourceended', this.onmse); + ms.removeEventListener('sourceclose', this.onmsc); + + try { + // unlink MediaSource from video tag + this.media.src = ''; + this.media.removeAttribute('src'); + } catch (err) { + _logger.logger.warn('onMediaDetaching:' + err.message + ' while unlinking video.src'); + } + this.mediaSource = null; + this.media = null; + this.pendingTracks = null; + this.sourceBuffer = null; + } + this.onmso = this.onmse = this.onmsc = null; + this.hls.trigger(_events2.default.MEDIA_DETACHED); + } + }, { + key: 'onMediaSourceOpen', + value: function onMediaSourceOpen() { + _logger.logger.log('media source opened'); + this.hls.trigger(_events2.default.MEDIA_ATTACHED, { media: this.media }); + // once received, don't listen anymore to sourceopen event + this.mediaSource.removeEventListener('sourceopen', this.onmso); + // if any buffer codecs pending, treat it here. + var pendingTracks = this.pendingTracks; + if (pendingTracks) { + this.onBufferCodecs(pendingTracks); + this.pendingTracks = null; + this.doAppending(); + } + } + }, { + key: 'onMediaSourceClose', + value: function onMediaSourceClose() { + _logger.logger.log('media source closed'); + } + }, { + key: 'onMediaSourceEnded', + value: function onMediaSourceEnded() { + _logger.logger.log('media source ended'); + } + }, { + key: 'onSBUpdateEnd', + value: function onSBUpdateEnd() { + + if (this._needsFlush) { + this.doFlush(); + } + + if (this._needsEos) { + this.onBufferEos(); + } + + this.hls.trigger(_events2.default.BUFFER_APPENDED); + + this.doAppending(); + } + }, { + key: 'onSBUpdateError', + value: function onSBUpdateError(event) { + _logger.logger.error('sourceBuffer error:' + event); + // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error + // this error might not always be fatal (it is fatal if decode error is set, in that case + // it will be followed by a mediaElement error ...) + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_APPENDING_ERROR, fatal: false }); + // we don't need to do more than that, as accordin to the spec, updateend will be fired just after + } + }, { + key: 'onBufferReset', + value: function onBufferReset() { + var sourceBuffer = this.sourceBuffer; + if (sourceBuffer) { + for (var type in sourceBuffer) { + var sb = sourceBuffer[type]; + try { + this.mediaSource.removeSourceBuffer(sb); + sb.removeEventListener('updateend', this.onsbue); + sb.removeEventListener('error', this.onsbe); + } catch (err) {} + } + this.sourceBuffer = null; + } + this.flushRange = []; + this.appended = 0; + } + }, { + key: 'onBufferCodecs', + value: function onBufferCodecs(tracks) { + var mediaSource = this.mediaSource; + + // delay sourcebuffer creation if media source not opened yet + if (!mediaSource || mediaSource.readyState !== 'open') { + this.pendingTracks = tracks; + return; + } + + if (!this.sourceBuffer) { + var sourceBuffer = {}; + for (var trackName in tracks) { + var track = tracks[trackName]; + // use levelCodec as first priority + var codec = track.levelCodec || track.codec; + var mimeType = track.container + ';codecs=' + codec; + _logger.logger.log('creating sourceBuffer with mimeType:' + mimeType); + var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType); + sb.addEventListener('updateend', this.onsbue); + sb.addEventListener('error', this.onsbe); + } + this.sourceBuffer = sourceBuffer; + } + } + }, { + key: 'onBufferAppending', + value: function onBufferAppending(data) { + if (!this.segments) { + this.segments = [data]; + } else { + this.segments.push(data); + } + this.doAppending(); + } + }, { + key: 'onBufferAppendFail', + value: function onBufferAppendFail(data) { + _logger.logger.error('sourceBuffer error:' + data.event); + // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error + // this error might not always be fatal (it is fatal if decode error is set, in that case + // it will be followed by a mediaElement error ...) + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_APPENDING_ERROR, fatal: false, frag: this.fragCurrent }); + } + }, { + key: 'onBufferEos', + value: function onBufferEos() { + var sb = this.sourceBuffer, + mediaSource = this.mediaSource; + if (!mediaSource || mediaSource.readyState !== 'open') { + return; + } + if (!(sb.audio && sb.audio.updating || sb.video && sb.video.updating)) { + _logger.logger.log('all media data available, signal endOfStream() to MediaSource and stop loading fragment'); + //Notify the media element that it now has all of the media data + mediaSource.endOfStream(); + this._needsEos = false; + } else { + this._needsEos = true; + } + } + }, { + key: 'onBufferFlushing', + value: function onBufferFlushing(data) { + this.flushRange.push({ start: data.startOffset, end: data.endOffset }); + // attempt flush immediatly + this.flushBufferCounter = 0; + this.doFlush(); + } + }, { + key: 'onLevelUpdated', + value: function onLevelUpdated(event) { + var details = event.details; + if (details.fragments.length === 0) { + return; + } + this._levelDuration = details.totalduration + details.fragments[0].start; + this.updateMediaElementDuration(); + } - str = H>0 ? H+':'+M+':'+S: M+':'+S; + // https://github.com/dailymotion/hls.js/issues/355 + + }, { + key: 'updateMediaElementDuration', + value: function updateMediaElementDuration() { + if (this._levelDuration === null) { + return; + } + var media = this.media, + mediaSource = this.mediaSource, + sourceBuffer = this.sourceBuffer; + if (!media || !mediaSource || !sourceBuffer || media.readyState === 0 || mediaSource.readyState !== 'open') { + return; + } + for (var type in sourceBuffer) { + if (sourceBuffer[type].updating) { + // can't set duration whilst a buffer is updating + return; + } + } + if (this._msDuration === null) { + // initialise to the value that the media source is reporting + this._msDuration = mediaSource.duration; + } + // this._levelDuration was the last value we set. + // not using mediaSource.duration as the browser may tweak this value + // only update mediasource duration if its value increase, this is to avoid + // flushing already buffered portion when switching between quality level, as they + if (this._levelDuration > this._msDuration) { + _logger.logger.log('Updating mediasource duration to ' + this._levelDuration); + mediaSource.duration = this._levelDuration; + this._msDuration = this._levelDuration; + } + } + }, { + key: 'doFlush', + value: function doFlush() { + // loop through all buffer ranges to flush + while (this.flushRange.length) { + var range = this.flushRange[0]; + // flushBuffer will abort any buffer append in progress and flush Audio/Video Buffer + if (this.flushBuffer(range.start, range.end)) { + // range flushed, remove from flush array + this.flushRange.shift(); + this.flushBufferCounter = 0; + } else { + this._needsFlush = true; + // avoid looping, wait for SB update end to retrigger a flush + return; + } + } + if (this.flushRange.length === 0) { + // everything flushed + this._needsFlush = false; + + // let's recompute this.appended, which is used to avoid flush looping + var appended = 0; + var sourceBuffer = this.sourceBuffer; + if (sourceBuffer) { + for (var type in sourceBuffer) { + appended += sourceBuffer[type].buffered.length; + } + } + this.appended = appended; + this.hls.trigger(_events2.default.BUFFER_FLUSHED); + } + } + }, { + key: 'doAppending', + value: function doAppending() { + var hls = this.hls, + sourceBuffer = this.sourceBuffer, + segments = this.segments; + if (sourceBuffer) { + if (this.media.error) { + segments = []; + _logger.logger.error('trying to append although a media error occured, flush segment and abort'); + return; + } + for (var type in sourceBuffer) { + if (sourceBuffer[type].updating) { + //logger.log('sb update in progress'); + return; + } + } + if (segments.length) { + var segment = segments.shift(); + try { + //logger.log(`appending ${segment.type} SB, size:${segment.data.length}); + sourceBuffer[segment.type].appendBuffer(segment.data); + this.appendError = 0; + this.appended++; + } catch (err) { + // in case any error occured while appending, put back segment in segments table + _logger.logger.error('error while trying to append buffer:' + err.message); + segments.unshift(segment); + var event = { type: _errors.ErrorTypes.MEDIA_ERROR }; + if (err.code !== 22) { + if (this.appendError) { + this.appendError++; + } else { + this.appendError = 1; + } + event.details = _errors.ErrorDetails.BUFFER_APPEND_ERROR; + event.frag = this.fragCurrent; + /* with UHD content, we could get loop of quota exceeded error until + browser is able to evict some data from sourcebuffer. retrying help recovering this + */ + if (this.appendError > hls.config.appendErrorMaxRetry) { + _logger.logger.log('fail ' + hls.config.appendErrorMaxRetry + ' times to append segment in sourceBuffer'); + segments = []; + event.fatal = true; + hls.trigger(_events2.default.ERROR, event); + return; + } else { + event.fatal = false; + hls.trigger(_events2.default.ERROR, event); + } + } else { + // QuotaExceededError: http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror + // let's stop appending any segments, and report BUFFER_FULL_ERROR error + this.segments = []; + event.details = _errors.ErrorDetails.BUFFER_FULL_ERROR; + hls.trigger(_events2.default.ERROR, event); + return; + } + } + } + } + } - return str; + /* + flush specified buffered range, + return true once range has been flushed. + as sourceBuffer.remove() is asynchronous, flushBuffer will be retriggered on sourceBuffer update end + */ + + }, { + key: 'flushBuffer', + value: function flushBuffer(startOffset, endOffset) { + var sb, i, bufStart, bufEnd, flushStart, flushEnd; + //logger.log('flushBuffer,pos/start/end: ' + this.media.currentTime + '/' + startOffset + '/' + endOffset); + // safeguard to avoid infinite looping : don't try to flush more than the nb of appended segments + if (this.flushBufferCounter < this.appended && this.sourceBuffer) { + for (var type in this.sourceBuffer) { + sb = this.sourceBuffer[type]; + if (!sb.updating) { + for (i = 0; i < sb.buffered.length; i++) { + bufStart = sb.buffered.start(i); + bufEnd = sb.buffered.end(i); + // workaround firefox not able to properly flush multiple buffered range. + if (navigator.userAgent.toLowerCase().indexOf('firefox') !== -1 && endOffset === Number.POSITIVE_INFINITY) { + flushStart = startOffset; + flushEnd = endOffset; + } else { + flushStart = Math.max(bufStart, startOffset); + flushEnd = Math.min(bufEnd, endOffset); + } + /* sometimes sourcebuffer.remove() does not flush + the exact expected time range. + to avoid rounding issues/infinite loop, + only flush buffer range of length greater than 500ms. + */ + if (Math.min(flushEnd, bufEnd) - flushStart > 0.5) { + this.flushBufferCounter++; + _logger.logger.log('flush ' + type + ' [' + flushStart + ',' + flushEnd + '], of [' + bufStart + ',' + bufEnd + '], pos:' + this.media.currentTime); + sb.remove(flushStart, flushEnd); + return false; + } } + } else { + //logger.log('abort ' + type + ' append in progress'); + // this will abort any appending in progress + //sb.abort(); + _logger.logger.warn('cannot flush, sb updating in progress'); + return false; + } + } + } else { + _logger.logger.warn('abort flushing too many retries'); + } + _logger.logger.log('buffer flushed'); + // everything flushed ! + return true; + } + }]); + + return BufferController; +}(_eventHandler2.default); + +exports.default = BufferController; + +},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],5:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _eventHandler = require('../event-handler'); + +var _eventHandler2 = _interopRequireDefault(_eventHandler); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* + * cap stream level to media size dimension controller + */ + +var CapLevelController = function (_EventHandler) { + _inherits(CapLevelController, _EventHandler); + + function CapLevelController(hls) { + _classCallCheck(this, CapLevelController); + + return _possibleConstructorReturn(this, Object.getPrototypeOf(CapLevelController).call(this, hls, _events2.default.MEDIA_ATTACHING, _events2.default.MANIFEST_PARSED)); + } + + _createClass(CapLevelController, [{ + key: 'destroy', + value: function destroy() { + if (this.hls.config.capLevelToPlayerSize) { + this.media = null; + this.autoLevelCapping = Number.POSITIVE_INFINITY; + if (this.timer) { + this.timer = clearInterval(this.timer); + } + } + } + }, { + key: 'onMediaAttaching', + value: function onMediaAttaching(data) { + this.media = data.media instanceof HTMLVideoElement ? data.media : null; + } + }, { + key: 'onManifestParsed', + value: function onManifestParsed(data) { + if (this.hls.config.capLevelToPlayerSize) { + this.autoLevelCapping = Number.POSITIVE_INFINITY; + this.levels = data.levels; + this.hls.firstLevel = this.getMaxLevel(data.firstLevel); + clearInterval(this.timer); + this.timer = setInterval(this.detectPlayerSize.bind(this), 1000); + this.detectPlayerSize(); + } + } + }, { + key: 'detectPlayerSize', + value: function detectPlayerSize() { + if (this.media) { + var levelsLength = this.levels ? this.levels.length : 0; + if (levelsLength) { + this.hls.autoLevelCapping = this.getMaxLevel(levelsLength - 1); + if (this.hls.autoLevelCapping > this.autoLevelCapping) { + // if auto level capping has a higher value for the previous one, flush the buffer using nextLevelSwitch + // usually happen when the user go to the fullscreen mode. + this.hls.streamController.nextLevelSwitch(); + } + this.autoLevelCapping = this.hls.autoLevelCapping; + } + } + } + + /* + * returns level should be the one with the dimensions equal or greater than the media (player) dimensions (so the video will be downscaled) + */ + + }, { + key: 'getMaxLevel', + value: function getMaxLevel(capLevelIndex) { + var result = void 0, + i = void 0, + level = void 0, + mWidth = this.mediaWidth, + mHeight = this.mediaHeight, + lWidth = 0, + lHeight = 0; + + for (i = 0; i <= capLevelIndex; i++) { + level = this.levels[i]; + result = i; + lWidth = level.width; + lHeight = level.height; + if (mWidth <= lWidth || mHeight <= lHeight) { + break; + } + } + return result; + } + }, { + key: 'contentScaleFactor', + get: function get() { + var pixelRatio = 1; + try { + pixelRatio = window.devicePixelRatio; + } catch (e) {} + return pixelRatio; + } + }, { + key: 'mediaWidth', + get: function get() { + var width = void 0; + if (this.media) { + width = this.media.width || this.media.clientWidth || this.media.offsetWidth; + width *= this.contentScaleFactor; + } + return width; + } + }, { + key: 'mediaHeight', + get: function get() { + var height = void 0; + if (this.media) { + height = this.media.height || this.media.clientHeight || this.media.offsetHeight; + height *= this.contentScaleFactor; + } + return height; + } + }]); + + return CapLevelController; +}(_eventHandler2.default); + +exports.default = CapLevelController; + +},{"../event-handler":22,"../events":23}],6:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* + * EWMA Bandwidth Estimator + * - heavily inspired from shaka-player + * Tracks bandwidth samples and estimates available bandwidth. + * Based on the minimum of two exponentially-weighted moving averages with + * different half-lives. + */ + +var _ewma = require('../utils/ewma'); + +var _ewma2 = _interopRequireDefault(_ewma); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var EwmaBandWidthEstimator = function () { + function EwmaBandWidthEstimator(hls, slow, fast, defaultEstimate) { + _classCallCheck(this, EwmaBandWidthEstimator); + + this.hls = hls; + this.defaultEstimate_ = defaultEstimate; + this.minWeight_ = 0.001; + this.minDelayMs_ = 50; + this.slow_ = new _ewma2.default(slow); + this.fast_ = new _ewma2.default(fast); + } + + _createClass(EwmaBandWidthEstimator, [{ + key: 'sample', + value: function sample(durationMs, numBytes) { + durationMs = Math.max(durationMs, this.minDelayMs_); + var bandwidth = 8000 * numBytes / durationMs, + + //console.log('instant bw:'+ Math.round(bandwidth)); + // we weight sample using loading duration.... + weight = durationMs / 1000; + this.fast_.sample(weight, bandwidth); + this.slow_.sample(weight, bandwidth); + } + }, { + key: 'getEstimate', + value: function getEstimate() { + if (!this.fast_ || !this.slow_ || this.fast_.getTotalWeight() < this.minWeight_) { + return this.defaultEstimate_; + } + //console.log('slow estimate:'+ Math.round(this.slow_.getEstimate())); + //console.log('fast estimate:'+ Math.round(this.fast_.getEstimate())); + // Take the minimum of these two estimates. This should have the effect of + // adapting down quickly, but up more slowly. + return Math.min(this.fast_.getEstimate(), this.slow_.getEstimate()); + } + }, { + key: 'destroy', + value: function destroy() {} + }]); + + return EwmaBandWidthEstimator; +}(); + +exports.default = EwmaBandWidthEstimator; + +},{"../utils/ewma":37}],7:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _eventHandler = require('../event-handler'); + +var _eventHandler2 = _interopRequireDefault(_eventHandler); + +var _logger = require('../utils/logger'); + +var _errors = require('../errors'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* + * Level Controller + */ + +var LevelController = function (_EventHandler) { + _inherits(LevelController, _EventHandler); + + function LevelController(hls) { + _classCallCheck(this, LevelController); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LevelController).call(this, hls, _events2.default.MANIFEST_LOADED, _events2.default.LEVEL_LOADED, _events2.default.ERROR)); + + _this.ontick = _this.tick.bind(_this); + _this._manualLevel = _this._autoLevelCapping = -1; + return _this; + } + + _createClass(LevelController, [{ + key: 'destroy', + value: function destroy() { + if (this.timer) { + clearTimeout(this.timer); + this.timer = null; + } + this._manualLevel = -1; + } + }, { + key: 'startLoad', + value: function startLoad() { + this.canload = true; + // speed up live playlist refresh if timer exists + if (this.timer) { + this.tick(); + } + } + }, { + key: 'stopLoad', + value: function stopLoad() { + this.canload = false; + } + }, { + key: 'onManifestLoaded', + value: function onManifestLoaded(data) { + var levels0 = [], + levels = [], + bitrateStart, + i, + bitrateSet = {}, + videoCodecFound = false, + audioCodecFound = false, + hls = this.hls; + + // regroup redundant level together + data.levels.forEach(function (level) { + if (level.videoCodec) { + videoCodecFound = true; + } + if (level.audioCodec) { + audioCodecFound = true; + } + var redundantLevelId = bitrateSet[level.bitrate]; + if (redundantLevelId === undefined) { + bitrateSet[level.bitrate] = levels0.length; + level.url = [level.url]; + level.urlId = 0; + levels0.push(level); + } else { + levels0[redundantLevelId].url.push(level.url); + } + }); + + // remove audio-only level if we also have levels with audio+video codecs signalled + if (videoCodecFound && audioCodecFound) { + levels0.forEach(function (level) { + if (level.videoCodec) { + levels.push(level); + } + }); + } else { + levels = levels0; + } + + // only keep level with supported audio/video codecs + levels = levels.filter(function (level) { + var checkSupportedAudio = function checkSupportedAudio(codec) { + return MediaSource.isTypeSupported('audio/mp4;codecs=' + codec); + }; + var checkSupportedVideo = function checkSupportedVideo(codec) { + return MediaSource.isTypeSupported('video/mp4;codecs=' + codec); }; + var audioCodec = level.audioCodec, + videoCodec = level.videoCodec; + + return (!audioCodec || checkSupportedAudio(audioCodec)) && (!videoCodec || checkSupportedVideo(videoCodec)); + }); + + if (levels.length) { + // start bitrate is the first bitrate of the manifest + bitrateStart = levels[0].bitrate; + // sort level on bitrate + levels.sort(function (a, b) { + return a.bitrate - b.bitrate; + }); + this._levels = levels; + // find index of first level in sorted levels + for (i = 0; i < levels.length; i++) { + if (levels[i].bitrate === bitrateStart) { + this._firstLevel = i; + _logger.logger.log('manifest loaded,' + levels.length + ' level(s) found, first bitrate:' + bitrateStart); + break; + } + } + hls.trigger(_events2.default.MANIFEST_PARSED, { levels: this._levels, firstLevel: this._firstLevel, stats: data.stats }); + } else { + hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal: true, url: hls.url, reason: 'no level with compatible codecs found in manifest' }); + } + return; + } + }, { + key: 'setLevelInternal', + value: function setLevelInternal(newLevel) { + var levels = this._levels; + // check if level idx is valid + if (newLevel >= 0 && newLevel < levels.length) { + // stopping live reloading timer if any + if (this.timer) { + clearTimeout(this.timer); + this.timer = null; + } + this._level = newLevel; + _logger.logger.log('switching to level ' + newLevel); + this.hls.trigger(_events2.default.LEVEL_SWITCH, { level: newLevel }); + var level = levels[newLevel]; + // check if we need to load playlist for this level + if (level.details === undefined || level.details.live === true) { + // level not retrieved yet, or live playlist we need to (re)load it + _logger.logger.log('(re)loading playlist for level ' + newLevel); + var urlId = level.urlId; + this.hls.trigger(_events2.default.LEVEL_LOADING, { url: level.url[urlId], level: newLevel, id: urlId }); + } + } else { + // invalid level id given, trigger error + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.OTHER_ERROR, details: _errors.ErrorDetails.LEVEL_SWITCH_ERROR, level: newLevel, fatal: false, reason: 'invalid level idx' }); + } + } + }, { + key: 'onError', + value: function onError(data) { + if (data.fatal) { + return; + } + + var details = data.details, + hls = this.hls, + levelId = void 0, + level = void 0, + levelError = false; + // try to recover not fatal errors + switch (details) { + case _errors.ErrorDetails.FRAG_LOAD_ERROR: + case _errors.ErrorDetails.FRAG_LOAD_TIMEOUT: + case _errors.ErrorDetails.FRAG_LOOP_LOADING_ERROR: + case _errors.ErrorDetails.KEY_LOAD_ERROR: + case _errors.ErrorDetails.KEY_LOAD_TIMEOUT: + levelId = data.frag.level; + break; + case _errors.ErrorDetails.LEVEL_LOAD_ERROR: + case _errors.ErrorDetails.LEVEL_LOAD_TIMEOUT: + levelId = data.level; + levelError = true; + break; + default: + break; + } + /* try to switch to a redundant stream if any available. + * if no redundant stream available, emergency switch down (if in auto mode and current level not 0) + * otherwise, we cannot recover this network error ... + * don't raise FRAG_LOAD_ERROR and FRAG_LOAD_TIMEOUT as fatal, as it is handled by mediaController + */ + if (levelId !== undefined) { + level = this._levels[levelId]; + if (level.urlId < level.url.length - 1) { + level.urlId++; + level.details = undefined; + _logger.logger.warn('level controller,' + details + ' for level ' + levelId + ': switching to redundant stream id ' + level.urlId); + } else { + // we could try to recover if in auto mode and current level not lowest level (0) + var recoverable = this._manualLevel === -1 && levelId; + if (recoverable) { + _logger.logger.warn('level controller,' + details + ': emergency switch-down for next fragment'); + hls.abrController.nextAutoLevel = 0; + } else if (level && level.details && level.details.live) { + _logger.logger.warn('level controller,' + details + ' on live stream, discard'); + if (levelError) { + // reset this._level so that another call to set level() will retrigger a frag load + this._level = undefined; + } + // FRAG_LOAD_ERROR and FRAG_LOAD_TIMEOUT are handled by mediaController + } else if (details !== _errors.ErrorDetails.FRAG_LOAD_ERROR && details !== _errors.ErrorDetails.FRAG_LOAD_TIMEOUT) { + _logger.logger.error('cannot recover ' + details + ' error'); + this._level = undefined; + // stopping live reloading timer if any + if (this.timer) { + clearTimeout(this.timer); + this.timer = null; + } + // redispatch same error but with fatal set to true + data.fatal = true; + hls.trigger(_events2.default.ERROR, data); + } + } + } + } + }, { + key: 'onLevelLoaded', + value: function onLevelLoaded(data) { + // only process level loaded events matching with expected level + if (data.level === this._level) { + var newDetails = data.details; + // if current playlist is a live playlist, arm a timer to reload it + if (newDetails.live) { + var reloadInterval = 1000 * newDetails.targetduration, + curLevel = this._levels[data.level], + curDetails = curLevel.details; + if (curDetails && newDetails.endSN === curDetails.endSN) { + // follow HLS Spec, If the client reloads a Playlist file and finds that it has not + // changed then it MUST wait for a period of one-half the target + // duration before retrying. + reloadInterval /= 2; + _logger.logger.log('same live playlist, reload twice faster'); + } + // decrement reloadInterval with level loading delay + reloadInterval -= performance.now() - data.stats.trequest; + // in any case, don't reload more than every second + reloadInterval = Math.max(1000, Math.round(reloadInterval)); + _logger.logger.log('live playlist, reload in ' + reloadInterval + ' ms'); + this.timer = setTimeout(this.ontick, reloadInterval); + } else { + this.timer = null; + } + } + } + }, { + key: 'tick', + value: function tick() { + var levelId = this._level; + if (levelId !== undefined && this.canload) { + var level = this._levels[levelId], + urlId = level.urlId; + this.hls.trigger(_events2.default.LEVEL_LOADING, { url: level.url[urlId], level: levelId, id: urlId }); + } + } + }, { + key: 'levels', + get: function get() { + return this._levels; + } + }, { + key: 'level', + get: function get() { + return this._level; + }, + set: function set(newLevel) { + var levels = this._levels; + if (levels && levels.length > newLevel) { + if (this._level !== newLevel || levels[newLevel].details === undefined) { + this.setLevelInternal(newLevel); + } + } + } + }, { + key: 'manualLevel', + get: function get() { + return this._manualLevel; + }, + set: function set(newLevel) { + this._manualLevel = newLevel; + if (this._startLevel === undefined) { + this._startLevel = newLevel; + } + if (newLevel !== -1) { + this.level = newLevel; + } + } + }, { + key: 'firstLevel', + get: function get() { + return this._firstLevel; + }, + set: function set(newLevel) { + this._firstLevel = newLevel; + } + }, { + key: 'startLevel', + get: function get() { + if (this._startLevel === undefined) { + return this._firstLevel; + } else { + return this._startLevel; + } + }, + set: function set(newLevel) { + this._startLevel = newLevel; + } + }, { + key: 'nextLoadLevel', + get: function get() { + if (this._manualLevel !== -1) { + return this._manualLevel; + } else { + return this.hls.abrController.nextAutoLevel; + } + }, + set: function set(nextLevel) { + this.level = nextLevel; + if (this._manualLevel === -1) { + this.hls.abrController.nextAutoLevel = nextLevel; + } + } + }]); + + return LevelController; +}(_eventHandler2.default); + +exports.default = LevelController; + +},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],8:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _demuxer = require('../demux/demuxer'); + +var _demuxer2 = _interopRequireDefault(_demuxer); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _eventHandler = require('../event-handler'); + +var _eventHandler2 = _interopRequireDefault(_eventHandler); + +var _logger = require('../utils/logger'); + +var _binarySearch = require('../utils/binary-search'); + +var _binarySearch2 = _interopRequireDefault(_binarySearch); +var _bufferHelper = require('../helper/buffer-helper'); - // Suggest engine - var _suggest = { +var _bufferHelper2 = _interopRequireDefault(_bufferHelper); + +var _levelHelper = require('../helper/level-helper'); + +var _levelHelper2 = _interopRequireDefault(_levelHelper); + +var _errors = require('../errors'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* + * Stream Controller + */ + +var State = { + 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_LEVEL: 'WAITING_LEVEL', + PARSING: 'PARSING', + PARSED: 'PARSED', + ENDED: 'ENDED', + ERROR: 'ERROR' +}; + +var StreamController = function (_EventHandler) { + _inherits(StreamController, _EventHandler); + + function StreamController(hls) { + _classCallCheck(this, StreamController); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StreamController).call(this, hls, _events2.default.MEDIA_ATTACHED, _events2.default.MEDIA_DETACHING, _events2.default.MANIFEST_LOADING, _events2.default.MANIFEST_PARSED, _events2.default.LEVEL_LOADED, _events2.default.KEY_LOADED, _events2.default.FRAG_LOADED, _events2.default.FRAG_LOAD_EMERGENCY_ABORTED, _events2.default.FRAG_PARSING_INIT_SEGMENT, _events2.default.FRAG_PARSING_DATA, _events2.default.FRAG_PARSED, _events2.default.ERROR, _events2.default.BUFFER_APPENDED, _events2.default.BUFFER_FLUSHED)); + + _this.config = hls.config; + _this.audioCodecSwap = false; + _this.ticks = 0; + _this.ontick = _this.tick.bind(_this); + return _this; + } + + _createClass(StreamController, [{ + key: 'destroy', + value: function destroy() { + this.stopLoad(); + if (this.timer) { + clearInterval(this.timer); + this.timer = null; + } + _eventHandler2.default.prototype.destroy.call(this); + this.state = State.STOPPED; + } + }, { + key: 'startLoad', + value: function startLoad(startPosition) { + if (this.levels) { + var media = this.media, + lastCurrentTime = this.lastCurrentTime; + this.stopLoad(); + this.demuxer = new _demuxer2.default(this.hls); + if (!this.timer) { + this.timer = setInterval(this.ontick, 100); + } + this.level = -1; + this.fragLoadError = 0; + if (media && lastCurrentTime > 0) { + _logger.logger.log('configure startPosition @' + lastCurrentTime); + if (!this.lastPaused) { + _logger.logger.log('resuming video'); + media.play(); + } + this.state = State.IDLE; + } else { + this.lastCurrentTime = this.startPosition ? this.startPosition : startPosition; + this.state = State.STARTING; + } + this.nextLoadPosition = this.startPosition = this.lastCurrentTime; + this.tick(); + } else { + _logger.logger.warn('cannot start loading as manifest not parsed yet'); + this.state = State.STOPPED; + } + } + }, { + key: 'stopLoad', + value: function stopLoad() { + var frag = this.fragCurrent; + if (frag) { + if (frag.loader) { + frag.loader.abort(); + } + this.fragCurrent = null; + } + this.fragPrevious = null; + if (this.demuxer) { + this.demuxer.destroy(); + this.demuxer = null; + } + this.state = State.STOPPED; + } + }, { + key: 'tick', + value: function tick() { + this.ticks++; + if (this.ticks === 1) { + this.doTick(); + if (this.ticks > 1) { + setTimeout(this.tick, 1); + } + this.ticks = 0; + } + } + }, { + key: 'doTick', + value: function doTick() { + var pos, + level, + levelDetails, + hls = this.hls, + config = hls.config, + media = this.media, + isSeeking = media && media.seeking; + //logger.log(this.state); + switch (this.state) { + case State.ERROR: + //don't do anything in error state to avoid breaking further ... + case State.PAUSED: + //don't do anything in paused state either ... + break; + case State.STARTING: + // determine load level + var startLevel = hls.startLevel; + if (startLevel === -1) { + // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level + startLevel = 0; + this.fragBitrateTest = true; + } + // set new level to playlist loader : this will trigger start level load + // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded + this.level = hls.nextLoadLevel = startLevel; + this.state = State.WAITING_LEVEL; + this.loadedmetadata = false; + break; + case State.IDLE: + // if video not attached AND + // start fragment already requested OR start frag prefetch disable + // exit loop + // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop + if (!media && (this.startFragRequested || !config.startFragPrefetch)) { + break; + } + // determine next candidate fragment to be loaded, based on current position and + // end of buffer position + // ensure 60s of buffer upfront + // if we have not yet loaded any fragment, start loading from start position + if (this.loadedmetadata) { + pos = media.currentTime; + } else { + pos = this.nextLoadPosition; + } + level = hls.nextLoadLevel; + var bufferInfo = _bufferHelper2.default.bufferInfo(media, pos, config.maxBufferHole), + bufferLen = bufferInfo.len, + bufferEnd = bufferInfo.end, + fragPrevious = this.fragPrevious, + maxBufLen; + // compute max Buffer Length that we could get from this load level, based on level bitrate. don't buffer more than 60 MB and more than 30s + if (this.levels[level].hasOwnProperty('bitrate')) { + maxBufLen = Math.max(8 * config.maxBufferSize / this.levels[level].bitrate, config.maxBufferLength); + maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength); + } else { + maxBufLen = config.maxBufferLength; + } + // if buffer length is less than maxBufLen try to load a new fragment + if (bufferLen < maxBufLen) { + // set next load level : this will trigger a playlist load if needed + hls.nextLoadLevel = level; + this.level = level; + levelDetails = this.levels[level].details; + // if level info not retrieved yet, switch state and wait for level retrieval + // if live playlist, ensure that new playlist has been refreshed to avoid loading/try to load + // a useless and outdated fragment (that might even introduce load error if it is already out of the live playlist) + if (typeof levelDetails === 'undefined' || levelDetails.live && this.levelLastLoaded !== level) { + this.state = State.WAITING_LEVEL; + break; + } + // find fragment index, contiguous with end of buffer position + var fragments = levelDetails.fragments, + fragLen = fragments.length, + start = fragments[0].start, + end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration, + frag = void 0; + + // in case of live playlist we need to ensure that requested position is not located before playlist start + if (levelDetails.live) { + // check if requested position is within seekable boundaries : + //logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${media.seeking}`); + var maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount * levelDetails.targetduration; + + if (bufferEnd < Math.max(start, end - maxLatency)) { + var targetLatency = config.liveSyncDuration !== undefined ? config.liveSyncDuration : config.liveSyncDurationCount * levelDetails.targetduration; + var liveSyncPosition = start + Math.max(0, levelDetails.totalduration - targetLatency); + _logger.logger.log('buffer end: ' + bufferEnd + ' is located too far from the end of live sliding playlist, reset currentTime to : ' + liveSyncPosition.toFixed(3)); + bufferEnd = liveSyncPosition; + if (media && media.readyState && media.duration > liveSyncPosition) { + media.currentTime = liveSyncPosition; + } + } + + // if end of buffer greater than live edge, don't load any fragment + // this could happen if live playlist intermittently slides in the past. + // level 1 loaded [182580161,182580167] + // level 1 loaded [182580162,182580169] + // Loading 182580168 of [182580162 ,182580169],level 1 .. + // Loading 182580169 of [182580162 ,182580169],level 1 .. + // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168 + // level 1 loaded [182580164,182580171] + // + if (levelDetails.PTSKnown && bufferEnd > end) { + break; + } + + if (this.startFragRequested && !levelDetails.PTSKnown) { + /* we are switching level on live playlist, but we don't have any PTS info for that quality level ... + try to load frag matching with next SN. + even if SN are not synchronized between playlists, loading this frag will help us + compute playlist sliding and find the right one after in case it was not the right consecutive one */ + if (fragPrevious) { + var targetSN = fragPrevious.sn + 1; + if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) { + frag = fragments[targetSN - levelDetails.startSN]; + _logger.logger.log('live playlist, switching playlist, load frag with next SN: ' + frag.sn); + } + } + if (!frag) { + /* we have no idea about which fragment should be loaded. + so let's load mid fragment. it will help computing playlist sliding and find the right one + */ + frag = fragments[Math.min(fragLen - 1, Math.round(fragLen / 2))]; + _logger.logger.log('live playlist, switching playlist, unknown, load middle frag : ' + frag.sn); + } + } + } else { + // VoD playlist: if bufferEnd before start of playlist, load first fragment + if (bufferEnd < start) { + frag = fragments[0]; + } + } + if (!frag) { + (function () { + var maxFragLookUpTolerance = config.maxFragLookUpTolerance; + if (bufferEnd < end) { + // no frag look up tolerance in case bufferEnd close to end, or media seeking + if (bufferEnd > end - maxFragLookUpTolerance || isSeeking) { + maxFragLookUpTolerance = 0; + } + frag = _binarySearch2.default.search(fragments, function (candidate) { + // offset should be within fragment boundary - config.maxFragLookUpTolerance + // this is to cope with situations like + // bufferEnd = 9.991 + // frag[Ø] : [0,10] + // frag[1] : [10,20] + // bufferEnd is within frag[0] range ... although what we are expecting is to return frag[1] here + // frag start frag start+duration + // |-----------------------------| + // <---> <---> + // ...--------><-----------------------------><---------.... + // previous frag matching fragment next frag + // return -1 return 0 return 1 + //logger.log(`level/sn/start/end/bufEnd:${level}/${candidate.sn}/${candidate.start}/${(candidate.start+candidate.duration)}/${bufferEnd}`); + if (candidate.start + candidate.duration - maxFragLookUpTolerance <= bufferEnd) { + return 1; + } else if (candidate.start - maxFragLookUpTolerance > bufferEnd) { + return -1; + } + return 0; + }); + } else { + // reach end of playlist + frag = fragments[fragLen - 1]; + } + })(); + } + if (frag) { + start = frag.start; + //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn); + if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) { + if (frag.sn < levelDetails.endSN) { + var deltaPTS = fragPrevious.deltaPTS, + curSNIdx = frag.sn - levelDetails.startSN; + // if there is a significant delta between audio and video, larger than max allowed hole, + // and if previous remuxed fragment did not start with a keyframe. (fragPrevious.dropped) + // let's try to load previous fragment again to get last keyframe + // then we will reload again current fragment (that way we should be able to fill the buffer hole ...) + if (deltaPTS && deltaPTS > config.maxBufferHole && fragPrevious.dropped) { + frag = fragments[curSNIdx - 1]; + _logger.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'); + // decrement previous frag load counter to avoid frag loop loading error when next fragment will get reloaded + fragPrevious.loadCounter--; + } else { + frag = fragments[curSNIdx + 1]; + _logger.logger.log('SN just loaded, load next one: ' + frag.sn); + } + // ensure frag is not undefined + if (!frag) { + break; + } + } else { + // have we reached end of VOD playlist ? + if (!levelDetails.live) { + // Finalize the media stream + this.hls.trigger(_events2.default.BUFFER_EOS); + // We might be loading the last fragment but actually the media + // is currently processing a seek command and waiting for new data to resume at another point. + // Going to ended state while media is seeking can spawn an infinite buffering broken state. + if (!isSeeking) { + this.state = State.ENDED; + } + } + break; + } + } + //logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3)); + if (frag.decryptdata.uri != null && frag.decryptdata.key == null) { + _logger.logger.log('Loading key for ' + frag.sn + ' of [' + levelDetails.startSN + ' ,' + levelDetails.endSN + '],level ' + level); + this.state = State.KEY_LOADING; + hls.trigger(_events2.default.KEY_LOADING, { frag: frag }); + } else { + _logger.logger.log('Loading ' + frag.sn + ' of [' + levelDetails.startSN + ' ,' + levelDetails.endSN + '],level ' + level + ', currentTime:' + pos + ',bufferEnd:' + bufferEnd.toFixed(3)); + // ensure that we are not reloading the same fragments in loop ... + if (this.fragLoadIdx !== undefined) { + this.fragLoadIdx++; + } else { + this.fragLoadIdx = 0; + } + if (frag.loadCounter) { + frag.loadCounter++; + var maxThreshold = config.fragLoadingLoopThreshold; + // if this frag has already been loaded 3 times, and if it has been reloaded recently + if (frag.loadCounter > maxThreshold && Math.abs(this.fragLoadIdx - frag.loadIdx) < maxThreshold) { + hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal: false, frag: frag }); + return; + } + } else { + frag.loadCounter = 1; + } + frag.loadIdx = this.fragLoadIdx; + this.fragCurrent = frag; + this.startFragRequested = true; + frag.autoLevel = hls.autoLevelEnabled; + hls.trigger(_events2.default.FRAG_LOADING, { frag: frag }); + this.state = State.FRAG_LOADING; + } + } + } + break; + case State.WAITING_LEVEL: + level = this.levels[this.level]; + // check if playlist is already loaded + if (level && level.details) { + this.state = State.IDLE; + } + break; + case State.FRAG_LOADING_WAITING_RETRY: + var now = performance.now(); + var retryDate = this.retryDate; + // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading + if (!retryDate || now >= retryDate || isSeeking) { + _logger.logger.log('mediaController: retryDate reached, switch back to IDLE state'); + this.state = State.IDLE; + } + break; + case State.STOPPED: + case State.FRAG_LOADING: + case State.PARSING: + case State.PARSED: + case State.ENDED: + break; + default: + break; + } + // check buffer + this._checkBuffer(); + // check/update current fragment + this._checkFragmentChanged(); + } + }, { + key: 'getBufferRange', + value: function getBufferRange(position) { + var i, + range, + bufferRange = this.bufferRange; + if (bufferRange) { + for (i = bufferRange.length - 1; i >= 0; i--) { + range = bufferRange[i]; + if (position >= range.start && position <= range.end) { + return range; + } + } + } + return null; + } + }, { + key: 'followingBufferRange', + value: function followingBufferRange(range) { + if (range) { + // try to get range of next fragment (500ms after this range) + return this.getBufferRange(range.end + 0.5); + } + return null; + } + }, { + key: 'isBuffered', + value: function isBuffered(position) { + var media = this.media; + if (media) { + var buffered = media.buffered; + for (var i = 0; i < buffered.length; i++) { + if (position >= buffered.start(i) && position <= buffered.end(i)) { + return true; + } + } + } + return false; + } + }, { + key: '_checkFragmentChanged', + value: function _checkFragmentChanged() { + var rangeCurrent, + currentTime, + video = this.media; + if (video && video.seeking === false) { + currentTime = video.currentTime; + /* if video element is in seeked state, currentTime can only increase. + (assuming that playback rate is positive ...) + As sometimes currentTime jumps back to zero after a + media decode error, check this, to avoid seeking back to + wrong position after a media decode error + */ + if (currentTime > video.playbackRate * this.lastCurrentTime) { + this.lastCurrentTime = currentTime; + } + if (this.isBuffered(currentTime)) { + rangeCurrent = this.getBufferRange(currentTime); + } else if (this.isBuffered(currentTime + 0.1)) { + /* ensure that FRAG_CHANGED event is triggered at startup, + when first video frame is displayed and playback is paused. + add a tolerance of 100ms, in case current position is not buffered, + check if current pos+100ms is buffered and use that buffer range + for FRAG_CHANGED event reporting */ + rangeCurrent = this.getBufferRange(currentTime + 0.1); + } + if (rangeCurrent) { + var fragPlaying = rangeCurrent.frag; + if (fragPlaying !== this.fragPlaying) { + this.fragPlaying = fragPlaying; + this.hls.trigger(_events2.default.FRAG_CHANGED, { frag: fragPlaying }); + } + } + } + } + + /* + on immediate level switch : + - pause playback if playing + - cancel any pending load request + - and trigger a buffer flush + */ + + }, { + key: 'immediateLevelSwitch', + value: function immediateLevelSwitch() { + _logger.logger.log('immediateLevelSwitch'); + if (!this.immediateSwitch) { + this.immediateSwitch = true; + var media = this.media, + previouslyPaused = void 0; + if (media) { + previouslyPaused = media.paused; + media.pause(); + } else { + // don't restart playback after instant level switch in case media not attached + previouslyPaused = true; + } + this.previouslyPaused = previouslyPaused; + } + var fragCurrent = this.fragCurrent; + if (fragCurrent && fragCurrent.loader) { + fragCurrent.loader.abort(); + } + this.fragCurrent = null; + // increase fragment load Index to avoid frag loop loading error after buffer flush + this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold; + this.state = State.PAUSED; + // flush everything + this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY }); + } + + /* + on immediate level switch end, after new fragment has been buffered : + - nudge video decoder by slightly adjusting video currentTime + - resume the playback if needed + */ + + }, { + key: 'immediateLevelSwitchEnd', + value: function immediateLevelSwitchEnd() { + this.immediateSwitch = false; + var media = this.media; + if (media && media.readyState) { + media.currentTime -= 0.0001; + if (!this.previouslyPaused) { + media.play(); + } + } + } + }, { + key: 'nextLevelSwitch', + value: function nextLevelSwitch() { + /* try to switch ASAP without breaking video playback : + in order to ensure smooth but quick level switching, + we need to find the next flushable buffer range + we should take into account new segment fetch time + */ + var media = this.media; + // ensure that media is defined and that metadata are available (to retrieve currentTime) + if (media && media.readyState) { + var fetchdelay = void 0, + currentRange = void 0, + nextRange = void 0; + // increase fragment load Index to avoid frag loop loading error after buffer flush + this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold; + currentRange = this.getBufferRange(media.currentTime); + if (currentRange && currentRange.start > 1) { + // flush buffer preceding current fragment (flush until current fragment start offset) + // minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ... + this.state = State.PAUSED; + this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: currentRange.start - 1 }); + } + if (!media.paused) { + // add a safety delay of 1s + var nextLevelId = this.hls.nextLoadLevel, + nextLevel = this.levels[nextLevelId], + fragLastKbps = this.fragLastKbps; + if (fragLastKbps && this.fragCurrent) { + fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1; + } else { + fetchdelay = 0; + } + } else { + fetchdelay = 0; + } + //logger.log('fetchdelay:'+fetchdelay); + // find buffer range that will be reached once new fragment will be fetched + nextRange = this.getBufferRange(media.currentTime + fetchdelay); + if (nextRange) { + // we can flush buffer range following this one without stalling playback + nextRange = this.followingBufferRange(nextRange); + if (nextRange) { + // if we are here, we can also cancel any loading/demuxing in progress, as they are useless + var fragCurrent = this.fragCurrent; + if (fragCurrent && fragCurrent.loader) { + fragCurrent.loader.abort(); + } + this.fragCurrent = null; + // flush position is the start position of this new buffer + this.state = State.PAUSED; + this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: nextRange.start, endOffset: Number.POSITIVE_INFINITY }); + } + } + } + } + }, { + key: 'onMediaAttached', + value: function onMediaAttached(data) { + var media = this.media = data.media; + this.onvseeking = this.onMediaSeeking.bind(this); + this.onvseeked = this.onMediaSeeked.bind(this); + this.onvended = this.onMediaEnded.bind(this); + media.addEventListener('seeking', this.onvseeking); + media.addEventListener('seeked', this.onvseeked); + media.addEventListener('ended', this.onvended); + var config = this.config; + if (this.levels && config.autoStartLoad) { + this.hls.startLoad(config.startPosition); + } + } + }, { + key: 'onMediaDetaching', + value: function onMediaDetaching() { + var media = this.media; + if (media && media.ended) { + _logger.logger.log('MSE detaching and video ended, reset startPosition'); + this.startPosition = this.lastCurrentTime = 0; + } + + // reset fragment loading counter on MSE detaching to avoid reporting FRAG_LOOP_LOADING_ERROR after error recovery + var levels = this.levels; + if (levels) { + // reset fragment load counter + levels.forEach(function (level) { + if (level.details) { + level.details.fragments.forEach(function (fragment) { + fragment.loadCounter = undefined; + }); + } + }); + } + // remove video listeners + if (media) { + media.removeEventListener('seeking', this.onvseeking); + media.removeEventListener('seeked', this.onvseeked); + media.removeEventListener('ended', this.onvended); + this.onvseeking = this.onvseeked = this.onvended = null; + } + this.media = null; + this.loadedmetadata = false; + this.stopLoad(); + } + }, { + key: 'onMediaSeeking', + value: function onMediaSeeking() { + if (this.state === State.FRAG_LOADING) { + // check if currently loaded fragment is inside buffer. + //if outside, cancel fragment loading, otherwise do nothing + if (_bufferHelper2.default.bufferInfo(this.media, this.media.currentTime, this.config.maxBufferHole).len === 0) { + _logger.logger.log('seeking outside of buffer while fragment load in progress, cancel fragment load'); + var fragCurrent = this.fragCurrent; + if (fragCurrent) { + if (fragCurrent.loader) { + fragCurrent.loader.abort(); + } + this.fragCurrent = null; + } + this.fragPrevious = null; + // switch to IDLE state to load new fragment + this.state = State.IDLE; + } + } else if (this.state === State.ENDED) { + // switch to IDLE state to check for potential new fragment + this.state = State.IDLE; + } + if (this.media) { + this.lastCurrentTime = this.media.currentTime; + } + // avoid reporting fragment loop loading error in case user is seeking several times on same position + if (this.fragLoadIdx !== undefined) { + this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold; + } + // tick to speed up processing + this.tick(); + } + }, { + key: 'onMediaSeeked', + value: function onMediaSeeked() { + // tick to speed up FRAGMENT_PLAYING triggering + this.tick(); + } + }, { + key: 'onMediaEnded', + value: function onMediaEnded() { + _logger.logger.log('media ended'); + // reset startPosition and lastCurrentTime to restart playback @ stream beginning + this.startPosition = this.lastCurrentTime = 0; + } + }, { + key: 'onManifestLoading', + value: function onManifestLoading() { + // reset buffer on manifest loading + _logger.logger.log('trigger BUFFER_RESET'); + this.hls.trigger(_events2.default.BUFFER_RESET); + this.bufferRange = []; + this.stalled = false; + } + }, { + key: 'onManifestParsed', + value: function onManifestParsed(data) { + var aac = false, + heaac = false, + codec; + data.levels.forEach(function (level) { + // detect if we have different kind of audio codecs used amongst playlists + codec = level.audioCodec; + if (codec) { + if (codec.indexOf('mp4a.40.2') !== -1) { + aac = true; + } + if (codec.indexOf('mp4a.40.5') !== -1) { + heaac = true; + } + } + }); + this.audioCodecSwitch = aac && heaac; + if (this.audioCodecSwitch) { + _logger.logger.log('both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC'); + } + this.levels = data.levels; + this.startLevelLoaded = false; + this.startFragRequested = false; + var config = this.config; + if (config.autoStartLoad) { + this.hls.startLoad(config.startPosition); + } + } + }, { + key: 'onLevelLoaded', + value: function onLevelLoaded(data) { + var newDetails = data.details, + newLevelId = data.level, + curLevel = this.levels[newLevelId], + duration = newDetails.totalduration, + sliding = 0; + + _logger.logger.log('level ' + newLevelId + ' loaded [' + newDetails.startSN + ',' + newDetails.endSN + '],duration:' + duration); + this.levelLastLoaded = newLevelId; + + if (newDetails.live) { + var curDetails = curLevel.details; + if (curDetails) { + // we already have details for that level, merge them + _levelHelper2.default.mergeDetails(curDetails, newDetails); + sliding = newDetails.fragments[0].start; + if (newDetails.PTSKnown) { + _logger.logger.log('live playlist sliding:' + sliding.toFixed(3)); + } else { + _logger.logger.log('live playlist - outdated PTS, unknown sliding'); + } + } else { + newDetails.PTSKnown = false; + _logger.logger.log('live playlist - first load, unknown sliding'); + } + } else { + newDetails.PTSKnown = false; + } + // override level info + curLevel.details = newDetails; + this.hls.trigger(_events2.default.LEVEL_UPDATED, { details: newDetails, level: newLevelId }); + + if (this.startFragRequested === false) { + // compute start position if set to -1. use it straight away if value is defined + if (this.startPosition === -1) { + // first, check if start time offset has been set in playlist, if yes, use this value + var startTimeOffset = newDetails.startTimeOffset; + if (!isNaN(startTimeOffset)) { + _logger.logger.log('start time offset found in playlist, adjust startPosition to ' + startTimeOffset); + this.startPosition = startTimeOffset; + } else { + // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3) + if (newDetails.live) { + var targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * newDetails.targetduration; + this.startPosition = Math.max(0, sliding + duration - targetLatency); + } else { + this.startPosition = 0; + } + } + } + this.nextLoadPosition = this.startPosition; + } + // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment + if (this.state === State.WAITING_LEVEL) { + this.state = State.IDLE; + } + //trigger handler right now + this.tick(); + } + }, { + key: 'onKeyLoaded', + value: function onKeyLoaded() { + if (this.state === State.KEY_LOADING) { + this.state = State.IDLE; + this.tick(); + } + } + }, { + key: 'onFragLoaded', + value: function onFragLoaded(data) { + var fragCurrent = this.fragCurrent; + if (this.state === State.FRAG_LOADING && fragCurrent && data.frag.level === fragCurrent.level && data.frag.sn === fragCurrent.sn) { + + _logger.logger.log('Loaded ' + fragCurrent.sn + ' of level ' + fragCurrent.level); + if (this.fragBitrateTest === true) { + // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo + this.state = State.IDLE; + this.fragBitrateTest = false; + this.startFragRequested = false; + data.stats.tparsed = data.stats.tbuffered = performance.now(); + this.hls.trigger(_events2.default.FRAG_BUFFERED, { stats: data.stats, frag: fragCurrent }); + } else { + this.state = State.PARSING; + // transmux the MPEG-TS data to ISO-BMFF segments + this.stats = data.stats; + var currentLevel = this.levels[this.level], + details = currentLevel.details, + duration = details.totalduration, + start = fragCurrent.startDTS !== undefined && !isNaN(fragCurrent.startDTS) ? fragCurrent.startDTS : fragCurrent.start, + level = fragCurrent.level, + sn = fragCurrent.sn, + audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec; + if (this.audioCodecSwap) { + _logger.logger.log('swapping playlist audio codec'); + if (audioCodec === undefined) { + audioCodec = this.lastAudioCodec; + } + if (audioCodec) { + if (audioCodec.indexOf('mp4a.40.5') !== -1) { + audioCodec = 'mp4a.40.2'; + } else { + audioCodec = 'mp4a.40.5'; + } + } + } + this.pendingAppending = 0; + _logger.logger.log('Demuxing ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],level ' + level + ', cc ' + fragCurrent.cc); + var demuxer = this.demuxer; + if (demuxer) { + demuxer.push(data.payload, audioCodec, currentLevel.videoCodec, start, fragCurrent.cc, level, sn, duration, fragCurrent.decryptdata); + } + } + } + this.fragLoadError = 0; + } + }, { + key: 'onFragParsingInitSegment', + value: function onFragParsingInitSegment(data) { + if (this.state === State.PARSING) { + var tracks = data.tracks, + trackName, + track; + + // include levelCodec in audio and video tracks + track = tracks.audio; + if (track) { + var audioCodec = this.levels[this.level].audioCodec, + ua = navigator.userAgent.toLowerCase(); + if (audioCodec && this.audioCodecSwap) { + _logger.logger.log('swapping playlist audio codec'); + if (audioCodec.indexOf('mp4a.40.5') !== -1) { + audioCodec = 'mp4a.40.2'; + } else { + audioCodec = 'mp4a.40.5'; + } + } + // in case AAC and HE-AAC audio codecs are signalled in manifest + // force HE-AAC , as it seems that most browsers prefers that way, + // except for mono streams OR on FF + // these conditions might need to be reviewed ... + if (this.audioCodecSwitch) { + // don't force HE-AAC if mono stream + if (track.metadata.channelCount !== 1 && + // don't force HE-AAC if firefox + ua.indexOf('firefox') === -1) { + audioCodec = 'mp4a.40.5'; + } + } + // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise + if (ua.indexOf('android') !== -1) { + audioCodec = 'mp4a.40.2'; + _logger.logger.log('Android: force audio codec to' + audioCodec); + } + track.levelCodec = audioCodec; + } + track = tracks.video; + if (track) { + track.levelCodec = this.levels[this.level].videoCodec; + } + + // if remuxer specify that a unique track needs to generated, + // let's merge all tracks together + if (data.unique) { + var mergedTrack = { + codec: '', + levelCodec: '' + }; + for (trackName in data.tracks) { + track = tracks[trackName]; + mergedTrack.container = track.container; + if (mergedTrack.codec) { + mergedTrack.codec += ','; + mergedTrack.levelCodec += ','; + } + if (track.codec) { + mergedTrack.codec += track.codec; + } + if (track.levelCodec) { + mergedTrack.levelCodec += track.levelCodec; + } + } + tracks = { audiovideo: mergedTrack }; + } + this.hls.trigger(_events2.default.BUFFER_CODECS, tracks); + // loop through tracks that are going to be provided to bufferController + for (trackName in tracks) { + track = tracks[trackName]; + _logger.logger.log('track:' + trackName + ',container:' + track.container + ',codecs[level/parsed]=[' + track.levelCodec + '/' + track.codec + ']'); + var initSegment = track.initSegment; + if (initSegment) { + this.pendingAppending++; + this.hls.trigger(_events2.default.BUFFER_APPENDING, { type: trackName, data: initSegment }); + } + } + //trigger handler right now + this.tick(); + } + } + }, { + key: 'onFragParsingData', + value: function onFragParsingData(data) { + var _this2 = this; + + if (this.state === State.PARSING) { + this.tparse2 = Date.now(); + var level = this.levels[this.level], + frag = this.fragCurrent; + + _logger.logger.log('parsed ' + data.type + ',PTS:[' + data.startPTS.toFixed(3) + ',' + data.endPTS.toFixed(3) + '],DTS:[' + data.startDTS.toFixed(3) + '/' + data.endDTS.toFixed(3) + '],nb:' + data.nb + ',dropped:' + (data.dropped || 0)); + + var drift = _levelHelper2.default.updateFragPTSDTS(level.details, frag.sn, data.startPTS, data.endPTS, data.startDTS, data.endDTS), + hls = this.hls; + hls.trigger(_events2.default.LEVEL_PTS_UPDATED, { details: level.details, level: this.level, drift: drift }); + + // has remuxer dropped video frames located before first keyframe ? + if (data.type === 'video') { + frag.dropped = data.dropped; + } + + [data.data1, data.data2].forEach(function (buffer) { + if (buffer) { + _this2.pendingAppending++; + hls.trigger(_events2.default.BUFFER_APPENDING, { type: data.type, data: buffer }); + } + }); + + this.nextLoadPosition = data.endPTS; + this.bufferRange.push({ type: data.type, start: data.startPTS, end: data.endPTS, frag: frag }); + + //trigger handler right now + this.tick(); + } else { + _logger.logger.warn('not in PARSING state but ' + this.state + ', ignoring FRAG_PARSING_DATA event'); + } + } + }, { + key: 'onFragParsed', + value: function onFragParsed() { + if (this.state === State.PARSING) { + this.stats.tparsed = performance.now(); + this.state = State.PARSED; + this._checkAppendedParsed(); + } + } + }, { + key: 'onBufferAppended', + value: function onBufferAppended() { + switch (this.state) { + case State.PARSING: + case State.PARSED: + this.pendingAppending--; + this._checkAppendedParsed(); + break; + default: + break; + } + } + }, { + key: '_checkAppendedParsed', + value: function _checkAppendedParsed() { + //trigger handler right now + if (this.state === State.PARSED && this.pendingAppending === 0) { + var frag = this.fragCurrent, + stats = this.stats; + if (frag) { + this.fragPrevious = frag; + stats.tbuffered = performance.now(); + this.fragLastKbps = Math.round(8 * stats.length / (stats.tbuffered - stats.tfirst)); + this.hls.trigger(_events2.default.FRAG_BUFFERED, { stats: stats, frag: frag }); + _logger.logger.log('media buffered : ' + this.timeRangesToString(this.media.buffered)); + this.state = State.IDLE; + } + this.tick(); + } + } + }, { + key: 'onError', + value: function onError(data) { + switch (data.details) { + case _errors.ErrorDetails.FRAG_LOAD_ERROR: + case _errors.ErrorDetails.FRAG_LOAD_TIMEOUT: + if (!data.fatal) { + var loadError = this.fragLoadError; + if (loadError) { + loadError++; + } else { + loadError = 1; + } + if (loadError <= this.config.fragLoadingMaxRetry) { + this.fragLoadError = loadError; + // reset load counter to avoid frag loop loading error + data.frag.loadCounter = 0; + // exponential backoff capped to 64s + var delay = Math.min(Math.pow(2, loadError - 1) * this.config.fragLoadingRetryDelay, 64000); + _logger.logger.warn('mediaController: frag loading failed, retry in ' + delay + ' ms'); + this.retryDate = performance.now() + delay; + // retry loading state + this.state = State.FRAG_LOADING_WAITING_RETRY; + } else { + _logger.logger.error('mediaController: ' + data.details + ' reaches max retry, redispatch as fatal ...'); + // redispatch same error but with fatal set to true + data.fatal = true; + this.hls.trigger(_events2.default.ERROR, data); + this.state = State.ERROR; + } + } + break; + case _errors.ErrorDetails.FRAG_LOOP_LOADING_ERROR: + case _errors.ErrorDetails.LEVEL_LOAD_ERROR: + case _errors.ErrorDetails.LEVEL_LOAD_TIMEOUT: + case _errors.ErrorDetails.KEY_LOAD_ERROR: + case _errors.ErrorDetails.KEY_LOAD_TIMEOUT: + // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received + if (this.state !== State.ERROR) { + // if fatal error, stop processing, otherwise move to IDLE to retry loading + this.state = data.fatal ? State.ERROR : State.IDLE; + _logger.logger.warn('mediaController: ' + data.details + ' while loading frag,switch to ' + this.state + ' state ...'); + } + break; + case _errors.ErrorDetails.BUFFER_FULL_ERROR: + // only reduce max buf len if in appending state + if (this.state === State.PARSING || this.state === State.PARSED) { + // reduce max buffer length as it might be too high. we do this to avoid loop flushing ... + this.config.maxMaxBufferLength /= 2; + _logger.logger.warn('reduce max buffer length to ' + this.config.maxMaxBufferLength + 's and switch to IDLE state'); + // increase fragment load Index to avoid frag loop loading error after buffer flush + this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold; + this.state = State.IDLE; + } + break; + default: + break; + } + } + }, { + key: '_checkBuffer', + value: function _checkBuffer() { + var media = this.media; + // if ready state different from HAVE_NOTHING (numeric value 0), we are allowed to seek + if (media && media.readyState) { + var currentTime = media.currentTime, + buffered = media.buffered; + // adjust currentTime to start position on loaded metadata + if (!this.loadedmetadata && buffered.length) { + this.loadedmetadata = true; + // only adjust currentTime if startPosition not equal to 0 + var startPosition = this.startPosition; + // if currentTime === 0 AND not matching with expected startPosition + if (!currentTime && currentTime !== startPosition) { + if (startPosition) { + _logger.logger.log('target start position:' + startPosition); + // at that stage, there should be only one buffered range, as we reach that code after first fragment has been + var bufferStart = buffered.start(0), + bufferEnd = buffered.end(0); + // if startPosition not buffered, let's seek to buffered.start(0) + if (startPosition < bufferStart || startPosition > bufferEnd) { + startPosition = bufferStart; + _logger.logger.log('target start position not buffered, seek to buffered.start(0) ' + bufferStart); + } + _logger.logger.log('adjust currentTime from ' + currentTime + ' to ' + startPosition); + media.currentTime = startPosition; + } + } + } else { + var bufferInfo = _bufferHelper2.default.bufferInfo(media, currentTime, 0), + expectedPlaying = !(media.paused || // not playing when media is paused + media.ended || // not playing when media is ended + media.buffered.length === 0), + // not playing if nothing buffered + jumpThreshold = 0.4, + // tolerance needed as some browsers stalls playback before reaching buffered range end + playheadMoving = currentTime > media.playbackRate * this.lastCurrentTime; + + if (this.stalled && playheadMoving) { + this.stalled = false; + _logger.logger.log('playback not stuck anymore @' + currentTime); + } + // check buffer upfront + // if less than jumpThreshold second is buffered, let's check in more details + if (expectedPlaying && bufferInfo.len <= jumpThreshold) { + if (playheadMoving) { + // playhead moving + jumpThreshold = 0; + this.seekHoleNudgeDuration = 0; + } else { + // playhead not moving AND media expected to play + if (!this.stalled) { + this.seekHoleNudgeDuration = 0; + _logger.logger.log('playback seems stuck @' + currentTime); + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_STALLED_ERROR, fatal: false }); + this.stalled = true; + } else { + this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration; + } + } + // if we are below threshold, try to jump to start of next buffer range if close + if (bufferInfo.len <= jumpThreshold) { + // no buffer available @ currentTime, check if next buffer is close (within a config.maxSeekHole second range) + var nextBufferStart = bufferInfo.nextStart, + delta = nextBufferStart - currentTime; + if (nextBufferStart && delta < this.config.maxSeekHole && delta > 0) { + // next buffer is close ! adjust currentTime to nextBufferStart + // this will ensure effective video decoding + _logger.logger.log('adjust currentTime from ' + media.currentTime + ' to next buffered @ ' + nextBufferStart + ' + nudge ' + this.seekHoleNudgeDuration); + var hole = nextBufferStart + this.seekHoleNudgeDuration - media.currentTime; + media.currentTime = nextBufferStart + this.seekHoleNudgeDuration; + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false, hole: hole }); + } + } + } + } + } + } + }, { + key: 'onFragLoadEmergencyAborted', + value: function onFragLoadEmergencyAborted() { + this.state = State.IDLE; + this.tick(); + } + }, { + key: 'onBufferFlushed', + value: function onBufferFlushed() { + /* after successful buffer flushing, rebuild buffer Range array + loop through existing buffer range and check if + corresponding range is still buffered. only push to new array already buffered range + */ + var newRange = [], + range, + i; + for (i = 0; i < this.bufferRange.length; i++) { + range = this.bufferRange[i]; + if (this.isBuffered((range.start + range.end) / 2)) { + newRange.push(range); + } + } + this.bufferRange = newRange; + + // handle end of immediate switching if needed + if (this.immediateSwitch) { + this.immediateLevelSwitchEnd(); + } + // move to IDLE once flush complete. this should trigger new fragment loading + this.state = State.IDLE; + // reset reference to frag + this.fragPrevious = null; + } + }, { + key: 'swapAudioCodec', + value: function swapAudioCodec() { + this.audioCodecSwap = !this.audioCodecSwap; + } + }, { + key: 'timeRangesToString', + value: function timeRangesToString(r) { + var log = '', + len = r.length; + for (var i = 0; i < len; i++) { + log += '[' + r.start(i) + ',' + r.end(i) + ']'; + } + return log; + } + }, { + key: 'currentLevel', + get: function get() { + if (this.media) { + var range = this.getBufferRange(this.media.currentTime); + if (range) { + return range.frag.level; + } + } + return -1; + } + }, { + key: 'nextBufferRange', + get: function get() { + if (this.media) { + // first get end range of current fragment + return this.followingBufferRange(this.getBufferRange(this.media.currentTime)); + } else { + return null; + } + } + }, { + key: 'nextLevel', + get: function get() { + var range = this.nextBufferRange; + if (range) { + return range.frag.level; + } else { + return -1; + } + } + }]); + + return StreamController; +}(_eventHandler2.default); + +exports.default = StreamController; + +},{"../demux/demuxer":17,"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../helper/level-helper":25,"../utils/binary-search":35,"../utils/logger":38}],9:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _eventHandler = require('../event-handler'); + +var _eventHandler2 = _interopRequireDefault(_eventHandler); + +var _cea708Interpreter = require('../utils/cea-708-interpreter'); + +var _cea708Interpreter2 = _interopRequireDefault(_cea708Interpreter); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* + * Timeline Controller + */ + +var TimelineController = function (_EventHandler) { + _inherits(TimelineController, _EventHandler); + + function TimelineController(hls) { + _classCallCheck(this, TimelineController); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(TimelineController).call(this, hls, _events2.default.MEDIA_ATTACHING, _events2.default.MEDIA_DETACHING, _events2.default.FRAG_PARSING_USERDATA, _events2.default.MANIFEST_LOADING, _events2.default.FRAG_LOADED)); + + _this.hls = hls; + _this.config = hls.config; + + if (_this.config.enableCEA708Captions) { + _this.cea708Interpreter = new _cea708Interpreter2.default(); + } + return _this; + } + + _createClass(TimelineController, [{ + key: 'destroy', + value: function destroy() { + _eventHandler2.default.prototype.destroy.call(this); + } + }, { + key: 'onMediaAttaching', + value: function onMediaAttaching(data) { + var media = this.media = data.media; + this.cea708Interpreter.attach(media); + } + }, { + key: 'onMediaDetaching', + value: function onMediaDetaching() { + this.cea708Interpreter.detach(); + } + }, { + key: 'onManifestLoading', + value: function onManifestLoading() { + this.lastPts = Number.POSITIVE_INFINITY; + } + }, { + key: 'onFragLoaded', + value: function onFragLoaded(data) { + var pts = data.frag.start; //Number.POSITIVE_INFINITY; + + // if this is a frag for a previously loaded timerange, remove all captions + // TODO: consider just removing captions for the timerange + if (pts <= this.lastPts) { + this.cea708Interpreter.clear(); + } + + this.lastPts = pts; + } + }, { + key: 'onFragParsingUserdata', + value: function onFragParsingUserdata(data) { + // push all of the CEA-708 messages into the interpreter + // immediately. It will create the proper timestamps based on our PTS value + for (var i = 0; i < data.samples.length; i++) { + this.cea708Interpreter.push(data.samples[i].pts, data.samples[i].bytes); + } + } + }]); + + return TimelineController; +}(_eventHandler2.default); + +exports.default = TimelineController; + +},{"../event-handler":22,"../events":23,"../utils/cea-708-interpreter":36}],10:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/* + * + * This file contains an adaptation of the AES decryption algorithm + * from the Standford Javascript Cryptography Library. That work is + * covered by the following copyright and permissions notice: + * + * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation + * are those of the authors and should not be interpreted as representing + * official policies, either expressed or implied, of the authors. + */ + +var AES = function () { + + /** + * Schedule out an AES key for both encryption and decryption. This + * is a low-level class. Use a cipher mode to do bulk encryption. + * + * @constructor + * @param key {Array} The key as an array of 4, 6 or 8 words. + */ + + function AES(key) { + _classCallCheck(this, AES); + + /** + * The expanded S-box and inverse S-box tables. These will be computed + * on the client so that we don't have to send them down the wire. + * + * There are two tables, _tables[0] is for encryption and + * _tables[1] is for decryption. + * + * The first 4 sub-tables are the expanded S-box with MixColumns. The + * last (_tables[01][4]) is the S-box itself. + * + * @private + */ + this._tables = [[[], [], [], [], []], [[], [], [], [], []]]; + + this._precompute(); + + var i, + j, + tmp, + encKey, + decKey, + sbox = this._tables[0][4], + decTable = this._tables[1], + keyLen = key.length, + rcon = 1; + + if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) { + throw new Error('Invalid aes key size=' + keyLen); + } + + encKey = key.slice(0); + decKey = []; + this._key = [encKey, decKey]; + + // schedule encryption keys + for (i = keyLen; i < 4 * keyLen + 28; i++) { + tmp = encKey[i - 1]; + + // apply sbox + if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) { + tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; + + // shift rows and add rcon + if (i % keyLen === 0) { + tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24; + rcon = rcon << 1 ^ (rcon >> 7) * 283; + } + } + + encKey[i] = encKey[i - keyLen] ^ tmp; + } + + // schedule decryption keys + for (j = 0; i; j++, i--) { + tmp = encKey[j & 3 ? i : i - 4]; + if (i <= 4 || j < 4) { + decKey[j] = tmp; + } else { + decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]]; + } + } + } + + /** + * Expand the S-box tables. + * + * @private + */ + + + _createClass(AES, [{ + key: '_precompute', + value: function _precompute() { + var encTable = this._tables[0], + decTable = this._tables[1], + sbox = encTable[4], + sboxInv = decTable[4], + i, + x, + xInv, + d = [], + th = [], + x2, + x4, + x8, + s, + tEnc, + tDec; + + // Compute double and third tables + for (i = 0; i < 256; i++) { + th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i; + } + + for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) { + // Compute sbox + s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4; + s = s >> 8 ^ s & 255 ^ 99; + sbox[x] = s; + sboxInv[s] = x; + + // Compute MixColumns + x8 = d[x4 = d[x2 = d[x]]]; + tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; + tEnc = d[s] * 0x101 ^ s * 0x1010100; + + for (i = 0; i < 4; i++) { + encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8; + decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8; + } + } + + // Compactify. Considerable speedup on Firefox. + for (i = 0; i < 5; i++) { + encTable[i] = encTable[i].slice(0); + decTable[i] = decTable[i].slice(0); + } + } + + /** + * Decrypt 16 bytes, specified as four 32-bit words. + * @param encrypted0 {number} the first word to decrypt + * @param encrypted1 {number} the second word to decrypt + * @param encrypted2 {number} the third word to decrypt + * @param encrypted3 {number} the fourth word to decrypt + * @param out {Int32Array} the array to write the decrypted words + * into + * @param offset {number} the offset into the output array to start + * writing results + * @return {Array} The plaintext. + */ + + }, { + key: 'decrypt', + value: function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) { + var key = this._key[1], + + // state variables a,b,c,d are loaded with pre-whitened data + a = encrypted0 ^ key[0], + b = encrypted3 ^ key[1], + c = encrypted2 ^ key[2], + d = encrypted1 ^ key[3], + a2, + b2, + c2, + nInnerRounds = key.length / 4 - 2, + // key.length === 2 ? + i, + kIndex = 4, + table = this._tables[1], + + + // load up the tables + table0 = table[0], + table1 = table[1], + table2 = table[2], + table3 = table[3], + sbox = table[4]; + + // Inner rounds. Cribbed from OpenSSL. + for (i = 0; i < nInnerRounds; i++) { + a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex]; + b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1]; + c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2]; + d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3]; + kIndex += 4; + a = a2;b = b2;c = c2; + } + + // Last round. + for (i = 0; i < 4; i++) { + out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++]; + a2 = a;a = b;b = c;c = d;d = a2; + } + } + }]); + + return AES; +}(); + +exports.default = AES; + +},{}],11:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* + * + * This file contains an adaptation of the AES decryption algorithm + * from the Standford Javascript Cryptography Library. That work is + * covered by the following copyright and permissions notice: + * + * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation + * are those of the authors and should not be interpreted as representing + * official policies, either expressed or implied, of the authors. + */ + +var _aes = require('./aes'); + +var _aes2 = _interopRequireDefault(_aes); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var AES128Decrypter = function () { + function AES128Decrypter(key, initVector) { + _classCallCheck(this, AES128Decrypter); + + this.key = key; + this.iv = initVector; + } + + /** + * Convert network-order (big-endian) bytes into their little-endian + * representation. + */ + + + _createClass(AES128Decrypter, [{ + key: 'ntoh', + value: function ntoh(word) { + return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24; + } + + /** + * Decrypt bytes using AES-128 with CBC and PKCS#7 padding. + * @param encrypted {Uint8Array} the encrypted bytes + * @param key {Uint32Array} the bytes of the decryption key + * @param initVector {Uint32Array} the initialization vector (IV) to + * use for the first round of CBC. + * @return {Uint8Array} the decrypted bytes + * + * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard + * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29 + * @see https://tools.ietf.org/html/rfc2315 + */ + + }, { + key: 'doDecrypt', + value: function doDecrypt(encrypted, key, initVector) { + var + // word-level access to the encrypted bytes + encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2), + decipher = new _aes2.default(Array.prototype.slice.call(key)), + + + // byte and word-level access for the decrypted output + decrypted = new Uint8Array(encrypted.byteLength), + decrypted32 = new Int32Array(decrypted.buffer), + + + // temporary variables for working with the IV, encrypted, and + // decrypted data + init0, + init1, + init2, + init3, + encrypted0, + encrypted1, + encrypted2, + encrypted3, + + + // iteration variable + wordIx; + + // pull out the words of the IV to ensure we don't modify the + // passed-in reference and easier access + init0 = ~ ~initVector[0]; + init1 = ~ ~initVector[1]; + init2 = ~ ~initVector[2]; + init3 = ~ ~initVector[3]; + + // decrypt four word sequences, applying cipher-block chaining (CBC) + // to each decrypted block + for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) { + // convert big-endian (network order) words into little-endian + // (javascript order) + encrypted0 = ~ ~this.ntoh(encrypted32[wordIx]); + encrypted1 = ~ ~this.ntoh(encrypted32[wordIx + 1]); + encrypted2 = ~ ~this.ntoh(encrypted32[wordIx + 2]); + encrypted3 = ~ ~this.ntoh(encrypted32[wordIx + 3]); + + // decrypt the block + decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); + + // XOR with the IV, and restore network byte-order to obtain the + // plaintext + decrypted32[wordIx] = this.ntoh(decrypted32[wordIx] ^ init0); + decrypted32[wordIx + 1] = this.ntoh(decrypted32[wordIx + 1] ^ init1); + decrypted32[wordIx + 2] = this.ntoh(decrypted32[wordIx + 2] ^ init2); + decrypted32[wordIx + 3] = this.ntoh(decrypted32[wordIx + 3] ^ init3); + + // setup the IV for the next round + init0 = encrypted0; + init1 = encrypted1; + init2 = encrypted2; + init3 = encrypted3; + } + + return decrypted; + } + }, { + key: 'localDecrypt', + value: function localDecrypt(encrypted, key, initVector, decrypted) { + var bytes = this.doDecrypt(encrypted, key, initVector); + decrypted.set(bytes, encrypted.byteOffset); + } + }, { + key: 'decrypt', + value: function decrypt(encrypted) { + var step = 4 * 8000, + + //encrypted32 = new Int32Array(encrypted.buffer), + encrypted32 = new Int32Array(encrypted), + decrypted = new Uint8Array(encrypted.byteLength), + i = 0; + + // split up the encryption job and do the individual chunks asynchronously + var key = this.key; + var initVector = this.iv; + this.localDecrypt(encrypted32.subarray(i, i + step), key, initVector, decrypted); + + for (i = step; i < encrypted32.length; i += step) { + initVector = new Uint32Array([this.ntoh(encrypted32[i - 4]), this.ntoh(encrypted32[i - 3]), this.ntoh(encrypted32[i - 2]), this.ntoh(encrypted32[i - 1])]); + this.localDecrypt(encrypted32.subarray(i, i + step), key, initVector, decrypted); + } + + return decrypted; + } + }]); + + return AES128Decrypter; +}(); + +exports.default = AES128Decrypter; + +},{"./aes":10}],12:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* + * AES128 decryption. + */ + +var _aes128Decrypter = require('./aes128-decrypter'); + +var _aes128Decrypter2 = _interopRequireDefault(_aes128Decrypter); + +var _errors = require('../errors'); + +var _logger = require('../utils/logger'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Decrypter = function () { + function Decrypter(hls) { + _classCallCheck(this, Decrypter); + + this.hls = hls; + try { + var browserCrypto = window ? window.crypto : crypto; + this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle; + this.disableWebCrypto = !this.subtle; + } catch (e) { + this.disableWebCrypto = true; + } + } + + _createClass(Decrypter, [{ + key: 'destroy', + value: function destroy() {} + }, { + key: 'decrypt', + value: function decrypt(data, key, iv, callback) { + if (this.disableWebCrypto && this.hls.config.enableSoftwareAES) { + this.decryptBySoftware(data, key, iv, callback); + } else { + this.decryptByWebCrypto(data, key, iv, callback); + } + } + }, { + key: 'decryptByWebCrypto', + value: function decryptByWebCrypto(data, key, iv, callback) { + var _this = this; + + _logger.logger.log('decrypting by WebCrypto API'); + + this.subtle.importKey('raw', key, { name: 'AES-CBC', length: 128 }, false, ['decrypt']).then(function (importedKey) { + _this.subtle.decrypt({ name: 'AES-CBC', iv: iv.buffer }, importedKey, data).then(callback).catch(function (err) { + _this.onWebCryptoError(err, data, key, iv, callback); + }); + }).catch(function (err) { + _this.onWebCryptoError(err, data, key, iv, callback); + }); + } + }, { + key: 'decryptBySoftware', + value: function decryptBySoftware(data, key8, iv8, callback) { + _logger.logger.log('decrypting by JavaScript Implementation'); + + var view = new DataView(key8.buffer); + var key = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]); + + view = new DataView(iv8.buffer); + var iv = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]); + + var decrypter = new _aes128Decrypter2.default(key, iv); + callback(decrypter.decrypt(data).buffer); + } + }, { + key: 'onWebCryptoError', + value: function onWebCryptoError(err, data, key, iv, callback) { + if (this.hls.config.enableSoftwareAES) { + _logger.logger.log('disabling to use WebCrypto API'); + this.disableWebCrypto = true; + this.decryptBySoftware(data, key, iv, callback); + } else { + _logger.logger.error('decrypting error : ' + err.message); + this.hls.trigger(Event.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_DECRYPT_ERROR, fatal: true, reason: err.message }); + } + } + }]); + + return Decrypter; +}(); + +exports.default = Decrypter; + +},{"../errors":21,"../utils/logger":38,"./aes128-decrypter":11}],13:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * AAC demuxer + */ + + +var _adts = require('./adts'); + +var _adts2 = _interopRequireDefault(_adts); + +var _logger = require('../utils/logger'); + +var _id = require('../demux/id3'); + +var _id2 = _interopRequireDefault(_id); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var AACDemuxer = function () { + function AACDemuxer(observer, remuxerClass) { + _classCallCheck(this, AACDemuxer); + + this.observer = observer; + this.remuxerClass = remuxerClass; + this.remuxer = new this.remuxerClass(observer); + this._aacTrack = { container: 'audio/adts', type: 'audio', id: -1, sequenceNumber: 0, samples: [], len: 0 }; + } + + _createClass(AACDemuxer, [{ + key: 'push', + + + // feed incoming data to the front of the parsing pipeline + value: function push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) { + var track = this._aacTrack, + id3 = new _id2.default(data), + pts = 90 * id3.timeStamp, + config, + frameLength, + frameDuration, + frameIndex, + offset, + headerLength, + stamp, + len, + aacSample; + // look for ADTS header (0xFFFx) + for (offset = id3.length, len = data.length; offset < len - 1; offset++) { + if (data[offset] === 0xff && (data[offset + 1] & 0xf0) === 0xf0) { + break; + } + } + + if (!track.audiosamplerate) { + config = _adts2.default.getAudioConfig(this.observer, data, offset, audioCodec); + track.config = config.config; + track.audiosamplerate = config.samplerate; + track.channelCount = config.channelCount; + track.codec = config.codec; + track.duration = duration; + _logger.logger.log('parsed codec:' + track.codec + ',rate:' + config.samplerate + ',nb channel:' + config.channelCount); + } + frameIndex = 0; + frameDuration = 1024 * 90000 / track.audiosamplerate; + while (offset + 5 < len) { + // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header + headerLength = !!(data[offset + 1] & 0x01) ? 7 : 9; + // retrieve frame size + frameLength = (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xE0) >>> 5; + frameLength -= headerLength; + //stamp = pes.pts; + + if (frameLength > 0 && offset + headerLength + frameLength <= len) { + stamp = pts + frameIndex * frameDuration; + //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`); + aacSample = { unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp }; + track.samples.push(aacSample); + track.len += frameLength; + offset += frameLength + headerLength; + frameIndex++; + // look for ADTS header (0xFFFx) + for (; offset < len - 1; offset++) { + if (data[offset] === 0xff && (data[offset + 1] & 0xf0) === 0xf0) { + break; + } + } + } else { + break; + } + } + this.remuxer.remux(this._aacTrack, { samples: [] }, { samples: [{ pts: pts, dts: pts, unit: id3.payload }] }, { samples: [] }, timeOffset); + } + }, { + key: 'destroy', + value: function destroy() {} + }], [{ + key: 'probe', + value: function probe(data) { + // check if data contains ID3 timestamp and ADTS sync worc + var id3 = new _id2.default(data), + offset, + len; + if (id3.hasTimeStamp) { + // look for ADTS header (0xFFFx) + for (offset = id3.length, len = data.length; offset < len - 1; offset++) { + if (data[offset] === 0xff && (data[offset + 1] & 0xf0) === 0xf0) { + //logger.log('ADTS sync word found !'); + return true; + } + } + } + return false; + } + }]); + + return AACDemuxer; +}(); + +exports.default = AACDemuxer; + +},{"../demux/id3":19,"../utils/logger":38,"./adts":14}],14:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * ADTS parser helper + */ + + +var _logger = require('../utils/logger'); + +var _errors = require('../errors'); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var ADTS = function () { + function ADTS() { + _classCallCheck(this, ADTS); + } + + _createClass(ADTS, null, [{ + key: 'getAudioConfig', + value: function getAudioConfig(observer, data, offset, audioCodec) { + var adtsObjectType, + // :int + adtsSampleingIndex, + // :int + adtsExtensionSampleingIndex, + // :int + adtsChanelConfig, + // :int + config, + userAgent = navigator.userAgent.toLowerCase(), + adtsSampleingRates = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; + // byte 2 + adtsObjectType = ((data[offset + 2] & 0xC0) >>> 6) + 1; + adtsSampleingIndex = (data[offset + 2] & 0x3C) >>> 2; + if (adtsSampleingIndex > adtsSampleingRates.length - 1) { + observer.trigger(Event.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_PARSING_ERROR, fatal: true, reason: 'invalid ADTS sampling index:' + adtsSampleingIndex }); + return; + } + adtsChanelConfig = (data[offset + 2] & 0x01) << 2; + // byte 3 + adtsChanelConfig |= (data[offset + 3] & 0xC0) >>> 6; + _logger.logger.log('manifest codec:' + audioCodec + ',ADTS data:type:' + adtsObjectType + ',sampleingIndex:' + adtsSampleingIndex + '[' + adtsSampleingRates[adtsSampleingIndex] + 'Hz],channelConfig:' + adtsChanelConfig); + // firefox: freq less than 24kHz = AAC SBR (HE-AAC) + if (userAgent.indexOf('firefox') !== -1) { + if (adtsSampleingIndex >= 6) { + adtsObjectType = 5; + config = new Array(4); + // HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies + // there is a factor 2 between frame sample rate and output sample rate + // multiply frequency by 2 (see table below, equivalent to substract 3) + adtsExtensionSampleingIndex = adtsSampleingIndex - 3; + } else { + adtsObjectType = 2; + config = new Array(2); + adtsExtensionSampleingIndex = adtsSampleingIndex; + } + // Android : always use AAC + } else if (userAgent.indexOf('android') !== -1) { + adtsObjectType = 2; + config = new Array(2); + adtsExtensionSampleingIndex = adtsSampleingIndex; + } else { + /* for other browsers (chrome ...) + always force audio type to be HE-AAC SBR, as some browsers do not support audio codec switch properly (like Chrome ...) + */ + adtsObjectType = 5; + config = new Array(4); + // if (manifest codec is HE-AAC or HE-AACv2) OR (manifest codec not specified AND frequency less than 24kHz) + if (audioCodec && (audioCodec.indexOf('mp4a.40.29') !== -1 || audioCodec.indexOf('mp4a.40.5') !== -1) || !audioCodec && adtsSampleingIndex >= 6) { + // HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies + // there is a factor 2 between frame sample rate and output sample rate + // multiply frequency by 2 (see table below, equivalent to substract 3) + adtsExtensionSampleingIndex = adtsSampleingIndex - 3; + } else { + // if (manifest codec is AAC) AND (frequency less than 24kHz AND nb channel is 1) OR (manifest codec not specified and mono audio) + // Chrome fails to play back with low frequency AAC LC mono when initialized with HE-AAC. This is not a problem with stereo. + if (audioCodec && audioCodec.indexOf('mp4a.40.2') !== -1 && adtsSampleingIndex >= 6 && adtsChanelConfig === 1 || !audioCodec && adtsChanelConfig === 1) { + adtsObjectType = 2; + config = new Array(2); + } + adtsExtensionSampleingIndex = adtsSampleingIndex; + } + } + /* refer to http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config + ISO 14496-3 (AAC).pdf - Table 1.13 — Syntax of AudioSpecificConfig() + Audio Profile / Audio Object Type + 0: Null + 1: AAC Main + 2: AAC LC (Low Complexity) + 3: AAC SSR (Scalable Sample Rate) + 4: AAC LTP (Long Term Prediction) + 5: SBR (Spectral Band Replication) + 6: AAC Scalable + sampling freq + 0: 96000 Hz + 1: 88200 Hz + 2: 64000 Hz + 3: 48000 Hz + 4: 44100 Hz + 5: 32000 Hz + 6: 24000 Hz + 7: 22050 Hz + 8: 16000 Hz + 9: 12000 Hz + 10: 11025 Hz + 11: 8000 Hz + 12: 7350 Hz + 13: Reserved + 14: Reserved + 15: frequency is written explictly + Channel Configurations + These are the channel configurations: + 0: Defined in AOT Specifc Config + 1: 1 channel: front-center + 2: 2 channels: front-left, front-right + */ + // audioObjectType = profile => profile, the MPEG-4 Audio Object Type minus 1 + config[0] = adtsObjectType << 3; + // samplingFrequencyIndex + config[0] |= (adtsSampleingIndex & 0x0E) >> 1; + config[1] |= (adtsSampleingIndex & 0x01) << 7; + // channelConfiguration + config[1] |= adtsChanelConfig << 3; + if (adtsObjectType === 5) { + // adtsExtensionSampleingIndex + config[1] |= (adtsExtensionSampleingIndex & 0x0E) >> 1; + config[2] = (adtsExtensionSampleingIndex & 0x01) << 7; + // adtsObjectType (force to 2, chrome is checking that object type is less than 5 ??? + // https://chromium.googlesource.com/chromium/src.git/+/master/media/formats/mp4/aac.cc + config[2] |= 2 << 2; + config[3] = 0; + } + return { config: config, samplerate: adtsSampleingRates[adtsSampleingIndex], channelCount: adtsChanelConfig, codec: 'mp4a.40.' + adtsObjectType }; + } + }]); + + return ADTS; +}(); + +exports.default = ADTS; + +},{"../errors":21,"../utils/logger":38}],15:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* inline demuxer. + * probe fragments and instantiate appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...) + */ + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _errors = require('../errors'); + +var _aacdemuxer = require('../demux/aacdemuxer'); + +var _aacdemuxer2 = _interopRequireDefault(_aacdemuxer); + +var _tsdemuxer = require('../demux/tsdemuxer'); + +var _tsdemuxer2 = _interopRequireDefault(_tsdemuxer); + +var _mp4Remuxer = require('../remux/mp4-remuxer'); + +var _mp4Remuxer2 = _interopRequireDefault(_mp4Remuxer); + +var _passthroughRemuxer = require('../remux/passthrough-remuxer'); + +var _passthroughRemuxer2 = _interopRequireDefault(_passthroughRemuxer); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var DemuxerInline = function () { + function DemuxerInline(hls, typeSupported) { + _classCallCheck(this, DemuxerInline); + + this.hls = hls; + this.typeSupported = typeSupported; + } + + _createClass(DemuxerInline, [{ + key: 'destroy', + value: function destroy() { + var demuxer = this.demuxer; + if (demuxer) { + demuxer.destroy(); + } + } + }, { + key: 'push', + value: function push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) { + var demuxer = this.demuxer; + if (!demuxer) { + var hls = this.hls; + // probe for content type + if (_tsdemuxer2.default.probe(data)) { + if (this.typeSupported.mp2t === true) { + demuxer = new _tsdemuxer2.default(hls, _passthroughRemuxer2.default); + } else { + demuxer = new _tsdemuxer2.default(hls, _mp4Remuxer2.default); + } + } else if (_aacdemuxer2.default.probe(data)) { + demuxer = new _aacdemuxer2.default(hls, _mp4Remuxer2.default); + } else { + hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_PARSING_ERROR, fatal: true, reason: 'no demux matching with content found' }); + return; + } + this.demuxer = demuxer; + } + demuxer.push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration); + } + }]); + + return DemuxerInline; +}(); + +exports.default = DemuxerInline; + +},{"../demux/aacdemuxer":13,"../demux/tsdemuxer":20,"../errors":21,"../events":23,"../remux/mp4-remuxer":32,"../remux/passthrough-remuxer":33}],16:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _demuxerInline = require('../demux/demuxer-inline'); + +var _demuxerInline2 = _interopRequireDefault(_demuxerInline); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _events3 = require('events'); + +var _events4 = _interopRequireDefault(_events3); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var DemuxerWorker = function DemuxerWorker(self) { + // observer setup + var observer = new _events4.default(); + observer.trigger = function trigger(event) { + for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + data[_key - 1] = arguments[_key]; + } + + observer.emit.apply(observer, [event, event].concat(data)); + }; + + observer.off = function off(event) { + for (var _len2 = arguments.length, data = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + data[_key2 - 1] = arguments[_key2]; + } + + observer.removeListener.apply(observer, [event].concat(data)); + }; + self.addEventListener('message', function (ev) { + var data = ev.data; + //console.log('demuxer cmd:' + data.cmd); + switch (data.cmd) { + case 'init': + self.demuxer = new _demuxerInline2.default(observer, data.typeSupported); + break; + case 'demux': + self.demuxer.push(new Uint8Array(data.data), data.audioCodec, data.videoCodec, data.timeOffset, data.cc, data.level, data.sn, data.duration); + break; + default: + break; + } + }); + + // listen to events triggered by Demuxer + observer.on(_events2.default.FRAG_PARSING_INIT_SEGMENT, function (ev, data) { + self.postMessage({ event: ev, tracks: data.tracks, unique: data.unique }); + }); + + observer.on(_events2.default.FRAG_PARSING_DATA, function (ev, data) { + var objData = { event: ev, type: data.type, startPTS: data.startPTS, endPTS: data.endPTS, startDTS: data.startDTS, endDTS: data.endDTS, data1: data.data1.buffer, data2: data.data2.buffer, nb: data.nb, dropped: data.dropped }; + // pass data1/data2 as transferable object (no copy) + self.postMessage(objData, [objData.data1, objData.data2]); + }); + + observer.on(_events2.default.FRAG_PARSED, function (event) { + self.postMessage({ event: event }); + }); + + observer.on(_events2.default.ERROR, function (event, data) { + self.postMessage({ event: event, data: data }); + }); + + observer.on(_events2.default.FRAG_PARSING_METADATA, function (event, data) { + var objData = { event: event, samples: data.samples }; + self.postMessage(objData); + }); + + observer.on(_events2.default.FRAG_PARSING_USERDATA, function (event, data) { + var objData = { event: event, samples: data.samples }; + self.postMessage(objData); + }); +}; /* demuxer web worker. + * - listen to worker message, and trigger DemuxerInline upon reception of Fragments. + * - provides MP4 Boxes back to main thread using [transferable objects](https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast) in order to minimize message passing overhead. + */ + +exports.default = DemuxerWorker; + +},{"../demux/demuxer-inline":15,"../events":23,"events":1}],17:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _demuxerInline = require('../demux/demuxer-inline'); + +var _demuxerInline2 = _interopRequireDefault(_demuxerInline); + +var _demuxerWorker = require('../demux/demuxer-worker'); + +var _demuxerWorker2 = _interopRequireDefault(_demuxerWorker); + +var _logger = require('../utils/logger'); + +var _decrypter = require('../crypt/decrypter'); + +var _decrypter2 = _interopRequireDefault(_decrypter); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Demuxer = function () { + function Demuxer(hls) { + _classCallCheck(this, Demuxer); + + this.hls = hls; + var typeSupported = { + mp4: MediaSource.isTypeSupported('video/mp4'), + mp2t: hls.config.enableMP2TPassThrough && MediaSource.isTypeSupported('video/mp2t') + }; + if (hls.config.enableWorker && typeof Worker !== 'undefined') { + _logger.logger.log('demuxing in webworker'); + try { + var work = require('webworkify'); + this.w = work(_demuxerWorker2.default); + this.onwmsg = this.onWorkerMessage.bind(this); + this.w.addEventListener('message', this.onwmsg); + this.w.postMessage({ cmd: 'init', typeSupported: typeSupported }); + } catch (err) { + _logger.logger.error('error while initializing DemuxerWorker, fallback on DemuxerInline'); + this.demuxer = new _demuxerInline2.default(hls, typeSupported); + } + } else { + this.demuxer = new _demuxerInline2.default(hls, typeSupported); + } + this.demuxInitialized = true; + } + + _createClass(Demuxer, [{ + key: 'destroy', + value: function destroy() { + if (this.w) { + this.w.removeEventListener('message', this.onwmsg); + this.w.terminate(); + this.w = null; + } else { + this.demuxer.destroy(); + this.demuxer = null; + } + if (this.decrypter) { + this.decrypter.destroy(); + this.decrypter = null; + } + } + }, { + key: 'pushDecrypted', + value: function pushDecrypted(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) { + if (this.w) { + // post fragment payload as transferable objects (no copy) + this.w.postMessage({ cmd: 'demux', data: data, audioCodec: audioCodec, videoCodec: videoCodec, timeOffset: timeOffset, cc: cc, level: level, sn: sn, duration: duration }, [data]); + } else { + this.demuxer.push(new Uint8Array(data), audioCodec, videoCodec, timeOffset, cc, level, sn, duration); + } + } + }, { + key: 'push', + value: function push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration, decryptdata) { + if (data.byteLength > 0 && decryptdata != null && decryptdata.key != null && decryptdata.method === 'AES-128') { + if (this.decrypter == null) { + this.decrypter = new _decrypter2.default(this.hls); + } + + var localthis = this; + this.decrypter.decrypt(data, decryptdata.key, decryptdata.iv, function (decryptedData) { + localthis.pushDecrypted(decryptedData, audioCodec, videoCodec, timeOffset, cc, level, sn, duration); + }); + } else { + this.pushDecrypted(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration); + } + } + }, { + key: 'onWorkerMessage', + value: function onWorkerMessage(ev) { + var data = ev.data; + //console.log('onWorkerMessage:' + data.event); + switch (data.event) { + case _events2.default.FRAG_PARSING_INIT_SEGMENT: + var obj = {}; + obj.tracks = data.tracks; + obj.unique = data.unique; + this.hls.trigger(_events2.default.FRAG_PARSING_INIT_SEGMENT, obj); + break; + case _events2.default.FRAG_PARSING_DATA: + this.hls.trigger(_events2.default.FRAG_PARSING_DATA, { + data1: new Uint8Array(data.data1), + data2: new Uint8Array(data.data2), + startPTS: data.startPTS, + endPTS: data.endPTS, + startDTS: data.startDTS, + endDTS: data.endDTS, + type: data.type, + nb: data.nb, + dropped: data.dropped + }); + break; + case _events2.default.FRAG_PARSING_METADATA: + this.hls.trigger(_events2.default.FRAG_PARSING_METADATA, { + samples: data.samples + }); + break; + case _events2.default.FRAG_PARSING_USERDATA: + this.hls.trigger(_events2.default.FRAG_PARSING_USERDATA, { + samples: data.samples + }); + break; + default: + this.hls.trigger(data.event, data.data); + break; + } + } + }]); + + return Demuxer; +}(); + +exports.default = Demuxer; + +},{"../crypt/decrypter":12,"../demux/demuxer-inline":15,"../demux/demuxer-worker":16,"../events":23,"../utils/logger":38,"webworkify":2}],18:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264. + */ + +var _logger = require('../utils/logger'); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var ExpGolomb = function () { + function ExpGolomb(data) { + _classCallCheck(this, ExpGolomb); + + this.data = data; + // the number of bytes left to examine in this.data + this.bytesAvailable = this.data.byteLength; + // the current word being examined + this.word = 0; // :uint + // the number of bits left to examine in the current word + this.bitsAvailable = 0; // :uint + } + + // ():void + + + _createClass(ExpGolomb, [{ + key: 'loadWord', + value: function loadWord() { + var position = this.data.byteLength - this.bytesAvailable, + workingBytes = new Uint8Array(4), + availableBytes = Math.min(4, this.bytesAvailable); + if (availableBytes === 0) { + throw new Error('no bytes available'); + } + workingBytes.set(this.data.subarray(position, position + availableBytes)); + this.word = new DataView(workingBytes.buffer).getUint32(0); + // track the amount of this.data that has been processed + this.bitsAvailable = availableBytes * 8; + this.bytesAvailable -= availableBytes; + } + + // (count:int):void + + }, { + key: 'skipBits', + value: function skipBits(count) { + var skipBytes; // :int + if (this.bitsAvailable > count) { + this.word <<= count; + this.bitsAvailable -= count; + } else { + count -= this.bitsAvailable; + skipBytes = count >> 3; + count -= skipBytes >> 3; + this.bytesAvailable -= skipBytes; + this.loadWord(); + this.word <<= count; + this.bitsAvailable -= count; + } + } + + // (size:int):uint + + }, { + key: 'readBits', + value: function readBits(size) { + var bits = Math.min(this.bitsAvailable, size), + // :uint + valu = this.word >>> 32 - bits; // :uint + if (size > 32) { + _logger.logger.error('Cannot read more than 32 bits at a time'); + } + this.bitsAvailable -= bits; + if (this.bitsAvailable > 0) { + this.word <<= bits; + } else if (this.bytesAvailable > 0) { + this.loadWord(); + } + bits = size - bits; + if (bits > 0) { + return valu << bits | this.readBits(bits); + } else { + return valu; + } + } + + // ():uint + + }, { + key: 'skipLZ', + value: function skipLZ() { + var leadingZeroCount; // :uint + for (leadingZeroCount = 0; leadingZeroCount < this.bitsAvailable; ++leadingZeroCount) { + if (0 !== (this.word & 0x80000000 >>> leadingZeroCount)) { + // the first bit of working word is 1 + this.word <<= leadingZeroCount; + this.bitsAvailable -= leadingZeroCount; + return leadingZeroCount; + } + } + // we exhausted word and still have not found a 1 + this.loadWord(); + return leadingZeroCount + this.skipLZ(); + } + + // ():void + + }, { + key: 'skipUEG', + value: function skipUEG() { + this.skipBits(1 + this.skipLZ()); + } + + // ():void + + }, { + key: 'skipEG', + value: function skipEG() { + this.skipBits(1 + this.skipLZ()); + } + + // ():uint + + }, { + key: 'readUEG', + value: function readUEG() { + var clz = this.skipLZ(); // :uint + return this.readBits(clz + 1) - 1; + } + + // ():int + + }, { + key: 'readEG', + value: function readEG() { + var valu = this.readUEG(); // :int + if (0x01 & valu) { + // the number is odd if the low order bit is set + return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 + } else { + return -1 * (valu >>> 1); // divide by two then make it negative + } + } + + // Some convenience functions + // :Boolean + + }, { + key: 'readBoolean', + value: function readBoolean() { + return 1 === this.readBits(1); + } + + // ():int + + }, { + key: 'readUByte', + value: function readUByte() { + return this.readBits(8); + } + + // ():int + + }, { + key: 'readUShort', + value: function readUShort() { + return this.readBits(16); + } + // ():int + + }, { + key: 'readUInt', + value: function readUInt() { + return this.readBits(32); + } + + /** + * Advance the ExpGolomb decoder past a scaling list. The scaling + * list is optionally transmitted as part of a sequence parameter + * set and is not relevant to transmuxing. + * @param count {number} the number of entries in this scaling list + * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 + */ + + }, { + key: 'skipScalingList', + value: function skipScalingList(count) { + var lastScale = 8, + nextScale = 8, + j, + deltaScale; + for (j = 0; j < count; j++) { + if (nextScale !== 0) { + deltaScale = this.readEG(); + nextScale = (lastScale + deltaScale + 256) % 256; + } + lastScale = nextScale === 0 ? lastScale : nextScale; + } + } + + /** + * Read a sequence parameter set and return some interesting video + * properties. A sequence parameter set is the H264 metadata that + * describes the properties of upcoming video frames. + * @param data {Uint8Array} the bytes of a sequence parameter set + * @return {object} an object with configuration parsed from the + * sequence parameter set, including the dimensions of the + * associated video frames. + */ + + }, { + key: 'readSPS', + value: function readSPS() { + var frameCropLeftOffset = 0, + frameCropRightOffset = 0, + frameCropTopOffset = 0, + frameCropBottomOffset = 0, + sarScale = 1, + profileIdc, + profileCompat, + levelIdc, + numRefFramesInPicOrderCntCycle, + picWidthInMbsMinus1, + picHeightInMapUnitsMinus1, + frameMbsOnlyFlag, + scalingListCount, + i; + this.readUByte(); + profileIdc = this.readUByte(); // profile_idc + profileCompat = this.readBits(5); // constraint_set[0-4]_flag, u(5) + this.skipBits(3); // reserved_zero_3bits u(3), + levelIdc = this.readUByte(); //level_idc u(8) + this.skipUEG(); // seq_parameter_set_id + // some profiles have more optional data we don't need + if (profileIdc === 100 || profileIdc === 110 || profileIdc === 122 || profileIdc === 244 || profileIdc === 44 || profileIdc === 83 || profileIdc === 86 || profileIdc === 118 || profileIdc === 128) { + var chromaFormatIdc = this.readUEG(); + if (chromaFormatIdc === 3) { + this.skipBits(1); // separate_colour_plane_flag + } + this.skipUEG(); // bit_depth_luma_minus8 + this.skipUEG(); // bit_depth_chroma_minus8 + this.skipBits(1); // qpprime_y_zero_transform_bypass_flag + if (this.readBoolean()) { + // seq_scaling_matrix_present_flag + scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; + for (i = 0; i < scalingListCount; i++) { + if (this.readBoolean()) { + // seq_scaling_list_present_flag[ i ] + if (i < 6) { + this.skipScalingList(16); + } else { + this.skipScalingList(64); + } + } + } + } + } + this.skipUEG(); // log2_max_frame_num_minus4 + var picOrderCntType = this.readUEG(); + if (picOrderCntType === 0) { + this.readUEG(); //log2_max_pic_order_cnt_lsb_minus4 + } else if (picOrderCntType === 1) { + this.skipBits(1); // delta_pic_order_always_zero_flag + this.skipEG(); // offset_for_non_ref_pic + this.skipEG(); // offset_for_top_to_bottom_field + numRefFramesInPicOrderCntCycle = this.readUEG(); + for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { + this.skipEG(); // offset_for_ref_frame[ i ] + } + } + this.skipUEG(); // max_num_ref_frames + this.skipBits(1); // gaps_in_frame_num_value_allowed_flag + picWidthInMbsMinus1 = this.readUEG(); + picHeightInMapUnitsMinus1 = this.readUEG(); + frameMbsOnlyFlag = this.readBits(1); + if (frameMbsOnlyFlag === 0) { + this.skipBits(1); // mb_adaptive_frame_field_flag + } + this.skipBits(1); // direct_8x8_inference_flag + if (this.readBoolean()) { + // frame_cropping_flag + frameCropLeftOffset = this.readUEG(); + frameCropRightOffset = this.readUEG(); + frameCropTopOffset = this.readUEG(); + frameCropBottomOffset = this.readUEG(); + } + if (this.readBoolean()) { + // vui_parameters_present_flag + if (this.readBoolean()) { + // aspect_ratio_info_present_flag + var sarRatio = void 0; + var aspectRatioIdc = this.readUByte(); + switch (aspectRatioIdc) { + case 1: + sarRatio = [1, 1];break; + case 2: + sarRatio = [12, 11];break; + case 3: + sarRatio = [10, 11];break; + case 4: + sarRatio = [16, 11];break; + case 5: + sarRatio = [40, 33];break; + case 6: + sarRatio = [24, 11];break; + case 7: + sarRatio = [20, 11];break; + case 8: + sarRatio = [32, 11];break; + case 9: + sarRatio = [80, 33];break; + case 10: + sarRatio = [18, 11];break; + case 11: + sarRatio = [15, 11];break; + case 12: + sarRatio = [64, 33];break; + case 13: + sarRatio = [160, 99];break; + case 14: + sarRatio = [4, 3];break; + case 15: + sarRatio = [3, 2];break; + case 16: + sarRatio = [2, 1];break; + case 255: + { + sarRatio = [this.readUByte() << 8 | this.readUByte(), this.readUByte() << 8 | this.readUByte()]; + break; + } + } + if (sarRatio) { + sarScale = sarRatio[0] / sarRatio[1]; + } + } + } + return { + width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale), + height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - (frameMbsOnlyFlag ? 2 : 4) * (frameCropTopOffset + frameCropBottomOffset) + }; + } + }, { + key: 'readSliceType', + value: function readSliceType() { + // skip NALu type + this.readUByte(); + // discard first_mb_in_slice + this.readUEG(); + // return slice_type + return this.readUEG(); + } + }]); + + return ExpGolomb; +}(); + +exports.default = ExpGolomb; + +},{"../utils/logger":38}],19:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * ID3 parser + */ + + +var _logger = require('../utils/logger'); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +//import Hex from '../utils/hex'; + +var ID3 = function () { + function ID3(data) { + _classCallCheck(this, ID3); + + this._hasTimeStamp = false; + var offset = 0, + byte1, + byte2, + byte3, + byte4, + tagSize, + endPos, + header, + len; + do { + header = this.readUTF(data, offset, 3); + offset += 3; + // first check for ID3 header + if (header === 'ID3') { + // skip 24 bits + offset += 3; + // retrieve tag(s) length + byte1 = data[offset++] & 0x7f; + byte2 = data[offset++] & 0x7f; + byte3 = data[offset++] & 0x7f; + byte4 = data[offset++] & 0x7f; + tagSize = (byte1 << 21) + (byte2 << 14) + (byte3 << 7) + byte4; + endPos = offset + tagSize; + //logger.log(`ID3 tag found, size/end: ${tagSize}/${endPos}`); + + // read ID3 tags + this._parseID3Frames(data, offset, endPos); + offset = endPos; + } else if (header === '3DI') { + // http://id3.org/id3v2.4.0-structure chapter 3.4. ID3v2 footer + offset += 7; + _logger.logger.log('3DI footer found, end: ' + offset); + } else { + offset -= 3; + len = offset; + if (len) { + //logger.log(`ID3 len: ${len}`); + if (!this.hasTimeStamp) { + _logger.logger.warn('ID3 tag found, but no timestamp'); + } + this._length = len; + this._payload = data.subarray(0, len); + } + return; + } + } while (true); + } + + _createClass(ID3, [{ + key: 'readUTF', + value: function readUTF(data, start, len) { + + var result = '', + offset = start, + end = start + len; + do { + result += String.fromCharCode(data[offset++]); + } while (offset < end); + return result; + } + }, { + key: '_parseID3Frames', + value: function _parseID3Frames(data, offset, endPos) { + var tagId, tagLen, tagStart, tagFlags, timestamp; + while (offset + 8 <= endPos) { + tagId = this.readUTF(data, offset, 4); + offset += 4; + + tagLen = data[offset++] << 24 + data[offset++] << 16 + data[offset++] << 8 + data[offset++]; + + tagFlags = data[offset++] << 8 + data[offset++]; + + tagStart = offset; + //logger.log("ID3 tag id:" + tagId); + switch (tagId) { + case 'PRIV': + //logger.log('parse frame:' + Hex.hexDump(data.subarray(offset,endPos))); + // owner should be "com.apple.streaming.transportStreamTimestamp" + if (this.readUTF(data, offset, 44) === 'com.apple.streaming.transportStreamTimestamp') { + offset += 44; + // smelling even better ! we found the right descriptor + // skip null character (string end) + 3 first bytes + offset += 4; + + // timestamp is 33 bit expressed as a big-endian eight-octet number, with the upper 31 bits set to zero. + var pts33Bit = data[offset++] & 0x1; + this._hasTimeStamp = true; + + timestamp = ((data[offset++] << 23) + (data[offset++] << 15) + (data[offset++] << 7) + data[offset++]) / 45; + + if (pts33Bit) { + timestamp += 47721858.84; // 2^32 / 90 + } + timestamp = Math.round(timestamp); + _logger.logger.trace('ID3 timestamp found: ' + timestamp); + this._timeStamp = timestamp; + } + break; + default: + break; + } + } + } + }, { + key: 'hasTimeStamp', + get: function get() { + return this._hasTimeStamp; + } + }, { + key: 'timeStamp', + get: function get() { + return this._timeStamp; + } + }, { + key: 'length', + get: function get() { + return this._length; + } + }, { + key: 'payload', + get: function get() { + return this._payload; + } + }]); + + return ID3; +}(); + +exports.default = ID3; + +},{"../utils/logger":38}],20:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * highly optimized TS demuxer: + * parse PAT, PMT + * extract PES packet from audio and video PIDs + * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet + * trigger the remuxer upon parsing completion + * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource. + * it also controls the remuxing process : + * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state. + */ + +// import Hex from '../utils/hex'; + + +var _adts = require('./adts'); + +var _adts2 = _interopRequireDefault(_adts); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _expGolomb = require('./exp-golomb'); + +var _expGolomb2 = _interopRequireDefault(_expGolomb); + +var _logger = require('../utils/logger'); + +var _errors = require('../errors'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var TSDemuxer = function () { + function TSDemuxer(observer, remuxerClass) { + _classCallCheck(this, TSDemuxer); + + this.observer = observer; + this.remuxerClass = remuxerClass; + this.lastCC = 0; + this.remuxer = new this.remuxerClass(observer); + } + + _createClass(TSDemuxer, [{ + key: 'switchLevel', + value: function switchLevel() { + this.pmtParsed = false; + this._pmtId = -1; + this._avcTrack = { container: 'video/mp2t', type: 'video', id: -1, sequenceNumber: 0, samples: [], len: 0, nbNalu: 0, dropped: 0 }; + this._aacTrack = { container: 'video/mp2t', type: 'audio', id: -1, sequenceNumber: 0, samples: [], len: 0 }; + this._id3Track = { type: 'id3', id: -1, sequenceNumber: 0, samples: [], len: 0 }; + this._txtTrack = { type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0 }; + // flush any partial content + this.aacOverFlow = null; + this.aacLastPTS = null; + this.avcNaluState = 0; + this.remuxer.switchLevel(); + } + }, { + key: 'insertDiscontinuity', + value: function insertDiscontinuity() { + this.switchLevel(); + this.remuxer.insertDiscontinuity(); + } + + // feed incoming data to the front of the parsing pipeline + + }, { + key: 'push', + value: function push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) { + var avcData, + aacData, + id3Data, + start, + len = data.length, + stt, + pid, + atf, + offset, + codecsOnly = this.remuxer.passthrough, + unknownPIDs = false; + + this.audioCodec = audioCodec; + this.videoCodec = videoCodec; + this.timeOffset = timeOffset; + this._duration = duration; + this.contiguous = false; + if (cc !== this.lastCC) { + _logger.logger.log('discontinuity detected'); + this.insertDiscontinuity(); + this.lastCC = cc; + } + if (level !== this.lastLevel) { + _logger.logger.log('level switch detected'); + this.switchLevel(); + this.lastLevel = level; + } else if (sn === this.lastSN + 1) { + this.contiguous = true; + } + this.lastSN = sn; + + var pmtParsed = this.pmtParsed, + avcId = this._avcTrack.id, + aacId = this._aacTrack.id, + id3Id = this._id3Track.id; + + // don't parse last TS packet if incomplete + len -= len % 188; + // loop through TS packets + for (start = 0; start < len; start += 188) { + if (data[start] === 0x47) { + stt = !!(data[start + 1] & 0x40); + // pid is a 13-bit field starting at the last bit of TS[1] + pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2]; + atf = (data[start + 3] & 0x30) >> 4; + // if an adaption field is present, its length is specified by the fifth byte of the TS packet header. + if (atf > 1) { + offset = start + 5 + data[start + 4]; + // continue if there is only adaptation field + if (offset === start + 188) { + continue; + } + } else { + offset = start + 4; + } + if (pmtParsed) { + if (pid === avcId) { + if (stt) { + if (avcData) { + this._parseAVCPES(this._parsePES(avcData)); + if (codecsOnly) { + // if we have video codec info AND + // if audio PID is undefined OR if we have audio codec info, + // we have all codec info ! + if (this._avcTrack.codec && (aacId === -1 || this._aacTrack.codec)) { + this.remux(data); + return; + } + } + } + avcData = { data: [], size: 0 }; + } + if (avcData) { + avcData.data.push(data.subarray(offset, start + 188)); + avcData.size += start + 188 - offset; + } + } else if (pid === aacId) { + if (stt) { + if (aacData) { + this._parseAACPES(this._parsePES(aacData)); + if (codecsOnly) { + // here we now that we have audio codec info + // if video PID is undefined OR if we have video codec info, + // we have all codec infos ! + if (this._aacTrack.codec && (avcId === -1 || this._avcTrack.codec)) { + this.remux(data); + return; + } + } + } + aacData = { data: [], size: 0 }; + } + if (aacData) { + aacData.data.push(data.subarray(offset, start + 188)); + aacData.size += start + 188 - offset; + } + } else if (pid === id3Id) { + if (stt) { + if (id3Data) { + this._parseID3PES(this._parsePES(id3Data)); + } + id3Data = { data: [], size: 0 }; + } + if (id3Data) { + id3Data.data.push(data.subarray(offset, start + 188)); + id3Data.size += start + 188 - offset; + } + } + } else { + if (stt) { + offset += data[offset] + 1; + } + if (pid === 0) { + this._parsePAT(data, offset); + } else if (pid === this._pmtId) { + this._parsePMT(data, offset); + pmtParsed = this.pmtParsed = true; + avcId = this._avcTrack.id; + aacId = this._aacTrack.id; + id3Id = this._id3Track.id; + if (unknownPIDs) { + _logger.logger.log('reparse from beginning'); + unknownPIDs = false; + // we set it to -188, the += 188 in the for loop will reset start to 0 + start = -188; + } + } else { + _logger.logger.log('unknown PID found before PAT/PMT'); + unknownPIDs = true; + } + } + } else { + this.observer.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'TS packet did not start with 0x47' }); + } + } + // parse last PES packet + if (avcData) { + this._parseAVCPES(this._parsePES(avcData)); + } + if (aacData) { + this._parseAACPES(this._parsePES(aacData)); + } + if (id3Data) { + this._parseID3PES(this._parsePES(id3Data)); + } + this.remux(null); + } + }, { + key: 'remux', + value: function remux(data) { + this.remuxer.remux(this._aacTrack, this._avcTrack, this._id3Track, this._txtTrack, this.timeOffset, this.contiguous, data); + } + }, { + key: 'destroy', + value: function destroy() { + this.switchLevel(); + this._initPTS = this._initDTS = undefined; + this._duration = 0; + } + }, { + key: '_parsePAT', + value: function _parsePAT(data, offset) { + // skip the PSI header and parse the first PMT entry + this._pmtId = (data[offset + 10] & 0x1F) << 8 | data[offset + 11]; + //logger.log('PMT PID:' + this._pmtId); + } + }, { + key: '_parsePMT', + value: function _parsePMT(data, offset) { + var sectionLength, tableEnd, programInfoLength, pid; + sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2]; + tableEnd = offset + 3 + sectionLength - 4; + // to determine where the table is, we have to figure out how + // long the program info descriptors are + programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11]; + // advance the offset to the first entry in the mapping table + offset += 12 + programInfoLength; + while (offset < tableEnd) { + pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2]; + switch (data[offset]) { + // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio) + case 0x0f: + //logger.log('AAC PID:' + pid); + this._aacTrack.id = pid; + break; + // Packetized metadata (ID3) + case 0x15: + //logger.log('ID3 PID:' + pid); + this._id3Track.id = pid; + break; + // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video) + case 0x1b: + //logger.log('AVC PID:' + pid); + this._avcTrack.id = pid; + break; + default: + _logger.logger.log('unkown stream type:' + data[offset]); + break; + } + // move to the next table entry + // skip past the elementary stream descriptors, if present + offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5; + } + } + }, { + key: '_parsePES', + value: function _parsePES(stream) { + var i = 0, + frag, + pesFlags, + pesPrefix, + pesLen, + pesHdrLen, + pesData, + pesPts, + pesDts, + payloadStartOffset, + data = stream.data; + //retrieve PTS/DTS from first fragment + frag = data[0]; + pesPrefix = (frag[0] << 16) + (frag[1] << 8) + frag[2]; + if (pesPrefix === 1) { + pesLen = (frag[4] << 8) + frag[5]; + pesFlags = frag[7]; + if (pesFlags & 0xC0) { + /* PES header described here : http://dvd.sourceforge.net/dvdinfo/pes-hdr.html + as PTS / DTS is 33 bit we cannot use bitwise operator in JS, + as Bitwise operators treat their operands as a sequence of 32 bits */ + pesPts = (frag[9] & 0x0E) * 536870912 + // 1 << 29 + (frag[10] & 0xFF) * 4194304 + // 1 << 22 + (frag[11] & 0xFE) * 16384 + // 1 << 14 + (frag[12] & 0xFF) * 128 + // 1 << 7 + (frag[13] & 0xFE) / 2; + // check if greater than 2^32 -1 + if (pesPts > 4294967295) { + // decrement 2^33 + pesPts -= 8589934592; + } + if (pesFlags & 0x40) { + pesDts = (frag[14] & 0x0E) * 536870912 + // 1 << 29 + (frag[15] & 0xFF) * 4194304 + // 1 << 22 + (frag[16] & 0xFE) * 16384 + // 1 << 14 + (frag[17] & 0xFF) * 128 + // 1 << 7 + (frag[18] & 0xFE) / 2; + // check if greater than 2^32 -1 + if (pesDts > 4294967295) { + // decrement 2^33 + pesDts -= 8589934592; + } + } else { + pesDts = pesPts; + } + } + pesHdrLen = frag[8]; + payloadStartOffset = pesHdrLen + 9; + + stream.size -= payloadStartOffset; + //reassemble PES packet + pesData = new Uint8Array(stream.size); + while (data.length) { + frag = data.shift(); + var len = frag.byteLength; + if (payloadStartOffset) { + if (payloadStartOffset > len) { + // trim full frag if PES header bigger than frag + payloadStartOffset -= len; + continue; + } else { + // trim partial frag if PES header smaller than frag + frag = frag.subarray(payloadStartOffset); + len -= payloadStartOffset; + payloadStartOffset = 0; + } + } + pesData.set(frag, i); + i += len; + } + return { data: pesData, pts: pesPts, dts: pesDts, len: pesLen }; + } else { + return null; + } + } + }, { + key: '_parseAVCPES', + value: function _parseAVCPES(pes) { + var _this = this; + + var track = this._avcTrack, + samples = track.samples, + units = this._parseAVCNALu(pes.data), + units2 = [], + debug = false, + key = false, + length = 0, + expGolombDecoder, + avcSample, + push, + i; + // no NALu found + if (units.length === 0 && samples.length > 0) { + // append pes.data to previous NAL unit + var lastavcSample = samples[samples.length - 1]; + var lastUnit = lastavcSample.units.units[lastavcSample.units.units.length - 1]; + var tmp = new Uint8Array(lastUnit.data.byteLength + pes.data.byteLength); + tmp.set(lastUnit.data, 0); + tmp.set(pes.data, lastUnit.data.byteLength); + lastUnit.data = tmp; + lastavcSample.units.length += pes.data.byteLength; + track.len += pes.data.byteLength; + } + //free pes.data to save up some memory + pes.data = null; + var debugString = ''; + + var pushAccesUnit = function () { + if (units2.length) { + // only push AVC sample if keyframe already found in this fragment OR + // keyframe found in last fragment (track.sps) AND + // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous + if (key === true || track.sps && (samples.length || this.contiguous)) { + avcSample = { units: { units: units2, length: length }, pts: pes.pts, dts: pes.dts, key: key }; + samples.push(avcSample); + track.len += length; + track.nbNalu += units2.length; + } else { + // dropped samples, track it + track.dropped++; + } + units2 = []; + length = 0; + } + }.bind(this); + + units.forEach(function (unit) { + switch (unit.type) { + //NDR + case 1: + push = true; + if (debug) { + debugString += 'NDR '; + } + break; + //IDR + case 5: + push = true; + if (debug) { + debugString += 'IDR '; + } + key = true; + break; + //SEI + case 6: + push = true; + if (debug) { + debugString += 'SEI '; + } + expGolombDecoder = new _expGolomb2.default(unit.data); + + // skip frameType + expGolombDecoder.readUByte(); + + var payloadType = expGolombDecoder.readUByte(); + + // TODO: there can be more than one payload in an SEI packet... + // TODO: need to read type and size in a while loop to get them all + if (payloadType === 4) { + var payloadSize = 0; + + do { + payloadSize = expGolombDecoder.readUByte(); + } while (payloadSize === 255); + + var countryCode = expGolombDecoder.readUByte(); + + if (countryCode === 181) { + var providerCode = expGolombDecoder.readUShort(); + + if (providerCode === 49) { + var userStructure = expGolombDecoder.readUInt(); + + if (userStructure === 0x47413934) { + var userDataType = expGolombDecoder.readUByte(); + + // Raw CEA-608 bytes wrapped in CEA-708 packet + if (userDataType === 3) { + var firstByte = expGolombDecoder.readUByte(); + var secondByte = expGolombDecoder.readUByte(); + + var totalCCs = 31 & firstByte; + var byteArray = [firstByte, secondByte]; + + for (i = 0; i < totalCCs; i++) { + // 3 bytes per CC + byteArray.push(expGolombDecoder.readUByte()); + byteArray.push(expGolombDecoder.readUByte()); + byteArray.push(expGolombDecoder.readUByte()); + } + + _this._txtTrack.samples.push({ type: 3, pts: pes.pts, bytes: byteArray }); + } + } + } + } + } + break; + //SPS + case 7: + push = true; + if (debug) { + debugString += 'SPS '; + } + if (!track.sps) { + expGolombDecoder = new _expGolomb2.default(unit.data); + var config = expGolombDecoder.readSPS(); + track.width = config.width; + track.height = config.height; + track.sps = [unit.data]; + track.duration = _this._duration; + var codecarray = unit.data.subarray(1, 4); + var codecstring = 'avc1.'; + for (i = 0; i < 3; i++) { + var h = codecarray[i].toString(16); + if (h.length < 2) { + h = '0' + h; + } + codecstring += h; + } + track.codec = codecstring; + } + break; + //PPS + case 8: + push = true; + if (debug) { + debugString += 'PPS '; + } + if (!track.pps) { + track.pps = [unit.data]; + } + break; + case 9: + push = false; + if (debug) { + debugString += 'AUD '; + } + pushAccesUnit(); + break; + default: + push = false; + debugString += 'unknown NAL ' + unit.type + ' '; + break; + } + if (push) { + units2.push(unit); + length += unit.data.byteLength; + } + }); + if (debug || debugString.length) { + _logger.logger.log(debugString); + } + pushAccesUnit(); + } + }, { + key: '_parseAVCNALu', + value: function _parseAVCNALu(array) { + var i = 0, + len = array.byteLength, + value, + overflow, + state = this.avcNaluState; + var units = [], + unit, + unitType, + lastUnitStart, + lastUnitType; + //logger.log('PES:' + Hex.hexDump(array)); + while (i < len) { + value = array[i++]; + // finding 3 or 4-byte start codes (00 00 01 OR 00 00 00 01) + switch (state) { + case 0: + if (value === 0) { + state = 1; + } + break; + case 1: + if (value === 0) { + state = 2; + } else { + state = 0; + } + break; + case 2: + case 3: + if (value === 0) { + state = 3; + } else if (value === 1 && i < len) { + unitType = array[i] & 0x1f; + //logger.log('find NALU @ offset:' + i + ',type:' + unitType); + if (lastUnitStart) { + unit = { data: array.subarray(lastUnitStart, i - state - 1), type: lastUnitType }; + //logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength); + units.push(unit); + } else { + // lastUnitStart is undefined => this is the first start code found in this PES packet + // first check if start code delimiter is overlapping between 2 PES packets, + // ie it started in last packet (lastState not zero) + // and ended at the beginning of this PES packet (i <= 4 - lastState) + var lastState = this.avcNaluState; + if (lastState && i <= 4 - lastState) { + // start delimiter overlapping between PES packets + // strip start delimiter bytes from the end of last NAL unit + var track = this._avcTrack, + samples = track.samples; + if (samples.length) { + var lastavcSample = samples[samples.length - 1], + lastUnits = lastavcSample.units.units, + lastUnit = lastUnits[lastUnits.length - 1]; + // check if lastUnit had a state different from zero + if (lastUnit.state) { + // strip last bytes + lastUnit.data = lastUnit.data.subarray(0, lastUnit.data.byteLength - lastState); + lastavcSample.units.length -= lastState; + track.len -= lastState; + } + } + } + // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit. + overflow = i - state - 1; + if (overflow > 0) { + var _track = this._avcTrack, + _samples = _track.samples; + //logger.log('first NALU found with overflow:' + overflow); + if (_samples.length) { + var _lastavcSample = _samples[_samples.length - 1], + _lastUnits = _lastavcSample.units.units, + _lastUnit = _lastUnits[_lastUnits.length - 1], + tmp = new Uint8Array(_lastUnit.data.byteLength + overflow); + tmp.set(_lastUnit.data, 0); + tmp.set(array.subarray(0, overflow), _lastUnit.data.byteLength); + _lastUnit.data = tmp; + _lastavcSample.units.length += overflow; + _track.len += overflow; + } + } + } + lastUnitStart = i; + lastUnitType = unitType; + state = 0; + } else { + state = 0; + } + break; + default: + break; + } + } + if (lastUnitStart) { + unit = { data: array.subarray(lastUnitStart, len), type: lastUnitType, state: state }; + units.push(unit); + //logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state); + this.avcNaluState = state; + } + return units; + } + }, { + key: '_parseAACPES', + value: function _parseAACPES(pes) { + var track = this._aacTrack, + data = pes.data, + pts = pes.pts, + startOffset = 0, + duration = this._duration, + audioCodec = this.audioCodec, + aacOverFlow = this.aacOverFlow, + aacLastPTS = this.aacLastPTS, + config, + frameLength, + frameDuration, + frameIndex, + offset, + headerLength, + stamp, + len, + aacSample; + if (aacOverFlow) { + var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength); + tmp.set(aacOverFlow, 0); + tmp.set(data, aacOverFlow.byteLength); + //logger.log(`AAC: append overflowing ${aacOverFlow.byteLength} bytes to beginning of new PES`); + data = tmp; + } + // look for ADTS header (0xFFFx) + for (offset = startOffset, len = data.length; offset < len - 1; offset++) { + if (data[offset] === 0xff && (data[offset + 1] & 0xf0) === 0xf0) { + break; + } + } + // if ADTS header does not start straight from the beginning of the PES payload, raise an error + if (offset) { + var reason, fatal; + if (offset < len - 1) { + reason = 'AAC PES did not start with ADTS header,offset:' + offset; + fatal = false; + } else { + reason = 'no ADTS header found in AAC PES'; + fatal = true; + } + this.observer.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_PARSING_ERROR, fatal: fatal, reason: reason }); + if (fatal) { + return; + } + } + if (!track.audiosamplerate) { + config = _adts2.default.getAudioConfig(this.observer, data, offset, audioCodec); + track.config = config.config; + track.audiosamplerate = config.samplerate; + track.channelCount = config.channelCount; + track.codec = config.codec; + track.duration = duration; + _logger.logger.log('parsed codec:' + track.codec + ',rate:' + config.samplerate + ',nb channel:' + config.channelCount); + } + frameIndex = 0; + frameDuration = 1024 * 90000 / track.audiosamplerate; + + // if last AAC frame is overflowing, we should ensure timestamps are contiguous: + // first sample PTS should be equal to last sample PTS + frameDuration + if (aacOverFlow && aacLastPTS) { + var newPTS = aacLastPTS + frameDuration; + if (Math.abs(newPTS - pts) > 1) { + _logger.logger.log('AAC: align PTS for overlapping frames by ' + Math.round((newPTS - pts) / 90)); + pts = newPTS; + } + } + + while (offset + 5 < len) { + // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header + headerLength = !!(data[offset + 1] & 0x01) ? 7 : 9; + // retrieve frame size + frameLength = (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xE0) >>> 5; + frameLength -= headerLength; + //stamp = pes.pts; + + if (frameLength > 0 && offset + headerLength + frameLength <= len) { + stamp = pts + frameIndex * frameDuration; + //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`); + aacSample = { unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp }; + track.samples.push(aacSample); + track.len += frameLength; + offset += frameLength + headerLength; + frameIndex++; + // look for ADTS header (0xFFFx) + for (; offset < len - 1; offset++) { + if (data[offset] === 0xff && (data[offset + 1] & 0xf0) === 0xf0) { + break; + } + } + } else { + break; + } + } + if (offset < len) { + aacOverFlow = data.subarray(offset, len); + //logger.log(`AAC: overflow detected:${len-offset}`); + } else { + aacOverFlow = null; + } + this.aacOverFlow = aacOverFlow; + this.aacLastPTS = stamp; + } + }, { + key: '_parseID3PES', + value: function _parseID3PES(pes) { + this._id3Track.samples.push(pes); + } + }], [{ + key: 'probe', + value: function probe(data) { + // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47 + if (data.length >= 3 * 188 && data[0] === 0x47 && data[188] === 0x47 && data[2 * 188] === 0x47) { + return true; + } else { + return false; + } + } + }]); + + return TSDemuxer; +}(); + +exports.default = TSDemuxer; + +},{"../errors":21,"../events":23,"../utils/logger":38,"./adts":14,"./exp-golomb":18}],21:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var ErrorTypes = exports.ErrorTypes = { + // Identifier for a network error (loading error / timeout ...) + NETWORK_ERROR: 'networkError', + // Identifier for a media Error (video/parsing/mediasource error) + MEDIA_ERROR: 'mediaError', + // Identifier for all other errors + OTHER_ERROR: 'otherError' +}; + +var ErrorDetails = exports.ErrorDetails = { + // Identifier for a manifest load error - data: { url : faulty URL, response : XHR response} + MANIFEST_LOAD_ERROR: 'manifestLoadError', + // Identifier for a manifest load timeout - data: { url : faulty URL, response : XHR response} + MANIFEST_LOAD_TIMEOUT: 'manifestLoadTimeOut', + // Identifier for a manifest parsing error - data: { url : faulty URL, reason : error reason} + MANIFEST_PARSING_ERROR: 'manifestParsingError', + // Identifier for a manifest with only incompatible codecs error - data: { url : faulty URL, reason : error reason} + MANIFEST_INCOMPATIBLE_CODECS_ERROR: 'manifestIncompatibleCodecsError', + // Identifier for playlist load error - data: { url : faulty URL, response : XHR response} + LEVEL_LOAD_ERROR: 'levelLoadError', + // Identifier for playlist load timeout - data: { url : faulty URL, response : XHR response} + LEVEL_LOAD_TIMEOUT: 'levelLoadTimeOut', + // Identifier for a level switch error - data: { level : faulty level Id, event : error description} + LEVEL_SWITCH_ERROR: 'levelSwitchError', + // Identifier for fragment load error - data: { frag : fragment object, response : XHR response} + FRAG_LOAD_ERROR: 'fragLoadError', + // Identifier for fragment loop loading error - data: { frag : fragment object} + FRAG_LOOP_LOADING_ERROR: 'fragLoopLoadingError', + // Identifier for fragment load timeout error - data: { frag : fragment object} + FRAG_LOAD_TIMEOUT: 'fragLoadTimeOut', + // Identifier for a fragment decryption error event - data: parsing error description + FRAG_DECRYPT_ERROR: 'fragDecryptError', + // Identifier for a fragment parsing error event - data: parsing error description + FRAG_PARSING_ERROR: 'fragParsingError', + // Identifier for decrypt key load error - data: { frag : fragment object, response : XHR response} + KEY_LOAD_ERROR: 'keyLoadError', + // Identifier for decrypt key load timeout error - data: { frag : fragment object} + KEY_LOAD_TIMEOUT: 'keyLoadTimeOut', + // Identifier for a buffer append error - data: append error description + BUFFER_APPEND_ERROR: 'bufferAppendError', + // Identifier for a buffer appending error event - data: appending error description + BUFFER_APPENDING_ERROR: 'bufferAppendingError', + // Identifier for a buffer stalled error event + BUFFER_STALLED_ERROR: 'bufferStalledError', + // Identifier for a buffer full event + BUFFER_FULL_ERROR: 'bufferFullError', + // Identifier for a buffer seek over hole event + BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole', + // Identifier for an internal exception happening inside hls.js while handling an event + INTERNAL_EXCEPTION: 'internalException' +}; + +},{}],22:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* + * + * All objects in the event handling chain should inherit from this class + * + */ + +var _logger = require('./utils/logger'); + +var _errors = require('./errors'); + +var _events = require('./events'); + +var _events2 = _interopRequireDefault(_events); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var EventHandler = function () { + function EventHandler(hls) { + _classCallCheck(this, EventHandler); + + this.hls = hls; + this.onEvent = this.onEvent.bind(this); + + for (var _len = arguments.length, events = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + events[_key - 1] = arguments[_key]; + } + + this.handledEvents = events; + this.useGenericHandler = true; + + this.registerListeners(); + } + + _createClass(EventHandler, [{ + key: 'destroy', + value: function destroy() { + this.unregisterListeners(); + } + }, { + key: 'isEventHandler', + value: function isEventHandler() { + return _typeof(this.handledEvents) === 'object' && this.handledEvents.length && typeof this.onEvent === 'function'; + } + }, { + key: 'registerListeners', + value: function registerListeners() { + if (this.isEventHandler()) { + this.handledEvents.forEach(function (event) { + if (event === 'hlsEventGeneric') { + throw new Error('Forbidden event name: ' + event); + } + this.hls.on(event, this.onEvent); + }.bind(this)); + } + } + }, { + key: 'unregisterListeners', + value: function unregisterListeners() { + if (this.isEventHandler()) { + this.handledEvents.forEach(function (event) { + this.hls.off(event, this.onEvent); + }.bind(this)); + } + } + + /* + * arguments: event (string), data (any) + */ + + }, { + key: 'onEvent', + value: function onEvent(event, data) { + this.onEventGeneric(event, data); + } + }, { + key: 'onEventGeneric', + value: function onEventGeneric(event, data) { + var eventToFunction = function eventToFunction(event, data) { + var funcName = 'on' + event.replace('hls', ''); + if (typeof this[funcName] !== 'function') { + throw new Error('Event ' + event + ' has no generic handler in this ' + this.constructor.name + ' class (tried ' + funcName + ')'); + } + return this[funcName].bind(this, data); + }; + try { + eventToFunction.call(this, event, data).call(); + } catch (err) { + _logger.logger.error('internal error happened while processing ' + event + ':' + err.message); + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.OTHER_ERROR, details: _errors.ErrorDetails.INTERNAL_EXCEPTION, fatal: false, event: event, err: err }); + } + } + }]); + + return EventHandler; +}(); + +exports.default = EventHandler; + +},{"./errors":21,"./events":23,"./utils/logger":38}],23:[function(require,module,exports){ +'use strict'; + +module.exports = { + // fired before MediaSource is attaching to media element - data: { media } + MEDIA_ATTACHING: 'hlsMediaAttaching', + // fired when MediaSource has been succesfully attached to media element - data: { } + MEDIA_ATTACHED: 'hlsMediaAttached', + // fired before detaching MediaSource from media element - data: { } + MEDIA_DETACHING: 'hlsMediaDetaching', + // fired when MediaSource has been detached from media element - data: { } + MEDIA_DETACHED: 'hlsMediaDetached', + // fired when we buffer is going to be resetted + BUFFER_RESET: 'hlsBufferReset', + // fired when we know about the codecs that we need buffers for to push into - data: {tracks : { container, codec, levelCodec, initSegment, metadata }} + BUFFER_CODECS: 'hlsBufferCodecs', + // fired when we append a segment to the buffer - data: { segment: segment object } + BUFFER_APPENDING: 'hlsBufferAppending', + // fired when we are done with appending a media segment to the buffer + BUFFER_APPENDED: 'hlsBufferAppended', + // fired when the stream is finished and we want to notify the media buffer that there will be no more data + BUFFER_EOS: 'hlsBufferEos', + // fired when the media buffer should be flushed - data {startOffset, endOffset} + BUFFER_FLUSHING: 'hlsBufferFlushing', + // fired when the media has been flushed + BUFFER_FLUSHED: 'hlsBufferFlushed', + // fired to signal that a manifest loading starts - data: { url : manifestURL} + MANIFEST_LOADING: 'hlsManifestLoading', + // fired after manifest has been loaded - data: { levels : [available quality levels] , url : manifestURL, stats : { trequest, tfirst, tload, mtime}} + MANIFEST_LOADED: 'hlsManifestLoaded', + // fired after manifest has been parsed - data: { levels : [available quality levels] , firstLevel : index of first quality level appearing in Manifest} + MANIFEST_PARSED: 'hlsManifestParsed', + // fired when a level playlist loading starts - data: { url : level URL level : id of level being loaded} + LEVEL_LOADING: 'hlsLevelLoading', + // fired when a level playlist loading finishes - data: { details : levelDetails object, level : id of loaded level, stats : { trequest, tfirst, tload, mtime} } + LEVEL_LOADED: 'hlsLevelLoaded', + // fired when a level's details have been updated based on previous details, after it has been loaded. - data: { details : levelDetails object, level : id of updated level } + LEVEL_UPDATED: 'hlsLevelUpdated', + // fired when a level's PTS information has been updated after parsing a fragment - data: { details : levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment } + LEVEL_PTS_UPDATED: 'hlsLevelPtsUpdated', + // fired when a level switch is requested - data: { level : id of new level } + LEVEL_SWITCH: 'hlsLevelSwitch', + // fired when a fragment loading starts - data: { frag : fragment object} + FRAG_LOADING: 'hlsFragLoading', + // fired when a fragment loading is progressing - data: { frag : fragment object, { trequest, tfirst, loaded}} + FRAG_LOAD_PROGRESS: 'hlsFragLoadProgress', + // Identifier for fragment load aborting for emergency switch down - data: {frag : fragment object} + FRAG_LOAD_EMERGENCY_ABORTED: 'hlsFragLoadEmergencyAborted', + // fired when a fragment loading is completed - data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length}} + FRAG_LOADED: 'hlsFragLoaded', + // fired when Init Segment has been extracted from fragment - data: { moov : moov MP4 box, codecs : codecs found while parsing fragment} + FRAG_PARSING_INIT_SEGMENT: 'hlsFragParsingInitSegment', + // fired when parsing sei text is completed - data: { samples : [ sei samples pes ] } + FRAG_PARSING_USERDATA: 'hlsFragParsingUserdata', + // fired when parsing id3 is completed - data: { samples : [ id3 samples pes ] } + FRAG_PARSING_METADATA: 'hlsFragParsingMetadata', + // fired when data have been extracted from fragment - data: { data1 : moof MP4 box or TS fragments, data2 : mdat MP4 box or null} + FRAG_PARSING_DATA: 'hlsFragParsingData', + // fired when fragment parsing is completed - data: undefined + FRAG_PARSED: 'hlsFragParsed', + // fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - data: { frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length} } + FRAG_BUFFERED: 'hlsFragBuffered', + // fired when fragment matching with current media position is changing - data : { frag : fragment object } + FRAG_CHANGED: 'hlsFragChanged', + // Identifier for a FPS drop event - data: {curentDropped, currentDecoded, totalDroppedFrames} + FPS_DROP: 'hlsFpsDrop', + // Identifier for an error event - data: { type : error type, details : error details, fatal : if true, hls.js cannot/will not try to recover, if false, hls.js will try to recover,other error specific data} + ERROR: 'hlsError', + // fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a media to the instance of hls.js to handle mid-rolls for example + DESTROYING: 'hlsDestroying', + // fired when a decrypt key loading starts - data: { frag : fragment object} + KEY_LOADING: 'hlsKeyLoading', + // fired when a decrypt key loading is completed - data: { frag : fragment object, payload : key payload, stats : { trequest, tfirst, tload, length}} + KEY_LOADED: 'hlsKeyLoaded' +}; + +},{}],24:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Buffer Helper class, providing methods dealing buffer length retrieval +*/ + +var BufferHelper = function () { + function BufferHelper() { + _classCallCheck(this, BufferHelper); + } + + _createClass(BufferHelper, null, [{ + key: "bufferInfo", + value: function bufferInfo(media, pos, maxHoleDuration) { + if (media) { + var vbuffered = media.buffered, + buffered = [], + i; + for (i = 0; i < vbuffered.length; i++) { + buffered.push({ start: vbuffered.start(i), end: vbuffered.end(i) }); + } + return this.bufferedInfo(buffered, pos, maxHoleDuration); + } else { + return { len: 0, start: 0, end: 0, nextStart: undefined }; + } + } + }, { + key: "bufferedInfo", + value: function bufferedInfo(buffered, pos, maxHoleDuration) { + var buffered2 = [], + + // bufferStart and bufferEnd are buffer boundaries around current video position + bufferLen, + bufferStart, + bufferEnd, + bufferStartNext, + i; + // sort on buffer.start/smaller end (IE does not always return sorted buffered range) + buffered.sort(function (a, b) { + var diff = a.start - b.start; + if (diff) { + return diff; + } else { + return b.end - a.end; + } + }); + // there might be some small holes between buffer time range + // consider that holes smaller than maxHoleDuration are irrelevant and build another + // buffer time range representations that discards those holes + for (i = 0; i < buffered.length; i++) { + var buf2len = buffered2.length; + if (buf2len) { + var buf2end = buffered2[buf2len - 1].end; + // if small hole (value between 0 or maxHoleDuration ) or overlapping (negative) + if (buffered[i].start - buf2end < maxHoleDuration) { + // merge overlapping time ranges + // update lastRange.end only if smaller than item.end + // e.g. [ 1, 15] with [ 2,8] => [ 1,15] (no need to modify lastRange.end) + // whereas [ 1, 8] with [ 2,15] => [ 1,15] ( lastRange should switch from [1,8] to [1,15]) + if (buffered[i].end > buf2end) { + buffered2[buf2len - 1].end = buffered[i].end; + } + } else { + // big hole + buffered2.push(buffered[i]); + } + } else { + // first value + buffered2.push(buffered[i]); + } + } + for (i = 0, bufferLen = 0, bufferStart = bufferEnd = pos; i < buffered2.length; i++) { + var start = buffered2[i].start, + end = buffered2[i].end; + //logger.log('buf start/end:' + buffered.start(i) + '/' + buffered.end(i)); + if (pos + maxHoleDuration >= start && pos < end) { + // play position is inside this buffer TimeRange, retrieve end of buffer position and buffer length + bufferStart = start; + bufferEnd = end; + bufferLen = bufferEnd - pos; + } else if (pos + maxHoleDuration < start) { + bufferStartNext = start; + break; + } + } + return { len: bufferLen, start: bufferStart, end: bufferEnd, nextStart: bufferStartNext }; + } + }]); + + return BufferHelper; +}(); + +exports.default = BufferHelper; + +},{}],25:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * Level Helper class, providing methods dealing with playlist sliding and drift + */ + +var _logger = require('../utils/logger'); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var LevelHelper = function () { + function LevelHelper() { + _classCallCheck(this, LevelHelper); + } + + _createClass(LevelHelper, null, [{ + key: 'mergeDetails', + value: function mergeDetails(oldDetails, newDetails) { + var start = Math.max(oldDetails.startSN, newDetails.startSN) - newDetails.startSN, + end = Math.min(oldDetails.endSN, newDetails.endSN) - newDetails.startSN, + delta = newDetails.startSN - oldDetails.startSN, + oldfragments = oldDetails.fragments, + newfragments = newDetails.fragments, + ccOffset = 0, + PTSFrag; + + // check if old/new playlists have fragments in common + if (end < start) { + newDetails.PTSKnown = false; + return; + } + // loop through overlapping SN and update startPTS , cc, and duration if any found + for (var i = start; i <= end; i++) { + var oldFrag = oldfragments[delta + i], + newFrag = newfragments[i]; + if (newFrag && oldFrag) { + ccOffset = oldFrag.cc - newFrag.cc; + if (!isNaN(oldFrag.startPTS)) { + newFrag.start = newFrag.startPTS = oldFrag.startPTS; + newFrag.endPTS = oldFrag.endPTS; + newFrag.duration = oldFrag.duration; + PTSFrag = newFrag; + } + } + } + + if (ccOffset) { + _logger.logger.log('discontinuity sliding from playlist, take drift into account'); + for (i = 0; i < newfragments.length; i++) { + newfragments[i].cc += ccOffset; + } + } + + // if at least one fragment contains PTS info, recompute PTS information for all fragments + if (PTSFrag) { + LevelHelper.updateFragPTSDTS(newDetails, PTSFrag.sn, PTSFrag.startPTS, PTSFrag.endPTS, PTSFrag.startDTS, PTSFrag.endDTS); + } else { + // ensure that delta is within oldfragments range + // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61]) + // in that case we also need to adjust start offset of all fragments + if (delta >= 0 && delta < oldfragments.length) { + // adjust start by sliding offset + var sliding = oldfragments[delta].start; + for (i = 0; i < newfragments.length; i++) { + newfragments[i].start += sliding; + } + } + } + // if we are here, it means we have fragments overlapping between + // old and new level. reliable PTS info is thus relying on old level + newDetails.PTSKnown = oldDetails.PTSKnown; + return; + } + }, { + key: 'updateFragPTSDTS', + value: function updateFragPTSDTS(details, sn, startPTS, endPTS, startDTS, endDTS) { + var fragIdx, fragments, frag, i; + // exit if sn out of range + if (sn < details.startSN || sn > details.endSN) { + return 0; + } + fragIdx = sn - details.startSN; + fragments = details.fragments; + frag = fragments[fragIdx]; + if (!isNaN(frag.startPTS)) { + // delta PTS between audio and video + var deltaPTS = Math.abs(frag.startPTS - startPTS); + if (isNaN(frag.deltaPTS)) { + frag.deltaPTS = deltaPTS; + } else { + frag.deltaPTS = Math.max(deltaPTS, frag.deltaPTS); + } + startPTS = Math.min(startPTS, frag.startPTS); + endPTS = Math.max(endPTS, frag.endPTS); + startDTS = Math.min(startDTS, frag.startDTS); + endDTS = Math.max(endDTS, frag.endDTS); + } + + var drift = startPTS - frag.start; + + frag.start = frag.startPTS = startPTS; + frag.endPTS = endPTS; + frag.startDTS = startDTS; + frag.endDTS = endDTS; + frag.duration = endPTS - startPTS; + // adjust fragment PTS/duration from seqnum-1 to frag 0 + for (i = fragIdx; i > 0; i--) { + LevelHelper.updatePTS(fragments, i, i - 1); + } + + // adjust fragment PTS/duration from seqnum to last frag + for (i = fragIdx; i < fragments.length - 1; i++) { + LevelHelper.updatePTS(fragments, i, i + 1); + } + details.PTSKnown = true; + //logger.log(` frag start/end:${startPTS.toFixed(3)}/${endPTS.toFixed(3)}`); + + return drift; + } + }, { + key: 'updatePTS', + value: function updatePTS(fragments, fromIdx, toIdx) { + var fragFrom = fragments[fromIdx], + fragTo = fragments[toIdx], + fragToPTS = fragTo.startPTS; + // if we know startPTS[toIdx] + if (!isNaN(fragToPTS)) { + // update fragment duration. + // it helps to fix drifts between playlist reported duration and fragment real duration + if (toIdx > fromIdx) { + fragFrom.duration = fragToPTS - fragFrom.start; + if (fragFrom.duration < 0) { + _logger.logger.error('negative duration computed for frag ' + fragFrom.sn + ',level ' + fragFrom.level + ', there should be some duration drift between playlist and fragment!'); + } + } else { + fragTo.duration = fragFrom.start - fragToPTS; + if (fragTo.duration < 0) { + _logger.logger.error('negative duration computed for frag ' + fragTo.sn + ',level ' + fragTo.level + ', there should be some duration drift between playlist and fragment!'); + } + } + } else { + // we dont know startPTS[toIdx] + if (toIdx > fromIdx) { + fragTo.start = fragFrom.start + fragFrom.duration; + } else { + fragTo.start = fragFrom.start - fragTo.duration; + } + } + } + }]); + + return LevelHelper; +}(); + +exports.default = LevelHelper; + +},{"../utils/logger":38}],26:[function(require,module,exports){ +/** + * HLS interface + */ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +//import FPSController from './controller/fps-controller'; + + +var _events = require('./events'); + +var _events2 = _interopRequireDefault(_events); + +var _errors = require('./errors'); + +var _playlistLoader = require('./loader/playlist-loader'); + +var _playlistLoader2 = _interopRequireDefault(_playlistLoader); + +var _fragmentLoader = require('./loader/fragment-loader'); + +var _fragmentLoader2 = _interopRequireDefault(_fragmentLoader); + +var _abrController = require('./controller/abr-controller'); + +var _abrController2 = _interopRequireDefault(_abrController); + +var _bufferController = require('./controller/buffer-controller'); + +var _bufferController2 = _interopRequireDefault(_bufferController); + +var _capLevelController = require('./controller/cap-level-controller'); + +var _capLevelController2 = _interopRequireDefault(_capLevelController); + +var _streamController = require('./controller/stream-controller'); + +var _streamController2 = _interopRequireDefault(_streamController); + +var _levelController = require('./controller/level-controller'); + +var _levelController2 = _interopRequireDefault(_levelController); + +var _timelineController = require('./controller/timeline-controller'); + +var _timelineController2 = _interopRequireDefault(_timelineController); + +var _logger = require('./utils/logger'); + +var _xhrLoader = require('./utils/xhr-loader'); + +var _xhrLoader2 = _interopRequireDefault(_xhrLoader); + +var _events3 = require('events'); + +var _events4 = _interopRequireDefault(_events3); + +var _keyLoader = require('./loader/key-loader'); + +var _keyLoader2 = _interopRequireDefault(_keyLoader); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Hls = function () { + _createClass(Hls, null, [{ + key: 'isSupported', + value: function isSupported() { + return window.MediaSource && typeof window.MediaSource.isTypeSupported === 'function' && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'); + } + }, { + key: 'Events', + get: function get() { + return _events2.default; + } + }, { + key: 'ErrorTypes', + get: function get() { + return _errors.ErrorTypes; + } + }, { + key: 'ErrorDetails', + get: function get() { + return _errors.ErrorDetails; + } + }, { + key: 'DefaultConfig', + get: function get() { + if (!Hls.defaultConfig) { + Hls.defaultConfig = { + autoStartLoad: true, + startPosition: -1, + debug: false, + capLevelToPlayerSize: false, + maxBufferLength: 30, + maxBufferSize: 60 * 1000 * 1000, + maxBufferHole: 0.5, + maxSeekHole: 2, + seekHoleNudgeDuration: 0.01, + stalledInBufferedNudgeThreshold: 10, + maxFragLookUpTolerance: 0.2, + liveSyncDurationCount: 3, + liveMaxLatencyDurationCount: Infinity, + liveSyncDuration: undefined, + liveMaxLatencyDuration: undefined, + maxMaxBufferLength: 600, + enableWorker: true, + enableSoftwareAES: true, + manifestLoadingTimeOut: 10000, + manifestLoadingMaxRetry: 1, + manifestLoadingRetryDelay: 1000, + levelLoadingTimeOut: 10000, + levelLoadingMaxRetry: 4, + levelLoadingRetryDelay: 1000, + fragLoadingTimeOut: 20000, + fragLoadingMaxRetry: 6, + fragLoadingRetryDelay: 1000, + fragLoadingLoopThreshold: 3, + startFragPrefetch: false, + // fpsDroppedMonitoringPeriod: 5000, + // fpsDroppedMonitoringThreshold: 0.2, + appendErrorMaxRetry: 3, + loader: _xhrLoader2.default, + fLoader: undefined, + pLoader: undefined, + abrController: _abrController2.default, + bufferController: _bufferController2.default, + capLevelController: _capLevelController2.default, + streamController: _streamController2.default, + timelineController: _timelineController2.default, + enableCEA708Captions: true, + enableMP2TPassThrough: false, + abrEwmaFastLive: 5, + abrEwmaSlowLive: 9, + abrEwmaFastVoD: 4, + abrEwmaSlowVoD: 15, + abrEwmaDefaultEstimate: 5e5, // 500 kbps + abrBandWidthFactor: 0.8, + abrBandWidthUpFactor: 0.7 + }; + } + return Hls.defaultConfig; + }, + set: function set(defaultConfig) { + Hls.defaultConfig = defaultConfig; + } + }]); + + function Hls() { + var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + _classCallCheck(this, Hls); + + var defaultConfig = Hls.DefaultConfig; + + if ((config.liveSyncDurationCount || config.liveMaxLatencyDurationCount) && (config.liveSyncDuration || config.liveMaxLatencyDuration)) { + throw new Error('Illegal hls.js config: don\'t mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration'); + } + + for (var prop in defaultConfig) { + if (prop in config) { + continue; + } + config[prop] = defaultConfig[prop]; + } + + if (config.liveMaxLatencyDurationCount !== undefined && config.liveMaxLatencyDurationCount <= config.liveSyncDurationCount) { + throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"'); + } + + if (config.liveMaxLatencyDuration !== undefined && (config.liveMaxLatencyDuration <= config.liveSyncDuration || config.liveSyncDuration === undefined)) { + throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"'); + } + + (0, _logger.enableLogs)(config.debug); + this.config = config; + // observer setup + var observer = this.observer = new _events4.default(); + observer.trigger = function trigger(event) { + for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + data[_key - 1] = arguments[_key]; + } + + observer.emit.apply(observer, [event, event].concat(data)); + }; + + observer.off = function off(event) { + for (var _len2 = arguments.length, data = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + data[_key2 - 1] = arguments[_key2]; + } + + observer.removeListener.apply(observer, [event].concat(data)); + }; + this.on = observer.on.bind(observer); + this.off = observer.off.bind(observer); + this.trigger = observer.trigger.bind(observer); + this.playlistLoader = new _playlistLoader2.default(this); + this.fragmentLoader = new _fragmentLoader2.default(this); + this.levelController = new _levelController2.default(this); + this.abrController = new config.abrController(this); + this.bufferController = new config.bufferController(this); + this.capLevelController = new config.capLevelController(this); + this.streamController = new config.streamController(this); + this.timelineController = new config.timelineController(this); + this.keyLoader = new _keyLoader2.default(this); + //this.fpsController = new FPSController(this); + } + + _createClass(Hls, [{ + key: 'destroy', + value: function destroy() { + _logger.logger.log('destroy'); + this.trigger(_events2.default.DESTROYING); + this.detachMedia(); + this.playlistLoader.destroy(); + this.fragmentLoader.destroy(); + this.levelController.destroy(); + this.abrController.destroy(); + this.bufferController.destroy(); + this.capLevelController.destroy(); + this.streamController.destroy(); + this.timelineController.destroy(); + this.keyLoader.destroy(); + //this.fpsController.destroy(); + this.url = null; + this.observer.removeAllListeners(); + } + }, { + key: 'attachMedia', + value: function attachMedia(media) { + _logger.logger.log('attachMedia'); + this.media = media; + this.trigger(_events2.default.MEDIA_ATTACHING, { media: media }); + } + }, { + key: 'detachMedia', + value: function detachMedia() { + _logger.logger.log('detachMedia'); + this.trigger(_events2.default.MEDIA_DETACHING); + this.media = null; + } + }, { + key: 'loadSource', + value: function loadSource(url) { + _logger.logger.log('loadSource:' + url); + this.url = url; + // when attaching to a source URL, trigger a playlist load + this.trigger(_events2.default.MANIFEST_LOADING, { url: url }); + } + }, { + key: 'startLoad', + value: function startLoad() { + var startPosition = arguments.length <= 0 || arguments[0] === undefined ? -1 : arguments[0]; + + _logger.logger.log('startLoad'); + this.levelController.startLoad(); + this.streamController.startLoad(startPosition); + } + }, { + key: 'stopLoad', + value: function stopLoad() { + _logger.logger.log('stopLoad'); + this.levelController.stopLoad(); + this.streamController.stopLoad(); + } + }, { + key: 'swapAudioCodec', + value: function swapAudioCodec() { + _logger.logger.log('swapAudioCodec'); + this.streamController.swapAudioCodec(); + } + }, { + key: 'recoverMediaError', + value: function recoverMediaError() { + _logger.logger.log('recoverMediaError'); + var media = this.media; + this.detachMedia(); + this.attachMedia(media); + } + + /** Return all quality levels **/ + + }, { + key: 'levels', + get: function get() { + return this.levelController.levels; + } + + /** Return current playback quality level **/ + + }, { + key: 'currentLevel', + get: function get() { + return this.streamController.currentLevel; + } + + /* set quality level immediately (-1 for automatic level selection) */ + , + set: function set(newLevel) { + _logger.logger.log('set currentLevel:' + newLevel); + this.loadLevel = newLevel; + this.streamController.immediateLevelSwitch(); + } + + /** Return next playback quality level (quality level of next fragment) **/ + + }, { + key: 'nextLevel', + get: function get() { + return this.streamController.nextLevel; + } + + /* set quality level for next fragment (-1 for automatic level selection) */ + , + set: function set(newLevel) { + _logger.logger.log('set nextLevel:' + newLevel); + this.levelController.manualLevel = newLevel; + this.streamController.nextLevelSwitch(); + } + + /** Return the quality level of current/last loaded fragment **/ + + }, { + key: 'loadLevel', + get: function get() { + return this.levelController.level; + } + + /* set quality level for current/next loaded fragment (-1 for automatic level selection) */ + , + set: function set(newLevel) { + _logger.logger.log('set loadLevel:' + newLevel); + this.levelController.manualLevel = newLevel; + } + + /** Return the quality level of next loaded fragment **/ + + }, { + key: 'nextLoadLevel', + get: function get() { + return this.levelController.nextLoadLevel; + } + + /** set quality level of next loaded fragment **/ + , + set: function set(level) { + this.levelController.nextLoadLevel = level; + } + + /** Return first level (index of first level referenced in manifest) + **/ + + }, { + key: 'firstLevel', + get: function get() { + return this.levelController.firstLevel; + } + + /** set first level (index of first level referenced in manifest) + **/ + , + set: function set(newLevel) { + _logger.logger.log('set firstLevel:' + newLevel); + this.levelController.firstLevel = newLevel; + } + + /** Return start level (level of first fragment that will be played back) + if not overrided by user, first level appearing in manifest will be used as start level + if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment) + **/ + + }, { + key: 'startLevel', + get: function get() { + return this.levelController.startLevel; + } + + /** set start level (level of first fragment that will be played back) + if not overrided by user, first level appearing in manifest will be used as start level + if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment) + **/ + , + set: function set(newLevel) { + _logger.logger.log('set startLevel:' + newLevel); + this.levelController.startLevel = newLevel; + } + + /** Return the capping/max level value that could be used by automatic level selection algorithm **/ + + }, { + key: 'autoLevelCapping', + get: function get() { + return this.abrController.autoLevelCapping; + } + + /** set the capping/max level value that could be used by automatic level selection algorithm **/ + , + set: function set(newLevel) { + _logger.logger.log('set autoLevelCapping:' + newLevel); + this.abrController.autoLevelCapping = newLevel; + } + + /* check if we are in automatic level selection mode */ + + }, { + key: 'autoLevelEnabled', + get: function get() { + return this.levelController.manualLevel === -1; + } + + /* return manual level */ + + }, { + key: 'manualLevel', + get: function get() { + return this.levelController.manualLevel; + } + }]); + + return Hls; +}(); + +exports.default = Hls; + +},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":7,"./controller/stream-controller":8,"./controller/timeline-controller":9,"./errors":21,"./events":23,"./loader/fragment-loader":28,"./loader/key-loader":29,"./loader/playlist-loader":30,"./utils/logger":38,"./utils/xhr-loader":40,"events":1}],27:[function(require,module,exports){ +'use strict'; + +// This is mostly for support of the es6 module export +// syntax with the babel compiler, it looks like it doesnt support +// function exports like we are used to in node/commonjs +module.exports = require('./hls.js').default; + +},{"./hls.js":26}],28:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _eventHandler = require('../event-handler'); + +var _eventHandler2 = _interopRequireDefault(_eventHandler); + +var _errors = require('../errors'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* + * Fragment Loader + */ + +var FragmentLoader = function (_EventHandler) { + _inherits(FragmentLoader, _EventHandler); + + function FragmentLoader(hls) { + _classCallCheck(this, FragmentLoader); + + return _possibleConstructorReturn(this, Object.getPrototypeOf(FragmentLoader).call(this, hls, _events2.default.FRAG_LOADING)); + } + + _createClass(FragmentLoader, [{ + key: 'destroy', + value: function destroy() { + if (this.loader) { + this.loader.destroy(); + this.loader = null; + } + _eventHandler2.default.prototype.destroy.call(this); + } + }, { + key: 'onFragLoading', + value: function onFragLoading(data) { + var frag = data.frag; + this.frag = frag; + this.frag.loaded = 0; + var config = this.hls.config; + frag.loader = this.loader = typeof config.fLoader !== 'undefined' ? new config.fLoader(config) : new config.loader(config); + this.loader.load(frag.url, 'arraybuffer', this.loadsuccess.bind(this), this.loaderror.bind(this), this.loadtimeout.bind(this), config.fragLoadingTimeOut, 1, 0, this.loadprogress.bind(this), frag); + } + }, { + key: 'loadsuccess', + value: function loadsuccess(event, stats) { + var payload = event.currentTarget.response; + stats.length = payload.byteLength; + // detach fragment loader on load success + this.frag.loader = undefined; + this.hls.trigger(_events2.default.FRAG_LOADED, { payload: payload, frag: this.frag, stats: stats }); + } + }, { + key: 'loaderror', + value: function loaderror(event) { + if (this.loader) { + this.loader.abort(); + } + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: _errors.ErrorDetails.FRAG_LOAD_ERROR, fatal: false, frag: this.frag, response: event }); + } + }, { + key: 'loadtimeout', + value: function loadtimeout() { + if (this.loader) { + this.loader.abort(); + } + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: _errors.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal: false, frag: this.frag }); + } + }, { + key: 'loadprogress', + value: function loadprogress(event, stats) { + this.frag.loaded = stats.loaded; + this.hls.trigger(_events2.default.FRAG_LOAD_PROGRESS, { frag: this.frag, stats: stats }); + } + }]); + + return FragmentLoader; +}(_eventHandler2.default); + +exports.default = FragmentLoader; + +},{"../errors":21,"../event-handler":22,"../events":23}],29:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _eventHandler = require('../event-handler'); + +var _eventHandler2 = _interopRequireDefault(_eventHandler); + +var _errors = require('../errors'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* + * Decrypt key Loader + */ + +var KeyLoader = function (_EventHandler) { + _inherits(KeyLoader, _EventHandler); + + function KeyLoader(hls) { + _classCallCheck(this, KeyLoader); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(KeyLoader).call(this, hls, _events2.default.KEY_LOADING)); + + _this.decryptkey = null; + _this.decrypturl = null; + return _this; + } + + _createClass(KeyLoader, [{ + key: 'destroy', + value: function destroy() { + if (this.loader) { + this.loader.destroy(); + this.loader = null; + } + _eventHandler2.default.prototype.destroy.call(this); + } + }, { + key: 'onKeyLoading', + value: function onKeyLoading(data) { + var frag = this.frag = data.frag, + decryptdata = frag.decryptdata, + uri = decryptdata.uri; + // if uri is different from previous one or if decrypt key not retrieved yet + if (uri !== this.decrypturl || this.decryptkey === null) { + var config = this.hls.config; + frag.loader = this.loader = new config.loader(config); + this.decrypturl = uri; + this.decryptkey = null; + frag.loader.load(uri, 'arraybuffer', this.loadsuccess.bind(this), this.loaderror.bind(this), this.loadtimeout.bind(this), config.fragLoadingTimeOut, config.fragLoadingMaxRetry, config.fragLoadingRetryDelay, this.loadprogress.bind(this), frag); + } else if (this.decryptkey) { + // we already loaded this key, return it + decryptdata.key = this.decryptkey; + this.hls.trigger(_events2.default.KEY_LOADED, { frag: frag }); + } + } + }, { + key: 'loadsuccess', + value: function loadsuccess(event) { + var frag = this.frag; + this.decryptkey = frag.decryptdata.key = new Uint8Array(event.currentTarget.response); + // detach fragment loader on load success + frag.loader = undefined; + this.hls.trigger(_events2.default.KEY_LOADED, { frag: frag }); + } + }, { + key: 'loaderror', + value: function loaderror(event) { + if (this.loader) { + this.loader.abort(); + } + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: _errors.ErrorDetails.KEY_LOAD_ERROR, fatal: false, frag: this.frag, response: event }); + } + }, { + key: 'loadtimeout', + value: function loadtimeout() { + if (this.loader) { + this.loader.abort(); + } + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: _errors.ErrorDetails.KEY_LOAD_TIMEOUT, fatal: false, frag: this.frag }); + } + }, { + key: 'loadprogress', + value: function loadprogress() {} + }]); + + return KeyLoader; +}(_eventHandler2.default); + +exports.default = KeyLoader; + +},{"../errors":21,"../event-handler":22,"../events":23}],30:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('../events'); + +var _events2 = _interopRequireDefault(_events); + +var _eventHandler = require('../event-handler'); + +var _eventHandler2 = _interopRequireDefault(_eventHandler); + +var _errors = require('../errors'); + +var _url = require('../utils/url'); + +var _url2 = _interopRequireDefault(_url); + +var _attrList = require('../utils/attr-list'); + +var _attrList2 = _interopRequireDefault(_attrList); + +var _logger = require('../utils/logger'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** + * Playlist Loader + */ + +var PlaylistLoader = function (_EventHandler) { + _inherits(PlaylistLoader, _EventHandler); + + function PlaylistLoader(hls) { + _classCallCheck(this, PlaylistLoader); + + return _possibleConstructorReturn(this, Object.getPrototypeOf(PlaylistLoader).call(this, hls, _events2.default.MANIFEST_LOADING, _events2.default.LEVEL_LOADING)); + } + + _createClass(PlaylistLoader, [{ + key: 'destroy', + value: function destroy() { + if (this.loader) { + this.loader.destroy(); + this.loader = null; + } + this.url = this.id = null; + _eventHandler2.default.prototype.destroy.call(this); + } + }, { + key: 'onManifestLoading', + value: function onManifestLoading(data) { + this.load(data.url, null); + } + }, { + key: 'onLevelLoading', + value: function onLevelLoading(data) { + this.load(data.url, data.level, data.id); + } + }, { + key: 'load', + value: function load(url, id1, id2) { + var config = this.hls.config, + retry, + timeout, + retryDelay; + + if (this.loading && this.loader) { + if (this.url === url && this.id === id1 && this.id2 === id2) { + // same request than last pending one, don't do anything + return; + } else { + // one playlist load request is pending, but with different params, abort it before loading new playlist + this.loader.abort(); + } + } + + this.url = url; + this.id = id1; + this.id2 = id2; + if (this.id === null) { + retry = config.manifestLoadingMaxRetry; + timeout = config.manifestLoadingTimeOut; + retryDelay = config.manifestLoadingRetryDelay; + } else { + retry = config.levelLoadingMaxRetry; + timeout = config.levelLoadingTimeOut; + retryDelay = config.levelLoadingRetryDelay; + } + this.loader = typeof config.pLoader !== 'undefined' ? new config.pLoader(config) : new config.loader(config); + this.loading = true; + this.loader.load(url, '', this.loadsuccess.bind(this), this.loaderror.bind(this), this.loadtimeout.bind(this), timeout, retry, retryDelay); + } + }, { + key: 'resolve', + value: function resolve(url, baseUrl) { + return _url2.default.buildAbsoluteURL(baseUrl, url); + } + }, { + key: 'parseMasterPlaylist', + value: function parseMasterPlaylist(string, baseurl) { + var levels = [], + result = void 0; + + // https://regex101.com is your friend + var re = /#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g; + while ((result = re.exec(string)) != null) { + var level = {}; + + var attrs = level.attrs = new _attrList2.default(result[1]); + level.url = this.resolve(result[2], baseurl); + + var resolution = attrs.decimalResolution('RESOLUTION'); + if (resolution) { + level.width = resolution.width; + level.height = resolution.height; + } + level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH'); + level.name = attrs.NAME; + + var codecs = attrs.CODECS; + if (codecs) { + codecs = codecs.split(','); + for (var i = 0; i < codecs.length; i++) { + var codec = codecs[i]; + if (codec.indexOf('avc1') !== -1) { + level.videoCodec = this.avc1toavcoti(codec); + } else { + level.audioCodec = codec; + } + } + } + + levels.push(level); + } + return levels; + } + + /** + * Utility method for parseLevelPlaylist to create an initialization vector for a given segment + * @returns {Uint8Array} + */ + + }, { + key: 'createInitializationVector', + value: function createInitializationVector(segmentNumber) { + var uint8View = new Uint8Array(16); + + for (var i = 12; i < 16; i++) { + uint8View[i] = segmentNumber >> 8 * (15 - i) & 0xff; + } + + return uint8View; + } + + /** + * Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data + * @param levelkey - a playlist's encryption info + * @param segmentNumber - the fragment's segment number + * @returns {*} - an object to be applied as a fragment's decryptdata + */ + + }, { + key: 'fragmentDecryptdataFromLevelkey', + value: function fragmentDecryptdataFromLevelkey(levelkey, segmentNumber) { + var decryptdata = levelkey; + + if (levelkey && levelkey.method && levelkey.uri && !levelkey.iv) { + decryptdata = this.cloneObj(levelkey); + decryptdata.iv = this.createInitializationVector(segmentNumber); + } + + return decryptdata; + } + }, { + key: 'avc1toavcoti', + value: function avc1toavcoti(codec) { + var result, + avcdata = codec.split('.'); + if (avcdata.length > 2) { + result = avcdata.shift() + '.'; + result += parseInt(avcdata.shift()).toString(16); + result += ('000' + parseInt(avcdata.shift()).toString(16)).substr(-4); + } else { + result = codec; + } + return result; + } + }, { + key: 'cloneObj', + value: function cloneObj(obj) { + return JSON.parse(JSON.stringify(obj)); + } + }, { + key: 'parseLevelPlaylist', + value: function parseLevelPlaylist(string, baseurl, id) { + var currentSN = 0, + fragdecryptdata, + totalduration = 0, + level = { version: null, type: null, url: baseurl, fragments: [], live: true, startSN: 0 }, + levelkey = { method: null, key: null, iv: null, uri: null }, + cc = 0, + programDateTime = null, + frag = null, + result, + regexp, + duration = null, + title = null, + byteRangeEndOffset = null, + byteRangeStartOffset = null; + + regexp = /(?:(?:#(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-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g; + while ((result = regexp.exec(string)) !== null) { + result.shift(); + result = result.filter(function (n) { + return n !== undefined; + }); + switch (result[0]) { + case 'VERSION': + level.version = parseInt(result[1]); + break; + case 'PLAYLIST-TYPE': + level.type = result[1].toUpperCase(); + break; + case 'MEDIA-SEQUENCE': + currentSN = level.startSN = parseInt(result[1]); + break; + case 'TARGETDURATION': + level.targetduration = parseFloat(result[1]); + break; + case 'EXTM3U': + break; + case 'ENDLIST': + level.live = false; + break; + case 'DIS': + cc++; + break; + case 'BYTERANGE': + var params = result[1].split('@'); + if (params.length === 1) { + byteRangeStartOffset = byteRangeEndOffset; + } else { + byteRangeStartOffset = parseInt(params[1]); + } + byteRangeEndOffset = parseInt(params[0]) + byteRangeStartOffset; + break; + case 'INF': + duration = parseFloat(result[1]); + title = result[2] ? result[2] : null; + break; + case '': + // url + if (!isNaN(duration)) { + var sn = currentSN++; + fragdecryptdata = this.fragmentDecryptdataFromLevelkey(levelkey, sn); + var url = result[1] ? this.resolve(result[1], baseurl) : null; + frag = { url: url, + duration: duration, + title: title, + start: totalduration, + sn: sn, + level: id, + cc: cc, + decryptdata: fragdecryptdata, + programDateTime: programDateTime }; + // only include byte range options if used/needed + if (byteRangeStartOffset !== null) { + frag.byteRangeStartOffset = byteRangeStartOffset; + frag.byteRangeEndOffset = byteRangeEndOffset; + } + level.fragments.push(frag); + totalduration += duration; + duration = null; + title = null; + byteRangeStartOffset = null; + programDateTime = null; + } + break; + case 'KEY': + // https://tools.ietf.org/html/draft-pantos-http-live-streaming-08#section-3.4.4 + var decryptparams = result[1]; + var keyAttrs = new _attrList2.default(decryptparams); + var decryptmethod = keyAttrs.enumeratedString('METHOD'), + decrypturi = keyAttrs.URI, + decryptiv = keyAttrs.hexadecimalInteger('IV'); + if (decryptmethod) { + levelkey = { method: null, key: null, iv: null, uri: null }; + if (decrypturi && decryptmethod === 'AES-128') { + levelkey.method = decryptmethod; + // URI to get the key + levelkey.uri = this.resolve(decrypturi, baseurl); + levelkey.key = null; + // Initialization Vector (IV) + levelkey.iv = decryptiv; + } + } + break; + case 'START': + var startParams = result[1]; + var startAttrs = new _attrList2.default(startParams); + var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET'); + if (startTimeOffset) { + level.startTimeOffset = startTimeOffset; + } + break; + case 'PROGRAM-DATE-TIME': + programDateTime = new Date(Date.parse(result[1])); + break; + case '#': + result.shift(); + break; + default: + _logger.logger.warn('line parsed but not handled: ' + result); + break; + } + } + //logger.log('found ' + level.fragments.length + ' fragments'); + if (frag && !frag.url) { + level.fragments.pop(); + totalduration -= frag.duration; + } + level.totalduration = totalduration; + level.endSN = currentSN - 1; + return level; + } + }, { + key: 'loadsuccess', + value: function loadsuccess(event, stats) { + var target = event.currentTarget, + string = target.responseText, + url = target.responseURL, + id = this.id, + id2 = this.id2, + hls = this.hls, + levels; + + this.loading = false; + // responseURL not supported on some browsers (it is used to detect URL redirection) + if (url === undefined) { + // fallback to initial URL + url = this.url; + } + stats.tload = performance.now(); + stats.mtime = new Date(target.getResponseHeader('Last-Modified')); + if (string.indexOf('#EXTM3U') === 0) { + if (string.indexOf('#EXTINF:') > 0) { + // 1 level playlist + // if first request, fire manifest loaded event, level will be reloaded afterwards + // (this is to have a uniform logic for 1 level/multilevel playlists) + if (this.id === null) { + hls.trigger(_events2.default.MANIFEST_LOADED, { levels: [{ url: url }], url: url, stats: stats }); + } else { + var levelDetails = this.parseLevelPlaylist(string, url, id); + stats.tparsed = performance.now(); + hls.trigger(_events2.default.LEVEL_LOADED, { details: levelDetails, level: id, id: id2, stats: stats }); + } + } else { + levels = this.parseMasterPlaylist(string, url); + // multi level playlist, parse level info + if (levels.length) { + hls.trigger(_events2.default.MANIFEST_LOADED, { levels: levels, url: url, stats: stats }); + } else { + hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: _errors.ErrorDetails.MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'no level found in manifest' }); + } + } + } else { + hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: _errors.ErrorDetails.MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'no EXTM3U delimiter' }); + } + } + }, { + key: 'loaderror', + value: function loaderror(event) { + var details, fatal; + if (this.id === null) { + details = _errors.ErrorDetails.MANIFEST_LOAD_ERROR; + fatal = true; + } else { + details = _errors.ErrorDetails.LEVEL_LOAD_ERROR; + fatal = false; + } + if (this.loader) { + this.loader.abort(); + } + this.loading = false; + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: details, fatal: fatal, url: this.url, loader: this.loader, response: event.currentTarget, level: this.id, id: this.id2 }); + } + }, { + key: 'loadtimeout', + value: function loadtimeout() { + var details, fatal; + if (this.id === null) { + details = _errors.ErrorDetails.MANIFEST_LOAD_TIMEOUT; + fatal = true; + } else { + details = _errors.ErrorDetails.LEVEL_LOAD_TIMEOUT; + fatal = false; + } + if (this.loader) { + this.loader.abort(); + } + this.loading = false; + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: details, fatal: fatal, url: this.url, loader: this.loader, level: this.id, id: this.id2 }); + } + }]); + + return PlaylistLoader; +}(_eventHandler2.default); + +exports.default = PlaylistLoader; + +},{"../errors":21,"../event-handler":22,"../events":23,"../utils/attr-list":34,"../utils/logger":38,"../utils/url":39}],31:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Generate MP4 Box +*/ + +//import Hex from '../utils/hex'; + +var MP4 = function () { + function MP4() { + _classCallCheck(this, MP4); + } + + _createClass(MP4, null, [{ + key: 'init', + value: function init() { + MP4.types = { + avc1: [], // codingname + avcC: [], + btrt: [], + dinf: [], + dref: [], + esds: [], + ftyp: [], + hdlr: [], + mdat: [], + mdhd: [], + mdia: [], + mfhd: [], + minf: [], + moof: [], + moov: [], + mp4a: [], + mvex: [], + mvhd: [], + sdtp: [], + stbl: [], + stco: [], + stsc: [], + stsd: [], + stsz: [], + stts: [], + tfdt: [], + tfhd: [], + traf: [], + trak: [], + trun: [], + trex: [], + tkhd: [], + vmhd: [], + smhd: [] + }; + + var i; + for (i in MP4.types) { + if (MP4.types.hasOwnProperty(i)) { + MP4.types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; + } + } + + var videoHdlr = new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, 0x00, 0x00, // pre_defined + 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' + 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, 0x00, // reserved + 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' + ]); + + var audioHdlr = new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, 0x00, 0x00, // pre_defined + 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' + 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, 0x00, // reserved + 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' + ]); + + MP4.HDLR_TYPES = { + 'video': videoHdlr, + 'audio': audioHdlr + }; + + var dref = new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, 0x00, 0x01, // entry_count + 0x00, 0x00, 0x00, 0x0c, // entry_size + 0x75, 0x72, 0x6c, 0x20, // 'url' type + 0x00, // version 0 + 0x00, 0x00, 0x01 // entry_flags + ]); + + var stco = new Uint8Array([0x00, // version + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, 0x00, 0x00 // entry_count + ]); + + MP4.STTS = MP4.STSC = MP4.STCO = stco; + + MP4.STSZ = new Uint8Array([0x00, // version + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, 0x00, 0x00, // sample_size + 0x00, 0x00, 0x00, 0x00]); + // sample_count + MP4.VMHD = new Uint8Array([0x00, // version + 0x00, 0x00, 0x01, // flags + 0x00, 0x00, // graphicsmode + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor + ]); + MP4.SMHD = new Uint8Array([0x00, // version + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, // balance + 0x00, 0x00 // reserved + ]); + + MP4.STSD = new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, 0x00, 0x01]); // entry_count + + var majorBrand = new Uint8Array([105, 115, 111, 109]); // isom + var avc1Brand = new Uint8Array([97, 118, 99, 49]); // avc1 + var minorVersion = new Uint8Array([0, 0, 0, 1]); + + MP4.FTYP = MP4.box(MP4.types.ftyp, majorBrand, minorVersion, majorBrand, avc1Brand); + MP4.DINF = MP4.box(MP4.types.dinf, MP4.box(MP4.types.dref, dref)); + } + }, { + key: 'box', + value: function box(type) { + var payload = Array.prototype.slice.call(arguments, 1), + size = 8, + i = payload.length, + len = i, + result; + // calculate the total size we need to allocate + while (i--) { + size += payload[i].byteLength; + } + result = new Uint8Array(size); + result[0] = size >> 24 & 0xff; + result[1] = size >> 16 & 0xff; + result[2] = size >> 8 & 0xff; + result[3] = size & 0xff; + result.set(type, 4); + // copy the payload into the result + for (i = 0, size = 8; i < len; i++) { + // copy payload[i] array @ offset size + result.set(payload[i], size); + size += payload[i].byteLength; + } + return result; + } + }, { + key: 'hdlr', + value: function hdlr(type) { + return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]); + } + }, { + key: 'mdat', + value: function mdat(data) { + return MP4.box(MP4.types.mdat, data); + } + }, { + key: 'mdhd', + value: function mdhd(timescale, duration) { + duration *= timescale; + return MP4.box(MP4.types.mdhd, new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, 0x00, 0x02, // creation_time + 0x00, 0x00, 0x00, 0x03, // modification_time + timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // timescale + duration >> 24, duration >> 16 & 0xFF, duration >> 8 & 0xFF, duration & 0xFF, // duration + 0x55, 0xc4, // 'und' language (undetermined) + 0x00, 0x00])); + } + }, { + key: 'mdia', + value: function mdia(track) { + return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale, track.duration), MP4.hdlr(track.type), MP4.minf(track)); + } + }, { + key: 'mfhd', + value: function mfhd(sequenceNumber) { + return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags + sequenceNumber >> 24, sequenceNumber >> 16 & 0xFF, sequenceNumber >> 8 & 0xFF, sequenceNumber & 0xFF])); + } + }, { + key: 'minf', + // sequence_number + value: function minf(track) { + if (track.type === 'audio') { + return MP4.box(MP4.types.minf, MP4.box(MP4.types.smhd, MP4.SMHD), MP4.DINF, MP4.stbl(track)); + } else { + return MP4.box(MP4.types.minf, MP4.box(MP4.types.vmhd, MP4.VMHD), MP4.DINF, MP4.stbl(track)); + } + } + }, { + key: 'moof', + value: function moof(sn, baseMediaDecodeTime, track) { + return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track, baseMediaDecodeTime)); + } + /** + * @param tracks... (optional) {array} the tracks associated with this movie + */ + + }, { + key: 'moov', + value: function moov(tracks) { + var i = tracks.length, + boxes = []; + + while (i--) { + boxes[i] = MP4.trak(tracks[i]); + } + + return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale, tracks[0].duration)].concat(boxes).concat(MP4.mvex(tracks))); + } + }, { + key: 'mvex', + value: function mvex(tracks) { + var i = tracks.length, + boxes = []; + + while (i--) { + boxes[i] = MP4.trex(tracks[i]); + } + return MP4.box.apply(null, [MP4.types.mvex].concat(boxes)); + } + }, { + key: 'mvhd', + value: function mvhd(timescale, duration) { + duration *= timescale; + var bytes = new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + 0x00, 0x00, 0x00, 0x01, // creation_time + 0x00, 0x00, 0x00, 0x02, // modification_time + timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // timescale + duration >> 24 & 0xFF, duration >> 16 & 0xFF, duration >> 8 & 0xFF, duration & 0xFF, // duration + 0x00, 0x01, 0x00, 0x00, // 1.0 rate + 0x01, 0x00, // 1.0 volume + 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined + 0xff, 0xff, 0xff, 0xff // next_track_ID + ]); + return MP4.box(MP4.types.mvhd, bytes); + } + }, { + key: 'sdtp', + value: function sdtp(track) { + var samples = track.samples || [], + bytes = new Uint8Array(4 + samples.length), + flags, + i; + // leave the full box header (4 bytes) all zero + // write the sample table + for (i = 0; i < samples.length; i++) { + flags = samples[i].flags; + bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; + } + + return MP4.box(MP4.types.sdtp, bytes); + } + }, { + key: 'stbl', + value: function stbl(track) { + return MP4.box(MP4.types.stbl, MP4.stsd(track), MP4.box(MP4.types.stts, MP4.STTS), MP4.box(MP4.types.stsc, MP4.STSC), MP4.box(MP4.types.stsz, MP4.STSZ), MP4.box(MP4.types.stco, MP4.STCO)); + } + }, { + key: 'avc1', + value: function avc1(track) { + var sps = [], + pps = [], + i, + data, + len; + // assemble the SPSs + + for (i = 0; i < track.sps.length; i++) { + data = track.sps[i]; + len = data.byteLength; + sps.push(len >>> 8 & 0xFF); + sps.push(len & 0xFF); + sps = sps.concat(Array.prototype.slice.call(data)); // SPS + } + + // assemble the PPSs + for (i = 0; i < track.pps.length; i++) { + data = track.pps[i]; + len = data.byteLength; + pps.push(len >>> 8 & 0xFF); + pps.push(len & 0xFF); + pps = pps.concat(Array.prototype.slice.call(data)); + } + + var avcc = MP4.box(MP4.types.avcC, new Uint8Array([0x01, // version + sps[3], // profile + sps[4], // profile compat + sps[5], // level + 0xfc | 3, // lengthSizeMinusOne, hard-coded to 4 bytes + 0xE0 | track.sps.length // 3bit reserved (111) + numOfSequenceParameterSets + ].concat(sps).concat([track.pps.length // numOfPictureParameterSets + ]).concat(pps))), + // "PPS" + width = track.width, + height = track.height; + //console.log('avcc:' + Hex.hexDump(avcc)); + return MP4.box(MP4.types.avc1, new Uint8Array([0x00, 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, // reserved + 0x00, 0x01, // data_reference_index + 0x00, 0x00, // pre_defined + 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined + width >> 8 & 0xFF, width & 0xff, // width + height >> 8 & 0xFF, height & 0xff, // height + 0x00, 0x48, 0x00, 0x00, // horizresolution + 0x00, 0x48, 0x00, 0x00, // vertresolution + 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, 0x01, // frame_count + 0x12, 0x64, 0x61, 0x69, 0x6C, //dailymotion/hls.js + 0x79, 0x6D, 0x6F, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x68, 0x6C, 0x73, 0x2E, 0x6A, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname + 0x00, 0x18, // depth = 24 + 0x11, 0x11]), // pre_defined = -1 + avcc, MP4.box(MP4.types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB + 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate + 0x00, 0x2d, 0xc6, 0xc0])) // avgBitrate + ); + } + }, { + key: 'esds', + value: function esds(track) { + var configlen = track.config.length; + return new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + + 0x03, // descriptor_type + 0x17 + configlen, // length + 0x00, 0x01, //es_id + 0x00, // stream_priority + + 0x04, // descriptor_type + 0x0f + configlen, // length + 0x40, //codec : mpeg4_audio + 0x15, // stream_type + 0x00, 0x00, 0x00, // buffer_size + 0x00, 0x00, 0x00, 0x00, // maxBitrate + 0x00, 0x00, 0x00, 0x00, // avgBitrate + + 0x05 // descriptor_type + ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor + } + }, { + key: 'mp4a', + value: function mp4a(track) { + var audiosamplerate = track.audiosamplerate; + return MP4.box(MP4.types.mp4a, new Uint8Array([0x00, 0x00, 0x00, // reserved + 0x00, 0x00, 0x00, // reserved + 0x00, 0x01, // data_reference_index + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, track.channelCount, // channelcount + 0x00, 0x10, // sampleSize:16bits + 0x00, 0x00, 0x00, 0x00, // reserved2 + audiosamplerate >> 8 & 0xFF, audiosamplerate & 0xff, // + 0x00, 0x00]), MP4.box(MP4.types.esds, MP4.esds(track))); + } + }, { + key: 'stsd', + value: function stsd(track) { + if (track.type === 'audio') { + return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track)); + } else { + return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track)); + } + } + }, { + key: 'tkhd', + value: function tkhd(track) { + var id = track.id, + duration = track.duration * track.timescale, + width = track.width, + height = track.height; + return MP4.box(MP4.types.tkhd, new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x07, // flags + 0x00, 0x00, 0x00, 0x00, // creation_time + 0x00, 0x00, 0x00, 0x00, // modification_time + id >> 24 & 0xFF, id >> 16 & 0xFF, id >> 8 & 0xFF, id & 0xFF, // track_ID + 0x00, 0x00, 0x00, 0x00, // reserved + duration >> 24, duration >> 16 & 0xFF, duration >> 8 & 0xFF, duration & 0xFF, // duration + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved + 0x00, 0x00, // layer + 0x00, 0x00, // alternate_group + 0x00, 0x00, // non-audio track volume + 0x00, 0x00, // reserved + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix + width >> 8 & 0xFF, width & 0xFF, 0x00, 0x00, // width + height >> 8 & 0xFF, height & 0xFF, 0x00, 0x00 // height + ])); + } + }, { + key: 'traf', + value: function traf(track, baseMediaDecodeTime) { + var sampleDependencyTable = MP4.sdtp(track), + id = track.id; + return MP4.box(MP4.types.traf, MP4.box(MP4.types.tfhd, new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF])), // track_ID + MP4.box(MP4.types.tfdt, new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + baseMediaDecodeTime >> 24, baseMediaDecodeTime >> 16 & 0XFF, baseMediaDecodeTime >> 8 & 0XFF, baseMediaDecodeTime & 0xFF])), // baseMediaDecodeTime + MP4.trun(track, sampleDependencyTable.length + 16 + // tfhd + 16 + // tfdt + 8 + // traf header + 16 + // mfhd + 8 + // moof header + 8), // mdat header + sampleDependencyTable); + } - run: function() - { - _env.suggest.html(''); - _control.press('stop'); - _env.suggestClicked = false; - _env.tries = 0; - - if(options.suggest.length > 0) - { - x = 0; - for(var i in options.suggest) - { - if(x < options.suggestLimit && options.suggest[i].played === false) - { - mode = !!options.suggest[i].live && options.suggest[i].live === true ? 'live': 'vod'; - liveText = !!options.suggest[i].liveText ? options.suggest[i].liveText: 'Live'; - var poster = !!options.suggest[i].poster ? options.suggest[i].poster: ''; - posterImage = poster.length>0 ? '': ''; - suggestItemWidget = $('
' - + posterImage - +'
'+options.suggest[i].title+'
' - +'
'); - - suggestItemWidget.on('click', function(e) - { - - if(options.onSuggest !== false) - { - _call.fn(options.onSuggest, options.suggest[i]); - } - - - if(_env.flashApi===false) - { - options.muted = _env.api.muted; - }else{ - - } - - options.poster = $(this).data('poster'); - _env.suggestClicked = true; - _env.shield.find('.julia-big-play').hide(); - _env.started = false; - options.source = $(this).data('file'); - _boot.selectSource(); - options.autoplay = true; - options.live = $(this).data('mode') == 'live' ? true: false; - options.i18n.liveText = $(this).data('live-text'); - - _env.toolbar.find('.julia-live-indicator>span').text(options.i18n.liveText); - - _debug.run({ - suggestRemoveIndex: $(this).data('index'), - suggestRemove: $(this).data('file') - }); - - options.suggest[$(this).data('index')].played = true; - _env.suggest.removeClass('on'); - - _boot.init(); - _boot.load(); - _support.resize(); - }); - - _env.suggest.append(suggestItemWidget); - x++; - } - } + /** + * Generate a track box. + * @param track {object} a track definition + * @return {Uint8Array} the track box + */ + + }, { + key: 'trak', + value: function trak(track) { + track.duration = track.duration || 0xffffffff; + return MP4.box(MP4.types.trak, MP4.tkhd(track), MP4.mdia(track)); + } + }, { + key: 'trex', + value: function trex(track) { + var id = track.id; + return MP4.box(MP4.types.trex, new Uint8Array([0x00, // version 0 + 0x00, 0x00, 0x00, // flags + id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF, // track_ID + 0x00, 0x00, 0x00, 0x01, // default_sample_description_index + 0x00, 0x00, 0x00, 0x00, // default_sample_duration + 0x00, 0x00, 0x00, 0x00, // default_sample_size + 0x00, 0x01, 0x00, 0x01 // default_sample_flags + ])); + } + }, { + key: 'trun', + value: function trun(track, offset) { + var samples = track.samples || [], + len = samples.length, + arraylen = 12 + 16 * len, + array = new Uint8Array(arraylen), + i, + sample, + duration, + size, + flags, + cts; + offset += 8 + arraylen; + array.set([0x00, // version 0 + 0x00, 0x0f, 0x01, // flags + len >>> 24 & 0xFF, len >>> 16 & 0xFF, len >>> 8 & 0xFF, len & 0xFF, // sample_count + offset >>> 24 & 0xFF, offset >>> 16 & 0xFF, offset >>> 8 & 0xFF, offset & 0xFF // data_offset + ], 0); + for (i = 0; i < len; i++) { + sample = samples[i]; + duration = sample.duration; + size = sample.size; + flags = sample.flags; + cts = sample.cts; + array.set([duration >>> 24 & 0xFF, duration >>> 16 & 0xFF, duration >>> 8 & 0xFF, duration & 0xFF, // sample_duration + size >>> 24 & 0xFF, size >>> 16 & 0xFF, size >>> 8 & 0xFF, size & 0xFF, // sample_size + flags.isLeading << 2 | flags.dependsOn, flags.isDependedOn << 6 | flags.hasRedundancy << 4 | flags.paddingValue << 1 | flags.isNonSync, flags.degradPrio & 0xF0 << 8, flags.degradPrio & 0x0F, // sample_flags + cts >>> 24 & 0xFF, cts >>> 16 & 0xFF, cts >>> 8 & 0xFF, cts & 0xFF // sample_composition_time_offset + ], 12 + 16 * i); + } + return MP4.box(MP4.types.trun, array); + } + }, { + key: 'initSegment', + value: function initSegment(tracks) { + if (!MP4.types) { + MP4.init(); + } + var movie = MP4.moov(tracks), + result; + result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength); + result.set(MP4.FTYP); + result.set(movie, MP4.FTYP.byteLength); + return result; + } + }]); - if(x > 0) - { - if(options.suggestTimeout > 0 && _support.isMobile() === false) - { - setTimeout( function() - { - if(_env.suggestClicked === false) - { - _env.suggest.find('div.julia-suggest-item:first').click(); - } - }, options.suggestTimeout); - } - _env.suggest.addClass('on'); - } + return MP4; +}(); - }else{ - _fullscreen.off(); - } +exports.default = MP4; - _debug.run({ - 'Suggest' : 'raised' - }); - } - }; +},{}],32:[function(require,module,exports){ +'use strict'; - // Support - var _support = { +Object.defineProperty(exports, "__esModule", { + value: true +}); - aspect: function(w,h) - { - return w>0 && h>0 ? h/w: 0; - }, +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * fMP4 remuxer + */ - isMobile: function() - { - if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) - { - return true; - } +var _events = require('../events'); - return false; - }, +var _events2 = _interopRequireDefault(_events); - forceReady: function() - { - if( /Firefox/i.test(navigator.userAgent) ) - { - return true; - } +var _logger = require('../utils/logger'); - return false; - }, +var _mp4Generator = require('../remux/mp4-generator'); - theme: function() - { - _debug.run({ - 'theme': options.themePath+'/'+options.theme+'/julia.css' - }); +var _mp4Generator2 = _interopRequireDefault(_mp4Generator); - $('head').append(''); - }, +var _errors = require('../errors'); - canPlayMedia: function() - { - var vid = document.createElement('video'); - vid.id = 'video-cap-test-'+_env.apiId; - _env.canPlayMediaString = vid.canPlayType('application/vnd.apple.mpegURL'); - $('#video-cap-test'+_env.apiId).remove(); - return (_env.canPlayMediaString == 'probably' || _env.canPlayMediaString == 'maybe'); - }, - - resize: function() - { - // Player dimensions - defaultDim = _env.element.width() ? [_env.element.width(), _env.element.height()]: [options.width, options.height]; - dimensions = options.responsive === true ? _support.getSize(): defaultDim; - - _debug.run({ - 'resizeDefaults': defaultDim, - 'resize': dimensions - }); - - _env.player.width(dimensions[0]); - _env.player.height(dimensions[1]); - - _env.dimensions.width = dimensions[0]; - _env.dimensions.height = dimensions[1]; - - if(_env.flashApi===false) - { - _env.api.setAttribute('width', '100%'); - _env.api.setAttribute('height', '100%'); - }else{ - - if(_env.apiOk === true) - { - _env.api.flashObject.width = '100%'; - _env.api.flashObject.height = '100%'; - }else{ - _env.api.flashObject.width('100%'); - _env.api.flashObject.height('100%'); - } - } - }, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - getSize: function() - { - // Fix video wrapped in inline block, can not get size properlym if inline element detected - var parentBlock = _env.element.parent().css('display').toLowerCase(); - if(parentBlock == 'inline') - { - _env.element.parent().css({'display': 'block'}); - } - var parentWidth = _env.element.parent().width(); - for(i in options.dimensions) - { - var dim = options.dimensions[i]; - if(parentWidth>=dim[0]) - { - if(_env.flashApi===false) - { - a = _support.aspect(parentWidth) == 0 ? dim[1]/dim[0]: _support.aspect(_env.api.videoWidth, _env.api.videoHeight); - }else{ - a = _support.aspect(parentWidth) == 0 ? dim[1]/dim[0]: _support.aspect(_env.api.width(), _env.api.height()); - } - - dimensions = [dim[0],(dim[0]*a)]; - _debug.run({ - 'resizePredefined': dimensions - }); - return dimensions; - } - } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - a = _support.aspect() == 0 ? dim[1]/dim[0]: _support.aspect(_env.api.videoWidth, _env.api.videoHeight); - dimensions = [parentWidth, (parentWidth*a)]; +var MP4Remuxer = function () { + function MP4Remuxer(observer) { + _classCallCheck(this, MP4Remuxer); - _debug.run({ - 'resizeFallback': dimensions - }); + this.observer = observer; + this.ISGenerated = false; + this.PES2MP4SCALEFACTOR = 4; + this.PES_TIMESCALE = 90000; + this.MP4_TIMESCALE = this.PES_TIMESCALE / this.PES2MP4SCALEFACTOR; + } - return dimensions; + _createClass(MP4Remuxer, [{ + key: 'destroy', + value: function destroy() {} + }, { + key: 'insertDiscontinuity', + value: function insertDiscontinuity() { + this._initPTS = this._initDTS = undefined; + } + }, { + key: 'switchLevel', + value: function switchLevel() { + this.ISGenerated = false; + } + }, { + key: 'remux', + value: function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous) { + // generate Init Segment if needed + if (!this.ISGenerated) { + this.generateIS(audioTrack, videoTrack, timeOffset); + } + if (this.ISGenerated) { + //logger.log('nb AVC samples:' + videoTrack.samples.length); + if (videoTrack.samples.length) { + this.remuxVideo(videoTrack, timeOffset, contiguous); + } + //logger.log('nb AAC samples:' + audioTrack.samples.length); + if (audioTrack.samples.length) { + this.remuxAudio(audioTrack, timeOffset, contiguous); + } + } + //logger.log('nb ID3 samples:' + audioTrack.samples.length); + if (id3Track.samples.length) { + this.remuxID3(id3Track, timeOffset); + } + //logger.log('nb ID3 samples:' + audioTrack.samples.length); + if (textTrack.samples.length) { + this.remuxText(textTrack, timeOffset); + } + //notify end of parsing + this.observer.trigger(_events2.default.FRAG_PARSED); + } + }, { + key: 'generateIS', + value: function generateIS(audioTrack, videoTrack, timeOffset) { + var observer = this.observer, + audioSamples = audioTrack.samples, + videoSamples = videoTrack.samples, + pesTimeScale = this.PES_TIMESCALE, + tracks = {}, + data = { tracks: tracks, unique: false }, + computePTSDTS = this._initPTS === undefined, + initPTS, + initDTS; + + if (computePTSDTS) { + initPTS = initDTS = Infinity; + } + if (audioTrack.config && audioSamples.length) { + audioTrack.timescale = audioTrack.audiosamplerate; + // MP4 duration (track duration in seconds multiplied by timescale) is coded on 32 bits + // we know that each AAC sample contains 1024 frames.... + // in order to avoid overflowing the 32 bit counter for large duration, we use smaller timescale (timescale/gcd) + // we just need to ensure that AAC sample duration will still be an integer (will be 1024/gcd) + if (audioTrack.timescale * audioTrack.duration > Math.pow(2, 32)) { + (function () { + var greatestCommonDivisor = function greatestCommonDivisor(a, b) { + if (!b) { + return a; + } + return greatestCommonDivisor(b, a % b); + }; + audioTrack.timescale = audioTrack.audiosamplerate / greatestCommonDivisor(audioTrack.audiosamplerate, 1024); + })(); + } + _logger.logger.log('audio mp4 timescale :' + audioTrack.timescale); + tracks.audio = { + container: 'audio/mp4', + codec: audioTrack.codec, + initSegment: _mp4Generator2.default.initSegment([audioTrack]), + metadata: { + channelCount: audioTrack.channelCount + } + }; + if (computePTSDTS) { + // remember first PTS of this demuxing context. for audio, PTS + DTS ... + initPTS = initDTS = audioSamples[0].pts - pesTimeScale * timeOffset; + } + } + + if (videoTrack.sps && videoTrack.pps && videoSamples.length) { + videoTrack.timescale = this.MP4_TIMESCALE; + tracks.video = { + container: 'video/mp4', + codec: videoTrack.codec, + initSegment: _mp4Generator2.default.initSegment([videoTrack]), + metadata: { + width: videoTrack.width, + height: videoTrack.height + } + }; + if (computePTSDTS) { + initPTS = Math.min(initPTS, videoSamples[0].pts - pesTimeScale * timeOffset); + initDTS = Math.min(initDTS, videoSamples[0].dts - pesTimeScale * timeOffset); + } + } + + if (Object.keys(tracks).length) { + observer.trigger(_events2.default.FRAG_PARSING_INIT_SEGMENT, data); + this.ISGenerated = true; + if (computePTSDTS) { + this._initPTS = initPTS; + this._initDTS = initDTS; + } + } else { + observer.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found' }); + } + } + }, { + key: 'remuxVideo', + value: function remuxVideo(track, timeOffset, contiguous) { + var view, + offset = 8, + pesTimeScale = this.PES_TIMESCALE, + pes2mp4ScaleFactor = this.PES2MP4SCALEFACTOR, + avcSample, + mp4Sample, + mp4SampleLength, + unit, + mdat, + moof, + firstPTS, + firstDTS, + lastDTS, + pts, + dts, + ptsnorm, + dtsnorm, + flags, + samples = []; + + // handle broken streams with PTS < DTS, tolerance up 200ms (18000 in 90kHz timescale) + var PTSDTSshift = track.samples.reduce(function (prev, curr) { + return Math.max(Math.min(prev, curr.pts - curr.dts), -18000); + }, 0); + if (PTSDTSshift < 0) { + _logger.logger.warn('PTS < DTS detected in video samples, shifting DTS by ' + Math.round(PTSDTSshift / 90) + ' ms to overcome this issue'); + } + /* concatenate the video data and construct the mdat in place + (need 8 more bytes to fill length and mpdat type) */ + mdat = new Uint8Array(track.len + 4 * track.nbNalu + 8); + view = new DataView(mdat.buffer); + view.setUint32(0, mdat.byteLength); + mdat.set(_mp4Generator2.default.types.mdat, 4); + while (track.samples.length) { + avcSample = track.samples.shift(); + mp4SampleLength = 0; + // convert NALU bitstream to MP4 format (prepend NALU with size field) + while (avcSample.units.units.length) { + unit = avcSample.units.units.shift(); + view.setUint32(offset, unit.data.byteLength); + offset += 4; + mdat.set(unit.data, offset); + offset += unit.data.byteLength; + mp4SampleLength += 4 + unit.data.byteLength; + } + pts = avcSample.pts - this._initDTS; + // shift dts by PTSDTSshift, to ensure that PTS >= DTS + dts = avcSample.dts - this._initDTS + PTSDTSshift; + // ensure DTS is not bigger than PTS // strap belt !!! + dts = Math.min(pts, dts); + //logger.log(`Video/PTS/DTS/ptsnorm/DTSnorm:${Math.round(avcSample.pts/90)}/${Math.round(avcSample.dts/90)}/${Math.round(pts/90)}/${Math.round(dts/90)}`); + // if not first AVC sample of video track, normalize PTS/DTS with previous sample value + // and ensure that sample duration is positive + if (lastDTS !== undefined) { + ptsnorm = this._PTSNormalize(pts, lastDTS); + dtsnorm = this._PTSNormalize(dts, lastDTS); + var sampleDuration = (dtsnorm - lastDTS) / pes2mp4ScaleFactor; + if (sampleDuration <= 0) { + _logger.logger.log('invalid sample duration at PTS/DTS: ' + avcSample.pts + '/' + avcSample.dts + ':' + sampleDuration); + sampleDuration = 1; + } + mp4Sample.duration = sampleDuration; + } else { + var nextAvcDts = void 0, + delta = void 0; + if (contiguous) { + nextAvcDts = this.nextAvcDts; + } else { + nextAvcDts = timeOffset * pesTimeScale; + } + // first AVC sample of video track, normalize PTS/DTS + ptsnorm = this._PTSNormalize(pts, nextAvcDts); + dtsnorm = this._PTSNormalize(dts, nextAvcDts); + delta = Math.round((dtsnorm - nextAvcDts) / 90); + // if fragment are contiguous, detect hole/overlapping between fragments + if (contiguous) { + if (delta) { + if (delta > 1) { + _logger.logger.log('AVC:' + delta + ' ms hole between fragments detected,filling it'); + } else if (delta < -1) { + _logger.logger.log('AVC:' + -delta + ' ms overlapping between fragments detected'); + } + // set DTS to next DTS + dtsnorm = nextAvcDts; + // offset PTS as well, ensure that PTS is smaller or equal than new DTS + ptsnorm = Math.max(ptsnorm - delta, dtsnorm); + _logger.logger.log('Video/PTS/DTS adjusted: ' + ptsnorm + '/' + dtsnorm + ',delta:' + delta); } + } + // remember first PTS of our avcSamples, ensure value is positive + firstPTS = Math.max(0, ptsnorm); + firstDTS = Math.max(0, dtsnorm); + } + //console.log(`PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${this._initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}); + mp4Sample = { + size: mp4SampleLength, + duration: 0, + cts: (ptsnorm - dtsnorm) / pes2mp4ScaleFactor, + flags: { + isLeading: 0, + isDependedOn: 0, + hasRedundancy: 0, + degradPrio: 0 + } }; - - - // Callback - var _call = { - - fn: function(f, data) - { - data = data||{}; - if(f !== false) - { - f(_options, _env, data); + flags = mp4Sample.flags; + if (avcSample.key === true) { + // the current sample is a key frame + flags.dependsOn = 2; + flags.isNonSync = 0; + } else { + flags.dependsOn = 1; + flags.isNonSync = 1; + } + samples.push(mp4Sample); + lastDTS = dtsnorm; + } + var lastSampleDuration = 0; + if (samples.length >= 2) { + lastSampleDuration = samples[samples.length - 2].duration; + mp4Sample.duration = lastSampleDuration; + } + // next AVC sample DTS should be equal to last sample DTS + last sample duration + this.nextAvcDts = dtsnorm + lastSampleDuration * pes2mp4ScaleFactor; + var dropped = track.dropped; + track.len = 0; + track.nbNalu = 0; + track.dropped = 0; + if (samples.length && navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { + flags = samples[0].flags; + // chrome workaround, mark first sample as being a Random Access Point to avoid sourcebuffer append issue + // https://code.google.com/p/chromium/issues/detail?id=229412 + flags.dependsOn = 2; + flags.isNonSync = 0; + } + track.samples = samples; + moof = _mp4Generator2.default.moof(track.sequenceNumber++, firstDTS / pes2mp4ScaleFactor, track); + track.samples = []; + this.observer.trigger(_events2.default.FRAG_PARSING_DATA, { + data1: moof, + data2: mdat, + startPTS: firstPTS / pesTimeScale, + endPTS: (ptsnorm + pes2mp4ScaleFactor * lastSampleDuration) / pesTimeScale, + startDTS: firstDTS / pesTimeScale, + endDTS: this.nextAvcDts / pesTimeScale, + type: 'video', + nb: samples.length, + dropped: dropped + }); + } + }, { + key: 'remuxAudio', + value: function remuxAudio(track, timeOffset, contiguous) { + var view, + offset = 8, + pesTimeScale = this.PES_TIMESCALE, + mp4timeScale = track.timescale, + pes2mp4ScaleFactor = pesTimeScale / mp4timeScale, + expectedSampleDuration = track.timescale * 1024 / track.audiosamplerate, + aacSample, + mp4Sample, + unit, + mdat, + moof, + firstPTS, + firstDTS, + lastDTS, + pts, + dts, + ptsnorm, + dtsnorm, + samples = [], + samples0 = []; + + track.samples.sort(function (a, b) { + return a.pts - b.pts; + }); + samples0 = track.samples; + + while (samples0.length) { + aacSample = samples0.shift(); + unit = aacSample.unit; + pts = aacSample.pts - this._initDTS; + dts = aacSample.dts - this._initDTS; + //logger.log(`Audio/PTS:${Math.round(pts/90)}`); + // if not first sample + if (lastDTS !== undefined) { + ptsnorm = this._PTSNormalize(pts, lastDTS); + dtsnorm = this._PTSNormalize(dts, lastDTS); + // let's compute sample duration. + // sample Duration should be close to expectedSampleDuration + mp4Sample.duration = (dtsnorm - lastDTS) / pes2mp4ScaleFactor; + if (Math.abs(mp4Sample.duration - expectedSampleDuration) > expectedSampleDuration / 10) { + // more than 10% diff between sample duration and expectedSampleDuration .... lets log that + _logger.logger.log('invalid AAC sample duration at PTS ' + Math.round(pts / 90) + ',should be 1024,found :' + Math.round(mp4Sample.duration * track.audiosamplerate / track.timescale)); + } + // always adjust sample duration to avoid av sync issue + mp4Sample.duration = expectedSampleDuration; + ptsnorm = dtsnorm = expectedSampleDuration * pes2mp4ScaleFactor + lastDTS; + } else { + var nextAacPts = void 0, + delta = void 0; + if (contiguous) { + nextAacPts = this.nextAacPts; + } else { + nextAacPts = timeOffset * pesTimeScale; + } + ptsnorm = this._PTSNormalize(pts, nextAacPts); + dtsnorm = this._PTSNormalize(dts, nextAacPts); + delta = Math.round(1000 * (ptsnorm - nextAacPts) / pesTimeScale); + // if fragment are contiguous, detect hole/overlapping between fragments + if (contiguous) { + // log delta + if (delta) { + if (delta > 0) { + _logger.logger.log(delta + ' ms hole between AAC samples detected,filling it'); + // if we have frame overlap, overlapping for more than half a frame duration + } else if (delta < -12) { + // drop overlapping audio frames... browser will deal with it + _logger.logger.log(-delta + ' ms overlapping between AAC samples detected, drop frame'); + track.len -= unit.byteLength; + continue; } + // set PTS/DTS to next PTS/DTS + ptsnorm = dtsnorm = nextAacPts; } + } + // remember first PTS of our aacSamples, ensure value is positive + firstPTS = Math.max(0, ptsnorm); + firstDTS = Math.max(0, dtsnorm); + if (track.len > 0) { + /* concatenate the audio data and construct the mdat in place + (need 8 more bytes to fill length and mdat type) */ + mdat = new Uint8Array(track.len + 8); + view = new DataView(mdat.buffer); + view.setUint32(0, mdat.byteLength); + mdat.set(_mp4Generator2.default.types.mdat, 4); + } else { + // no audio samples + return; + } + } + mdat.set(unit, offset); + offset += unit.byteLength; + //console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${aacSample.pts}/${aacSample.dts}/${this._initDTS}/${ptsnorm}/${dtsnorm}/${(aacSample.pts/4294967296).toFixed(3)}'); + mp4Sample = { + size: unit.byteLength, + cts: 0, + duration: 0, + flags: { + isLeading: 0, + isDependedOn: 0, + hasRedundancy: 0, + degradPrio: 0, + dependsOn: 1 + } }; + samples.push(mp4Sample); + lastDTS = dtsnorm; + } + var lastSampleDuration = 0; + var nbSamples = samples.length; + //set last sample duration as being identical to previous sample + if (nbSamples >= 2) { + lastSampleDuration = samples[nbSamples - 2].duration; + mp4Sample.duration = lastSampleDuration; + } + if (nbSamples) { + // next aac sample PTS should be equal to last sample PTS + duration + this.nextAacPts = ptsnorm + pes2mp4ScaleFactor * lastSampleDuration; + //logger.log('Audio/PTS/PTSend:' + aacSample.pts.toFixed(0) + '/' + this.nextAacDts.toFixed(0)); + track.len = 0; + track.samples = samples; + moof = _mp4Generator2.default.moof(track.sequenceNumber++, firstDTS / pes2mp4ScaleFactor, track); + track.samples = []; + this.observer.trigger(_events2.default.FRAG_PARSING_DATA, { + data1: moof, + data2: mdat, + startPTS: firstPTS / pesTimeScale, + endPTS: this.nextAacPts / pesTimeScale, + startDTS: firstDTS / pesTimeScale, + endDTS: (dtsnorm + pes2mp4ScaleFactor * lastSampleDuration) / pesTimeScale, + type: 'audio', + nb: nbSamples + }); + } + } + }, { + key: 'remuxID3', + value: function remuxID3(track, timeOffset) { + var length = track.samples.length, + sample; + // consume samples + if (length) { + for (var index = 0; index < length; index++) { + sample = track.samples[index]; + // setting id3 pts, dts to relative time + // using this._initPTS and this._initDTS to calculate relative time + sample.pts = (sample.pts - this._initPTS) / this.PES_TIMESCALE; + sample.dts = (sample.dts - this._initDTS) / this.PES_TIMESCALE; + } + this.observer.trigger(_events2.default.FRAG_PARSING_METADATA, { + samples: track.samples + }); + } - // Api && UI control - var _control = { + track.samples = []; + timeOffset = timeOffset; + } + }, { + key: 'remuxText', + value: function remuxText(track, timeOffset) { + track.samples.sort(function (a, b) { + return a.pts - b.pts; + }); + + var length = track.samples.length, + sample; + // consume samples + if (length) { + for (var index = 0; index < length; index++) { + sample = track.samples[index]; + // setting text pts, dts to relative time + // using this._initPTS and this._initDTS to calculate relative time + sample.pts = (sample.pts - this._initPTS) / this.PES_TIMESCALE; + } + this.observer.trigger(_events2.default.FRAG_PARSING_USERDATA, { + samples: track.samples + }); + } - press: function(action, data) - { - data = data||{}; + track.samples = []; + timeOffset = timeOffset; + } + }, { + key: '_PTSNormalize', + value: function _PTSNormalize(value, reference) { + var offset; + if (reference === undefined) { + return value; + } + if (reference < value) { + // - 2^33 + offset = -8589934592; + } else { + // + 2^33 + offset = 8589934592; + } + /* PTS is 33bit (from 0 to 2^33 -1) + if diff between value and reference is bigger than half of the amplitude (2^32) then it means that + PTS looping occured. fill the gap */ + while (Math.abs(value - reference) > 4294967296) { + value += offset; + } + return value; + } + }, { + key: 'passthrough', + get: function get() { + return false; + } + }]); - if(data.length>0) - { - _debug.run({ - 'action': action, - 'action-data': data, - }); + return MP4Remuxer; +}(); - }else{ +exports.default = MP4Remuxer; - _debug.run({ - 'action': action, - }); - } +},{"../errors":21,"../events":23,"../remux/mp4-generator":31,"../utils/logger":38}],33:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); - switch(action) - { - case 'play': +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * passthrough remuxer + */ - if(options.onPlay !== false) - { - _call.fn(options.onPlay, data); - } - if(_env.flashApi === false) - { - _env.api.play(); +var _events = require('../events'); - }else{ +var _events2 = _interopRequireDefault(_events); - _env.shield.find('.julia-big-play').hide(); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if(_env.started === false) - { - _env.api.play(-1); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - _debug.run({ - 'FlashPlay': 'play', - 'FlashPosition': _env.api.getPosition() - }); +var PassThroughRemuxer = function () { + function PassThroughRemuxer(observer) { + _classCallCheck(this, PassThroughRemuxer); - }else{ + this.observer = observer; + this.ISGenerated = false; + } - _env.api.resume(); //(api.getPosition()); + _createClass(PassThroughRemuxer, [{ + key: 'destroy', + value: function destroy() {} + }, { + key: 'insertDiscontinuity', + value: function insertDiscontinuity() {} + }, { + key: 'switchLevel', + value: function switchLevel() { + this.ISGenerated = false; + } + }, { + key: 'remux', + value: function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, rawData) { + var observer = this.observer; + // generate Init Segment if needed + if (!this.ISGenerated) { + var tracks = {}, + data = { tracks: tracks, unique: true }, + track = videoTrack, + codec = track.codec; + + if (codec) { + data.tracks.video = { + container: track.container, + codec: codec, + metadata: { + width: track.width, + height: track.height + } + }; + } - _debug.run({ - 'FlashPlay': 'resume', - 'FlashPosition': _env.api.getPosition() - }); - } - } + track = audioTrack; + codec = track.codec; + if (codec) { + data.tracks.audio = { + container: track.container, + codec: codec, + metadata: { + channelCount: track.channelCount + } + }; + } + this.ISGenerated = true; + observer.trigger(_events2.default.FRAG_PARSING_INIT_SEGMENT, data); + } + observer.trigger(_events2.default.FRAG_PARSING_DATA, { + data1: rawData, + startPTS: timeOffset, + startDTS: timeOffset, + type: 'audiovideo', + nb: 1, + dropped: 0 + }); + } + }, { + key: 'passthrough', + get: function get() { + return true; + } + }]); - break; case 'pause': + return PassThroughRemuxer; +}(); - if(options.onPause !== false) - { - _call.fn(options.onPause, data); - } +exports.default = PassThroughRemuxer; - if(_env.flashApi === false) - { - _env.api.pause(); +},{"../events":23}],34:[function(require,module,exports){ +'use strict'; - }else{ +Object.defineProperty(exports, "__esModule", { + value: true +}); - _env.api.pause(); - _env.toolbar.find('.julia-playback.pause').removeClass('pause').addClass('play') - .find('i').removeClass('ion-pause').addClass('ion-play'); - _env.shield.find('.julia-big-play').show(); - } +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - break; case 'stop': +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - if(options.onStop !== false) - { - _call.fn(options.onStop, data); - } +// adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js - if(_env.flashApi === false) - { - _env.api.pause(); - _env.api.currentTime = 0; +var AttrList = function () { + function AttrList(attrs) { + _classCallCheck(this, AttrList); - }else{ + if (typeof attrs === 'string') { + attrs = AttrList.parseAttrList(attrs); + } + for (var attr in attrs) { + if (attrs.hasOwnProperty(attr)) { + this[attr] = attrs[attr]; + } + } + } + + _createClass(AttrList, [{ + key: 'decimalInteger', + value: function decimalInteger(attrName) { + var intValue = parseInt(this[attrName], 10); + if (intValue > Number.MAX_SAFE_INTEGER) { + return Infinity; + } + return intValue; + } + }, { + key: 'hexadecimalInteger', + value: function hexadecimalInteger(attrName) { + if (this[attrName]) { + var stringValue = (this[attrName] || '0x').slice(2); + stringValue = (stringValue.length & 1 ? '0' : '') + stringValue; + + var value = new Uint8Array(stringValue.length / 2); + for (var i = 0; i < stringValue.length / 2; i++) { + value[i] = parseInt(stringValue.slice(i * 2, i * 2 + 2), 16); + } + return value; + } else { + return null; + } + } + }, { + key: 'hexadecimalIntegerAsNumber', + value: function hexadecimalIntegerAsNumber(attrName) { + var intValue = parseInt(this[attrName], 16); + if (intValue > Number.MAX_SAFE_INTEGER) { + return Infinity; + } + return intValue; + } + }, { + key: 'decimalFloatingPoint', + value: function decimalFloatingPoint(attrName) { + return parseFloat(this[attrName]); + } + }, { + key: 'enumeratedString', + value: function enumeratedString(attrName) { + return this[attrName]; + } + }, { + key: 'decimalResolution', + value: function decimalResolution(attrName) { + var res = /^(\d+)x(\d+)$/.exec(this[attrName]); + if (res === null) { + return undefined; + } + return { + width: parseInt(res[1], 10), + height: parseInt(res[2], 10) + }; + } + }], [{ + key: 'parseAttrList', + value: function parseAttrList(input) { + var re = /\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g; + var match, + attrs = {}; + while ((match = re.exec(input)) !== null) { + var value = match[2], + quote = '"'; + + if (value.indexOf(quote) === 0 && value.lastIndexOf(quote) === value.length - 1) { + value = value.slice(1, -1); + } + attrs[match[1]] = value; + } + return attrs; + } + }]); + + return AttrList; +}(); + +exports.default = AttrList; + +},{}],35:[function(require,module,exports){ +"use strict"; + +var BinarySearch = { + /** + * Searches for an item in an array which matches a certain condition. + * This requires the condition to only match one item in the array, + * and for the array to be ordered. + * + * @param {Array} list The array to search. + * @param {Function} comparisonFunction + * Called and provided a candidate item as the first argument. + * Should return: + * > -1 if the item should be located at a lower index than the provided item. + * > 1 if the item should be located at a higher index than the provided item. + * > 0 if the item is the item you're looking for. + * + * @return {*} The object if it is found or null otherwise. + */ + search: function search(list, comparisonFunction) { + var minIndex = 0; + var maxIndex = list.length - 1; + var currentIndex = null; + var currentElement = null; + + while (minIndex <= maxIndex) { + currentIndex = (minIndex + maxIndex) / 2 | 0; + currentElement = list[currentIndex]; + + var comparisonResult = comparisonFunction(currentElement); + if (comparisonResult > 0) { + minIndex = currentIndex + 1; + } else if (comparisonResult < 0) { + maxIndex = currentIndex - 1; + } else { + return currentElement; + } + } - _env.started = false; - _env.api.stop(); - } + return null; + } +}; - _env.toolbar.find('.julia-playback.pause').removeClass('pause').addClass('play') - .find('i').removeClass('ion-pause').addClass('ion-play'); - _env.shield.find('.julia-big-play').show(); - _env.toolbar.find('.julia-progress>input').val(0).rangeslider('update', true); +module.exports = BinarySearch; - break; case 'goto': +},{}],36:[function(require,module,exports){ +'use strict'; - if(options.onPosition !== false) - { - _call.fn(options.onPosition, data); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - if(_env.flashApi === false) - { - _env.api.currentTime = data.currentTime; +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - }else{ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - _env.api.seek(data.currentTime); - } +/* + * CEA-708 interpreter +*/ - break; case 'setDuration': +var CEA708Interpreter = function () { + function CEA708Interpreter() { + _classCallCheck(this, CEA708Interpreter); + } - _env.toolbar.find('.julia-panel.julia-duration>span').text(data.duration); + _createClass(CEA708Interpreter, [{ + key: 'attach', + value: function attach(media) { + this.media = media; + this.display = []; + this.memory = []; + } + }, { + key: 'detach', + value: function detach() { + this.clear(); + } + }, { + key: 'destroy', + value: function destroy() {} + }, { + key: '_createCue', + value: function _createCue() { + var VTTCue = window.VTTCue || window.TextTrackCue; + + var cue = this.cue = new VTTCue(-1, -1, ''); + cue.text = ''; + cue.pauseOnExit = false; + + // make sure it doesn't show up before it's ready + cue.startTime = Number.MAX_VALUE; + + // show it 'forever' once we do show it + // (we'll set the end time once we know it later) + cue.endTime = Number.MAX_VALUE; + + this.memory.push(cue); + } + }, { + key: 'clear', + value: function clear() { + var textTrack = this._textTrack; + if (textTrack && textTrack.cues) { + while (textTrack.cues.length > 0) { + textTrack.removeCue(textTrack.cues[0]); + } + } + } + }, { + key: 'push', + value: function push(timestamp, bytes) { + if (!this.cue) { + this._createCue(); + } + + var count = bytes[0] & 31; + var position = 2; + var tmpByte, ccbyte1, ccbyte2, ccValid, ccType; + + for (var j = 0; j < count; j++) { + tmpByte = bytes[position++]; + ccbyte1 = 0x7F & bytes[position++]; + ccbyte2 = 0x7F & bytes[position++]; + ccValid = (4 & tmpByte) === 0 ? false : true; + ccType = 3 & tmpByte; + + if (ccbyte1 === 0 && ccbyte2 === 0) { + continue; + } - if(_env.started === false) - { - _env.toolbar.find('.julia-progress>input').val(0).rangeslider('update', true); - } + if (ccValid) { + if (ccType === 0) // || ccType === 1 + { + // Standard Characters + if (0x20 & ccbyte1 || 0x40 & ccbyte1) { + this.cue.text += this._fromCharCode(ccbyte1) + this._fromCharCode(ccbyte2); + } + // Special Characters + else if ((ccbyte1 === 0x11 || ccbyte1 === 0x19) && ccbyte2 >= 0x30 && ccbyte2 <= 0x3F) { + // extended chars, e.g. musical note, accents + switch (ccbyte2) { + case 48: + this.cue.text += '®'; + break; + case 49: + this.cue.text += '°'; + break; + case 50: + this.cue.text += '½'; + break; + case 51: + this.cue.text += '¿'; + break; + case 52: + this.cue.text += '™'; + break; + case 53: + this.cue.text += '¢'; + break; + case 54: + this.cue.text += ''; + break; + case 55: + this.cue.text += '£'; + break; + case 56: + this.cue.text += '♪'; + break; + case 57: + this.cue.text += ' '; + break; + case 58: + this.cue.text += 'è'; + break; + case 59: + this.cue.text += 'â'; + break; + case 60: + this.cue.text += 'ê'; + break; + case 61: + this.cue.text += 'î'; + break; + case 62: + this.cue.text += 'ô'; + break; + case 63: + this.cue.text += 'û'; + break; + } + } + if ((ccbyte1 === 0x11 || ccbyte1 === 0x19) && ccbyte2 >= 0x20 && ccbyte2 <= 0x2F) { + // Mid-row codes: color/underline + switch (ccbyte2) { + case 0x20: + // White + break; + case 0x21: + // White Underline + break; + case 0x22: + // Green + break; + case 0x23: + // Green Underline + break; + case 0x24: + // Blue + break; + case 0x25: + // Blue Underline + break; + case 0x26: + // Cyan + break; + case 0x27: + // Cyan Underline + break; + case 0x28: + // Red + break; + case 0x29: + // Red Underline + break; + case 0x2A: + // Yellow + break; + case 0x2B: + // Yellow Underline + break; + case 0x2C: + // Magenta + break; + case 0x2D: + // Magenta Underline + break; + case 0x2E: + // Italics + break; + case 0x2F: + // Italics Underline + break; + } + } + if ((ccbyte1 === 0x14 || ccbyte1 === 0x1C) && ccbyte2 >= 0x20 && ccbyte2 <= 0x2F) { + // Mid-row codes: color/underline + switch (ccbyte2) { + case 0x20: + // TODO: shouldn't affect roll-ups... + this._clearActiveCues(timestamp); + // RCL: Resume Caption Loading + // begin pop on + break; + case 0x21: + // BS: Backspace + this.cue.text = this.cue.text.substr(0, this.cue.text.length - 1); + break; + case 0x22: + // AOF: reserved (formerly alarm off) + break; + case 0x23: + // AON: reserved (formerly alarm on) + break; + case 0x24: + // DER: Delete to end of row + break; + case 0x25: + // RU2: roll-up 2 rows + //this._rollup(2); + break; + case 0x26: + // RU3: roll-up 3 rows + //this._rollup(3); + break; + case 0x27: + // RU4: roll-up 4 rows + //this._rollup(4); + break; + case 0x28: + // FON: Flash on + break; + case 0x29: + // RDC: Resume direct captioning + this._clearActiveCues(timestamp); + break; + case 0x2A: + // TR: Text Restart + break; + case 0x2B: + // RTD: Resume Text Display + break; + case 0x2C: + // EDM: Erase Displayed Memory + this._clearActiveCues(timestamp); + break; + case 0x2D: + // CR: Carriage Return + // only affects roll-up + //this._rollup(1); + break; + case 0x2E: + // ENM: Erase non-displayed memory + this._text = ''; + break; + case 0x2F: + this._flipMemory(timestamp); + // EOC: End of caption + // hide any displayed captions and show any hidden one + break; + } + } + if ((ccbyte1 === 0x17 || ccbyte1 === 0x1F) && ccbyte2 >= 0x21 && ccbyte2 <= 0x23) { + // Mid-row codes: color/underline + switch (ccbyte2) { + case 0x21: + // TO1: tab offset 1 column + break; + case 0x22: + // TO1: tab offset 2 column + break; + case 0x23: + // TO1: tab offset 3 column + break; + } + } else { + // Probably a pre-amble address code + } + } + } + } + } + }, { + key: '_fromCharCode', + value: function _fromCharCode(tmpByte) { + switch (tmpByte) { + case 42: + return 'á'; - _debug.run({ - 'setDuration': data.duration - }); + case 2: + return 'á'; - break; case 'volume': + case 2: + return 'é'; - if(_env.flashApi === false) - { - options.volume = data.volume; - _env.api.volume = data.volume/100; + case 4: + return 'í'; - _debug.run({ - 'volume is': _env.api.volume - }); + case 5: + return 'ó'; - }else{ + case 6: + return 'ú'; - options.volume = data.volume; - _env.api.volume(options.volume); + case 3: + return 'ç'; - _debug.run({ - 'volume is': options.volume - }); - } + case 4: + return '÷'; - _env.toolbar.find('.julia-volume>input').val(data.volume).rangeslider('update', true); + case 5: + return 'Ñ'; - if(data.volume>0) - { - _control.press('sound-on'); + case 6: + return 'ñ'; - }else{ - _control.press('sound-off'); - } + case 7: + return '█'; - break; case 'sound-on': + default: + return String.fromCharCode(tmpByte); + } + } + }, { + key: '_flipMemory', + value: function _flipMemory(timestamp) { + this._clearActiveCues(timestamp); + this._flushCaptions(timestamp); + } + }, { + key: '_flushCaptions', + value: function _flushCaptions(timestamp) { + if (!this._has708) { + this._textTrack = this.media.addTextTrack('captions', 'English', 'en'); + this._has708 = true; + } + + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = this.memory[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var memoryItem = _step.value; + + memoryItem.startTime = timestamp; + this._textTrack.addCue(memoryItem); + this.display.push(memoryItem); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } - if(_env.flashApi === false) - { - _env.api.muted = false; + this.memory = []; + this.cue = null; + } + }, { + key: '_clearActiveCues', + value: function _clearActiveCues(timestamp) { + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = this.display[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var displayItem = _step2.value; + + displayItem.endTime = timestamp; + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } - }else{ + this.display = []; + } - _env.api.volume(options.volume); - _env.toolbar.find('.julia-volume>input').val(options.volume).rangeslider('update', true); - } + /* _rollUp(n) + { + // TODO: implement roll-up captions + } + */ - options.muted = false; - _persist.set('volume', options.volume, 30); - _persist.set('muted', options.muted, 30); + }, { + key: '_clearBufferedCues', + value: function _clearBufferedCues() { + //remove them all... + } + }]); - _env.toolbar.find('.julia-sound.off').removeClass('off').addClass('on') - .find('i').removeClass('ion-android-volume-off').addClass('ion-android-volume-up'); + return CEA708Interpreter; +}(); - break; case 'sound-off': +exports.default = CEA708Interpreter; - if(_env.flashApi === false) - { - _env.api.muted = true; +},{}],37:[function(require,module,exports){ +"use strict"; - }else{ +Object.defineProperty(exports, "__esModule", { + value: true +}); - _env.api.volume(0); - _env.toolbar.find('.julia-volume>input').val(0).rangeslider('update', true); - } +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - options.muted = true; - _persist.set('volume', options.volume, 30); - _persist.set('muted', options.muted, 30); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - _env.toolbar.find('.julia-sound.on').removeClass('on').addClass('off') - .find('i').removeClass('ion-android-volume-up').addClass('ion-android-volume-off'); +/* + * compute an Exponential Weighted moving average + * - https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average + * - heavily inspired from shaka-player + */ - break; case 'fullscreen-on': - _fullscreen.on(); +var EWMA = function () { - break; case 'fullscreen-off': - _fullscreen.off(); + // About half of the estimated value will be from the last |halfLife| samples by weight. - break; case 'destroy': + function EWMA(halfLife) { + _classCallCheck(this, EWMA); - setTiemout( function(){ - _env.player.remove(); - }, 100); + // Larger values of alpha expire historical data more slowly. + this.alpha_ = halfLife ? Math.exp(Math.log(0.5) / halfLife) : 0; + this.estimate_ = 0; + this.totalWeight_ = 0; + } - break; default: + _createClass(EWMA, [{ + key: "sample", + value: function sample(weight, value) { + var adjAlpha = Math.pow(this.alpha_, weight); + this.estimate_ = value * (1 - adjAlpha) + adjAlpha * this.estimate_; + this.totalWeight_ += weight; + } + }, { + key: "getTotalWeight", + value: function getTotalWeight() { + return this.totalWeight_; + } + }, { + key: "getEstimate", + value: function getEstimate() { + if (this.alpha_) { + var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_); + return this.estimate_ / zeroFactor; + } else { + return this.estimate_; + } + } + }]); - } + return EWMA; +}(); - return; - } - }; +exports.default = EWMA; +},{}],38:[function(require,module,exports){ +'use strict'; - // Bindings - var _bind = { +Object.defineProperty(exports, "__esModule", { + value: true +}); - // First play with some handlers - playAllowStart: function(e) - { - _env.shield.find('.julia-preloader').removeClass('on'); - _env.shield.find('.julia-big-play').show(); - _env.toolbar.show(); - - // Init actions - _control.press('setDuration', { - 'duration': _timeline.toHuman( _env.duration ) - }); - - // Set mute if needed - if(options.muted === true) - { - _control.press('sound-off'); - }else{ - _control.press('sound-on'); - - // Set initial volume - _control.press('volume', { - 'volume': options.volume - }); - } +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; - // Autostart playback, if possible - if(options.autoplay === true && _support.isMobile() === false) - { - _control.press('play'); - } +function noop() {} - _debug.run({ - 'eventType': e.type, - 'duration': _env.api.duration, - 'readyState': _env.api.readyState - }); - }, +var fakeLogger = { + trace: noop, + debug: noop, + log: noop, + warn: noop, + info: noop, + error: noop +}; - // Bind can play by ready state / fake readyState - // Because of Firefox cannot bind canplaythrough event with HLS.js properly - canplaythrough: function() - { - if(_env.started === false) - { - // don't let mobile Firefox make decision about readyState, mobile Firefox lie! - if(_env.api.readyState>=3 || (_support.isMobile() === true && _env.api.readyState>=2) ) - { - _bind.playAllowStart({ - type: '_bind.canplaythrough' - }); - }else{ - setTimeout( function() - { - _bind.canplaythrough(); - }, 250); - } - } - }, +var exportedLogger = fakeLogger; +//let lastCallTime; +// function formatMsgWithTimeInfo(type, msg) { +// const now = Date.now(); +// const diff = lastCallTime ? '+' + (now - lastCallTime) : '0'; +// lastCallTime = now; +// msg = (new Date(now)).toISOString() + ' | [' + type + '] > ' + msg + ' ( ' + diff + ' ms )'; +// return msg; +// } - // Bind user action & DOM events - domEvents: function() - { - // Buttons - _env.toolbar.on('contextmenu', function(e) - { - e.preventDefault(); - }) - .on('click', '.julia-playback.play', function(e) - { - e.preventDefault(); - _control.press('play'); - }) - .on('click', '.julia-playback.pause', function(e) - { - e.preventDefault(); - _control.press('pause'); - }) - .on('click', '.julia-sound.on', function(e) - { - e.preventDefault(); - _control.press('sound-off'); - }) - .on('click', '.julia-sound.off', function(e) - { - e.preventDefault(); - _control.press('sound-on'); - }) - .on('click', '.julia-fullscreen-toggle.on', function(e) - { - e.preventDefault(); - _control.press('fullscreen-on'); - }) - .on('click', '.julia-fullscreen-toggle.off', function(e) - { - e.preventDefault(); - _control.press('fullscreen-off'); - }); - - // Big play - _env.shield.on('click contextmenu', '.julia-big-play', function(e) - { - e.preventDefault(); - e.stopPropagation(); - if(e.type == 'click') - { - _control.press('play'); - } - }); - - // Area click - _env.shield.on('click', function(e) - { - e.preventDefault(); - e.stopPropagation(); - if(options.pauseOnClick === true && _support.isMobile() === false) - { - _control.press('pause'); - } - }); - - // Fullscreen toolbar behavior bindings - var mouseMoveCleaner; - - _env.player.on('mousemove', '#julia-shield-'+_env.apiId+', #julia-suggest-'+_env.apiId, function(e) - { - e.preventDefault(); - _env.toolbar.addClass('julia-toolbar-visible'); - clearTimeout(mouseMoveCleaner); - - mouseMoveCleaner = setTimeout(function() - { - _env.toolbar.removeClass('julia-toolbar-visible'); - }, 1750); - }) - .on('mouseover mousemove mouseout', '#julia-toolbar-'+_env.apiId+'.julia-toolbar-visible', function(e) - { - e.preventDefault(); - _env.toolbar.addClass('julia-toolbar-visible'); - clearTimeout(mouseMoveCleaner); - - if(e.type == 'mouseout') - { - mouseMoveCleaner = setTimeout(function(e) - { - _env.toolbar.removeClass('julia-toolbar-visible'); - }, 1750); - } - }); +function formatMsg(type, msg) { + msg = '[' + type + '] > ' + msg; + return msg; +} - // Bind progressbar change - _env.toolbar.on('change input', '.julia-progress>input', function(e) - { - if(e.type == 'input') - { - _env.seeking = true; - }else{ +function consolePrintFn(type) { + var func = window.console[type]; + if (func) { + return function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (args[0]) { + args[0] = formatMsg(type, args[0]); + } + func.apply(window.console, args); + }; + } + return noop; +} - seekTo = _timeline.toSeconds( $(this).val() ); - seekTo = seekTo >= _env.duration ? _env.duration: seekTo.toFixed(2); +function exportLoggerFunctions(debugConfig) { + for (var _len2 = arguments.length, functions = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + functions[_key2 - 1] = arguments[_key2]; + } - _control.press('goto', { - currentTime: seekTo - }); + functions.forEach(function (type) { + exportedLogger[type] = debugConfig[type] ? debugConfig[type].bind(debugConfig) : consolePrintFn(type); + }); +} - _env.seeking = false; - } - }); - - // Bind volumebar change - _env.toolbar.on('change', '.julia-volume>input', function() - { - _control.press('volume', { - volume: $(this).val(), - 'event': 'slideChange' - }); - }); - - // Fullscreen event included - $(window).on('resize', function() - { - _support.resize(); - }); - - // Fullscreen change event handler - $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', function(e) - { - if(!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) - { - $('.julia-player').removeClass('julia-fullscreen-on').addClass('julia-fullscreen-off') - .find('button.julia-fullscreen-toggle').removeClass('off').addClass('on') - .find('i').removeClass('ion-android-contract').addClass('ion-android-expand'); - - // Turn off landscape on mobile - if(_support.isMobile()) - { - screen.orientation.unlock(); - screen.msLockOrientation.unlock(); - screen.mozLockOrientation.unlock(); - } - - _debug.run({ - 'fullscreen off' : '#julia-player-'+_env.apiId - }); - - _support.resize(); - - }else{ - - $('.julia-player').removeClass('julia-fullscreen-off').addClass('julia-fullscreen-on') - .find('button.julia-fullscreen-toggle').removeClass('on').addClass('off') - .find('i').removeClass('ion-android-expand').addClass('ion-android-contract'); - - // Force landscape in fullscreen mode on mobile - if(_support.isMobile()) - { - screen.orientation.lock('landscape-primary'); - screen.msLockOrientation.lock('landscape-primary'); - screen.mozLockOrientation.lock('landscape-primary'); - } - - _debug.run({ - 'fullscreen on' : '#julia-player-'+_env.apiId - }); - } - }); - }, +var enableLogs = exports.enableLogs = function enableLogs(debugConfig) { + if (debugConfig === true || (typeof debugConfig === 'undefined' ? 'undefined' : _typeof(debugConfig)) === 'object') { + exportLoggerFunctions(debugConfig, + // Remove out from list here to hard-disable a log-level + //'trace', + 'debug', 'log', 'info', 'warn', 'error'); + // Some browsers don't allow to use bind on console object anyway + // fallback to default if needed + try { + exportedLogger.log(); + } catch (e) { + exportedLogger = fakeLogger; + } + } else { + exportedLogger = fakeLogger; + } +}; + +var logger = exports.logger = exportedLogger; + +},{}],39:[function(require,module,exports){ +'use strict'; + +var URLHelper = { + // build an absolute URL from a relative one using the provided baseURL + // if relativeURL is an absolute URL it will be returned as is. + buildAbsoluteURL: function buildAbsoluteURL(baseURL, relativeURL) { + // remove any remaining space and CRLF + relativeURL = relativeURL.trim(); + if (/^[a-z]+:/i.test(relativeURL)) { + // complete url, not relative + return relativeURL; + } + var relativeURLQuery = null; + var relativeURLHash = null; - // Native video api - nativeEvents: function() - { - if(_support.forceReady()===true && _env.isHls === true) - { - _bind.canplaythrough(); - }else{ - _env.api.oncanplaythrough = function(e) - { - _env.duration = _env.api.duration; - - if(_env.started === false && _env.api.readyState >= 3) - { - _bind.playAllowStart(e); - } - } - } + var relativeURLHashSplit = /^([^#]*)(.*)$/.exec(relativeURL); + if (relativeURLHashSplit) { + relativeURLHash = relativeURLHashSplit[2]; + relativeURL = relativeURLHashSplit[1]; + } + var relativeURLQuerySplit = /^([^\?]*)(.*)$/.exec(relativeURL); + if (relativeURLQuerySplit) { + relativeURLQuery = relativeURLQuerySplit[2]; + relativeURL = relativeURLQuerySplit[1]; + } - // Video playback detect - _env.api.onplay = function(e) - { - _env.toolbar.find('.julia-playback.play').removeClass('play').addClass('pause') - .find('i').removeClass('ion-play').addClass('ion-pause'); - _env.shield.find('.julia-big-play').hide(); - _env.shield.find('.julia-preloader').removeClass('on'); - _ui.posterUnset(); - _env.toolbar.show(); - } + var baseURLHashSplit = /^([^#]*)(.*)$/.exec(baseURL); + if (baseURLHashSplit) { + baseURL = baseURLHashSplit[1]; + } + var baseURLQuerySplit = /^([^\?]*)(.*)$/.exec(baseURL); + if (baseURLQuerySplit) { + baseURL = baseURLQuerySplit[1]; + } - _env.api.onplaying = function(e) - { - _env.toolbar.find('.julia-playback.play').removeClass('play').addClass('pause') - .find('i').removeClass('ion-play').addClass('ion-pause'); - _env.shield.find('.julia-big-play').hide(); - _env.shield.find('.julia-preloader').removeClass('on'); - _env.suggest.html('').removeClass('on'); - _env.toolbar.show(); - _control.press('setDuration', { - 'duration': _timeline.toHuman( _env.duration ) - }); - _env.started = true; - } + var baseURLDomainSplit = /^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(baseURL); + if (!baseURLDomainSplit) { + throw new Error('Error trying to parse base URL.'); + } + // e.g. 'http:', 'https:', '' + var baseURLProtocol = baseURLDomainSplit[2] || ''; + // e.g. 'http://example.com', '//example.com', '' + var baseURLProtocolDomain = baseURLDomainSplit[1] || ''; + // e.g. '/a/b/c/playlist.m3u8' + var baseURLPath = baseURLDomainSplit[4]; + + var builtURL = null; + if (/^\/\//.test(relativeURL)) { + // relative url starts wth '//' so copy protocol (which may be '' if baseUrl didn't provide one) + builtURL = baseURLProtocol + '//' + URLHelper.buildAbsolutePath('', relativeURL.substring(2)); + } else if (/^\//.test(relativeURL)) { + // relative url starts with '/' so start from root of domain + builtURL = baseURLProtocolDomain + '/' + URLHelper.buildAbsolutePath('', relativeURL.substring(1)); + } else { + builtURL = URLHelper.buildAbsolutePath(baseURLProtocolDomain + baseURLPath, relativeURL); + } - // Video pause - _env.api.onpause = function(e) - { - _env.toolbar.find('.julia-playback.pause').removeClass('pause').addClass('play') - .find('i').removeClass('ion-pause').addClass('ion-play'); - _env.shield.find('.julia-big-play').show(); - } + // put the query and hash parts back + if (relativeURLQuery) { + builtURL += relativeURLQuery; + } + if (relativeURLHash) { + builtURL += relativeURLHash; + } + return builtURL; + }, + + // build an absolute path using the provided basePath + // adapted from https://developer.mozilla.org/en-US/docs/Web/API/document/cookie#Using_relative_URLs_in_the_path_parameter + // this does not handle the case where relativePath is "/" or "//". These cases should be handled outside this. + buildAbsolutePath: function buildAbsolutePath(basePath, relativePath) { + var sRelPath = relativePath; + var nUpLn, + sDir = '', + sPath = basePath.replace(/[^\/]*$/, sRelPath.replace(/(\/|^)(?:\.?\/+)+/g, '$1')); + for (var nEnd, nStart = 0; nEnd = sPath.indexOf('/../', nStart), nEnd > -1; nStart = nEnd + nUpLn) { + nUpLn = /^\/(?:\.\.\/)*/.exec(sPath.slice(nEnd))[0].length; + sDir = (sDir + sPath.substring(nStart, nEnd)).replace(new RegExp('(?:\\\/+[^\\\/]*){0,' + (nUpLn - 1) / 3 + '}$'), '/'); + } + return sDir + sPath.substr(nStart); + } +}; +module.exports = URLHelper; - // Errors - _env.api.onerror = function(e) - { - // Bring to life again - if(_env.tries<11) - { - _boot.init(); - } - } +},{}],40:[function(require,module,exports){ +'use strict'; - _env.api.onemptied = function(e) - { - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - _env.api.onstalled = function(e) - { - } +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * XHR based logger + */ - _env.api.onsuspend = function(e) - { - } +var _logger = require('../utils/logger'); - // Video position - _env.api.ontimeupdate = function(e) - { - if(_env.seeking === false) - { - currentTimeReadable = _timeline.toHuman( _env.api.currentTime.toFixed(2) ); - _env.toolbar.find('.julia-progress>input').val( _timeline.toPercents( _env.api.currentTime.toFixed(2) ) ).rangeslider('update', true); - _env.toolbar.find('.julia-panel.julia-currentTime>span').text(currentTimeReadable); - } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - _bind.onTime(currentTimeReadable, _env.api.currentTime); +var XhrLoader = function () { + function XhrLoader(config) { + _classCallCheck(this, XhrLoader); - if(options.debugPlayback === true) - { - _debug.run({ - 'duration/current': _env.duration+'/'+_env.api.currentTime.toFixed(2)+' > '+currentTimeReadable - }); - } + if (config && config.xhrSetup) { + this.xhrSetup = config.xhrSetup; + } + } - // Fix for corrupted video end - // For development purposes only - /* - if(api.currentTime>=(duration-1)) - { - if(_support.forceReady()===true) - { - _suggest.run(); - } - } - */ - } + _createClass(XhrLoader, [{ + key: 'destroy', + value: function destroy() { + this.abort(); + this.loader = null; + } + }, { + key: 'abort', + value: function abort() { + var loader = this.loader, + timeoutHandle = this.timeoutHandle; + if (loader && loader.readyState !== 4) { + this.stats.aborted = true; + loader.abort(); + } + if (timeoutHandle) { + window.clearTimeout(timeoutHandle); + } + } + }, { + key: 'load', + value: function load(url, responseType, onSuccess, onError, onTimeout, timeout, maxRetry, retryDelay) { + var onProgress = arguments.length <= 8 || arguments[8] === undefined ? null : arguments[8]; + var frag = arguments.length <= 9 || arguments[9] === undefined ? null : arguments[9]; + + this.url = url; + if (frag && !isNaN(frag.byteRangeStartOffset) && !isNaN(frag.byteRangeEndOffset)) { + this.byteRange = frag.byteRangeStartOffset + '-' + (frag.byteRangeEndOffset - 1); + } + this.responseType = responseType; + this.onSuccess = onSuccess; + this.onProgress = onProgress; + this.onTimeout = onTimeout; + this.onError = onError; + this.stats = { trequest: performance.now(), retry: 0 }; + this.timeout = timeout; + this.maxRetry = maxRetry; + this.retryDelay = retryDelay; + this.loadInternal(); + } + }, { + key: 'loadInternal', + value: function loadInternal() { + var xhr; + + if (typeof XDomainRequest !== 'undefined') { + xhr = this.loader = new XDomainRequest(); + } else { + xhr = this.loader = new XMLHttpRequest(); + } + + xhr.onloadend = this.loadend.bind(this); + xhr.onprogress = this.loadprogress.bind(this); + + xhr.open('GET', this.url, true); + if (this.byteRange) { + xhr.setRequestHeader('Range', 'bytes=' + this.byteRange); + } + xhr.responseType = this.responseType; + var stats = this.stats; + stats.tfirst = 0; + stats.loaded = 0; + if (this.xhrSetup) { + this.xhrSetup(xhr, this.url); + } + this.timeoutHandle = window.setTimeout(this.loadtimeout.bind(this), this.timeout); + xhr.send(); + } + }, { + key: 'loadend', + value: function loadend(event) { + var xhr = event.currentTarget, + status = xhr.status, + stats = this.stats; + // don't proceed if xhr has been aborted + if (!stats.aborted) { + // http status between 200 to 299 are all successful + if (status >= 200 && status < 300) { + window.clearTimeout(this.timeoutHandle); + stats.tload = Math.max(stats.tfirst, performance.now()); + this.onSuccess(event, stats); + } else { + // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error + if (stats.retry >= this.maxRetry || status >= 400 && status < 499) { + window.clearTimeout(this.timeoutHandle); + _logger.logger.error(status + ' while loading ' + this.url); + this.onError(event); + } else { + _logger.logger.warn(status + ' while loading ' + this.url + ', retrying in ' + this.retryDelay + '...'); + this.destroy(); + window.setTimeout(this.loadInternal.bind(this), this.retryDelay); + // exponential backoff + this.retryDelay = Math.min(2 * this.retryDelay, 64000); + stats.retry++; + } + } + } + } + }, { + key: 'loadtimeout', + value: function loadtimeout(event) { + _logger.logger.warn('timeout while loading ' + this.url); + this.onTimeout(event, this.stats); + } + }, { + key: 'loadprogress', + value: function loadprogress(event) { + var stats = this.stats; + if (stats.tfirst === 0) { + stats.tfirst = Math.max(performance.now(), stats.trequest); + } + stats.loaded = event.loaded; + if (this.onProgress) { + this.onProgress(event, stats); + } + } + }]); + + return XhrLoader; +}(); + +exports.default = XhrLoader; + +},{"../utils/logger":38}]},{},[27])(27) +}); +//# sourceMappingURL=hls.js.map + +/*! rangeslider.js - v2.2.1 | (c) 2016 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */ +(function(factory) { + 'use strict'; + + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } +}(function($) { + 'use strict'; - // Video position - _env.api.seeked = function(e) - { - _env.seeking = false; - } + // Polyfill Number.isNaN(value) + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN + Number.isNaN = Number.isNaN || function(value) { + return typeof value === 'number' && value !== value; + }; - // Video position - _env.api.seeking = function(e) - { - _env.seeking = true; - } + /** + * Range feature detection + * @return {Boolean} + */ + function supportsRange() { + var input = document.createElement('input'); + input.setAttribute('type', 'range'); + return input.type !== 'text'; + } - // Volume - _env.api.onvolumechange = function(e) - { - if(_env.api.muted === false) - { - _env.toolbar.find('.julia-volume>input').val(_env.api.volume*100).rangeslider('update', true); - }else{ - _env.toolbar.find('.julia-volume>input').val(0).rangeslider('update', true); - } + var pluginName = 'rangeslider', + pluginIdentifier = 0, + hasInputRangeSupport = supportsRange(), + defaults = { + polyfill: true, + orientation: 'horizontal', + rangeClass: 'rangeslider', + disabledClass: 'rangeslider--disabled', + horizontalClass: 'rangeslider--horizontal', + verticalClass: 'rangeslider--vertical', + fillClass: 'rangeslider__fill', + handleClass: 'rangeslider__handle', + startEvent: ['mousedown', 'touchstart', 'pointerdown'], + moveEvent: ['mousemove', 'touchmove', 'pointermove'], + endEvent: ['mouseup', 'touchend', 'pointerup'] + }, + constants = { + orientation: { + horizontal: { + dimension: 'width', + direction: 'left', + directionStyle: 'left', + coordinate: 'x' + }, + vertical: { + dimension: 'height', + direction: 'top', + directionStyle: 'bottom', + coordinate: 'y' } + } + }; - // Set video duration - _env.api.ondurationchange = function(e) - { - _env.duration = _env.api.duration; - - if(_env.started === false) - { - _env.duration = _env.api.duration; - _env.seeking = false; - - _debug.run({ - 'duration': _env.duration, - 'readyState': _env.api.readyState, - 'started': _env.started - }); - } - } + /** + * Delays a function for the given number of milliseconds, and then calls + * it with the arguments supplied. + * + * @param {Function} fn [description] + * @param {Number} wait [description] + * @return {Function} + */ + function delay(fn, wait) { + var args = Array.prototype.slice.call(arguments, 2); + return setTimeout(function(){ return fn.apply(null, args); }, wait); + } + + /** + * Returns a debounced function that will make sure the given + * function is not triggered too much. + * + * @param {Function} fn Function to debounce. + * @param {Number} debounceDuration OPTIONAL. The amount of time in milliseconds for which we will debounce the function. (defaults to 100ms) + * @return {Function} + */ + function debounce(fn, debounceDuration) { + debounceDuration = debounceDuration || 100; + return function() { + if (!fn.debouncing) { + var args = Array.prototype.slice.apply(arguments); + fn.lastReturnVal = fn.apply(window, args); + fn.debouncing = true; + } + clearTimeout(fn.debounceTimeout); + fn.debounceTimeout = setTimeout(function(){ + fn.debouncing = false; + }, debounceDuration); + return fn.lastReturnVal; + }; + } - // Bind playback end event - _env.api.onended = function(e) - { - _suggest.run(); - }; - }, + /** + * Check if a `element` is visible in the DOM + * + * @param {Element} element + * @return {Boolean} + */ + function isHidden(element) { + return ( + element && ( + element.offsetWidth === 0 || + element.offsetHeight === 0 || + // Also Consider native `
` elements. + element.open === false + ) + ); + } + /** + * Get hidden parentNodes of an `element` + * + * @param {Element} element + * @return {[type]} + */ + function getHiddenParentNodes(element) { + var parents = [], + node = element.parentNode; + + while (isHidden(node)) { + parents.push(node); + node = node.parentNode; + } + return parents; + } - // Specific events, error handlers - hlsLibEvents: function() - { - _env.hls.on(Hls.Events.ERROR, function(event, data) - { - switch(data.details) - { - case Hls.ErrorDetails.MANIFEST_LOAD_ERROR: - case Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT: - case Hls.ErrorDetails.MANIFEST_PARSING_ERROR: - case Hls.ErrorDetails.LEVEL_LOAD_ERROR: - case Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT: - case Hls.ErrorDetails.LEVEL_SWITCH_ERROR: - case Hls.ErrorDetails.FRAG_LOAD_ERROR: - case Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR: - case Hls.ErrorDetails.FRAG_LOAD_TIMEOUT: - case Hls.ErrorDetails.FRAG_DECRYPT_ERROR: - case Hls.ErrorDetails.FRAG_PARSING_ERROR: - case Hls.ErrorDetails.BUFFER_APPEND_ERROR: - case Hls.ErrorDetails.BUFFER_APPENDING_ERROR: - - _debug.run({ - recoveringError: data.details, - errorType: data.type, - errorFatal: data.fatal - }); - - if(data.fatal === true && _env.tries<11) - { - // Bring to life again - _boot.init(); - } - - break; default: - } - }); - }, + /** + * Returns dimensions for an element even if it is not visible in the DOM. + * + * @param {Element} element + * @param {String} key (e.g. offsetWidth …) + * @return {Number} + */ + function getDimension(element, key) { + var hiddenParentNodes = getHiddenParentNodes(element), + hiddenParentNodesLength = hiddenParentNodes.length, + inlineStyle = [], + dimension = element[key]; + + // Used for native `
` elements + function toggleOpenProperty(element) { + if (typeof element.open !== 'undefined') { + element.open = (element.open) ? false : true; + } + } + if (hiddenParentNodesLength) { + for (var i = 0; i < hiddenParentNodesLength; i++) { - // Flash fallback for legacy browsers - flashEvents: function() - { - // Flash event object - var flashlsEvents = { - - ready: function(flashTime) - { - _env.api.load(_env.source); - - _debug.run({ - 'ready': flashTime - }); - }, - - videoSize: function(width, height) { - _support.resize(); - }, - - complete: function() - { - _debug.run({ - 'suggest': 'call', - 'flashPlayback': 'completed' - }); - - setTimeout( function() - { - _suggest.run(); - }, 1500); - }, - - error: function(code, url, message) - { - _debug.run({ - 'flashErrorCode': code, - 'flashErrorUrl': url, - 'flashErrorMessage': message, - }); - - // Bring to life again - if(_env.tries<10) - { - _boot.init(); - } - }, - - manifest: function(flashDuration, levels_, loadmetrics) - { - _env.duration = flashDuration.toFixed(2); - levels = levels_; - _debug.run({ - 'durationOrigin': flashDuration, - 'duration': _env.duration, - 'durationHuman': _timeline.toHuman( _env.duration ), - 'levels': levels, - 'metrics': loadmetrics, - }); - - if(_env.started === false) - { - _env.shield.find('.julia-preloader').removeClass('on'); - _env.shield.find('.julia-big-play').show(); - _env.toolbar.show(); - - // Init actions - _control.press('setDuration', { - 'duration': _timeline.toHuman( _env.duration ) - }); - - // Set initial volume - if(options.muted === false) - { - _control.press('volume', { - 'volume': options.volume - }); - } - // Set mute if needed - if(options.muted === true) - { - _control.press('sound-off'); - } - - // Autostart playback, if possible - if(options.autoplay === true) - { - _env.api.play(-1); - } - - _debug.run({ - 'duration': _env.api.duration, - 'readyState': true - }); - } - }, - - levelLoaded: function(loadmetrics) - { - }, - - fragmentLoaded: function(loadmetrics) - { - }, - - fragmentPlaying: function(playmetrics) - { - _env.toolbar.find('.julia-playback.play').removeClass('play').addClass('pause') - .find('i').removeClass('ion-play').addClass('ion-pause'); - _env.shield.find('.julia-big-play').hide(); - _env.shield.find('.julia-preloader').removeClass('on'); - _ui.posterUnset(); - _env.suggest.html('').removeClass('on'); - _env.toolbar.show(); - _env.started = true; - }, - - position: function(timemetrics) - { - if(_env.seeking === false) - { - currentTimeReadable = _timeline.toHuman( _env.api.getPosition() ); - _env.toolbar.find('.julia-progress>input').val( _timeline.toPercents( _env.api.getPosition() ) ).rangeslider('update', true); - _env.toolbar.find('.julia-panel.julia-currentTime>span').text(currentTimeReadable); - } - } - }; - - // Create a single global callback function and pass it's name - // to the SWF with the name `callback` in the FlashVars parameter. - window[_env.flashCallbackName] = function(eventName, args) - { - flashlsEvents[eventName].apply(null, args); - }; - }, - - // Time update event callbacks - onTime: function(time, timeNum) - { - if( (time in options.onTime) && _env.onTimeRised.indexOf(time) == -1 ) - { - handle = options.onTime[time]; - _env.onTimeRised.push(time); - - if(typeof window[handle] === 'function') - { - window[handle](time, _env.publicApi); - _debug.run({ - 'onTime': handle+' raised' - }); - - }else{ - - _debug.run({ - 'onTimeError': handle+' is not a function, but: '+(typeof handle) - }); - } + // Cache style attribute to restore it later. + inlineStyle[i] = hiddenParentNodes[i].style.cssText; + + // visually hide + if (hiddenParentNodes[i].style.setProperty) { + hiddenParentNodes[i].style.setProperty('display', 'block', 'important'); + } else { + hiddenParentNodes[i].style.cssText += ';display: block !important'; } + hiddenParentNodes[i].style.height = '0'; + hiddenParentNodes[i].style.overflow = 'hidden'; + hiddenParentNodes[i].style.visibility = 'hidden'; + toggleOpenProperty(hiddenParentNodes[i]); } - }; + // Update dimension + dimension = element[key]; - // Create player - var _boot = { + for (var j = 0; j < hiddenParentNodesLength; j++) { - create: function() - { - // Extend default options with external options - _system.extend(); + // Restore the style attribute + hiddenParentNodes[j].style.cssText = inlineStyle[j]; + toggleOpenProperty(hiddenParentNodes[j]); + } + } + return dimension; + } - // Degbug header - if(options.debug === true && window.console ) - { - console.info('=== Julia console debug start for '+_env.apiId+' ==='); - } + /** + * Returns the parsed float or the default if it failed. + * + * @param {String} str + * @param {Number} defaultValue + * @return {Number} + */ + function tryParseFloat(str, defaultValue) { + var value = parseFloat(str); + return Number.isNaN(value) ? defaultValue : value; + } - _debug.run(options); + /** + * Capitalize the first letter of string + * + * @param {String} str + * @return {String} + */ + function ucfirst(str) { + return str.charAt(0).toUpperCase() + str.substr(1); + } - // Suggest init - for(i in options.suggest) - { - options.suggest[i].played = false; - } + /** + * Plugin + * @param {String} element + * @param {Object} options + */ + function Plugin(element, options) { + this.$window = $(window); + this.$document = $(document); + this.$element = $(element); + this.options = $.extend( {}, defaults, options ); + this.polyfill = this.options.polyfill; + this.orientation = this.$element[0].getAttribute('data-orientation') || this.options.orientation; + this.onInit = this.options.onInit; + this.onSlide = this.options.onSlide; + this.onSlideEnd = this.options.onSlideEnd; + this.DIMENSION = constants.orientation[this.orientation].dimension; + this.DIRECTION = constants.orientation[this.orientation].direction; + this.DIRECTION_STYLE = constants.orientation[this.orientation].directionStyle; + this.COORDINATE = constants.orientation[this.orientation].coordinate; + + // Plugin should only be used as a polyfill + if (this.polyfill) { + // Input range support? + if (hasInputRangeSupport) { return false; } + } - // Set theme CSS - _support.theme(); + this.identifier = 'js-' + pluginName + '-' +(pluginIdentifier++); + this.startEvent = this.options.startEvent.join('.' + this.identifier + ' ') + '.' + this.identifier; + this.moveEvent = this.options.moveEvent.join('.' + this.identifier + ' ') + '.' + this.identifier; + this.endEvent = this.options.endEvent.join('.' + this.identifier + ' ') + '.' + this.identifier; + this.toFixed = (this.step + '').replace('.', '').length - 1; + this.$fill = $('
'); + this.$handle = $('
'); + this.$range = $('
').insertAfter(this.$element).prepend(this.$fill, this.$handle); + + // visually hide the input + this.$element.css({ + 'position': 'absolute', + 'width': '1px', + 'height': '1px', + 'overflow': 'hidden', + 'opacity': '0' + }); - // User data - volume = _persist.get('volume'); - muted = _persist.get('muted'); + // Store context + this.handleDown = $.proxy(this.handleDown, this); + this.handleMove = $.proxy(this.handleMove, this); + this.handleEnd = $.proxy(this.handleEnd, this); - if(volume.length>0) - { - options.volume = parseInt(volume); - } + this.init(); - if(muted.length>0) - { - options.muted = muted == 'false' ? false: true; - } + // Attach Events + var _this = this; + this.$window.on('resize.' + this.identifier, debounce(function() { + // Simulate resizeEnd event. + delay(function() { _this.update(false, false); }, 300); + }, 20)); - // Create UI - _ui.player(); - }, + this.$document.on(this.startEvent, '#' + this.identifier + ':not(.' + this.options.disabledClass + ')', this.handleDown); - // Select playback url - selectSource: function() - { - _env.element.prop('preload', 'none'); - protoSource = _env.element.prop('src') ? _env.element.prop('src'): _env.element.find('source').prop('src'); - _env.source = options.source && options.source.length>0 ? options.source: protoSource; - - _env.isHls = _env.source.indexOf('m3u8') == -1 ? false: true; - if(options.forceHls === true) - { - //_env.source += _env.source.indexOf('?') == -1 ? '?m3u8=yes': '&m3u8=yes'; - _env.isHls = true; - } + // Listen to programmatic value changes + this.$element.on('change.' + this.identifier, function(e, data) { + if (data && data.origin === _this.identifier) { + return; + } - _debug.run({ - 'sourceType': (_env.isHls === false ? 'file': 'hls') - }); + var value = e.target.value, + pos = _this.getPositionFromValue(value); + _this.setPosition(pos); + }); + } - _env.poster = options.poster && options.poster.length>0 ? options.poster: _env.element.prop('poster'); - _ui.posterSet(); - }, + Plugin.prototype.init = function() { + this.update(true, false); + if (this.onInit && typeof this.onInit === 'function') { + this.onInit(); + } + }; - // load media - load: function() - { - _env.shield.find('.julia-preloader').addClass('on'); - - // ************************ - // HLS library supported - // and HLS requested - // ************************ - if(_env.useHlsLib === true) - { - _bind.hlsLibEvents(); - _env.hls.loadSource(_env.source); - _env.hls.attachMedia(_env.api); - - // DETECT LEVEL DATA - _env.hls.on(Hls.Events.LEVEL_LOADED,function(event, data) - { - // SET LIVE EVENT STATE - if(data.details.live === true || options.live === true) - { - _env.isLive = true; - _env.toolbar.addClass('live'); - }else{ - _env.toolbar.removeClass('live'); - } - }); - - for(x in options.triggerHls) - { - handle = options.triggerHls[x]; - - if(typeof window[handle] === 'function') - { - _env.hls.on(Hls.Events[x], function(event, data) - { - window[handle](_env.apiId, event, data); - }); - - }else{ - - _debug.run({ - 'triggerHlsError': handle+' is not a function' - }); - } - } + Plugin.prototype.update = function(updateAttributes, triggerSlide) { + updateAttributes = updateAttributes || false; - // ************************ - // No HLS library support, - // but HLS is requested - // ************************ - }else if(_env.flashApi === true) - { - _api.create(); + if (updateAttributes) { + this.min = tryParseFloat(this.$element[0].getAttribute('min'), 0); + this.max = tryParseFloat(this.$element[0].getAttribute('max'), 100); + this.value = tryParseFloat(this.$element[0].value, Math.round(this.min + (this.max-this.min)/2)); + this.step = tryParseFloat(this.$element[0].getAttribute('step'), 1); + } - // ************************ - // Classic VOD file - // ************************ - }else{ + this.handleDimension = getDimension(this.$handle[0], 'offset' + ucfirst(this.DIMENSION)); + this.rangeDimension = getDimension(this.$range[0], 'offset' + ucfirst(this.DIMENSION)); + this.maxHandlePos = this.rangeDimension - this.handleDimension; + this.grabPos = this.handleDimension / 2; + this.position = this.getPositionFromValue(this.value); + + // Consider disabled state + if (this.$element[0].disabled) { + this.$range.addClass(this.options.disabledClass); + } else { + this.$range.removeClass(this.options.disabledClass); + } - _env.api.load(); - } + this.setPosition(this.position, triggerSlide); + }; - // ************************ - // Bind all events - // ************************ - if(_env.apiOk === true) - { - _bind.domEvents(); - - if(_env.flashApi === false) - { - // Classic html5 api - _bind.nativeEvents(); - }else{ - // Flash api - _bind.flashEvents(); - } - } + Plugin.prototype.handleDown = function(e) { + this.$document.on(this.moveEvent, this.handleMove); + this.$document.on(this.endEvent, this.handleEnd); - stats = { - 'isHls': _env.isHls, - 'flashApi': _env.flashApi, - 'useHlsLib': _env.useHlsLib, - 'live': _env.isLive, - 'canPlayMediaString': _env.canPlayMediaString, - 'canPlayMedia': _env.canPlayMedia, - }; - - _debug.run(stats); - - // Define publicApi - _env.publicApi = { - control: _control, - options: options, - support: _support, - dimensions: _env.dimensions, - timeline: _timeline, - shield: _env.shield, - toolbar: _env.toolbar, - media: _env.api, - id: _env.apiId, - stats: stats - }; - - }, - - // Initilize player - init: function() - { - // Create source - _boot.selectSource(); - _env.useHlsLib = false; - _env.flashApi = false; - _env.isLive = false; - _env.canPlayMedia = _support.canPlayMedia(); - _env.tries+=1; - - if(_env.isHls === true) - { - _env.useHlsLib = _env.canPlayMedia === false && Hls.isSupported() ? true: false; - } + // If we click on the handle don't set the new position + if ((' ' + e.target.className + ' ').replace(/[\n\t]/g, ' ').indexOf(this.options.handleClass) > -1) { + return; + } - // ************************ - // HLS library supported - // and HLS requested - // ************************ - if(_env.useHlsLib === true) - { - _api.create(); - _env.hls = new Hls(options.hlsConfig); - - // ************************ - // No HLS library support, - // but HLS is requested - // ************************ - }else if(_env.isHls === true && _env.useHlsLib === false && _env.canPlayMedia === false) - { - _env.flashApi = true; - - // ************************ - // Classic VOD file - // ************************ - }else{ - - _api.create(); - _env.api.src = _env.source; - } + var pos = this.getRelativePosition(e), + rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION], + handlePos = this.getPositionFromNode(this.$handle[0]) - rangePos, + setPos = (this.orientation === 'vertical') ? (this.maxHandlePos - (pos - this.grabPos)) : (pos - this.grabPos); - if(options.live === true) - { - _env.isLive = true; - _env.toolbar.addClass('live'); - }else{ - _env.toolbar.removeClass('live'); - } - } + this.setPosition(setPos); + + if (pos >= handlePos && pos < handlePos + this.handleDimension) { + this.grabPos = pos - handlePos; } + }; - // Build player object - _boot.create(); + Plugin.prototype.handleMove = function(e) { + e.preventDefault(); + var pos = this.getRelativePosition(e); + var setPos = (this.orientation === 'vertical') ? (this.maxHandlePos - (pos - this.grabPos)) : (pos - this.grabPos); + this.setPosition(setPos); + }; - // Bring to life - _boot.init(); + Plugin.prototype.handleEnd = function(e) { + e.preventDefault(); + this.$document.off(this.moveEvent, this.handleMove); + this.$document.off(this.endEvent, this.handleEnd); - // Bring to life - _boot.load(); + // Ok we're done fire the change event + this.$element.trigger('change', { origin: this.identifier }); - // Player dimensions - _support.resize(); + if (this.onSlideEnd && typeof this.onSlideEnd === 'function') { + this.onSlideEnd(this.position, this.value); + } + }; - // Populate public API - return _env.publicApi; - } + Plugin.prototype.cap = function(pos, min, max) { + if (pos < min) { return min; } + if (pos > max) { return max; } + return pos; + }; - // Build plugin instances - $.fn.julia = function(opts) - { - var resize = []; - return this.each(function() - { - var element = $(this); + Plugin.prototype.setPosition = function(pos, triggerSlide) { + var value, newPos; - // Return if this element already has a plugin instance - if ($(this).data('julia')) return; + if (triggerSlide === undefined) { + triggerSlide = true; + } - // Pass options to constructor - var __julia = new _julia($(this), opts); + // Snapping steps + value = this.getValueFromPosition(this.cap(pos, 0, this.maxHandlePos)); + newPos = this.getPositionFromValue(value); - // Store plugin object in element's data - $(this).data('julia', __julia); - }); - }; + // Update ui + this.$fill[0].style[this.DIMENSION] = (newPos + this.grabPos) + 'px'; + this.$handle[0].style[this.DIRECTION_STYLE] = newPos + 'px'; + this.setValue(value); - // API wrappers - $.fn.play = function() - { - $(this).data('julia').control.press('play'); - }; + // Update globals + this.position = newPos; + this.value = value; - $.fn.destroy = function() - { - $(this).data('julia').control.press('destroy'); + if (triggerSlide && this.onSlide && typeof this.onSlide === 'function') { + this.onSlide(newPos, value); + } }; - $.fn.media = function() - { - return $(this).data('julia').media; + // Returns element position relative to the parent + Plugin.prototype.getPositionFromNode = function(node) { + var i = 0; + while (node !== null) { + i += node.offsetLeft; + node = node.offsetParent; + } + return i; }; - $.fn.pause = function() - { - $(this).data('julia').control.press('pause'); + Plugin.prototype.getRelativePosition = function(e) { + // Get the offset DIRECTION relative to the viewport + var ucCoordinate = ucfirst(this.COORDINATE), + rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION], + pageCoordinate = 0; + + if (typeof e['page' + ucCoordinate] !== 'undefined') { + pageCoordinate = e['page' + ucCoordinate]; + } + // IE8 support :) + else if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') { + pageCoordinate = e.originalEvent['client' + ucCoordinate]; + } + else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0]['page' + ucCoordinate] !== 'undefined') { + pageCoordinate = e.originalEvent.touches[0]['page' + ucCoordinate]; + } + else if(e.currentPoint && typeof e.currentPoint[this.COORDINATE] !== 'undefined') { + pageCoordinate = e.currentPoint[this.COORDINATE]; + } + + return pageCoordinate - rangePos; }; - $.fn.stop = function() - { - $(this).data('julia').control.press('stop'); + Plugin.prototype.getPositionFromValue = function(value) { + var percentage, pos; + percentage = (value - this.min)/(this.max - this.min); + pos = (!Number.isNaN(percentage)) ? percentage * this.maxHandlePos : 0; + return pos; }; - $.fn.goto = function(t) - { - $(this).data('julia').control.press('goto', { - currentTime: t - }); + Plugin.prototype.getValueFromPosition = function(pos) { + var percentage, value; + percentage = ((pos) / (this.maxHandlePos || 1)); + value = this.step * Math.round(percentage * (this.max - this.min) / this.step) + this.min; + return Number((value).toFixed(this.toFixed)); }; - $.fn.mute = function() - { - if($(this).data('julia').media.muted === false) - { - $(this).data('julia').control.press('sound-off'); - }else{ - $(this).data('julia').control.press('sound-on'); + Plugin.prototype.setValue = function(value) { + if (value === this.value && this.$element[0].value !== '') { + return; } - }; - $.fn.volume = function(volume) - { - $(this).data('julia').control.press('volume', { - volume: volume - }); + // Set the new value and fire the `input` event + this.$element + .val(value) + .trigger('input', { origin: this.identifier }); }; - $.fn.getID = function() - { - return $(this).data('julia').id; + Plugin.prototype.destroy = function() { + this.$document.off('.' + this.identifier); + this.$window.off('.' + this.identifier); + + this.$element + .off('.' + this.identifier) + .removeAttr('style') + .removeData('plugin_' + pluginName); + + // Remove the generated markup + if (this.$range && this.$range.length) { + this.$range[0].parentNode.removeChild(this.$range[0]); + } }; - $.fn.stats = function() - { - return $(this).data('julia').stats; + // A really lightweight plugin wrapper around the constructor, + // preventing against multiple instantiations + $.fn[pluginName] = function(options) { + var args = Array.prototype.slice.call(arguments, 1); + + return this.each(function() { + var $this = $(this), + data = $this.data('plugin_' + pluginName); + + // Create a new instance. + if (!data) { + $this.data('plugin_' + pluginName, (data = new Plugin(this, options))); + } + + // Make it possible to access methods from public. + // e.g `$element.rangeslider('method');` + if (typeof options === 'string') { + data[options].apply(data, args); + } + }); }; -})(jQuery); + return 'rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);'; + +})); + +/* *********************** +| Julia player pre boot file +************************ */ + + +/* *********************************** +* Julia player +* +* @author prochor666@gmail.com +* version: 0.9.11 +* build: 2016-08-16 +* licensed under the MIT License +* +* @requires: +* jquery [required] +* hls.js [required] +* rangeslider.js [required] +* +************************************* */ + +var Julia = function(options) +{ + if(!window.jQuery) + { + alert('jQuery is required'); + window.stop(); + } + + var self = this; + + // Import self.options + options = typeof options === 'undefined' ? {}: options; + + // Root path workaround + var __JULIA_ROOT_PATH__ = 'julia'; + dir = $('script[src*="julia-player"]').attr('src'); + name = dir.split('/').pop(); + __JULIA_ROOT_PATH__ = dir.replace('/js/'+name,""); + $('head').append(''); + //$('head').append(''); + + + + // Default self.options + self.options = { + source: false, + autoplay: false, + volume: 25, + element: $('video'), + muted: false, + width: 512, + height: 288, + debug: false, + debugPlayback: false, + forceHls: false, + live: false, + responsive: true, + dimensions: [ + [1920, 1080], + [1280,720], + [960,540], + [640,360], + [512,288] + ], + pauseOnClick: false, + poster: '', + hlsConfig: { +/* + debug : false, + autoStartLoad : true, + autoRecoverError : true, + maxBufferLength : 60, + maxBufferSize : 120*1000*1000, + liveSyncDurationCount : 5, // D: 3 + liveMaxLatencyDurationCount: 10, + enableWorker : true, + levelLoadingTimeOut: 10000, + levelLoadingMaxRetry: 6, + levelLoadingRetryDelay: 500, + fragLoadingTimeOut : 5000, + fragLoadingMaxRetry : 6, + fragLoadingRetryDelay : 100, + manifestLoadingTimeOut : 10000, + manifestLoadingMaxRetry : 6, + manifestLoadingRetryDelay : 500, + fpsDroppedMonitoringPeriod : 5000, + fpsDroppedMonitoringThreshold : 0.2, + appendErrorMaxRetry : 200, + + xhrSetup: function(xhr, url) { + xhr.withCredentials = true; + xhr.setRequestHeader("Cache-Control","no-cache,max-age=0"); + xhr.setRequestHeader("pragma", "no-cache"); + }*/ + }, + dashConfig: { + + }, + suggest: [], + suggestLimit: 2, + suggestTimeout: 10000, + themePath: __JULIA_ROOT_PATH__+'/css/themes', + pluginPath: __JULIA_ROOT_PATH__+'/js/plugins', + theme: 'default', + i18n: { + liveText: 'Live' + }, + onTime: {}, + triggerHls: {}, + onPlay: false, + onPause: false, + onStop: false, + onPosition: false, + onSuggest: false, + }; + + + + + + + // Environment + self.env = { + shield: '', + element: self.options.element, + suggest: '', + toolbar: '', + poster: '', + api: '', + apiId: Math.floor((Math.random()*10000000)+1), // Create a shadow api unique ID + player: '', + isLive: false, + hls: {}, + canPlayMedia: '', + canPlayMediaString: '', + isHls: false, + useHlsLib: false, + tries: 0, + source: '', + duration: 0, + apiOk: false, + onTimeRised: [], + seeking: false, + dimensions: { + width: 0, + height: 0, + }, + started: false, + publicApi: {}, + suggestPointer: 0, + suggestClicked: false, + progressStep: 0.01, // Full sense: 100, so .01 is enough accurate + }; + + + + + + + + + + // Extend self.options + var _extend = function() + { + for(o in self.options) + { + if(options.hasOwnProperty(o)) + { + self.options[o] = options[o]; + } + } + }; + + + + + // Extend default self.options with external self.options + _extend(); + + + + + + + // Console debug + var _debug = function(data) + { + if(self.options.debug === true) + { + if(window.console) + { + for(d in data) + { + console.log(' - [instance: '+self.env.apiId+'] '+d+' ['+(typeof data[d])+']', data[d]); + } + } + } + }; + + + + + + + + + + // Persistent user data in cookies + var _client = { + + set: function(name, value, days) + { + dateObj = new Date(); + dateObj.setTime(dateObj.getTime() + (days*24*60*60*1000)); + var expires = 'expires=' + dateObj.toUTCString(); + document.cookie = name + '=' + value + '; ' + expires + '; path=/'; + }, + + get: function(name) + { + var name = name + '='; + var ca = document.cookie.split(';'); + + for(var i=0; i'); + self.env.player.prepend(apiElement); + self.env.api = document.getElementById('julia-api-'+self.env.apiId); + self.env.api.controls = false; + self.env.apiOk = true; + + _debug({ + 'apiId': self.env.apiId, + 'api': self.env.api, + }); + } + }; + + + + + + + + + + + + + + + + + // UI kit + var _ui = { + + // Video shield for helpers, buttons, preloaders, advertising etc... + shield: function() + { + self.env.shield = $('
' + +' ' + +'
' + +'
' + ); + + self.env.suggest = $('
'); + }, + + posterSet: function() + { + _ui.posterUnset(); + if(self.env.poster.length > 0) + { + img = $('') + + self.env.shield.append(img); + + _debug({ + poster: self.env.poster, + }) + } + }, + + posterUnset: function() + { + self.env.shield.find('img').remove(); + }, + + // Button toolbar + toolbar: function() + { + self.env.toolbar = $('
' + +'
' + +' ' + +'
' + +'
' + +' '+self.options.i18n.liveText+'' + +'
' + +'
' + +' 00:00:00 / ' + +'
' + +'
' + +' 00:00:00' + +'
' + +'' + +'' + +'
' + +' ' + +'
' + +'' + +'
'); + }, + + // Create player object + player: function() + { + _ui.shield(); + _ui.toolbar(); + + self.env.player = $('
' + +'
'); + + self.env.player.append(self.env.shield); + self.env.player.append(self.env.suggest); + self.env.player.append(self.env.toolbar); + + self.env.element.hide(); + self.env.player.insertAfter(self.env.element); + + // Simulate preload + self.env.shield.find('.julia-big-play').hide(); + self.env.toolbar.hide(); + + // Rangeslider polyfill + $('#julia-toolbar-'+self.env.apiId+'>div.julia-progress>input, #julia-toolbar-'+self.env.apiId+'>div.julia-volume>input').rangeslider({ + polyfill: false, + rangeClass: 'julia-rangeslider', + disabledClass: 'julia-rangeslider--disabled', + horizontalClass: 'julia-rangeslider--horizontal', + verticalClass: 'julia-rangeslider--vertical', + fillClass: 'julia-rangeslider__fill', + handleClass: 'julia-rangeslider__handle', + onInit: function(){}, + onSlide : function(position, value){}, + onSlideEnd : function(position, value){} + }); + + _debug({ + 'element': self.env.element, + 'toolbar': self.env.toolbar, + 'shield': self.env.shield, + 'player': self.env.player, + }); + } + }; + + + + + + + + + + + + + + // Fullscreen on + var _fullscreen = { + + on: function() + { + var videoFrame = document.querySelector('#julia-player-'+self.env.apiId); + + if(videoFrame.requestFullscreen) + { + videoFrame.requestFullscreen(); + } else if (videoFrame.msRequestFullscreen) + { + videoFrame.msRequestFullscreen(); + } else if (videoFrame.mozRequestFullScreen) + { + videoFrame.mozRequestFullScreen(); + } else if(videoFrame.webkitRequestFullscreen) + { + videoFrame.webkitRequestFullscreen(); + } + }, + + // Fullscreen off + off: function() + { + if(document.exitFullscreen) + { + document.exitFullscreen(); + }else if(document.msExitFullscreen) + { + document.msExitFullscreen(); + } else if(document.mozCancelFullScreen) + { + document.mozCancelFullScreen(); + } else if(document.webkitExitFullscreen) + { + document.webkitExitFullscreen(); + } + } + }; + + + + + + + + + + + + // Timeline numbers coonversion + var _timecode = { + + toPercents: function(currentTime) + { + p = (currentTime/self.env.duration)*100; + return p; + }, + + toSeconds: function(percent) + { + t = (self.env.duration/100)*percent; + return t; + }, + + toNum: function(human) + { + human = human.split(':'); + human.reverse(); + s = parseInt(human[0]); + m = human.length>1 ? parseInt(human[1]): 0; + h = human.length>2 ? parseInt(human[3]): 0; + t = s + m*60 + h*60*60; + return t; + }, + + toHuman: function(time) + { + time = time.toString().split('.'); + s = time[0]; + H = Math.floor(s/3600); + M = Math.floor( ( s - (H*3600) ) / 60 ); + S = Math.floor( ( s - (H*3600) - (M*60) ) ); + + H = ('0'+H.toString()).slice(-2); + M = ('0'+M.toString()).slice(-2); + S = ('0'+S.toString()).slice(-2); + + str = H>0 ? H+':'+M+':'+S: M+':'+S; + + return str; + } + }; + + + + + + + + + + + + + + + // Suggest engine + var _suggest = { + + run: function() + { + self.env.suggest.html(''); + _control.press('stop'); + self.env.suggestClicked = false; + self.env.tries = 0; + + if(self.options.suggest.length > 0) + { + x = 0; + for(var i in self.options.suggest) + { + if(x < self.options.suggestLimit && self.options.suggest[i].played === false) + { + mode = !!self.options.suggest[i].live && self.options.suggest[i].live === true ? 'live': 'vod'; + liveText = !!self.options.suggest[i].liveText ? self.options.suggest[i].liveText: 'Live'; + var poster = !!self.options.suggest[i].poster ? self.options.suggest[i].poster: ''; + posterImage = poster.length>0 ? '': ''; + suggestItemWidget = $('
' + + posterImage + +'
'+self.options.suggest[i].title+'
' + +'
'); + + suggestItemWidget.on('click', function(e) + { + + if(self.options.onSuggest !== false) + { + _call.fn(self.options.onSuggest, self.options.suggest[i]); + } + + self.options.muted = self.env.api.muted; + + self.options.poster = $(this).data('poster'); + self.env.suggestClicked = true; + self.env.shield.find('.julia-big-play').hide(); + self.env.started = false; + self.options.source = $(this).data('file'); + _boot.selectSource(); + self.options.autoplay = true; + self.options.live = $(this).data('mode') == 'live' ? true: false; + self.options.i18n.liveText = $(this).data('live-text'); + + self.env.toolbar.find('.julia-live-indicator>span').text(self.options.i18n.liveText); + + _debug({ + suggestRemoveIndex: $(this).data('index'), + suggestRemove: $(this).data('file') + }); + + self.options.suggest[$(this).data('index')].played = true; + self.env.suggest.removeClass('on'); + + _boot.init(); + _boot.load(); + _support.resize(); + }); + + self.env.suggest.append(suggestItemWidget); + x++; + } + } + + if(x > 0) + { + if(self.options.suggestTimeout > 0 && _support.isMobile() === false) + { + setTimeout( function() + { + if(self.env.suggestClicked === false) + { + self.env.suggest.find('div.julia-suggest-item:first').click(); + } + }, self.options.suggestTimeout); + } + self.env.suggest.addClass('on'); + } + + }else{ + _fullscreen.off(); + } + + _debug({ + 'Suggest' : 'raised' + }); + } + }; + + + + + + + + + + + + + + + + + + + // Support + var _support = { + + aspect: function(w,h) + { + return w>0 && h>0 ? h/w: 0; + }, + + isMobile: function() + { + if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) + { + return true; + } + + return false; + }, + + forceReady: function() + { + if( /Firefox/i.test(navigator.userAgent) ) + { + return true; + } + + return false; + }, + + theme: function() + { + _debug({ + 'theme': self.options.themePath+'/'+self.options.theme+'/julia.css' + }); + + $('head').append(''); + }, + + canPlayMedia: function() + { + var vid = document.createElement('video'); + vid.id = 'video-cap-test-'+self.env.apiId; + self.env.canPlayMediaString = vid.canPlayType('application/vnd.apple.mpegURL'); + $('#video-cap-test'+self.env.apiId).remove(); + return (self.env.canPlayMediaString == 'probably' || self.env.canPlayMediaString == 'maybe'); + }, + + resize: function() + { + // Player dimensions + defaultDim = self.env.element.width() ? [self.env.element.width(), self.env.element.height()]: [self.options.width, self.options.height]; + dimensions = self.options.responsive === true ? _support.getSize(): defaultDim; + + _debug({ + 'resizeDefaults': defaultDim, + 'resize': dimensions + }); + + self.env.player.width(dimensions[0]); + self.env.player.height(dimensions[1]); + + self.env.dimensions.width = dimensions[0]; + self.env.dimensions.height = dimensions[1]; + + self.env.api.setAttribute('width', '100%'); + self.env.api.setAttribute('height', '100%'); + }, + + getSize: function() + { + // Fix video wrapped in inline block, can not get size properlym if inline element detected + var parentBlock = self.env.element.parent().css('display').toLowerCase(); + if(parentBlock == 'inline') + { + self.env.element.parent().css({'display': 'block'}); + } + + var parentWidth = self.env.element.parent().width(); + for(i in self.options.dimensions) + { + var dim = self.options.dimensions[i]; + if(parentWidth>=dim[0]) + { + a = _support.aspect(parentWidth) == 0 ? dim[1]/dim[0]: _support.aspect(self.env.api.videoWidth, self.env.api.videoHeight); + + dimensions = [dim[0],(dim[0]*a)]; + _debug({ + 'resizePredefined': dimensions + }); + return dimensions; + } + } + + a = _support.aspect() == 0 ? dim[1]/dim[0]: _support.aspect(self.env.api.videoWidth, self.env.api.videoHeight); + dimensions = [parentWidth, (parentWidth*a)]; + + _debug({ + 'resizeFallback': dimensions + }); + + return dimensions; + } + }; + + + + + + + + + + + + // Callback + var _call = { + + fn: function(f, data) + { + data = data||{}; + if(f !== false) + { + f(self.options, self.env, data); + } + } + }; + + + + + + + + + + + + + + + // Api && UI control + var _control = { + + press: function(action, data) + { + data = data||{}; + + _debug({ + 'action': action, + 'action-data': data, + }); + + switch(action) + { + case 'play': + + if(self.options.onPlay !== false) + { + _call.fn(self.options.onPlay, data); + } + + self.env.api.play(); + + break; case 'pause': + + if(self.options.onPause !== false) + { + _call.fn(self.options.onPause, data); + } + + self.env.api.pause(); + + break; case 'stop': + + if(self.options.onStop !== false) + { + _call.fn(self.options.onStop, data); + } + + self.env.api.pause(); + self.env.api.currentTime = 0; + + self.env.toolbar.find('.julia-playback.pause') + .removeClass('pause') + .addClass('play') + .find('i') + .removeClass('julia-pause') + .addClass('julia-play'); + self.env.shield.find('.julia-big-play').show(); + self.env.toolbar.find('.julia-progress>input').val(0).rangeslider('update', true); + + break; case 'goto': + + if(self.options.onPosition !== false) + { + _call.fn(self.options.onPosition, data); + } + + self.env.api.currentTime = data.currentTime; + + break; case 'setDuration': + + self.env.toolbar.find('.julia-panel.julia-duration>span').text(data.duration); + + if(self.env.started === false) + { + self.env.toolbar.find('.julia-progress>input').val(0).rangeslider('update', true); + } + + _debug({ + 'setDuration': data.duration + }); + + break; case 'volume': + + self.options.volume = data.volume; + self.env.api.volume = data.volume/100; + + _debug({ + 'volume is': self.env.api.volume + }); + + self.env.toolbar.find('.julia-volume>input').val(data.volume).rangeslider('update', true); + + if(data.volume>0) + { + _control.press('sound-on'); + + }else{ + _control.press('sound-off'); + } + + break; case 'sound-on': + + self.env.api.muted = false; + self.options.muted = false; + _client.set('volume', self.options.volume, 30); + _client.set('muted', self.options.muted, 30); + + self.env.toolbar + .find('.julia-sound.off') + .removeClass('off') + .addClass('on') + .find('i') + .removeClass('julia-sound-off') + .addClass('julia-sound-on'); + + break; case 'sound-off': + + self.env.api.muted = true; + self.options.muted = true; + _client.set('volume', self.options.volume, 30); + _client.set('muted', self.options.muted, 30); + + self.env.toolbar + .find('.julia-sound.on') + .removeClass('on') + .addClass('off') + .find('i') + .removeClass('julia-sound-on') + .addClass('julia-sound-off'); + + break; case 'fullscreen-on': + _fullscreen.on(); + + break; case 'fullscreen-off': + _fullscreen.off(); + + break; case 'destroy': + + setTiemout( function(){ + self.env.player.remove(); + }, 100); + + break; default: + + } + + return; + } + }; + + + + + + + + + + + + + + // Bindings + var _events = { + + // First play with some handlers + playAllowStart: function(e) + { + self.env.shield.find('.julia-preloader').removeClass('on'); + self.env.shield.find('.julia-big-play').show(); + self.env.toolbar.show(); + + // Init actions + _control.press('setDuration', { + 'duration': _timecode.toHuman( self.env.duration ) + }); + + // Set mute if needed + if(self.options.muted === true) + { + _control.press('sound-off'); + }else{ + _control.press('sound-on'); + + // Set initial volume + _control.press('volume', { + 'volume': self.options.volume + }); + } + + // Autostart playback, if possible + if(self.options.autoplay === true && _support.isMobile() === false) + { + _control.press('play'); + } + + _debug({ + 'eventType': e.type, + 'duration': self.env.api.duration, + 'readyState': self.env.api.readyState + }); + }, + + // Bind can play by ready state / fake readyState + // Because of Firefox cannot bind canplaythrough event with HLS.js properly + canplaythrough: function() + { + if(self.env.started === false) + { + // don't let mobile Firefox make decision about readyState, mobile Firefox lie! + if(self.env.api.readyState>=3 || (_support.isMobile() === true && self.env.api.readyState>=2) ) + { + _events.playAllowStart({ + type: '_events.canplaythrough' + }); + }else{ + setTimeout( function() + { + _events.canplaythrough(); + }, 250); + } + } + }, + + + // Bind user action & DOM events + DOM: function() + { + // Buttons + self.env.toolbar.on('contextmenu', function(e) + { + e.preventDefault(); + }) + .on('click', '.julia-playback.play', function(e) + { + e.preventDefault(); + _control.press('play'); + }) + .on('click', '.julia-playback.pause', function(e) + { + e.preventDefault(); + _control.press('pause'); + }) + .on('click', '.julia-sound.on', function(e) + { + e.preventDefault(); + _control.press('sound-off'); + }) + .on('click', '.julia-sound.off', function(e) + { + e.preventDefault(); + _control.press('sound-on'); + }) + .on('click', '.julia-fullscreen-toggle.on', function(e) + { + e.preventDefault(); + _control.press('fullscreen-on'); + }) + .on('click', '.julia-fullscreen-toggle.off', function(e) + { + e.preventDefault(); + _control.press('fullscreen-off'); + }); + + // Big play + self.env.shield.on('click contextmenu', '.julia-big-play', function(e) + { + e.preventDefault(); + e.stopPropagation(); + if(e.type == 'click') + { + _control.press('play'); + } + }); + + // Area click + self.env.shield.on('click', function(e) + { + e.preventDefault(); + e.stopPropagation(); + if(self.options.pauseOnClick === true && _support.isMobile() === false) + { + _control.press('pause'); + } + }); + + // Fullscreen toolbar behavior bindings + var mouseMoveCleaner; + + self.env.player.on('mousemove', '#julia-shield-'+self.env.apiId+', #julia-suggest-'+self.env.apiId, function(e) + { + e.preventDefault(); + self.env.toolbar.addClass('julia-toolbar-visible'); + clearTimeout(mouseMoveCleaner); + + mouseMoveCleaner = setTimeout(function() + { + self.env.toolbar.removeClass('julia-toolbar-visible'); + }, 1750); + }) + .on('mouseover mousemove mouseout', '#julia-toolbar-'+self.env.apiId+'.julia-toolbar-visible', function(e) + { + e.preventDefault(); + self.env.toolbar.addClass('julia-toolbar-visible'); + clearTimeout(mouseMoveCleaner); + + if(e.type == 'mouseout') + { + mouseMoveCleaner = setTimeout(function(e) + { + self.env.toolbar.removeClass('julia-toolbar-visible'); + }, 1750); + } + }); + + // Bind progressbar change + self.env.toolbar.on('change input', '.julia-progress>input', function(e) + { + if(e.type == 'input') + { + self.env.seeking = true; + }else{ + + seekTo = _timecode.toSeconds( $(this).val() ); + seekTo = seekTo >= self.env.duration ? self.env.duration: seekTo.toFixed(2); + + _control.press('goto', { + currentTime: seekTo + }); + + self.env.seeking = false; + } + }); + + // Bind volumebar change + self.env.toolbar.on('change', '.julia-volume>input', function() + { + _control.press('volume', { + volume: $(this).val(), + 'event': 'slideChange' + }); + }); + + // Fullscreen event included + $(window).on('resize', function() + { + _support.resize(); + }); + + // Fullscreen change event handler + $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', function(e) + { + if(!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) + { + $('.julia-player') + .removeClass('julia-fullscreen-on') + .addClass('julia-fullscreen-off') + .find('button.julia-fullscreen-toggle') + .removeClass('off') + .addClass('on') + .find('i') + .removeClass('julia-fullscreen-exit') + .addClass('julia-fullscreen'); + + // Turn off landscape on mobile + if(_support.isMobile()) + { + screen.orientation.unlock(); + screen.msLockOrientation.unlock(); + screen.mozLockOrientation.unlock(); + } + + _debug({ + 'fullscreen off' : '#julia-player-'+self.env.apiId + }); + + _support.resize(); + + }else{ + + $('.julia-player') + .removeClass('julia-fullscreen-off') + .addClass('julia-fullscreen-on') + .find('button.julia-fullscreen-toggle') + .removeClass('on').addClass('off') + .find('i') + .removeClass('julia-fullscreen') + .addClass('julia-fullscreen-exit'); + + // Force landscape in fullscreen mode on mobile + if(_support.isMobile()) + { + screen.orientation.lock('landscape-primary'); + screen.msLockOrientation.lock('landscape-primary'); + screen.mozLockOrientation.lock('landscape-primary'); + } + + _debug({ + 'fullscreen on' : '#julia-player-'+self.env.apiId + }); + } + }); + }, + + + // Native video api + nativeEvents: function() + { + if(_support.forceReady()===true && self.env.isHls === true) + { + _events.canplaythrough(); + }else{ + self.env.api.oncanplaythrough = function(e) + { + self.env.duration = self.env.api.duration; + + if(self.env.started === false && self.env.api.readyState >= 3) + { + _events.playAllowStart(e); + } + } + } + + // Video playback detect + self.env.api.onplay = function(e) + { + self.env.toolbar + .find('.julia-playback.play') + .removeClass('play') + .addClass('pause') + .find('i') + .removeClass('julia-play') + .addClass('julia-pause'); + self.env.shield.find('.julia-big-play').hide(); + self.env.shield.find('.julia-preloader').removeClass('on'); + _ui.posterUnset(); + self.env.toolbar.show(); + } + + self.env.api.onplaying = function(e) + { + self.env.toolbar + .find('.julia-playback.play') + .removeClass('play') + .addClass('pause') + .find('i') + .removeClass('julia-play') + .addClass('julia-pause'); + self.env.shield.find('.julia-big-play').hide(); + self.env.shield.find('.julia-preloader').removeClass('on'); + self.env.suggest.html('').removeClass('on'); + self.env.toolbar.show(); + _control.press('setDuration', { + 'duration': _timecode.toHuman( self.env.duration ) + }); + self.env.started = true; + } + + + // Video pause + self.env.api.onpause = function(e) + { + self.env.toolbar + .find('.julia-playback.pause') + .removeClass('pause') + .addClass('play') + .find('i') + .removeClass('julia-pause') + .addClass('julia-play'); + self.env.shield.find('.julia-big-play').show(); + } + + + // Errors + self.env.api.onerror = function(e) + { + // Bring to life again + if(self.env.tries<11) + { + _boot.init(); + } + } + + self.env.api.onemptied = function(e) + { + } + + self.env.api.onstalled = function(e) + { + } + + self.env.api.onsuspend = function(e) + { + } + + // Video position + self.env.api.ontimeupdate = function(e) + { + if(self.env.seeking === false) + { + currentTimeReadable = _timecode.toHuman( self.env.api.currentTime.toFixed(2) ); + self.env.toolbar.find('.julia-progress>input').val( _timecode.toPercents( self.env.api.currentTime.toFixed(2) ) ).rangeslider('update', true); + self.env.toolbar.find('.julia-panel.julia-currentTime>span').text(currentTimeReadable); + } + + _events.onTime(currentTimeReadable, self.env.api.currentTime); + + if(self.options.debugPlayback === true) + { + _debug({ + 'duration/current': self.env.duration+'/'+self.env.api.currentTime.toFixed(2)+' > '+currentTimeReadable + }); + } + + /* + // Fix for corrupted video end + // For development purposes only + if(api.currentTime>=(duration-1)) + { + if(_support.forceReady()===true) + { + _suggest.run(); + } + } + */ + } + + // Video position + self.env.api.seeked = function(e) + { + self.env.seeking = false; + } + + // Video position + self.env.api.seeking = function(e) + { + self.env.seeking = true; + } + + // Volume + self.env.api.onvolumechange = function(e) + { + if(self.env.api.muted === false) + { + self.env.toolbar.find('.julia-volume>input').val(self.env.api.volume*100).rangeslider('update', true); + }else{ + self.env.toolbar.find('.julia-volume>input').val(0).rangeslider('update', true); + } + } + + // Set video duration + self.env.api.ondurationchange = function(e) + { + self.env.duration = self.env.api.duration; + + if(self.env.started === false) + { + self.env.duration = self.env.api.duration; + self.env.seeking = false; + + _debug({ + 'duration': self.env.duration, + 'readyState': self.env.api.readyState, + 'started': self.env.started + }); + } + } + + // Bind playback end event + self.env.api.onended = function(e) + { + _suggest.run(); + }; + }, + + + // Specific events, error handlers + hlsLibEvents: function() + { + self.env.hls.on(Hls.Events.ERROR, function(event, data) + { + switch(data.details) + { + case Hls.ErrorDetails.MANIFEST_LOAD_ERROR: + case Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT: + case Hls.ErrorDetails.MANIFEST_PARSING_ERROR: + case Hls.ErrorDetails.LEVEL_LOAD_ERROR: + case Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT: + case Hls.ErrorDetails.LEVEL_SWITCH_ERROR: + case Hls.ErrorDetails.FRAG_LOAD_ERROR: + case Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR: + case Hls.ErrorDetails.FRAG_LOAD_TIMEOUT: + case Hls.ErrorDetails.FRAG_DECRYPT_ERROR: + case Hls.ErrorDetails.FRAG_PARSING_ERROR: + case Hls.ErrorDetails.BUFFER_APPEND_ERROR: + case Hls.ErrorDetails.BUFFER_APPENDING_ERROR: + + _debug({ + recoveringError: data.details, + errorType: data.type, + errorFatal: data.fatal, + data: data, + tries: self.env.tries + }); + + if(data.fatal === true && self.env.tries<11) + { + // Bring to life again + _boot.load(); + } + + break; default: + } + }); + }, + + + // Time update event callbacks + onTime: function(time, timeNum) + { + if( (time in self.options.onTime) && self.env.onTimeRised.indexOf(time) == -1 ) + { + handle = self.options.onTime[time]; + self.env.onTimeRised.push(time); + + if(typeof window[handle] === 'function') + { + window[handle](time, self.env.publicApi); + _debug({ + 'onTime': handle+' raised' + }); + + }else{ + + _debug({ + 'onTimeError': handle+' is not a function, but: '+(typeof handle) + }); + } + } + } + }; + + + + + + + + + + + + + + + + + // Create player + var _boot = { + + create: function() + { + self.env.element = self.options.element; + + // Degbug header + if(self.options.debug === true && window.console ) + { + console.info('=== Julia console debug start for '+self.env.apiId+' ==='); + } + + _debug(self.options); + + // Suggest init + for(i in self.options.suggest) + { + self.options.suggest[i].played = false; + } + + // Set theme CSS + _support.theme(); + + // User data + volume = _client.get('volume'); + muted = _client.get('muted'); + + if(volume.length>0) + { + self.options.volume = parseInt(volume); + } + + if(muted.length>0) + { + self.options.muted = muted == 'false' ? false: true; + } + + // Create UI + _ui.player(); + }, + + // Select playback url + selectSource: function() + { + self.env.element.prop('preload', 'none'); + protoSource = self.env.element.prop('src') ? self.env.element.prop('src'): self.env.element.find('source').prop('src'); + self.env.source = self.options.source && self.options.source.length>0 ? self.options.source: protoSource; + + self.env.isHls = self.env.source.indexOf('m3u8') == -1 ? false: true; + if(self.options.forceHls === true) + { + self.env.isHls = true; + } + + _debug({ + 'sourceType': (self.env.isHls === false ? 'file': 'hls') + }); + + self.env.poster = self.options.poster && self.options.poster.length>0 ? self.options.poster: self.env.element.prop('poster'); + _ui.posterSet(); + }, + + + // load media + load: function() + { + self.env.shield.find('.julia-preloader').addClass('on'); + + // ************************ + // HLS library supported + // and HLS requested + // ************************ + if(self.env.useHlsLib === true) + { + _events.hlsLibEvents(); + self.env.hls.autoLevelCapping = -1; + self.env.hls.attachMedia(self.env.api); + self.env.hls.loadSource(self.env.source); + + // API READY + self.env.hls.on(Hls.Events.MEDIA_ATTACHED, function(event, data) + { + + // DETECT LEVEL DATA + self.env.hls.on(Hls.Events.LEVEL_LOADED, function(event, data) + { + // SET LIVE EVENT STATE + if(data.details.live === true || self.options.live === true) + { + self.env.isLive = true; + self.env.toolbar.addClass('live'); + }else{ + self.env.toolbar.removeClass('live'); + } + }); + + for(x in self.options.triggerHls) + { + handle = self.options.triggerHls[x]; + + if(typeof window[handle] === 'function') + { + self.env.hls.on(Hls.Events[x], function(event, data) + { + window[handle](self.env.apiId, event, data); + }); + + }else{ + + _debug({ + 'triggerHlsError': handle+' is not a function' + }); + } + } + + }); + + // ************************ + // Classic VOD file + // ************************ + }else{ + + self.env.api.load(); + } + + // ************************ + // Bind all events + // ************************ + if(self.env.apiOk === true) + { + _events.DOM(); + // Classic html5 api + _events.nativeEvents(); + } + + stats = { + 'isHls': self.env.isHls, + 'useHlsLib': self.env.useHlsLib, + 'live': self.env.isLive, + 'canPlayMediaString': self.env.canPlayMediaString, + 'canPlayMedia': self.env.canPlayMedia, + }; + + _debug(stats); + + // Define publicApi + self.env.publicApi = { + control: _control, + options: self.options, + support: _support, + dimensions: self.env.dimensions, + timecode: _timecode, + shield: self.env.shield, + toolbar: self.env.toolbar, + media: self.env.api, + id: self.env.apiId, + stats: stats + }; + }, + + // Initilize player + init: function() + { + // Create source + _boot.selectSource(); + self.env.useHlsLib = false; + self.env.isLive = false; + self.env.canPlayMedia = _support.canPlayMedia(); + self.env.tries+=1; + + if(self.env.isHls === true) + { + self.env.useHlsLib = self.env.canPlayMedia === false && Hls.isSupported() ? true: false; + } + + // ************************ + // HLS library supported + // and HLS requested + // ************************ + if(self.env.useHlsLib === true) + { + _api.create(); + self.env.hls = new Hls(self.options.hlsConfig); + + // ************************ + // Classic VOD file + // ************************ + }else{ + + _api.create(); + self.env.api.src = self.env.source; + } + + if(self.options.live === true) + { + self.env.isLive = true; + self.env.toolbar.addClass('live'); + }else{ + self.env.toolbar.removeClass('live'); + } + } + }; + + + + + + + + // Build player object + _boot.create(); + + // Bring to life + _boot.init(); + + // Bring api + _boot.load(); + + // Player dimensions + _support.resize(); + + // Populate public API + return self.env.publicApi; +}; + +// Build jQuery plugin +$.fn.julia = function(options) +{ + return this.each(function() + { + // Return if this element already has a plugin instance + if($(this).data('julia')) + { + return; + } + + options = typeof options === 'undefined' ? {}: options; + options.element = $(this); + + // Pass options to constructor + var julia = new Julia(options); + + // Store plugin object in element's data + $(this).data('julia', julia); + }); +}; + +// API wrappers +$.fn.play = function() +{ + $(this).data('julia').control.press('play'); +}; + +$.fn.destroy = function() +{ + $(this).data('julia').control.press('destroy'); +}; + +$.fn.media = function() +{ + return $(this).data('julia').media; +}; + +$.fn.pause = function() +{ + $(this).data('julia').control.press('pause'); +}; + +$.fn.stop = function() +{ + $(this).data('julia').control.press('stop'); +}; + +$.fn.goto = function(t) +{ + $(this).data('julia').control.press('goto', { + currentTime: t + }); +}; + +$.fn.mute = function() +{ + if($(this).data('julia').media.muted === false) + { + $(this).data('julia').control.press('sound-off'); + }else{ + $(this).data('julia').control.press('sound-on'); + } +}; + +$.fn.volume = function(volume) +{ + $(this).data('julia').control.press('volume', { + volume: volume + }); +}; + +$.fn.getID = function() +{ + return $(this).data('julia').id; +}; + +$.fn.stats = function() +{ + return $(this).data('julia').stats; +}; diff --git a/dist/js/julia-player.min.js b/dist/js/julia-player.min.js new file mode 100644 index 0000000..68aa484 --- /dev/null +++ b/dist/js/julia-player.min.js @@ -0,0 +1,6 @@ +!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(){return function e(t,i,r){function n(s,o){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[s]={exports:{}};t[s][0].call(d.exports,function(e){var i=t[s][1][e];return n(i?i:e)},d,d.exports,e,t,i,r)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var r=!1;return i.listener=t,this.on(e,i),this},r.prototype.removeListener=function(e,t){var i,r,a,o;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],a=i.length,r=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(i)){for(o=a;o-- >0;)if(i[o]===t||i[o].listener&&i[o].listener===t){r=o;break}if(r<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,i;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(i=this._events[e],n(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,i){var r=arguments[3],n=arguments[4],a=arguments[5],s=JSON.stringify;t.exports=function(e){for(var t,i=Object.keys(a),o=0,l=i.length;o500*i.duration){var n=e.levels,a=Math.max(1,1e3*i.loaded/r),s=Math.max(i.loaded,Math.round(i.duration*n[i.level].bitrate/8)),o=t.currentTime,l=(s-i.loaded)/a,d=c.default.bufferInfo(t,o,e.config.maxBufferHole).end-o;if(d<2*i.duration&&l>d){var f=void 0,h=void 0;for(h=i.level-1;h>=0&&(f=i.duration*n[h].bitrate/(6.4*a),p.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+h+"] :"+l.toFixed(1)+"/"+d.toFixed(1)+"/"+f.toFixed(1)),!(fthis._msDuration&&(h.logger.log("Updating mediasource duration to "+this._levelDuration),t.duration=this._levelDuration,this._msDuration=this._levelDuration)}}}},{key:"doFlush",value:function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,i=this.sourceBuffer;if(i)for(var r in i)t+=i[r].buffered.length;this.appended=t,this.hls.trigger(u.default.BUFFER_FLUSHED)}}},{key:"doAppending",value:function(){var e=this.hls,t=this.sourceBuffer,i=this.segments;if(t){if(this.media.error)return i=[],void h.logger.error("trying to append although a media error occured, flush segment and abort");for(var r in t)if(t[r].updating)return;if(i.length){var n=i.shift();try{t[n.type].appendBuffer(n.data),this.appendError=0,this.appended++}catch(t){h.logger.error("error while trying to append buffer:"+t.message),i.unshift(n);var a={type:c.ErrorTypes.MEDIA_ERROR};if(22===t.code)return this.segments=[],a.details=c.ErrorDetails.BUFFER_FULL_ERROR,void e.trigger(u.default.ERROR,a);if(this.appendError?this.appendError++:this.appendError=1,a.details=c.ErrorDetails.BUFFER_APPEND_ERROR,a.frag=this.fragCurrent,this.appendError>e.config.appendErrorMaxRetry)return h.logger.log("fail "+e.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),i=[],a.fatal=!0,void e.trigger(u.default.ERROR,a);a.fatal=!1,e.trigger(u.default.ERROR,a)}}}}},{key:"flushBuffer",value:function(e,t){var i,r,n,a,s,o;if(this.flushBufferCounter.5)return this.flushBufferCounter++,h.logger.log("flush "+l+" ["+s+","+o+"], of ["+n+","+a+"], pos:"+this.media.currentTime),i.remove(s,o),!1}else h.logger.warn("abort flushing too many retries");return h.logger.log("buffer flushed"),!0}}]),t}(f.default);i.default=v},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],5:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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 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(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;ithis.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(e){var t=void 0,i=void 0,r=void 0,n=this.mediaWidth,a=this.mediaHeight,s=0,o=0;for(i=0;i<=e&&(r=this.levels[i],t=i,s=r.width,o=r.height,!(n<=s||a<=o));i++);return t}},{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}(f.default);i.default=h},{"../event-handler":22,"../events":23}],6:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i=0&&ee&&(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(){return void 0===this._startLevel?this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{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}(f.default);i.default=v},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],8:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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 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(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i0?(v.logger.log("configure startPosition @"+i),this.lastPaused||(v.logger.log("resuming video"),t.play()),this.state=R.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=R.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else v.logger.warn("cannot start loading as manifest not parsed yet"),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(){this.ticks++,1===this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var e,t,i,r=this.hls,n=r.config,a=this.media,s=a&&a.seeking;switch(this.state){case R.ERROR:case R.PAUSED:break;case R.STARTING:var o=r.startLevel;o===-1&&(o=0,this.fragBitrateTest=!0),this.level=r.nextLoadLevel=o,this.state=R.WAITING_LEVEL,this.loadedmetadata=!1;break;case R.IDLE:if(!a&&(this.startFragRequested||!n.startFragPrefetch))break;e=this.loadedmetadata?a.currentTime:this.nextLoadPosition,t=r.nextLoadLevel;var l,u=m.default.bufferInfo(a,e,n.maxBufferHole),d=u.len,h=u.end,c=this.fragPrevious;if(this.levels[t].hasOwnProperty("bitrate")?(l=Math.max(8*n.maxBufferSize/this.levels[t].bitrate,n.maxBufferLength),l=Math.min(l,n.maxMaxBufferLength)):l=n.maxBufferLength,dA&&(a.currentTime=A)}if(i.PTSKnown&&h>E)break;if(this.startFragRequested&&!i.PTSKnown){if(c){var L=c.sn+1;L>=i.startSN&&L<=i.endSN&&(T=p[L-i.startSN],v.logger.log("live playlist, switching playlist, load frag with next SN: "+T.sn))}T||(T=p[Math.min(y-1,Math.round(y/2))],v.logger.log("live playlist, switching playlist, unknown, load middle frag : "+T.sn))}}else hE-e||s)&&(e=0),T=g.default.search(p,function(t){return t.start+t.duration-e<=h?1:t.start-e>h?-1:0})):T=p[y-1]}(),T){if(b=T.start,c&&T.level===c.level&&T.sn===c.sn){ +if(!(T.snn.maxBufferHole&&c.dropped?(T=p[D-1],v.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"),c.loadCounter--):(T=p[D+1],v.logger.log("SN just loaded, load next one: "+T.sn)),!T)break}if(null!=T.decryptdata.uri&&null==T.decryptdata.key)v.logger.log("Loading key for "+T.sn+" of ["+i.startSN+" ,"+i.endSN+"],level "+t),this.state=R.KEY_LOADING,r.trigger(f.default.KEY_LOADING,{frag:T});else{if(v.logger.log("Loading "+T.sn+" of ["+i.startSN+" ,"+i.endSN+"],level "+t+", currentTime:"+e+",bufferEnd:"+h.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,T.loadCounter){T.loadCounter++;var O=n.fragLoadingLoopThreshold;if(T.loadCounter>O&&Math.abs(this.fragLoadIdx-T.loadIdx)=I||s)&&(v.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=R.IDLE);break;case R.STOPPED:case R.FRAG_LOADING:case R.PARSING:case R.PARSED:case R.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(e){var t,i,r=this.bufferRange;if(r)for(t=r.length-1;t>=0;t--)if(i=r[t],e>=i.start&&e<=i.end)return i;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(e){var t=this.media;if(t)for(var i=t.buffered,r=0;r=i.start(r)&&e<=i.end(r))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var e,t,i=this.media;if(i&&i.seeking===!1&&(t=i.currentTime,t>i.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=t),this.isBuffered(t)?e=this.getBufferRange(t):this.isBuffered(t+.1)&&(e=this.getBufferRange(t+.1)),e)){var r=e.frag;r!==this.fragPlaying&&(this.fragPlaying=r,this.hls.trigger(f.default.FRAG_CHANGED,{frag:r}))}}},{key:"immediateLevelSwitch",value:function(){if(v.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 i=this.fragCurrent;i&&i.loader&&i.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=R.PAUSED,this.hls.trigger(f.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})}},{key:"immediateLevelSwitchEnd",value:function(){this.immediateSwitch=!1;var e=this.media;e&&e.readyState&&(e.currentTime-=1e-4,this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var e=this.media;if(e&&e.readyState){var t=void 0,i=void 0,r=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,i=this.getBufferRange(e.currentTime),i&&i.start>1&&(this.state=R.PAUSED,this.hls.trigger(f.default.BUFFER_FLUSHING,{startOffset:0,endOffset:i.start-1})),e.paused)t=0;else{var n=this.hls.nextLoadLevel,a=this.levels[n],s=this.fragLastKbps;t=s&&this.fragCurrent?this.fragCurrent.duration*a.bitrate/(1e3*s)+1:0}if(r=this.getBufferRange(e.currentTime+t),r&&(r=this.followingBufferRange(r))){var o=this.fragCurrent;o&&o.loader&&o.loader.abort(),this.fragCurrent=null,this.state=R.PAUSED,this.hls.trigger(f.default.BUFFER_FLUSHING,{startOffset:r.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(e){var t=this.media=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 i=this.config;this.levels&&i.autoStartLoad&&this.hls.startLoad(i.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(v.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(){if(this.state===R.FRAG_LOADING){if(0===m.default.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len){v.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load");var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.state=R.IDLE}}else 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:"onMediaSeeked",value:function(){this.tick()}},{key:"onMediaEnded",value:function(){v.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){v.logger.log("trigger BUFFER_RESET"),this.hls.trigger(f.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(e){var t,i=!1,r=!1;e.levels.forEach(function(e){t=e.audioCodec,t&&(t.indexOf("mp4a.40.2")!==-1&&(i=!0),t.indexOf("mp4a.40.5")!==-1&&(r=!0))}),this.audioCodecSwitch=i&&r,this.audioCodecSwitch&&v.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 n=this.config;n.autoStartLoad&&this.hls.startLoad(n.startPosition)}},{key:"onLevelLoaded",value:function(e){var t=e.details,i=e.level,r=this.levels[i],n=t.totalduration,a=0;if(v.logger.log("level "+i+" loaded ["+t.startSN+","+t.endSN+"],duration:"+n),this.levelLastLoaded=i,t.live){var s=r.details;s?(E.default.mergeDetails(s,t),a=t.fragments[0].start,t.PTSKnown?v.logger.log("live playlist sliding:"+a.toFixed(3)):v.logger.log("live playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,v.logger.log("live playlist - first load, unknown sliding"))}else t.PTSKnown=!1;if(r.details=t,this.hls.trigger(f.default.LEVEL_UPDATED,{details:t,level:i}),this.startFragRequested===!1){if(this.startPosition===-1){var o=t.startTimeOffset;if(isNaN(o))if(t.live){var l=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;this.startPosition=Math.max(0,a+n-l)}else this.startPosition=0;else v.logger.log("start time offset found in playlist, adjust startPosition to "+o),this.startPosition=o}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;if(this.state===R.FRAG_LOADING&&t&&e.frag.level===t.level&&e.frag.sn===t.sn)if(v.logger.log("Loaded "+t.sn+" of level "+t.level),this.fragBitrateTest===!0)this.state=R.IDLE,this.fragBitrateTest=!1,this.startFragRequested=!1,e.stats.tparsed=e.stats.tbuffered=performance.now(),this.hls.trigger(f.default.FRAG_BUFFERED,{stats:e.stats,frag:t});else{this.state=R.PARSING,this.stats=e.stats;var i=this.levels[this.level],r=i.details,n=r.totalduration,a=void 0===t.startDTS||isNaN(t.startDTS)?t.start:t.startDTS,s=t.level,o=t.sn,l=i.audioCodec||this.config.defaultAudioCodec;this.audioCodecSwap&&(v.logger.log("swapping playlist audio codec"),void 0===l&&(l=this.lastAudioCodec),l&&(l=l.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,v.logger.log("Demuxing "+o+" of ["+r.startSN+" ,"+r.endSN+"],level "+s+", cc "+t.cc);var u=this.demuxer;u&&u.push(e.payload,l,i.videoCodec,a,t.cc,s,o,n,t.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(e){if(this.state===R.PARSING){var t,i,r=e.tracks;if(i=r.audio){var n=this.levels[this.level].audioCodec,a=navigator.userAgent.toLowerCase();n&&this.audioCodecSwap&&(v.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&&a.indexOf("firefox")===-1&&(n="mp4a.40.5"),a.indexOf("android")!==-1&&(n="mp4a.40.2",v.logger.log("Android: force audio codec to"+n)),i.levelCodec=n}if(i=r.video,i&&(i.levelCodec=this.levels[this.level].videoCodec),e.unique){var s={codec:"",levelCodec:""};for(t in e.tracks)i=r[t],s.container=i.container,s.codec&&(s.codec+=",",s.levelCodec+=","),i.codec&&(s.codec+=i.codec),i.levelCodec&&(s.levelCodec+=i.levelCodec);r={audiovideo:s}}this.hls.trigger(f.default.BUFFER_CODECS,r);for(t in r){i=r[t],v.logger.log("track:"+t+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var o=i.initSegment;o&&(this.pendingAppending++,this.hls.trigger(f.default.BUFFER_APPENDING,{type:t,data:o}))}this.tick()}}},{key:"onFragParsingData",value:function(e){var t=this;if(this.state===R.PARSING){this.tparse2=Date.now();var i=this.levels[this.level],r=this.fragCurrent;v.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,r.sn,e.startPTS,e.endPTS,e.startDTS,e.endDTS),a=this.hls;a.trigger(f.default.LEVEL_PTS_UPDATED,{details:i.details,level:this.level,drift:n}),"video"===e.type&&(r.dropped=e.dropped),[e.data1,e.data2].forEach(function(i){i&&(t.pendingAppending++,a.trigger(f.default.BUFFER_APPENDING,{type:e.type,data:i}))}),this.nextLoadPosition=e.endPTS,this.bufferRange.push({type:e.type,start:e.startPTS,end:e.endPTS,frag:r}),this.tick()}else v.logger.warn("not in PARSING state but "+this.state+", ignoring FRAG_PARSING_DATA event")}},{key:"onFragParsed",value:function(){this.state===R.PARSING&&(this.stats.tparsed=performance.now(),this.state=R.PARSED,this._checkAppendedParsed())}},{key:"onBufferAppended",value:function(){switch(this.state){case R.PARSING:case R.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===R.PARSED&&0===this.pendingAppending){var e=this.fragCurrent,t=this.stats;e&&(this.fragPrevious=e,t.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*t.length/(t.tbuffered-t.tfirst)),this.hls.trigger(f.default.FRAG_BUFFERED,{stats:t,frag:e}),v.logger.log("media buffered : "+this.timeRangesToString(this.media.buffered)),this.state=R.IDLE),this.tick()}}},{key:"onError",value:function(e){switch(e.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!e.fatal){var t=this.fragLoadError;if(t?t++:t=1,t<=this.config.fragLoadingMaxRetry){this.fragLoadError=t,e.frag.loadCounter=0;var i=Math.min(Math.pow(2,t-1)*this.config.fragLoadingRetryDelay,64e3);v.logger.warn("mediaController: frag loading failed, retry in "+i+" ms"),this.retryDate=performance.now()+i,this.state=R.FRAG_LOADING_WAITING_RETRY}else v.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.trigger(f.default.ERROR,e),this.state=R.ERROR}break;case _.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==R.ERROR&&(this.state=e.fatal?R.ERROR:R.IDLE,v.logger.warn("mediaController: "+e.details+" while loading frag,switch to "+this.state+" state ..."));break;case _.ErrorDetails.BUFFER_FULL_ERROR:this.state!==R.PARSING&&this.state!==R.PARSED||(this.config.maxMaxBufferLength/=2,v.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and switch to IDLE state"),this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=R.IDLE)}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e&&e.readyState){var t=e.currentTime,i=e.buffered;if(!this.loadedmetadata&&i.length){this.loadedmetadata=!0;var r=this.startPosition;if(!t&&t!==r&&r){v.logger.log("target start position:"+r);var n=i.start(0),a=i.end(0);(ra)&&(r=n,v.logger.log("target start position not buffered, seek to buffered.start(0) "+n)),v.logger.log("adjust currentTime from "+t+" to "+r),e.currentTime=r}}else{var s=m.default.bufferInfo(e,t,0),o=!(e.paused||e.ended||0===e.buffered.length),l=.4,u=t>e.playbackRate*this.lastCurrentTime;if(this.stalled&&u&&(this.stalled=!1,v.logger.log("playback not stuck anymore @"+t)),o&&s.len<=l&&(u?(l=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,v.logger.log("playback seems stuck @"+t),this.hls.trigger(f.default.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),s.len<=l)){var d=s.nextStart,h=d-t;if(d&&h0){v.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(f.default.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:c})}}}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=R.IDLE,this.tick()}},{key:"onBufferFlushed",value:function(){var e,t,i=[];for(t=0;t>7))^e]=e;for(t=i=0;!f[t];t^=r||1,i=v[i]||1)for(s=i^i<<1^i<<2^i<<3^i<<4,s=s>>8^255&s^99,f[t]=s,h[s]=t,a=c[n=c[r=c[t]]],l=16843009*a^65537*n^257*r^16843008*t,o=257*c[s]^16843008*s,e=0;e<4;e++)u[e][t]=o=o<<24^o>>>8,d[e][s]=l=l<<24^l>>>8;for(e=0;e<5;e++)u[e]=u[e].slice(0),d[e]=d[e].slice(0)}},{key:"decrypt",value:function(e,t,i,r,n,a){var s,o,l,u,d=this._key[1],f=e^d[0],h=r^d[1],c=i^d[2],v=t^d[3],p=d.length/4-2,g=4,y=this._tables[1],m=y[0],b=y[1],E=y[2],_=y[3],R=y[4];for(u=0;u>>24]^b[h>>16&255]^E[c>>8&255]^_[255&v]^d[g],o=m[h>>>24]^b[c>>16&255]^E[v>>8&255]^_[255&f]^d[g+1],l=m[c>>>24]^b[v>>16&255]^E[f>>8&255]^_[255&h]^d[g+2],v=m[v>>>24]^b[f>>16&255]^E[h>>8&255]^_[255&c]^d[g+3],g+=4,f=s,h=o,c=l;for(u=0;u<4;u++)n[(3&-u)+a]=R[f>>>24]<<24^R[h>>16&255]<<16^R[c>>8&255]<<8^R[255&v]^d[g++],s=f,f=h,h=c,c=v,v=s}}]),e}();i.default=a},{}],11:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i>8|e>>>24}},{key:"doDecrypt",value:function(e,t,i){var r,n,a,s,l,u,d,f,h,c=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),v=new o.default(Array.prototype.slice.call(t)),p=new Uint8Array(e.byteLength),g=new Int32Array(p.buffer);for(r=~~i[0],n=~~i[1],a=~~i[2],s=~~i[3],h=0;h>>5,h-=g,h>0&&p+g+h<=m);)for(y=R+v*c,b={unit:e.subarray(p+g,p+g+h),pts:y,dts:y},E.samples.push(b),E.len+=h,p+=h+g,v++;p>>6)+1,o=(60&t[i+2])>>>2,o>h.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[i+2])<<2,u|=(192&t[i+3])>>>6,a.logger.log("manifest codec:"+r+",ADTS data:type:"+n+",sampleingIndex:"+o+"["+h[o]+"Hz],channelConfig:"+u),f.indexOf("firefox")!==-1?o>=6?(n=5,d=new Array(4),l=o-3):(n=2,d=new Array(2),l=o):f.indexOf("android")!==-1?(n=2,d=new Array(2),l=o):(n=5,d=new Array(4),r&&(r.indexOf("mp4a.40.29")!==-1||r.indexOf("mp4a.40.5")!==-1)||!r&&o>=6?l=o-3:((r&&r.indexOf("mp4a.40.2")!==-1&&o>=6&&1===u||!r&&1===u)&&(n=2,d=new Array(2)),l=o)),d[0]=n<<3,d[0]|=(14&o)>>1,d[1]|=(1&o)<<7,d[1]|=u<<3,5===n&&(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."+n})}}]),e}();i.default=o},{"../errors":21,"../utils/logger":38}],15:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i1?i-1:0),n=1;n1?i-1:0),n=1;n0&&null!=l&&null!=l.key&&"AES-128"===l.method){null==this.decrypter&&(this.decrypter=new v.default(this.hls));var u=this;this.decrypter.decrypt(e,l.key,l.iv,function(e){u.pushDecrypted(e,t,i,r,n,a,s,o)})}else this.pushDecrypted(e,t,i,r,n,a,s,o)}},{key:"onWorkerMessage",value:function(e){var t=e.data;switch(t.event){case o.default.FRAG_PARSING_INIT_SEGMENT:var i={};i.tracks=t.tracks,i.unique=t.unique,this.hls.trigger(o.default.FRAG_PARSING_INIT_SEGMENT,i);break;case o.default.FRAG_PARSING_DATA:this.hls.trigger(o.default.FRAG_PARSING_DATA,{data1:new Uint8Array(t.data1),data2:new Uint8Array(t.data2),startPTS:t.startPTS,endPTS:t.endPTS,startDTS:t.startDTS,endDTS:t.endDTS,type:t.type,nb:t.nb,dropped:t.dropped});break;case o.default.FRAG_PARSING_METADATA:this.hls.trigger(o.default.FRAG_PARSING_METADATA,{samples:t.samples});break;case o.default.FRAG_PARSING_USERDATA:this.hls.trigger(o.default.FRAG_PARSING_USERDATA,{samples:t.samples +});break;default:this.hls.trigger(t.event,t.data)}}}]),t}();i.default=p},{"../crypt/decrypter":12,"../demux/demuxer-inline":15,"../demux/demuxer-worker":16,"../events":23,"../utils/logger":38,webworkify:2}],18:[function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;ie?(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),i=this.word>>>32-t;return e>32&&a.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?i<>>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,i,r=8,n=8;for(t=0;t>4,y>1){if(m=v+5+e[v+4],m===v+188)continue}else m=v+4;if(R)if(g===T){if(p){if(l&&(this._parseAVCPES(this._parsePES(l)),E&&this._avcTrack.codec&&(k===-1||this._aacTrack.codec)))return void this.remux(e);l={data:[],size:0}}l&&(l.data.push(e.subarray(m,v+188)),l.size+=v+188-m)}else if(g===k){if(p){if(d&&(this._parseAACPES(this._parsePES(d)),E&&this._aacTrack.codec&&(T===-1||this._avcTrack.codec)))return void this.remux(e);d={data:[],size:0}}d&&(d.data.push(e.subarray(m,v+188)),d.size+=v+188-m)}else g===S&&(p&&(f&&this._parseID3PES(this._parsePES(f)),f={data:[],size:0}),f&&(f.data.push(e.subarray(m,v+188)),f.size+=v+188-m));else p&&(m+=e[m]+1),0===g?this._parsePAT(e,m):g===this._pmtId?(this._parsePMT(e,m),R=this.pmtParsed=!0,T=this._avcTrack.id,k=this._aacTrack.id,S=this._id3Track.id,_&&(h.logger.log("reparse from beginning"),_=!1,v=-188)):(h.logger.log("unknown PID found before PAT/PMT"),_=!0)}else this.observer.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});l&&this._parseAVCPES(this._parsePES(l)),d&&this._parseAACPES(this._parsePES(d)),f&&this._parseID3PES(this._parsePES(f)),this.remux(null)}},{key:"remux",value:function(e){this.remuxer.remux(this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,e)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){this._pmtId=(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(e,t){var i,r,n,a;for(i=(15&e[t+1])<<8|e[t+2],r=t+3+i-4,n=(15&e[t+10])<<8|e[t+11],t+=12+n;t4294967295&&(o-=8589934592),64&i?(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),a=t[8],u=a+9,e.size-=u,s=new Uint8Array(e.size);f.length;){t=f.shift();var h=t.byteLength;if(u){if(u>h){u-=h;continue}t=t.subarray(u),h-=u,u=0}s.set(t,d),d+=h}return{data:s,pts:o,dts:l,len:n}}return null}},{key:"_parseAVCPES",value:function(e){var t,i,r,n,a=this,s=this._avcTrack,o=s.samples,l=this._parseAVCNALu(e.data),u=[],d=!1,c=!1,v=0;if(0===l.length&&o.length>0){var p=o[o.length-1],g=p.units.units[p.units.units.length-1],y=new Uint8Array(g.data.byteLength+e.data.byteLength);y.set(g.data,0),y.set(e.data,g.data.byteLength),g.data=y,p.units.length+=e.data.byteLength,s.len+=e.data.byteLength}e.data=null;var m="",b=function(){u.length&&(c===!0||s.sps&&(o.length||this.contiguous)?(i={units:{units:u,length:v},pts:e.pts,dts:e.dts,key:c},o.push(i),s.len+=v,s.nbNalu+=u.length):s.dropped++,u=[],v=0)}.bind(this);l.forEach(function(i){switch(i.type){case 1:r=!0,d&&(m+="NDR ");break;case 5:r=!0,d&&(m+="IDR "),c=!0;break;case 6:r=!0,d&&(m+="SEI "),t=new f.default(i.data),t.readUByte();var o=t.readUByte();if(4===o){var l=0;do l=t.readUByte();while(255===l);var h=t.readUByte();if(181===h){var p=t.readUShort();if(49===p){var g=t.readUInt();if(1195456820===g){var y=t.readUByte();if(3===y){var E=t.readUByte(),_=t.readUByte(),R=31&E,T=[E,_];for(n=0;n0){var y=this._avcTrack,m=y.samples;if(m.length){var b=m[m.length-1],E=b.units.units,_=E[E.length-1],R=new Uint8Array(_.data.byteLength+i);R.set(_.data,0),R.set(e.subarray(0,i),_.data.byteLength),_.data=R,b.units.length+=i,y.len+=i}}}a=o,s=n,u=0}else u=0}return a&&(r={data:e.subarray(a,l),type:s,state:u},d.push(r),this.avcNaluState=u),d}},{key:"_parseAACPES",value:function(e){var t,i,r,n,a,s,l,d,f,v=this._aacTrack,p=e.data,g=e.pts,y=0,m=this._duration,b=this.audioCodec,E=this.aacOverFlow,_=this.aacLastPTS;if(E){var R=new Uint8Array(E.byteLength+p.byteLength);R.set(E,0),R.set(p,E.byteLength),p=R}for(a=y,d=p.length;a1&&(h.logger.log("AAC: align PTS for overlapping frames by "+Math.round((S-g)/90)),g=S)}for(;a+5>>5,i-=s,i>0&&a+s+i<=d);)for(l=g+n*r,f={unit:p.subarray(a+s,a+s+i),pts:l,dts:l},v.samples.push(f),v.len+=i,a+=i+s,n++;a=564&&71===e[0]&&71===e[188]&&71===e[376]}}]),e}();i.default=v},{"../errors":21,"../events":23,"../utils/logger":38,"./adts":14,"./exp-golomb":18}],21:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},i.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",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_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],22:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__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?"symbol":typeof e},s=function(){function e(e,t){for(var i=0;i1?i-1:0),a=1;ad&&(l[u-1].end=e[o].end):l.push(e[o])}else l.push(e[o])}for(o=0,r=0,n=a=t;o=f&&t=0&&ot.endSN)return 0;if(o=i-t.startSN,l=t.fragments,u=l[o],!isNaN(u.startPTS)){var f=Math.abs(u.startPTS-r);isNaN(u.deltaPTS)?u.deltaPTS=f:u.deltaPTS=Math.max(f,u.deltaPTS),r=Math.min(r,u.startPTS),n=Math.max(n,u.endPTS),a=Math.min(a,u.startDTS),s=Math.max(s,u.endDTS)}var h=r-u.start;for(u.start=u.startPTS=r,u.endPTS=n,u.startDTS=a,u.endDTS=s,u.duration=n-r,d=o;d>0;d--)e.updatePTS(l,d,d-1);for(d=o;dt?n.start=r.start+r.duration:n.start=r.start-n.duration:i>t?(r.duration=s-r.start,r.duration<0&&a.logger.error("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!")):(n.duration=r.start-s,n.duration<0&&a.logger.error("negative duration computed for frag "+n.sn+",level "+n.level+", there should be some duration drift between playlist and fragment!"))}}]),e}();i.default=s},{"../utils/logger":38}],26:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i1?t-1:0),r=1;r1?t-1:0),r=1;r>8*(15-i)&255;return t}},{key:"fragmentDecryptdataFromLevelkey",value:function(e,t){var i=e;return e&&e.method&&e.uri&&!e.iv&&(i=this.cloneObj(e),i.iv=this.createInitializationVector(t)),i}},{key:"avc1toavcoti",value:function(e){var t,i=e.split(".");return i.length>2?(t=i.shift()+".",t+=parseInt(i.shift()).toString(16),t+=("000"+parseInt(i.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,i){var r,n,a,s=0,o=0,l={version:null,type:null,url:t,fragments:[],live:!0,startSN:0},u={method:null,key:null,iv:null,uri:null},d=0,f=null,h=null,c=null,v=null,p=null,m=null;for(a=/(?:(?:#(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-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g;null!==(n=a.exec(e));)switch(n.shift(),n=n.filter(function(e){return void 0!==e}),n[0]){case"VERSION":l.version=parseInt(n[1]);break;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"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"DIS":d++;break;case"BYTERANGE":var b=n[1].split("@");m=1===b.length?p:parseInt(b[1]),p=parseInt(b[0])+m;break;case"INF":c=parseFloat(n[1]),v=n[2]?n[2]:null;break;case"":if(!isNaN(c)){var E=s++;r=this.fragmentDecryptdataFromLevelkey(u,E);var _=n[1]?this.resolve(n[1],t):null;h={url:_,duration:c,title:v,start:o,sn:E,level:i,cc:d,decryptdata:r,programDateTime:f},null!==m&&(h.byteRangeStartOffset=m,h.byteRangeEndOffset=p),l.fragments.push(h),o+=c,c=null,v=null,m=null,f=null}break;case"KEY":var R=n[1],T=new g.default(R),k=T.enumeratedString("METHOD"),S=T.URI,A=T.hexadecimalInteger("IV");k&&(u={method:null,key:null,iv:null,uri:null},S&&"AES-128"===k&&(u.method=k,u.uri=this.resolve(S,t),u.key=null,u.iv=A));break;case"START":var L=n[1],w=new g.default(L),D=w.decimalFloatingPoint("TIME-OFFSET");D&&(l.startTimeOffset=D);break;case"PROGRAM-DATE-TIME":f=new Date(Date.parse(n[1]));break;case"#":n.shift();break;default:y.logger.warn("line parsed but not handled: "+n)}return h&&!h.url&&(l.fragments.pop(),o-=h.duration),l.totalduration=o,l.endSN=s-1,l}},{key:"loadsuccess",value:function(e,t){var i,r=e.currentTarget,n=r.responseText,a=r.responseURL,s=this.id,o=this.id2,l=this.hls;if(this.loading=!1,void 0===a&&(a=this.url),t.tload=performance.now(),t.mtime=new Date(r.getResponseHeader("Last-Modified")),0===n.indexOf("#EXTM3U"))if(n.indexOf("#EXTINF:")>0)if(null===this.id)l.trigger(u.default.MANIFEST_LOADED,{levels:[{url:a}],url:a,stats:t});else{var d=this.parseLevelPlaylist(n,a,s);t.tparsed=performance.now(),l.trigger(u.default.LEVEL_LOADED,{details:d,level:s,id:o,stats:t})}else i=this.parseMasterPlaylist(n,a),i.length?l.trigger(u.default.MANIFEST_LOADED,{levels:i,url:a,stats:t}):l.trigger(u.default.ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:a,reason:"no level found in manifest"});else l.trigger(u.default.ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:a,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(e){var t,i;null===this.id?(t=h.ErrorDetails.MANIFEST_LOAD_ERROR,i=!0):(t=h.ErrorDetails.LEVEL_LOAD_ERROR,i=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:t,fatal:i,url:this.url,loader:this.loader,response:e.currentTarget,level:this.id,id:this.id2})}},{key:"loadtimeout",value:function(){var e,t;null===this.id?(e=h.ErrorDetails.MANIFEST_LOAD_TIMEOUT,t=!0):(e=h.ErrorDetails.LEVEL_LOAD_TIMEOUT,t=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:e,fatal:t,url:this.url,loader:this.loader,level:this.id,id:this.id2})}}]),t}(f.default);i.default=m},{"../errors":21,"../event-handler":22,"../events":23,"../utils/attr-list":34,"../utils/logger":38,"../utils/url":39}],31:[function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i>24&255,t[1]=r>>16&255,t[2]=r>>8&255,t[3]=255&r,t.set(e,4),n=0,r=8;n>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,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,i,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,i))}},{key:"moov",value:function(t){for(var i=t.length,r=[];i--;)r[i]=e.trak(t[i]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var i=t.length,r=[];i--;)r[i]=e.trex(t[i]);return e.box.apply(null,[e.types.mvex].concat(r))}},{key:"mvhd",value:function(t,i){i*=t;var r=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,i>>24&255,i>>16&255,i>>8&255,255&i,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,r)}},{key:"sdtp",value:function(t){var i,r,n=t.samples||[],a=new Uint8Array(4+n.length);for(r=0;r>>8&255),a.push(255&n),a=a.concat(Array.prototype.slice.call(r));for(i=0;i>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(r));var o=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).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 i=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,i>>8&255,255&i,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var i=t.id,r=t.duration*t.timescale,n=t.width,a=t.height;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>24&255,i>>16&255,i>>8&255,255&i,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,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,n>>8&255,255&n,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(t,i){var r=e.sdtp(t),n=t.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),e.trun(t,r.length+16+16+8+16+8+8),r)}},{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 i=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,i){var r,n,a,s,o,l,u=t.samples||[],d=u.length,f=12+16*d,h=new Uint8Array(f);for(i+=8+f,h.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0),r=0;r>>24&255,a>>>16&255,a>>>8&255,255&a,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*r);return e.box(e.types.trun,h)}},{key:"initSegment",value:function(t){e.types||e.init();var i,r=e.moov(t);return i=new Uint8Array(e.FTYP.byteLength+r.byteLength),i.set(e.FTYP),i.set(r,e.FTYP.byteLength),i}}]),e}();i.default=a},{}],32:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;iMath.pow(2,32)&&!function(){var t=function e(t,i){return i?e(i,t%i):t};e.timescale=e.audiosamplerate/t(e.audiosamplerate,1024)}(),l.logger.log("audio mp4 timescale :"+e.timescale),c.audio={container:"audio/mp4",codec:e.codec,initSegment:d.default.initSegment([e]),metadata:{channelCount:e.channelCount}},p&&(r=n=s[0].pts-h*i)),t.sps&&t.pps&&u.length&&(t.timescale=this.MP4_TIMESCALE,c.video={container:"video/mp4",codec:t.codec,initSegment:d.default.initSegment([t]),metadata:{width:t.width,height:t.height}},p&&(r=Math.min(r,u[0].pts-h*i),n=Math.min(n,u[0].dts-h*i))),Object.keys(c).length?(a.trigger(o.default.FRAG_PARSING_INIT_SEGMENT,v),this.ISGenerated=!0,p&&(this._initPTS=r,this._initDTS=n)):a.trigger(o.default.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(e,t,i){var r,n,a,s,u,f,h,c,v,p,g,y,m,b,E,_=8,R=this.PES_TIMESCALE,T=this.PES2MP4SCALEFACTOR,k=[],S=e.samples.reduce(function(e,t){return Math.max(Math.min(e,t.pts-t.dts),-18e3)},0);for(S<0&&l.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(S/90)+" ms to overcome this issue"),f=new Uint8Array(e.len+4*e.nbNalu+8),r=new DataView(f.buffer),r.setUint32(0,f.byteLength),f.set(d.default.types.mdat,4);e.samples.length;){for(n=e.samples.shift(),s=0;n.units.units.length;)u=n.units.units.shift(),r.setUint32(_,u.data.byteLength),_+=4,f.set(u.data,_),_+=u.data.byteLength,s+=4+u.data.byteLength;if(g=n.pts-this._initDTS,y=n.dts-this._initDTS+S,y=Math.min(g,y),void 0!==p){m=this._PTSNormalize(g,p),b=this._PTSNormalize(y,p);var A=(b-p)/T;A<=0&&(l.logger.log("invalid sample duration at PTS/DTS: "+n.pts+"/"+n.dts+":"+A),A=1),a.duration=A}else{var L=void 0,w=void 0;L=i?this.nextAvcDts:t*R,m=this._PTSNormalize(g,L),b=this._PTSNormalize(y,L),w=Math.round((b-L)/90),i&&w&&(w>1?l.logger.log("AVC:"+w+" ms hole between fragments detected,filling it"):w<-1&&l.logger.log("AVC:"+-w+" ms overlapping between fragments detected"),b=L,m=Math.max(m-w,b),l.logger.log("Video/PTS/DTS adjusted: "+m+"/"+b+",delta:"+w)),c=Math.max(0,m),v=Math.max(0,b)}a={size:s,duration:0,cts:(m-b)/T,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0}},E=a.flags,n.key===!0?(E.dependsOn=2,E.isNonSync=0):(E.dependsOn=1,E.isNonSync=1),k.push(a),p=b}var D=0;k.length>=2&&(D=k[k.length-2].duration,a.duration=D),this.nextAvcDts=b+D*T;var O=e.dropped;e.len=0,e.nbNalu=0,e.dropped=0,k.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&(E=k[0].flags,E.dependsOn=2,E.isNonSync=0),e.samples=k,h=d.default.moof(e.sequenceNumber++,v/T,e),e.samples=[],this.observer.trigger(o.default.FRAG_PARSING_DATA,{data1:h,data2:f,startPTS:c/R,endPTS:(m+T*D)/R,startDTS:v/R,endDTS:this.nextAvcDts/R,type:"video",nb:k.length,dropped:O})}},{key:"remuxAudio",value:function(e,t,i){var r,n,a,s,u,f,h,c,v,p,g,y,m,b=8,E=this.PES_TIMESCALE,_=e.timescale,R=E/_,T=1024*e.timescale/e.audiosamplerate,k=[],S=[];for(e.samples.sort(function(e,t){return e.pts-t.pts}),S=e.samples;S.length;){if(n=S.shift(),s=n.unit,p=n.pts-this._initDTS,g=n.dts-this._initDTS,void 0!==v)y=this._PTSNormalize(p,v),m=this._PTSNormalize(g,v),a.duration=(m-v)/R,Math.abs(a.duration-T)>T/10&&l.logger.log("invalid AAC sample duration at PTS "+Math.round(p/90)+",should be 1024,found :"+Math.round(a.duration*e.audiosamplerate/e.timescale)),a.duration=T,y=m=T*R+v;else{var A=void 0,L=void 0;if(A=i?this.nextAacPts:t*E,y=this._PTSNormalize(p,A),m=this._PTSNormalize(g,A),L=Math.round(1e3*(y-A)/E),i&&L){if(L>0)l.logger.log(L+" ms hole between AAC samples detected,filling it");else if(L<-12){l.logger.log(-L+" ms overlapping between AAC samples detected, drop frame"),e.len-=s.byteLength;continue}y=m=A}if(h=Math.max(0,y),c=Math.max(0,m),!(e.len>0))return;u=new Uint8Array(e.len+8),r=new DataView(u.buffer),r.setUint32(0,u.byteLength),u.set(d.default.types.mdat,4)}u.set(s,b),b+=s.byteLength,a={size:s.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},k.push(a),v=m}var w=0,D=k.length;D>=2&&(w=k[D-2].duration,a.duration=w),D&&(this.nextAacPts=y+R*w,e.len=0,e.samples=k,f=d.default.moof(e.sequenceNumber++,c/R,e),e.samples=[],this.observer.trigger(o.default.FRAG_PARSING_DATA,{data1:f,data2:u,startPTS:h/E,endPTS:this.nextAacPts/E,startDTS:c/E,endDTS:(m+R*w)/E,type:"audio",nb:D}))}},{key:"remuxID3",value:function(e,t){var i,r=e.samples.length;if(r){for(var n=0;n4294967296;)e+=i;return e}},{key:"passthrough",get:function(){return!1}}]),e}();i.default=h},{"../errors":21,"../events":23,"../remux/mp4-generator":31,"../utils/logger":38}],33:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;iNumber.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 i=new Uint8Array(t.length/2),r=0;rNumber.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=/^(\d+)x(\d+)$/.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}}],[{key:"parseAttrList",value:function(e){for(var t,i=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(t=i.exec(e));){var n=t[2],a='"';0===n.indexOf(a)&&n.lastIndexOf(a)===n.length-1&&(n=n.slice(1,-1)),r[t[1]]=n}return r}}]),e}();i.default=a},{}],35:[function(e,t,i){"use strict";var r={search:function(e,t){for(var i=0,r=e.length-1,n=null,a=null;i<=r;){n=(i+r)/2|0,a=e[n];var s=t(a);if(s>0)i=n+1;else{if(!(s<0))return a;r=n-1}}return null}};t.exports=r},{}],36:[function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i0;)e.removeCue(e.cues[0])}},{key:"push",value:function(e,t){this.cue||this._createCue();for(var i,r,n,a,s,o=31&t[0],l=2,u=0;u=48&&n<=63)switch(n){case 48:this.cue.text+="®";break;case 49:this.cue.text+="°";break;case 50:this.cue.text+="½";break;case 51:this.cue.text+="¿";break;case 52:this.cue.text+="™";break;case 53:this.cue.text+="¢";break;case 54:this.cue.text+="";break;case 55:this.cue.text+="£";break;case 56:this.cue.text+="♪";break;case 57:this.cue.text+=" ";break;case 58:this.cue.text+="è";break;case 59:this.cue.text+="â";break;case 60:this.cue.text+="ê";break;case 61:this.cue.text+="î";break;case 62:this.cue.text+="ô";break;case 63:this.cue.text+="û"}if((17===r||25===r)&&n>=32&&n<=47)switch(n){case 32:break;case 33:break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:break;case 42:break;case 43:break;case 44:break;case 45:break;case 46:break;case 47:}if((20===r||28===r)&&n>=32&&n<=47)switch(n){case 32:this._clearActiveCues(e);break;case 33:this.cue.text=this.cue.text.substr(0,this.cue.text.length-1);break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:this._clearActiveCues(e);break;case 42:break;case 43:break;case 44:this._clearActiveCues(e);break;case 45:break;case 46:this._text="";break;case 47:this._flipMemory(e)}if((23===r||31===r)&&n>=33&&n<=35)switch(n){case 33:break;case 34:break;case 35:}}}},{key:"_fromCharCode",value:function(e){switch(e){case 42:return"á";case 2:return"á";case 2:return"é";case 4:return"í";case 5:return"ó";case 6:return"ú";case 3:return"ç";case 4:return"÷";case 5:return"Ñ";case 6:return"ñ";case 7:return"█";default:return String.fromCharCode(e)}}},{key:"_flipMemory",value:function(e){this._clearActiveCues(e),this._flushCaptions(e)}},{key:"_flushCaptions",value:function(e){this._has708||(this._textTrack=this.media.addTextTrack("captions","English","en"),this._has708=!0);var t=!0,i=!1,r=void 0;try{for(var n,a=this.memory[Symbol.iterator]();!(t=(n=a.next()).done);t=!0){var s=n.value;s.startTime=e,this._textTrack.addCue(s),this.display.push(s)}}catch(e){i=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(i)throw r}}this.memory=[],this.cue=null}},{key:"_clearActiveCues",value:function(e){var t=!0,i=!1,r=void 0;try{for(var n,a=this.display[Symbol.iterator]();!(t=(n=a.next()).done);t=!0){var s=n.value;s.endTime=e}}catch(e){i=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(i)throw r}}this.display=[]}},{key:"_clearBufferedCues",value:function(){}}]),e}();i.default=a},{}],37:[function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i "+t}function a(e){var t=window.console[e];return t?function(){for(var i=arguments.length,r=Array(i),a=0;a1?t-1:0),r=1;r-1;o=r+i)i=/^\/(?:\.\.\/)*/.exec(s.slice(r))[0].length,a=(a+s.substring(o,r)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");return a+s.substr(o)}};t.exports=r},{}],40:[function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i=200&&i<300?(window.clearTimeout(this.timeoutHandle),r.tload=Math.max(r.tfirst,performance.now()),this.onSuccess(e,r)):r.retry>=this.maxRetry||i>=400&&i<499?(window.clearTimeout(this.timeoutHandle),a.logger.error(i+" while loading "+this.url),this.onError(e)):(a.logger.warn(i+" while loading "+this.url+", retrying in "+this.retryDelay+"..."),this.destroy(),window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,64e3),r.retry++))}},{key:"loadtimeout",value:function(e){a.logger.warn("timeout while loading "+this.url),this.onTimeout(e,this.stats)}},{key:"loadprogress",value:function(e){var t=this.stats;0===t.tfirst&&(t.tfirst=Math.max(performance.now(),t.trequest)),t.loaded=e.loaded,this.onProgress&&this.onProgress(e,t)}}]),e}();i.default=s},{"../utils/logger":38}]},{},[27])(27)}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";function t(){var e=document.createElement("input");return e.setAttribute("type","range"),"text"!==e.type}function i(e,t){var i=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)}function r(e,t){return t=t||100,function(){if(!e.debouncing){var i=Array.prototype.slice.apply(arguments);e.lastReturnVal=e.apply(window,i),e.debouncing=!0}return clearTimeout(e.debounceTimeout),e.debounceTimeout=setTimeout(function(){e.debouncing=!1},t),e.lastReturnVal}}function n(e){return e&&(0===e.offsetWidth||0===e.offsetHeight||e.open===!1)}function a(e){for(var t=[],i=e.parentNode;n(i);)t.push(i),i=i.parentNode;return t}function s(e,t){function i(e){"undefined"!=typeof e.open&&(e.open=!e.open)}var r=a(e),n=r.length,s=[],o=e[t];if(n){for(var l=0;l'),this.$handle=e('
'),this.$range=e('
').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=e.proxy(this.handleDown,this),this.handleMove=e.proxy(this.handleMove,this),this.handleEnd=e.proxy(this.handleEnd,this),this.init();var a=this;this.$window.on("resize."+this.identifier,r(function(){i(function(){a.update(!1,!1)},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+this.identifier,function(e,t){if(!t||t.origin!==a.identifier){var i=e.target.value,r=a.getPositionFromValue(i);a.setPosition(r)}})}Number.isNaN=Number.isNaN||function(e){return"number"==typeof e&&e!==e};var d="rangeslider",f=0,h=t(),c={polyfill:!0,orientation:"horizontal",rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",horizontalClass:"rangeslider--horizontal",verticalClass:"rangeslider--vertical",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]},v={orientation:{horizontal:{dimension:"width",direction:"left",directionStyle:"left",coordinate:"x"},vertical:{dimension:"height",direction:"top",directionStyle:"bottom",coordinate:"y"}}};return u.prototype.init=function(){this.update(!0,!1),this.onInit&&"function"==typeof this.onInit&&this.onInit()},u.prototype.update=function(e,t){e=e||!1,e&&(this.min=o(this.$element[0].getAttribute("min"),0),this.max=o(this.$element[0].getAttribute("max"),100),this.value=o(this.$element[0].value,Math.round(this.min+(this.max-this.min)/2)),this.step=o(this.$element[0].getAttribute("step"),1)),this.handleDimension=s(this.$handle[0],"offset"+l(this.DIMENSION)),this.rangeDimension=s(this.$range[0],"offset"+l(this.DIMENSION)),this.maxHandlePos=this.rangeDimension-this.handleDimension,this.grabPos=this.handleDimension/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position,t)},u.prototype.handleDown=function(e){if(this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+e.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var t=this.getRelativePosition(e),i=this.$range[0].getBoundingClientRect()[this.DIRECTION],r=this.getPositionFromNode(this.$handle[0])-i,n="vertical"===this.orientation?this.maxHandlePos-(t-this.grabPos):t-this.grabPos;this.setPosition(n),t>=r&&ti?i:e},u.prototype.setPosition=function(e,t){var i,r;void 0===t&&(t=!0),i=this.getValueFromPosition(this.cap(e,0,this.maxHandlePos)),r=this.getPositionFromValue(i),this.$fill[0].style[this.DIMENSION]=r+this.grabPos+"px",this.$handle[0].style[this.DIRECTION_STYLE]=r+"px",this.setValue(i),this.position=r,this.value=i,t&&this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(r,i)},u.prototype.getPositionFromNode=function(e){for(var t=0;null!==e;)t+=e.offsetLeft,e=e.offsetParent;return t},u.prototype.getRelativePosition=function(e){var t=l(this.COORDINATE),i=this.$range[0].getBoundingClientRect()[this.DIRECTION],r=0;return"undefined"!=typeof e["page"+t]?r=e["page"+t]:"undefined"!=typeof e.originalEvent["client"+t]?r=e.originalEvent["client"+t]:e.originalEvent.touches&&e.originalEvent.touches[0]&&"undefined"!=typeof e.originalEvent.touches[0]["page"+t]?r=e.originalEvent.touches[0]["page"+t]:e.currentPoint&&"undefined"!=typeof e.currentPoint[this.COORDINATE]&&(r=e.currentPoint[this.COORDINATE]),r-i},u.prototype.getPositionFromValue=function(e){var t,i;return t=(e-this.min)/(this.max-this.min),i=Number.isNaN(t)?0:t*this.maxHandlePos},u.prototype.getValueFromPosition=function(e){var t,i;return t=e/(this.maxHandlePos||1),i=this.step*Math.round(t*(this.max-this.min)/this.step)+this.min,Number(i.toFixed(this.toFixed))},u.prototype.setValue=function(e){e===this.value&&""!==this.$element[0].value||this.$element.val(e).trigger("input",{origin:this.identifier})},u.prototype.destroy=function(){this.$document.off("."+this.identifier),this.$window.off("."+this.identifier),this.$element.off("."+this.identifier).removeAttr("style").removeData("plugin_"+d),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0])},e.fn[d]=function(t){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var r=e(this),n=r.data("plugin_"+d);n||r.data("plugin_"+d,n=new u(this,t)),"string"==typeof t&&n[t].apply(n,i)})},"rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);"});var Julia=function(e){window.jQuery||(alert("jQuery is required"),window.stop());var r=this;e="undefined"==typeof e?{}:e;var n="julia";dir=$('script[src*="julia-player"]').attr("src"),name=dir.split("/").pop(),n=dir.replace("/js/"+name,""),$("head").append(''),r.options={source:!1,autoplay:!1,volume:25,element:$("video"),muted:!1,width:512,height:288,debug:!1,debugPlayback:!1,forceHls:!1,live:!1,responsive:!0,dimensions:[[1920,1080],[1280,720],[960,540],[640,360],[512,288]],pauseOnClick:!1,poster:"",hlsConfig:{},dashConfig:{},suggest:[],suggestLimit:2,suggestTimeout:1e4,themePath:n+"/css/themes",pluginPath:n+"/js/plugins",theme:"default",i18n:{liveText:"Live"},onTime:{},triggerHls:{},onPlay:!1,onPause:!1,onStop:!1,onPosition:!1,onSuggest:!1},r.env={shield:"",element:r.options.element,suggest:"",toolbar:"",poster:"",api:"",apiId:Math.floor(1e7*Math.random()+1),player:"",isLive:!1,hls:{},canPlayMedia:"",canPlayMediaString:"",isHls:!1,useHlsLib:!1,tries:0,source:"",duration:0,apiOk:!1,onTimeRised:[],seeking:!1,dimensions:{width:0,height:0},started:!1,publicApi:{},suggestPointer:0,suggestClicked:!1,progressStep:.01};var l=function(){for(o in r.options)e.hasOwnProperty(o)&&(r.options[o]=e[o])};l();var u=function(e){if(r.options.debug===!0&&window.console)for(d in e)console.log(" - [instance: "+r.env.apiId+"] "+d+" ["+typeof e[d]+"]",e[d])},f={set:function(e,t,i){dateObj=new Date,dateObj.setTime(dateObj.getTime()+24*i*60*60*1e3);var r="expires="+dateObj.toUTCString();document.cookie=e+"="+t+"; "+r+"; path=/"},get:function(e){for(var e=e+"=",t=document.cookie.split(";"),i=0;i'),r.env.player.prepend(apiElement),r.env.api=document.getElementById("julia-api-"+r.env.apiId),r.env.api.controls=!1,r.env.apiOk=!0,u({apiId:r.env.apiId,api:r.env.api})}},v={shield:function(){r.env.shield=$('
'),r.env.suggest=$('
')},posterSet:function(){v.posterUnset(),r.env.poster.length>0&&(img=$(''),r.env.shield.append(img),u({poster:r.env.poster}))},posterUnset:function(){r.env.shield.find("img").remove()},toolbar:function(){r.env.toolbar=$('
'+r.options.i18n.liveText+'
00:00:00
00:00:00
')},player:function(){v.shield(),v.toolbar(),r.env.player=$('
'),r.env.player.append(r.env.shield),r.env.player.append(r.env.suggest),r.env.player.append(r.env.toolbar),r.env.element.hide(),r.env.player.insertAfter(r.env.element),r.env.shield.find(".julia-big-play").hide(),r.env.toolbar.hide(),$("#julia-toolbar-"+r.env.apiId+">div.julia-progress>input, #julia-toolbar-"+r.env.apiId+">div.julia-volume>input").rangeslider({polyfill:!1,rangeClass:"julia-rangeslider",disabledClass:"julia-rangeslider--disabled",horizontalClass:"julia-rangeslider--horizontal",verticalClass:"julia-rangeslider--vertical",fillClass:"julia-rangeslider__fill",handleClass:"julia-rangeslider__handle",onInit:function(){},onSlide:function(e,t){},onSlideEnd:function(e,t){}}),u({element:r.env.element,toolbar:r.env.toolbar,shield:r.env.shield,player:r.env.player})}},g={on:function(){var e=document.querySelector("#julia-player-"+r.env.apiId);e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()},off:function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},y={toPercents:function(e){return p=e/r.env.duration*100,p},toSeconds:function(e){return t=r.env.duration/100*e,t},toNum:function(e){return e=e.split(":"),e.reverse(),s=parseInt(e[0]),m=e.length>1?parseInt(e[1]):0,h=e.length>2?parseInt(e[3]):0,t=s+60*m+60*h*60,t},toHuman:function(e){return e=e.toString().split("."),s=e[0],H=Math.floor(s/3600),M=Math.floor((s-3600*H)/60),S=Math.floor(s-3600*H-60*M),H=("0"+H.toString()).slice(-2),M=("0"+M.toString()).slice(-2),S=("0"+S.toString()).slice(-2),str=H>0?H+":"+M+":"+S:M+":"+S,str}},b={run:function(){if(r.env.suggest.html(""),R.press("stop"),r.env.suggestClicked=!1,r.env.tries=0,r.options.suggest.length>0){x=0;for(var e in r.options.suggest)if(x0?'':"",suggestItemWidget=$('
'+posterImage+'
'+r.options.suggest[e].title+"
"),suggestItemWidget.on("click",function(t){r.options.onSuggest!==!1&&_.fn(r.options.onSuggest,r.options.suggest[e]),r.options.muted=r.env.api.muted,r.options.poster=$(this).data("poster"),r.env.suggestClicked=!0,r.env.shield.find(".julia-big-play").hide(),r.env.started=!1,r.options.source=$(this).data("file"),k.selectSource(),r.options.autoplay=!0,r.options.live="live"==$(this).data("mode"),r.options.i18n.liveText=$(this).data("live-text"),r.env.toolbar.find(".julia-live-indicator>span").text(r.options.i18n.liveText),u({suggestRemoveIndex:$(this).data("index"),suggestRemove:$(this).data("file")}),r.options.suggest[$(this).data("index")].played=!0,r.env.suggest.removeClass("on"),k.init(),k.load(),E.resize()}),r.env.suggest.append(suggestItemWidget),x++}x>0&&(r.options.suggestTimeout>0&&E.isMobile()===!1&&setTimeout(function(){r.env.suggestClicked===!1&&r.env.suggest.find("div.julia-suggest-item:first").click()},r.options.suggestTimeout),r.env.suggest.addClass("on"))}else g.off();u({Suggest:"raised"})}},E={aspect:function(e,t){return e>0&&t>0?t/e:0},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},forceReady:function(){return!!/Firefox/i.test(navigator.userAgent)},theme:function(){u({theme:r.options.themePath+"/"+r.options.theme+"/julia.css"}),$("head").append('')},canPlayMedia:function(){var e=document.createElement("video");return e.id="video-cap-test-"+r.env.apiId,r.env.canPlayMediaString=e.canPlayType("application/vnd.apple.mpegURL"),$("#video-cap-test"+r.env.apiId).remove(),"probably"==r.env.canPlayMediaString||"maybe"==r.env.canPlayMediaString},resize:function(){defaultDim=r.env.element.width()?[r.env.element.width(),r.env.element.height()]:[r.options.width,r.options.height],dimensions=r.options.responsive===!0?E.getSize():defaultDim,u({resizeDefaults:defaultDim,resize:dimensions}),r.env.player.width(dimensions[0]),r.env.player.height(dimensions[1]),r.env.dimensions.width=dimensions[0],r.env.dimensions.height=dimensions[1],r.env.api.setAttribute("width","100%"),r.env.api.setAttribute("height","100%")},getSize:function(){var e=r.env.element.parent().css("display").toLowerCase();"inline"==e&&r.env.element.parent().css({display:"block"});var t=r.env.element.parent().width();for(i in r.options.dimensions){var n=r.options.dimensions[i];if(t>=n[0])return a=0==E.aspect(t)?n[1]/n[0]:E.aspect(r.env.api.videoWidth,r.env.api.videoHeight),dimensions=[n[0],n[0]*a],u({resizePredefined:dimensions}),dimensions}return a=0==E.aspect()?n[1]/n[0]:E.aspect(r.env.api.videoWidth,r.env.api.videoHeight),dimensions=[t,t*a],u({resizeFallback:dimensions}),dimensions}},_={fn:function(e,t){t=t||{},e!==!1&&e(r.options,r.env,t)}},R={press:function(e,t){switch(t=t||{},u({action:e,"action-data":t}),e){case"play":r.options.onPlay!==!1&&_.fn(r.options.onPlay,t),r.env.api.play();break;case"pause":r.options.onPause!==!1&&_.fn(r.options.onPause,t),r.env.api.pause();break;case"stop":r.options.onStop!==!1&&_.fn(r.options.onStop,t),r.env.api.pause(),r.env.api.currentTime=0,r.env.toolbar.find(".julia-playback.pause").removeClass("pause").addClass("play").find("i").removeClass("julia-pause").addClass("julia-play"),r.env.shield.find(".julia-big-play").show(),r.env.toolbar.find(".julia-progress>input").val(0).rangeslider("update",!0);break;case"goto":r.options.onPosition!==!1&&_.fn(r.options.onPosition,t),r.env.api.currentTime=t.currentTime;break;case"setDuration":r.env.toolbar.find(".julia-panel.julia-duration>span").text(t.duration),r.env.started===!1&&r.env.toolbar.find(".julia-progress>input").val(0).rangeslider("update",!0),u({setDuration:t.duration});break;case"volume":r.options.volume=t.volume,r.env.api.volume=t.volume/100,u({"volume is":r.env.api.volume}),r.env.toolbar.find(".julia-volume>input").val(t.volume).rangeslider("update",!0),t.volume>0?R.press("sound-on"):R.press("sound-off");break;case"sound-on":r.env.api.muted=!1,r.options.muted=!1,f.set("volume",r.options.volume,30),f.set("muted",r.options.muted,30),r.env.toolbar.find(".julia-sound.off").removeClass("off").addClass("on").find("i").removeClass("julia-sound-off").addClass("julia-sound-on");break;case"sound-off":r.env.api.muted=!0,r.options.muted=!0,f.set("volume",r.options.volume,30),f.set("muted",r.options.muted,30),r.env.toolbar.find(".julia-sound.on").removeClass("on").addClass("off").find("i").removeClass("julia-sound-on").addClass("julia-sound-off");break;case"fullscreen-on":g.on();break;case"fullscreen-off":g.off();break;case"destroy":setTiemout(function(){r.env.player.remove()},100)}}},T={playAllowStart:function(e){r.env.shield.find(".julia-preloader").removeClass("on"),r.env.shield.find(".julia-big-play").show(),r.env.toolbar.show(),R.press("setDuration",{duration:y.toHuman(r.env.duration)}),r.options.muted===!0?R.press("sound-off"):(R.press("sound-on"),R.press("volume",{volume:r.options.volume})),r.options.autoplay===!0&&E.isMobile()===!1&&R.press("play"),u({eventType:e.type,duration:r.env.api.duration,readyState:r.env.api.readyState})},canplaythrough:function(){r.env.started===!1&&(r.env.api.readyState>=3||E.isMobile()===!0&&r.env.api.readyState>=2?T.playAllowStart({type:"_events.canplaythrough"}):setTimeout(function(){T.canplaythrough()},250))},DOM:function(){r.env.toolbar.on("contextmenu",function(e){e.preventDefault()}).on("click",".julia-playback.play",function(e){e.preventDefault(),R.press("play")}).on("click",".julia-playback.pause",function(e){e.preventDefault(),R.press("pause")}).on("click",".julia-sound.on",function(e){e.preventDefault(),R.press("sound-off")}).on("click",".julia-sound.off",function(e){e.preventDefault(),R.press("sound-on")}).on("click",".julia-fullscreen-toggle.on",function(e){e.preventDefault(),R.press("fullscreen-on")}).on("click",".julia-fullscreen-toggle.off",function(e){e.preventDefault(),R.press("fullscreen-off")}),r.env.shield.on("click contextmenu",".julia-big-play",function(e){e.preventDefault(),e.stopPropagation(),"click"==e.type&&R.press("play")}),r.env.shield.on("click",function(e){e.preventDefault(),e.stopPropagation(),r.options.pauseOnClick===!0&&E.isMobile()===!1&&R.press("pause")});var e;r.env.player.on("mousemove","#julia-shield-"+r.env.apiId+", #julia-suggest-"+r.env.apiId,function(t){t.preventDefault(),r.env.toolbar.addClass("julia-toolbar-visible"),clearTimeout(e),e=setTimeout(function(){r.env.toolbar.removeClass("julia-toolbar-visible")},1750)}).on("mouseover mousemove mouseout","#julia-toolbar-"+r.env.apiId+".julia-toolbar-visible",function(t){t.preventDefault(),r.env.toolbar.addClass("julia-toolbar-visible"),clearTimeout(e),"mouseout"==t.type&&(e=setTimeout(function(e){r.env.toolbar.removeClass("julia-toolbar-visible")},1750))}),r.env.toolbar.on("change input",".julia-progress>input",function(e){"input"==e.type?r.env.seeking=!0:(seekTo=y.toSeconds($(this).val()),seekTo=seekTo>=r.env.duration?r.env.duration:seekTo.toFixed(2),R.press("goto",{currentTime:seekTo}),r.env.seeking=!1)}),r.env.toolbar.on("change",".julia-volume>input",function(){R.press("volume",{volume:$(this).val(),event:"slideChange"})}),$(window).on("resize",function(){E.resize()}),$(document).on("webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(e){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement?($(".julia-player").removeClass("julia-fullscreen-off").addClass("julia-fullscreen-on").find("button.julia-fullscreen-toggle").removeClass("on").addClass("off").find("i").removeClass("julia-fullscreen").addClass("julia-fullscreen-exit"),E.isMobile()&&(screen.orientation.lock("landscape-primary"),screen.msLockOrientation.lock("landscape-primary"),screen.mozLockOrientation.lock("landscape-primary")),u({"fullscreen on":"#julia-player-"+r.env.apiId})):($(".julia-player").removeClass("julia-fullscreen-on").addClass("julia-fullscreen-off").find("button.julia-fullscreen-toggle").removeClass("off").addClass("on").find("i").removeClass("julia-fullscreen-exit").addClass("julia-fullscreen"),E.isMobile()&&(screen.orientation.unlock(),screen.msLockOrientation.unlock(),screen.mozLockOrientation.unlock()),u({"fullscreen off":"#julia-player-"+r.env.apiId}),E.resize())})},nativeEvents:function(){E.forceReady()===!0&&r.env.isHls===!0?T.canplaythrough():r.env.api.oncanplaythrough=function(e){r.env.duration=r.env.api.duration,r.env.started===!1&&r.env.api.readyState>=3&&T.playAllowStart(e)},r.env.api.onplay=function(e){r.env.toolbar.find(".julia-playback.play").removeClass("play").addClass("pause").find("i").removeClass("julia-play").addClass("julia-pause"),r.env.shield.find(".julia-big-play").hide(),r.env.shield.find(".julia-preloader").removeClass("on"),v.posterUnset(),r.env.toolbar.show()},r.env.api.onplaying=function(e){r.env.toolbar.find(".julia-playback.play").removeClass("play").addClass("pause").find("i").removeClass("julia-play").addClass("julia-pause"),r.env.shield.find(".julia-big-play").hide(),r.env.shield.find(".julia-preloader").removeClass("on"),r.env.suggest.html("").removeClass("on"),r.env.toolbar.show(),R.press("setDuration",{duration:y.toHuman(r.env.duration)}),r.env.started=!0},r.env.api.onpause=function(e){r.env.toolbar.find(".julia-playback.pause").removeClass("pause").addClass("play").find("i").removeClass("julia-pause").addClass("julia-play"),r.env.shield.find(".julia-big-play").show()},r.env.api.onerror=function(e){r.env.tries<11&&k.init()},r.env.api.onemptied=function(e){},r.env.api.onstalled=function(e){},r.env.api.onsuspend=function(e){},r.env.api.ontimeupdate=function(e){r.env.seeking===!1&&(currentTimeReadable=y.toHuman(r.env.api.currentTime.toFixed(2)),r.env.toolbar.find(".julia-progress>input").val(y.toPercents(r.env.api.currentTime.toFixed(2))).rangeslider("update",!0),r.env.toolbar.find(".julia-panel.julia-currentTime>span").text(currentTimeReadable)),T.onTime(currentTimeReadable,r.env.api.currentTime),r.options.debugPlayback===!0&&u({"duration/current":r.env.duration+"/"+r.env.api.currentTime.toFixed(2)+" > "+currentTimeReadable})},r.env.api.seeked=function(e){r.env.seeking=!1},r.env.api.seeking=function(e){r.env.seeking=!0},r.env.api.onvolumechange=function(e){r.env.api.muted===!1?r.env.toolbar.find(".julia-volume>input").val(100*r.env.api.volume).rangeslider("update",!0):r.env.toolbar.find(".julia-volume>input").val(0).rangeslider("update",!0)},r.env.api.ondurationchange=function(e){r.env.duration=r.env.api.duration,r.env.started===!1&&(r.env.duration=r.env.api.duration,r.env.seeking=!1,u({duration:r.env.duration,readyState:r.env.api.readyState,started:r.env.started}))},r.env.api.onended=function(e){b.run()}},hlsLibEvents:function(){r.env.hls.on(Hls.Events.ERROR,function(e,t){switch(t.details){case Hls.ErrorDetails.MANIFEST_LOAD_ERROR:case Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case Hls.ErrorDetails.MANIFEST_PARSING_ERROR:case Hls.ErrorDetails.LEVEL_LOAD_ERROR:case Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT:case Hls.ErrorDetails.LEVEL_SWITCH_ERROR:case Hls.ErrorDetails.FRAG_LOAD_ERROR:case Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case Hls.ErrorDetails.FRAG_LOAD_TIMEOUT:case Hls.ErrorDetails.FRAG_DECRYPT_ERROR:case Hls.ErrorDetails.FRAG_PARSING_ERROR:case Hls.ErrorDetails.BUFFER_APPEND_ERROR:case Hls.ErrorDetails.BUFFER_APPENDING_ERROR:u({recoveringError:t.details,errorType:t.type,errorFatal:t.fatal,data:t,tries:r.env.tries}),t.fatal===!0&&r.env.tries<11&&k.load()}})},onTime:function(e,t){e in r.options.onTime&&r.env.onTimeRised.indexOf(e)==-1&&(handle=r.options.onTime[e],r.env.onTimeRised.push(e),"function"==typeof window[handle]?(window[handle](e,r.env.publicApi),u({onTime:handle+" raised"})):u({onTimeError:handle+" is not a function, but: "+typeof handle}))}},k={create:function(){r.env.element=r.options.element,r.options.debug===!0&&window.console&&console.info("=== Julia console debug start for "+r.env.apiId+" ==="),u(r.options);for(i in r.options.suggest)r.options.suggest[i].played=!1;E.theme(),volume=f.get("volume"),muted=f.get("muted"),volume.length>0&&(r.options.volume=parseInt(volume)),muted.length>0&&(r.options.muted="false"!=muted),v.player()},selectSource:function(){r.env.element.prop("preload","none"),protoSource=r.env.element.prop("src")?r.env.element.prop("src"):r.env.element.find("source").prop("src"),r.env.source=r.options.source&&r.options.source.length>0?r.options.source:protoSource,r.env.isHls=r.env.source.indexOf("m3u8")!=-1,r.options.forceHls===!0&&(r.env.isHls=!0),u({sourceType:r.env.isHls===!1?"file":"hls"}),r.env.poster=r.options.poster&&r.options.poster.length>0?r.options.poster:r.env.element.prop("poster"),v.posterSet()},load:function(){r.env.shield.find(".julia-preloader").addClass("on"),r.env.useHlsLib===!0?(T.hlsLibEvents(),r.env.hls.autoLevelCapping=-1,r.env.hls.attachMedia(r.env.api),r.env.hls.loadSource(r.env.source),r.env.hls.on(Hls.Events.MEDIA_ATTACHED,function(e,t){r.env.hls.on(Hls.Events.LEVEL_LOADED,function(e,t){t.details.live===!0||r.options.live===!0?(r.env.isLive=!0,r.env.toolbar.addClass("live")):r.env.toolbar.removeClass("live")});for(x in r.options.triggerHls)handle=r.options.triggerHls[x],"function"==typeof window[handle]?r.env.hls.on(Hls.Events[x],function(e,t){window[handle](r.env.apiId,e,t)}):u({triggerHlsError:handle+" is not a function"})})):r.env.api.load(),r.env.apiOk===!0&&(T.DOM(),T.nativeEvents()),stats={isHls:r.env.isHls,useHlsLib:r.env.useHlsLib,live:r.env.isLive,canPlayMediaString:r.env.canPlayMediaString,canPlayMedia:r.env.canPlayMedia},u(stats),r.env.publicApi={control:R,options:r.options,support:E,dimensions:r.env.dimensions,timecode:y,shield:r.env.shield,toolbar:r.env.toolbar,media:r.env.api,id:r.env.apiId,stats:stats}}, +init:function(){k.selectSource(),r.env.useHlsLib=!1,r.env.isLive=!1,r.env.canPlayMedia=E.canPlayMedia(),r.env.tries+=1,r.env.isHls===!0&&(r.env.useHlsLib=!(r.env.canPlayMedia!==!1||!Hls.isSupported())),r.env.useHlsLib===!0?(c.create(),r.env.hls=new Hls(r.options.hlsConfig)):(c.create(),r.env.api.src=r.env.source),r.options.live===!0?(r.env.isLive=!0,r.env.toolbar.addClass("live")):r.env.toolbar.removeClass("live")}};return k.create(),k.init(),k.load(),E.resize(),r.env.publicApi};$.fn.julia=function(e){return this.each(function(){if(!$(this).data("julia")){e="undefined"==typeof e?{}:e,e.element=$(this);var t=new Julia(e);$(this).data("julia",t)}})},$.fn.play=function(){$(this).data("julia").control.press("play")},$.fn.destroy=function(){$(this).data("julia").control.press("destroy")},$.fn.media=function(){return $(this).data("julia").media},$.fn.pause=function(){$(this).data("julia").control.press("pause")},$.fn.stop=function(){$(this).data("julia").control.press("stop")},$.fn.goto=function(e){$(this).data("julia").control.press("goto",{currentTime:e})},$.fn.mute=function(){$(this).data("julia").media.muted===!1?$(this).data("julia").control.press("sound-off"):$(this).data("julia").control.press("sound-on")},$.fn.volume=function(e){$(this).data("julia").control.press("volume",{volume:e})},$.fn.getID=function(){return $(this).data("julia").id},$.fn.stats=function(){return $(this).data("julia").stats}; \ No newline at end of file diff --git a/dist/swf/flashlsChromeless.swf b/dist/swf/flashlsChromeless.swf deleted file mode 100644 index 0efa6eb..0000000 Binary files a/dist/swf/flashlsChromeless.swf and /dev/null differ diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..9d05bda --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,67 @@ +'use strict'; + +/* +Nebula hub app builder +@TODO * source maps +*/ + +// Gulp && plugins +var gulp = require('gulp'); +var cleanCSS = require('gulp-clean-css'); +var sass = require('gulp-sass'); +var concat = require('gulp-concat'); +var minify = require('gulp-minify'); +var sourcemaps = require('gulp-sourcemaps'); + +// Sources +var appSrc = [ + 'src/js/lib/hls.js', + 'src/js/lib/rangeslider.js', + 'src/js/julia-pre.js', + 'src/js/julia-core.js', + 'src/js/julia-jquery-plugin.js', +]; + + +// App styles +gulp.task('sass', function() +{ + return gulp.src('src/scss/julia-player.scss') + .pipe(sass.sync().on('error', sass.logError)) + .pipe(gulp.dest('dist/css')) + .pipe(cleanCSS()) + .pipe(concat('julia-player.min.css')) + //.pipe(sourcemaps.init()) + //.pipe(cleanCSS()) + //.pipe(sourcemaps.write()) + .pipe(gulp.dest('dist/css')); +}); + + +// App scripts +gulp.task('jsbuild', function() +{ + return gulp.src(appSrc) + .pipe(concat('julia-player.js')) + .pipe(minify({ + ext:{ + src:'.js', + min:'.min.js' + }, + compress: { + properties: false + }, + exclude: ['tmp'], + ignoreFiles: ['.combo.js', '.min.js'] + })) + .pipe(gulp.dest('dist/js')); +}); + + + +// Watch it, Gulp! +gulp.task('watch', function () +{ + gulp.watch('src/scss/*.scss', ['sass']); + gulp.watch('src/js/*.js', ['jsbuild']); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..a91c0ad --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "julia-player", + "version": "1.0.0", + "description": "Julia player, HTML5 responsive, mobile ready media player", + "main": "gulpfile.js", + "dependencies": { + "gulp": "^3.9.1", + "gulp-clean-css": "^2.0.12", + "gulp-concat": "^2.6.0", + "gulp-minify": "^0.0.14", + "gulp-sass": "^2.3.2", + "gulp-sourcemaps": "^1.6.0" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/prochor666/julia-player.git" + }, + "keywords": [ + "html5", + "video", + "player" + ], + "author": "prochor666@gmail.com", + "license": "MIT", + "bugs": { + "url": "https://github.com/prochor666/julia-player/issues" + }, + "homepage": "https://github.com/prochor666/julia-player#readme" +} diff --git a/src/css/ionicons.css b/src/css/ionicons.css deleted file mode 100644 index f7678e3..0000000 --- a/src/css/ionicons.css +++ /dev/null @@ -1,1480 +0,0 @@ -@charset "UTF-8"; -/*! - Ionicons, v2.0.0 - Created by Ben Sperry for the Ionic Framework, http://ionicons.com/ - https://twitter.com/benjsperry https://twitter.com/ionicframework - MIT License: https://github.com/driftyco/ionicons - - Android-style icons originally built by Google’s - Material Design Icons: https://github.com/google/material-design-icons - used under CC BY http://creativecommons.org/licenses/by/4.0/ - Modified icons to fit ionicon’s grid from original. -*/ -@font-face { font-family: "Ionicons"; src: url("../fonts/ionicons.eot?v=2.0.0"); src: url("../fonts/ionicons.eot?v=2.0.0#iefix") format("embedded-opentype"), url("../fonts/ionicons.ttf?v=2.0.0") format("truetype"), url("../fonts/ionicons.woff?v=2.0.0") format("woff"), url("../fonts/ionicons.svg?v=2.0.0#Ionicons") format("svg"); font-weight: normal; font-style: normal; } -.ion, .ionicons, .ion-alert:before, .ion-alert-circled:before, .ion-android-add:before, .ion-android-add-circle:before, .ion-android-alarm-clock:before, .ion-android-alert:before, .ion-android-apps:before, .ion-android-archive:before, .ion-android-arrow-back:before, .ion-android-arrow-down:before, .ion-android-arrow-dropdown:before, .ion-android-arrow-dropdown-circle:before, .ion-android-arrow-dropleft:before, .ion-android-arrow-dropleft-circle:before, .ion-android-arrow-dropright:before, .ion-android-arrow-dropright-circle:before, .ion-android-arrow-dropup:before, .ion-android-arrow-dropup-circle:before, .ion-android-arrow-forward:before, .ion-android-arrow-up:before, .ion-android-attach:before, .ion-android-bar:before, .ion-android-bicycle:before, .ion-android-boat:before, .ion-android-bookmark:before, .ion-android-bulb:before, .ion-android-bus:before, .ion-android-calendar:before, .ion-android-call:before, .ion-android-camera:before, .ion-android-cancel:before, .ion-android-car:before, .ion-android-cart:before, .ion-android-chat:before, .ion-android-checkbox:before, .ion-android-checkbox-blank:before, .ion-android-checkbox-outline:before, .ion-android-checkbox-outline-blank:before, .ion-android-checkmark-circle:before, .ion-android-clipboard:before, .ion-android-close:before, .ion-android-cloud:before, .ion-android-cloud-circle:before, .ion-android-cloud-done:before, .ion-android-cloud-outline:before, .ion-android-color-palette:before, .ion-android-compass:before, .ion-android-contact:before, .ion-android-contacts:before, .ion-android-contract:before, .ion-android-create:before, .ion-android-delete:before, .ion-android-desktop:before, .ion-android-document:before, .ion-android-done:before, .ion-android-done-all:before, .ion-android-download:before, .ion-android-drafts:before, .ion-android-exit:before, .ion-android-expand:before, .ion-android-favorite:before, .ion-android-favorite-outline:before, .ion-android-film:before, .ion-android-folder:before, .ion-android-folder-open:before, .ion-android-funnel:before, .ion-android-globe:before, .ion-android-hand:before, .ion-android-hangout:before, .ion-android-happy:before, .ion-android-home:before, .ion-android-image:before, .ion-android-laptop:before, .ion-android-list:before, .ion-android-locate:before, .ion-android-lock:before, .ion-android-mail:before, .ion-android-map:before, .ion-android-menu:before, .ion-android-microphone:before, .ion-android-microphone-off:before, .ion-android-more-horizontal:before, .ion-android-more-vertical:before, .ion-android-navigate:before, .ion-android-notifications:before, .ion-android-notifications-none:before, .ion-android-notifications-off:before, .ion-android-open:before, .ion-android-options:before, .ion-android-people:before, .ion-android-person:before, .ion-android-person-add:before, .ion-android-phone-landscape:before, .ion-android-phone-portrait:before, .ion-android-pin:before, .ion-android-plane:before, .ion-android-playstore:before, .ion-android-print:before, .ion-android-radio-button-off:before, .ion-android-radio-button-on:before, .ion-android-refresh:before, .ion-android-remove:before, .ion-android-remove-circle:before, .ion-android-restaurant:before, .ion-android-sad:before, .ion-android-search:before, .ion-android-send:before, .ion-android-settings:before, .ion-android-share:before, .ion-android-share-alt:before, .ion-android-star:before, .ion-android-star-half:before, .ion-android-star-outline:before, .ion-android-stopwatch:before, .ion-android-subway:before, .ion-android-sunny:before, .ion-android-sync:before, .ion-android-textsms:before, .ion-android-time:before, .ion-android-train:before, .ion-android-unlock:before, .ion-android-upload:before, .ion-android-volume-down:before, .ion-android-volume-mute:before, .ion-android-volume-off:before, .ion-android-volume-up:before, .ion-android-walk:before, .ion-android-warning:before, .ion-android-watch:before, .ion-android-wifi:before, .ion-aperture:before, .ion-archive:before, .ion-arrow-down-a:before, .ion-arrow-down-b:before, .ion-arrow-down-c:before, .ion-arrow-expand:before, .ion-arrow-graph-down-left:before, .ion-arrow-graph-down-right:before, .ion-arrow-graph-up-left:before, .ion-arrow-graph-up-right:before, .ion-arrow-left-a:before, .ion-arrow-left-b:before, .ion-arrow-left-c:before, .ion-arrow-move:before, .ion-arrow-resize:before, .ion-arrow-return-left:before, .ion-arrow-return-right:before, .ion-arrow-right-a:before, .ion-arrow-right-b:before, .ion-arrow-right-c:before, .ion-arrow-shrink:before, .ion-arrow-swap:before, .ion-arrow-up-a:before, .ion-arrow-up-b:before, .ion-arrow-up-c:before, .ion-asterisk:before, .ion-at:before, .ion-backspace:before, .ion-backspace-outline:before, .ion-bag:before, .ion-battery-charging:before, .ion-battery-empty:before, .ion-battery-full:before, .ion-battery-half:before, .ion-battery-low:before, .ion-beaker:before, .ion-beer:before, .ion-bluetooth:before, .ion-bonfire:before, .ion-bookmark:before, .ion-bowtie:before, .ion-briefcase:before, .ion-bug:before, .ion-calculator:before, .ion-calendar:before, .ion-camera:before, .ion-card:before, .ion-cash:before, .ion-chatbox:before, .ion-chatbox-working:before, .ion-chatboxes:before, .ion-chatbubble:before, .ion-chatbubble-working:before, .ion-chatbubbles:before, .ion-checkmark:before, .ion-checkmark-circled:before, .ion-checkmark-round:before, .ion-chevron-down:before, .ion-chevron-left:before, .ion-chevron-right:before, .ion-chevron-up:before, .ion-clipboard:before, .ion-clock:before, .ion-close:before, .ion-close-circled:before, .ion-close-round:before, .ion-closed-captioning:before, .ion-cloud:before, .ion-code:before, .ion-code-download:before, .ion-code-working:before, .ion-coffee:before, .ion-compass:before, .ion-compose:before, .ion-connection-bars:before, .ion-contrast:before, .ion-crop:before, .ion-cube:before, .ion-disc:before, .ion-document:before, .ion-document-text:before, .ion-drag:before, .ion-earth:before, .ion-easel:before, .ion-edit:before, .ion-egg:before, .ion-eject:before, .ion-email:before, .ion-email-unread:before, .ion-erlenmeyer-flask:before, .ion-erlenmeyer-flask-bubbles:before, .ion-eye:before, .ion-eye-disabled:before, .ion-female:before, .ion-filing:before, .ion-film-marker:before, .ion-fireball:before, .ion-flag:before, .ion-flame:before, .ion-flash:before, .ion-flash-off:before, .ion-folder:before, .ion-fork:before, .ion-fork-repo:before, .ion-forward:before, .ion-funnel:before, .ion-gear-a:before, .ion-gear-b:before, .ion-grid:before, .ion-hammer:before, .ion-happy:before, .ion-happy-outline:before, .ion-headphone:before, .ion-heart:before, .ion-heart-broken:before, .ion-help:before, .ion-help-buoy:before, .ion-help-circled:before, .ion-home:before, .ion-icecream:before, .ion-image:before, .ion-images:before, .ion-information:before, .ion-information-circled:before, .ion-ionic:before, .ion-ios-alarm:before, .ion-ios-alarm-outline:before, .ion-ios-albums:before, .ion-ios-albums-outline:before, .ion-ios-americanfootball:before, .ion-ios-americanfootball-outline:before, .ion-ios-analytics:before, .ion-ios-analytics-outline:before, .ion-ios-arrow-back:before, .ion-ios-arrow-down:before, .ion-ios-arrow-forward:before, .ion-ios-arrow-left:before, .ion-ios-arrow-right:before, .ion-ios-arrow-thin-down:before, .ion-ios-arrow-thin-left:before, .ion-ios-arrow-thin-right:before, .ion-ios-arrow-thin-up:before, .ion-ios-arrow-up:before, .ion-ios-at:before, .ion-ios-at-outline:before, .ion-ios-barcode:before, .ion-ios-barcode-outline:before, .ion-ios-baseball:before, .ion-ios-baseball-outline:before, .ion-ios-basketball:before, .ion-ios-basketball-outline:before, .ion-ios-bell:before, .ion-ios-bell-outline:before, .ion-ios-body:before, .ion-ios-body-outline:before, .ion-ios-bolt:before, .ion-ios-bolt-outline:before, .ion-ios-book:before, .ion-ios-book-outline:before, .ion-ios-bookmarks:before, .ion-ios-bookmarks-outline:before, .ion-ios-box:before, .ion-ios-box-outline:before, .ion-ios-briefcase:before, .ion-ios-briefcase-outline:before, .ion-ios-browsers:before, .ion-ios-browsers-outline:before, .ion-ios-calculator:before, .ion-ios-calculator-outline:before, .ion-ios-calendar:before, .ion-ios-calendar-outline:before, .ion-ios-camera:before, .ion-ios-camera-outline:before, .ion-ios-cart:before, .ion-ios-cart-outline:before, .ion-ios-chatboxes:before, .ion-ios-chatboxes-outline:before, .ion-ios-chatbubble:before, .ion-ios-chatbubble-outline:before, .ion-ios-checkmark:before, .ion-ios-checkmark-empty:before, .ion-ios-checkmark-outline:before, .ion-ios-circle-filled:before, .ion-ios-circle-outline:before, .ion-ios-clock:before, .ion-ios-clock-outline:before, .ion-ios-close:before, .ion-ios-close-empty:before, .ion-ios-close-outline:before, .ion-ios-cloud:before, .ion-ios-cloud-download:before, .ion-ios-cloud-download-outline:before, .ion-ios-cloud-outline:before, .ion-ios-cloud-upload:before, .ion-ios-cloud-upload-outline:before, .ion-ios-cloudy:before, .ion-ios-cloudy-night:before, .ion-ios-cloudy-night-outline:before, .ion-ios-cloudy-outline:before, .ion-ios-cog:before, .ion-ios-cog-outline:before, .ion-ios-color-filter:before, .ion-ios-color-filter-outline:before, .ion-ios-color-wand:before, .ion-ios-color-wand-outline:before, .ion-ios-compose:before, .ion-ios-compose-outline:before, .ion-ios-contact:before, .ion-ios-contact-outline:before, .ion-ios-copy:before, .ion-ios-copy-outline:before, .ion-ios-crop:before, .ion-ios-crop-strong:before, .ion-ios-download:before, .ion-ios-download-outline:before, .ion-ios-drag:before, .ion-ios-email:before, .ion-ios-email-outline:before, .ion-ios-eye:before, .ion-ios-eye-outline:before, .ion-ios-fastforward:before, .ion-ios-fastforward-outline:before, .ion-ios-filing:before, .ion-ios-filing-outline:before, .ion-ios-film:before, .ion-ios-film-outline:before, .ion-ios-flag:before, .ion-ios-flag-outline:before, .ion-ios-flame:before, .ion-ios-flame-outline:before, .ion-ios-flask:before, .ion-ios-flask-outline:before, .ion-ios-flower:before, .ion-ios-flower-outline:before, .ion-ios-folder:before, .ion-ios-folder-outline:before, .ion-ios-football:before, .ion-ios-football-outline:before, .ion-ios-game-controller-a:before, .ion-ios-game-controller-a-outline:before, .ion-ios-game-controller-b:before, .ion-ios-game-controller-b-outline:before, .ion-ios-gear:before, .ion-ios-gear-outline:before, .ion-ios-glasses:before, .ion-ios-glasses-outline:before, .ion-ios-grid-view:before, .ion-ios-grid-view-outline:before, .ion-ios-heart:before, .ion-ios-heart-outline:before, .ion-ios-help:before, .ion-ios-help-empty:before, .ion-ios-help-outline:before, .ion-ios-home:before, .ion-ios-home-outline:before, .ion-ios-infinite:before, .ion-ios-infinite-outline:before, .ion-ios-information:before, .ion-ios-information-empty:before, .ion-ios-information-outline:before, .ion-ios-ionic-outline:before, .ion-ios-keypad:before, .ion-ios-keypad-outline:before, .ion-ios-lightbulb:before, .ion-ios-lightbulb-outline:before, .ion-ios-list:before, .ion-ios-list-outline:before, .ion-ios-location:before, .ion-ios-location-outline:before, .ion-ios-locked:before, .ion-ios-locked-outline:before, .ion-ios-loop:before, .ion-ios-loop-strong:before, .ion-ios-medical:before, .ion-ios-medical-outline:before, .ion-ios-medkit:before, .ion-ios-medkit-outline:before, .ion-ios-mic:before, .ion-ios-mic-off:before, .ion-ios-mic-outline:before, .ion-ios-minus:before, .ion-ios-minus-empty:before, .ion-ios-minus-outline:before, .ion-ios-monitor:before, .ion-ios-monitor-outline:before, .ion-ios-moon:before, .ion-ios-moon-outline:before, .ion-ios-more:before, .ion-ios-more-outline:before, .ion-ios-musical-note:before, .ion-ios-musical-notes:before, .ion-ios-navigate:before, .ion-ios-navigate-outline:before, .ion-ios-nutrition:before, .ion-ios-nutrition-outline:before, .ion-ios-paper:before, .ion-ios-paper-outline:before, .ion-ios-paperplane:before, .ion-ios-paperplane-outline:before, .ion-ios-partlysunny:before, .ion-ios-partlysunny-outline:before, .ion-ios-pause:before, .ion-ios-pause-outline:before, .ion-ios-paw:before, .ion-ios-paw-outline:before, .ion-ios-people:before, .ion-ios-people-outline:before, .ion-ios-person:before, .ion-ios-person-outline:before, .ion-ios-personadd:before, .ion-ios-personadd-outline:before, .ion-ios-photos:before, .ion-ios-photos-outline:before, .ion-ios-pie:before, .ion-ios-pie-outline:before, .ion-ios-pint:before, .ion-ios-pint-outline:before, .ion-ios-play:before, .ion-ios-play-outline:before, .ion-ios-plus:before, .ion-ios-plus-empty:before, .ion-ios-plus-outline:before, .ion-ios-pricetag:before, .ion-ios-pricetag-outline:before, .ion-ios-pricetags:before, .ion-ios-pricetags-outline:before, .ion-ios-printer:before, .ion-ios-printer-outline:before, .ion-ios-pulse:before, .ion-ios-pulse-strong:before, .ion-ios-rainy:before, .ion-ios-rainy-outline:before, .ion-ios-recording:before, .ion-ios-recording-outline:before, .ion-ios-redo:before, .ion-ios-redo-outline:before, .ion-ios-refresh:before, .ion-ios-refresh-empty:before, .ion-ios-refresh-outline:before, .ion-ios-reload:before, .ion-ios-reverse-camera:before, .ion-ios-reverse-camera-outline:before, .ion-ios-rewind:before, .ion-ios-rewind-outline:before, .ion-ios-rose:before, .ion-ios-rose-outline:before, .ion-ios-search:before, .ion-ios-search-strong:before, .ion-ios-settings:before, .ion-ios-settings-strong:before, .ion-ios-shuffle:before, .ion-ios-shuffle-strong:before, .ion-ios-skipbackward:before, .ion-ios-skipbackward-outline:before, .ion-ios-skipforward:before, .ion-ios-skipforward-outline:before, .ion-ios-snowy:before, .ion-ios-speedometer:before, .ion-ios-speedometer-outline:before, .ion-ios-star:before, .ion-ios-star-half:before, .ion-ios-star-outline:before, .ion-ios-stopwatch:before, .ion-ios-stopwatch-outline:before, .ion-ios-sunny:before, .ion-ios-sunny-outline:before, .ion-ios-telephone:before, .ion-ios-telephone-outline:before, .ion-ios-tennisball:before, .ion-ios-tennisball-outline:before, .ion-ios-thunderstorm:before, .ion-ios-thunderstorm-outline:before, .ion-ios-time:before, .ion-ios-time-outline:before, .ion-ios-timer:before, .ion-ios-timer-outline:before, .ion-ios-toggle:before, .ion-ios-toggle-outline:before, .ion-ios-trash:before, .ion-ios-trash-outline:before, .ion-ios-undo:before, .ion-ios-undo-outline:before, .ion-ios-unlocked:before, .ion-ios-unlocked-outline:before, .ion-ios-upload:before, .ion-ios-upload-outline:before, .ion-ios-videocam:before, .ion-ios-videocam-outline:before, .ion-ios-volume-high:before, .ion-ios-volume-low:before, .ion-ios-wineglass:before, .ion-ios-wineglass-outline:before, .ion-ios-world:before, .ion-ios-world-outline:before, .ion-ipad:before, .ion-iphone:before, .ion-ipod:before, .ion-jet:before, .ion-key:before, .ion-knife:before, .ion-laptop:before, .ion-leaf:before, .ion-levels:before, .ion-lightbulb:before, .ion-link:before, .ion-load-a:before, .ion-load-b:before, .ion-load-c:before, .ion-load-d:before, .ion-location:before, .ion-lock-combination:before, .ion-locked:before, .ion-log-in:before, .ion-log-out:before, .ion-loop:before, .ion-magnet:before, .ion-male:before, .ion-man:before, .ion-map:before, .ion-medkit:before, .ion-merge:before, .ion-mic-a:before, .ion-mic-b:before, .ion-mic-c:before, .ion-minus:before, .ion-minus-circled:before, .ion-minus-round:before, .ion-model-s:before, .ion-monitor:before, .ion-more:before, .ion-mouse:before, .ion-music-note:before, .ion-navicon:before, .ion-navicon-round:before, .ion-navigate:before, .ion-network:before, .ion-no-smoking:before, .ion-nuclear:before, .ion-outlet:before, .ion-paintbrush:before, .ion-paintbucket:before, .ion-paper-airplane:before, .ion-paperclip:before, .ion-pause:before, .ion-person:before, .ion-person-add:before, .ion-person-stalker:before, .ion-pie-graph:before, .ion-pin:before, .ion-pinpoint:before, .ion-pizza:before, .ion-plane:before, .ion-planet:before, .ion-play:before, .ion-playstation:before, .ion-plus:before, .ion-plus-circled:before, .ion-plus-round:before, .ion-podium:before, .ion-pound:before, .ion-power:before, .ion-pricetag:before, .ion-pricetags:before, .ion-printer:before, .ion-pull-request:before, .ion-qr-scanner:before, .ion-quote:before, .ion-radio-waves:before, .ion-record:before, .ion-refresh:before, .ion-reply:before, .ion-reply-all:before, .ion-ribbon-a:before, .ion-ribbon-b:before, .ion-sad:before, .ion-sad-outline:before, .ion-scissors:before, .ion-search:before, .ion-settings:before, .ion-share:before, .ion-shuffle:before, .ion-skip-backward:before, .ion-skip-forward:before, .ion-social-android:before, .ion-social-android-outline:before, .ion-social-angular:before, .ion-social-angular-outline:before, .ion-social-apple:before, .ion-social-apple-outline:before, .ion-social-bitcoin:before, .ion-social-bitcoin-outline:before, .ion-social-buffer:before, .ion-social-buffer-outline:before, .ion-social-chrome:before, .ion-social-chrome-outline:before, .ion-social-codepen:before, .ion-social-codepen-outline:before, .ion-social-css3:before, .ion-social-css3-outline:before, .ion-social-designernews:before, .ion-social-designernews-outline:before, .ion-social-dribbble:before, .ion-social-dribbble-outline:before, .ion-social-dropbox:before, .ion-social-dropbox-outline:before, .ion-social-euro:before, .ion-social-euro-outline:before, .ion-social-facebook:before, .ion-social-facebook-outline:before, .ion-social-foursquare:before, .ion-social-foursquare-outline:before, .ion-social-freebsd-devil:before, .ion-social-github:before, .ion-social-github-outline:before, .ion-social-google:before, .ion-social-google-outline:before, .ion-social-googleplus:before, .ion-social-googleplus-outline:before, .ion-social-hackernews:before, .ion-social-hackernews-outline:before, .ion-social-html5:before, .ion-social-html5-outline:before, .ion-social-instagram:before, .ion-social-instagram-outline:before, .ion-social-javascript:before, .ion-social-javascript-outline:before, .ion-social-linkedin:before, .ion-social-linkedin-outline:before, .ion-social-markdown:before, .ion-social-nodejs:before, .ion-social-octocat:before, .ion-social-pinterest:before, .ion-social-pinterest-outline:before, .ion-social-python:before, .ion-social-reddit:before, .ion-social-reddit-outline:before, .ion-social-rss:before, .ion-social-rss-outline:before, .ion-social-sass:before, .ion-social-skype:before, .ion-social-skype-outline:before, .ion-social-snapchat:before, .ion-social-snapchat-outline:before, .ion-social-tumblr:before, .ion-social-tumblr-outline:before, .ion-social-tux:before, .ion-social-twitch:before, .ion-social-twitch-outline:before, .ion-social-twitter:before, .ion-social-twitter-outline:before, .ion-social-usd:before, .ion-social-usd-outline:before, .ion-social-vimeo:before, .ion-social-vimeo-outline:before, .ion-social-whatsapp:before, .ion-social-whatsapp-outline:before, .ion-social-windows:before, .ion-social-windows-outline:before, .ion-social-wordpress:before, .ion-social-wordpress-outline:before, .ion-social-yahoo:before, .ion-social-yahoo-outline:before, .ion-social-yen:before, .ion-social-yen-outline:before, .ion-social-youtube:before, .ion-social-youtube-outline:before, .ion-soup-can:before, .ion-soup-can-outline:before, .ion-speakerphone:before, .ion-speedometer:before, .ion-spoon:before, .ion-star:before, .ion-stats-bars:before, .ion-steam:before, .ion-stop:before, .ion-thermometer:before, .ion-thumbsdown:before, .ion-thumbsup:before, .ion-toggle:before, .ion-toggle-filled:before, .ion-transgender:before, .ion-trash-a:before, .ion-trash-b:before, .ion-trophy:before, .ion-tshirt:before, .ion-tshirt-outline:before, .ion-umbrella:before, .ion-university:before, .ion-unlocked:before, .ion-upload:before, .ion-usb:before, .ion-videocamera:before, .ion-volume-high:before, .ion-volume-low:before, .ion-volume-medium:before, .ion-volume-mute:before, .ion-wand:before, .ion-waterdrop:before, .ion-wifi:before, .ion-wineglass:before, .ion-woman:before, .ion-wrench:before, .ion-xbox:before { display: inline-block; font-family: "Ionicons"; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; text-rendering: auto; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - -.ion-alert:before { content: "\f101"; } - -.ion-alert-circled:before { content: "\f100"; } - -.ion-android-add:before { content: "\f2c7"; } - -.ion-android-add-circle:before { content: "\f359"; } - -.ion-android-alarm-clock:before { content: "\f35a"; } - -.ion-android-alert:before { content: "\f35b"; } - -.ion-android-apps:before { content: "\f35c"; } - -.ion-android-archive:before { content: "\f2c9"; } - -.ion-android-arrow-back:before { content: "\f2ca"; } - -.ion-android-arrow-down:before { content: "\f35d"; } - -.ion-android-arrow-dropdown:before { content: "\f35f"; } - -.ion-android-arrow-dropdown-circle:before { content: "\f35e"; } - -.ion-android-arrow-dropleft:before { content: "\f361"; } - -.ion-android-arrow-dropleft-circle:before { content: "\f360"; } - -.ion-android-arrow-dropright:before { content: "\f363"; } - -.ion-android-arrow-dropright-circle:before { content: "\f362"; } - -.ion-android-arrow-dropup:before { content: "\f365"; } - -.ion-android-arrow-dropup-circle:before { content: "\f364"; } - -.ion-android-arrow-forward:before { content: "\f30f"; } - -.ion-android-arrow-up:before { content: "\f366"; } - -.ion-android-attach:before { content: "\f367"; } - -.ion-android-bar:before { content: "\f368"; } - -.ion-android-bicycle:before { content: "\f369"; } - -.ion-android-boat:before { content: "\f36a"; } - -.ion-android-bookmark:before { content: "\f36b"; } - -.ion-android-bulb:before { content: "\f36c"; } - -.ion-android-bus:before { content: "\f36d"; } - -.ion-android-calendar:before { content: "\f2d1"; } - -.ion-android-call:before { content: "\f2d2"; } - -.ion-android-camera:before { content: "\f2d3"; } - -.ion-android-cancel:before { content: "\f36e"; } - -.ion-android-car:before { content: "\f36f"; } - -.ion-android-cart:before { content: "\f370"; } - -.ion-android-chat:before { content: "\f2d4"; } - -.ion-android-checkbox:before { content: "\f374"; } - -.ion-android-checkbox-blank:before { content: "\f371"; } - -.ion-android-checkbox-outline:before { content: "\f373"; } - -.ion-android-checkbox-outline-blank:before { content: "\f372"; } - -.ion-android-checkmark-circle:before { content: "\f375"; } - -.ion-android-clipboard:before { content: "\f376"; } - -.ion-android-close:before { content: "\f2d7"; } - -.ion-android-cloud:before { content: "\f37a"; } - -.ion-android-cloud-circle:before { content: "\f377"; } - -.ion-android-cloud-done:before { content: "\f378"; } - -.ion-android-cloud-outline:before { content: "\f379"; } - -.ion-android-color-palette:before { content: "\f37b"; } - -.ion-android-compass:before { content: "\f37c"; } - -.ion-android-contact:before { content: "\f2d8"; } - -.ion-android-contacts:before { content: "\f2d9"; } - -.ion-android-contract:before { content: "\f37d"; } - -.ion-android-create:before { content: "\f37e"; } - -.ion-android-delete:before { content: "\f37f"; } - -.ion-android-desktop:before { content: "\f380"; } - -.ion-android-document:before { content: "\f381"; } - -.ion-android-done:before { content: "\f383"; } - -.ion-android-done-all:before { content: "\f382"; } - -.ion-android-download:before { content: "\f2dd"; } - -.ion-android-drafts:before { content: "\f384"; } - -.ion-android-exit:before { content: "\f385"; } - -.ion-android-expand:before { content: "\f386"; } - -.ion-android-favorite:before { content: "\f388"; } - -.ion-android-favorite-outline:before { content: "\f387"; } - -.ion-android-film:before { content: "\f389"; } - -.ion-android-folder:before { content: "\f2e0"; } - -.ion-android-folder-open:before { content: "\f38a"; } - -.ion-android-funnel:before { content: "\f38b"; } - -.ion-android-globe:before { content: "\f38c"; } - -.ion-android-hand:before { content: "\f2e3"; } - -.ion-android-hangout:before { content: "\f38d"; } - -.ion-android-happy:before { content: "\f38e"; } - -.ion-android-home:before { content: "\f38f"; } - -.ion-android-image:before { content: "\f2e4"; } - -.ion-android-laptop:before { content: "\f390"; } - -.ion-android-list:before { content: "\f391"; } - -.ion-android-locate:before { content: "\f2e9"; } - -.ion-android-lock:before { content: "\f392"; } - -.ion-android-mail:before { content: "\f2eb"; } - -.ion-android-map:before { content: "\f393"; } - -.ion-android-menu:before { content: "\f394"; } - -.ion-android-microphone:before { content: "\f2ec"; } - -.ion-android-microphone-off:before { content: "\f395"; } - -.ion-android-more-horizontal:before { content: "\f396"; } - -.ion-android-more-vertical:before { content: "\f397"; } - -.ion-android-navigate:before { content: "\f398"; } - -.ion-android-notifications:before { content: "\f39b"; } - -.ion-android-notifications-none:before { content: "\f399"; } - -.ion-android-notifications-off:before { content: "\f39a"; } - -.ion-android-open:before { content: "\f39c"; } - -.ion-android-options:before { content: "\f39d"; } - -.ion-android-people:before { content: "\f39e"; } - -.ion-android-person:before { content: "\f3a0"; } - -.ion-android-person-add:before { content: "\f39f"; } - -.ion-android-phone-landscape:before { content: "\f3a1"; } - -.ion-android-phone-portrait:before { content: "\f3a2"; } - -.ion-android-pin:before { content: "\f3a3"; } - -.ion-android-plane:before { content: "\f3a4"; } - -.ion-android-playstore:before { content: "\f2f0"; } - -.ion-android-print:before { content: "\f3a5"; } - -.ion-android-radio-button-off:before { content: "\f3a6"; } - -.ion-android-radio-button-on:before { content: "\f3a7"; } - -.ion-android-refresh:before { content: "\f3a8"; } - -.ion-android-remove:before { content: "\f2f4"; } - -.ion-android-remove-circle:before { content: "\f3a9"; } - -.ion-android-restaurant:before { content: "\f3aa"; } - -.ion-android-sad:before { content: "\f3ab"; } - -.ion-android-search:before { content: "\f2f5"; } - -.ion-android-send:before { content: "\f2f6"; } - -.ion-android-settings:before { content: "\f2f7"; } - -.ion-android-share:before { content: "\f2f8"; } - -.ion-android-share-alt:before { content: "\f3ac"; } - -.ion-android-star:before { content: "\f2fc"; } - -.ion-android-star-half:before { content: "\f3ad"; } - -.ion-android-star-outline:before { content: "\f3ae"; } - -.ion-android-stopwatch:before { content: "\f2fd"; } - -.ion-android-subway:before { content: "\f3af"; } - -.ion-android-sunny:before { content: "\f3b0"; } - -.ion-android-sync:before { content: "\f3b1"; } - -.ion-android-textsms:before { content: "\f3b2"; } - -.ion-android-time:before { content: "\f3b3"; } - -.ion-android-train:before { content: "\f3b4"; } - -.ion-android-unlock:before { content: "\f3b5"; } - -.ion-android-upload:before { content: "\f3b6"; } - -.ion-android-volume-down:before { content: "\f3b7"; } - -.ion-android-volume-mute:before { content: "\f3b8"; } - -.ion-android-volume-off:before { content: "\f3b9"; } - -.ion-android-volume-up:before { content: "\f3ba"; } - -.ion-android-walk:before { content: "\f3bb"; } - -.ion-android-warning:before { content: "\f3bc"; } - -.ion-android-watch:before { content: "\f3bd"; } - -.ion-android-wifi:before { content: "\f305"; } - -.ion-aperture:before { content: "\f313"; } - -.ion-archive:before { content: "\f102"; } - -.ion-arrow-down-a:before { content: "\f103"; } - -.ion-arrow-down-b:before { content: "\f104"; } - -.ion-arrow-down-c:before { content: "\f105"; } - -.ion-arrow-expand:before { content: "\f25e"; } - -.ion-arrow-graph-down-left:before { content: "\f25f"; } - -.ion-arrow-graph-down-right:before { content: "\f260"; } - -.ion-arrow-graph-up-left:before { content: "\f261"; } - -.ion-arrow-graph-up-right:before { content: "\f262"; } - -.ion-arrow-left-a:before { content: "\f106"; } - -.ion-arrow-left-b:before { content: "\f107"; } - -.ion-arrow-left-c:before { content: "\f108"; } - -.ion-arrow-move:before { content: "\f263"; } - -.ion-arrow-resize:before { content: "\f264"; } - -.ion-arrow-return-left:before { content: "\f265"; } - -.ion-arrow-return-right:before { content: "\f266"; } - -.ion-arrow-right-a:before { content: "\f109"; } - -.ion-arrow-right-b:before { content: "\f10a"; } - -.ion-arrow-right-c:before { content: "\f10b"; } - -.ion-arrow-shrink:before { content: "\f267"; } - -.ion-arrow-swap:before { content: "\f268"; } - -.ion-arrow-up-a:before { content: "\f10c"; } - -.ion-arrow-up-b:before { content: "\f10d"; } - -.ion-arrow-up-c:before { content: "\f10e"; } - -.ion-asterisk:before { content: "\f314"; } - -.ion-at:before { content: "\f10f"; } - -.ion-backspace:before { content: "\f3bf"; } - -.ion-backspace-outline:before { content: "\f3be"; } - -.ion-bag:before { content: "\f110"; } - -.ion-battery-charging:before { content: "\f111"; } - -.ion-battery-empty:before { content: "\f112"; } - -.ion-battery-full:before { content: "\f113"; } - -.ion-battery-half:before { content: "\f114"; } - -.ion-battery-low:before { content: "\f115"; } - -.ion-beaker:before { content: "\f269"; } - -.ion-beer:before { content: "\f26a"; } - -.ion-bluetooth:before { content: "\f116"; } - -.ion-bonfire:before { content: "\f315"; } - -.ion-bookmark:before { content: "\f26b"; } - -.ion-bowtie:before { content: "\f3c0"; } - -.ion-briefcase:before { content: "\f26c"; } - -.ion-bug:before { content: "\f2be"; } - -.ion-calculator:before { content: "\f26d"; } - -.ion-calendar:before { content: "\f117"; } - -.ion-camera:before { content: "\f118"; } - -.ion-card:before { content: "\f119"; } - -.ion-cash:before { content: "\f316"; } - -.ion-chatbox:before { content: "\f11b"; } - -.ion-chatbox-working:before { content: "\f11a"; } - -.ion-chatboxes:before { content: "\f11c"; } - -.ion-chatbubble:before { content: "\f11e"; } - -.ion-chatbubble-working:before { content: "\f11d"; } - -.ion-chatbubbles:before { content: "\f11f"; } - -.ion-checkmark:before { content: "\f122"; } - -.ion-checkmark-circled:before { content: "\f120"; } - -.ion-checkmark-round:before { content: "\f121"; } - -.ion-chevron-down:before { content: "\f123"; } - -.ion-chevron-left:before { content: "\f124"; } - -.ion-chevron-right:before { content: "\f125"; } - -.ion-chevron-up:before { content: "\f126"; } - -.ion-clipboard:before { content: "\f127"; } - -.ion-clock:before { content: "\f26e"; } - -.ion-close:before { content: "\f12a"; } - -.ion-close-circled:before { content: "\f128"; } - -.ion-close-round:before { content: "\f129"; } - -.ion-closed-captioning:before { content: "\f317"; } - -.ion-cloud:before { content: "\f12b"; } - -.ion-code:before { content: "\f271"; } - -.ion-code-download:before { content: "\f26f"; } - -.ion-code-working:before { content: "\f270"; } - -.ion-coffee:before { content: "\f272"; } - -.ion-compass:before { content: "\f273"; } - -.ion-compose:before { content: "\f12c"; } - -.ion-connection-bars:before { content: "\f274"; } - -.ion-contrast:before { content: "\f275"; } - -.ion-crop:before { content: "\f3c1"; } - -.ion-cube:before { content: "\f318"; } - -.ion-disc:before { content: "\f12d"; } - -.ion-document:before { content: "\f12f"; } - -.ion-document-text:before { content: "\f12e"; } - -.ion-drag:before { content: "\f130"; } - -.ion-earth:before { content: "\f276"; } - -.ion-easel:before { content: "\f3c2"; } - -.ion-edit:before { content: "\f2bf"; } - -.ion-egg:before { content: "\f277"; } - -.ion-eject:before { content: "\f131"; } - -.ion-email:before { content: "\f132"; } - -.ion-email-unread:before { content: "\f3c3"; } - -.ion-erlenmeyer-flask:before { content: "\f3c5"; } - -.ion-erlenmeyer-flask-bubbles:before { content: "\f3c4"; } - -.ion-eye:before { content: "\f133"; } - -.ion-eye-disabled:before { content: "\f306"; } - -.ion-female:before { content: "\f278"; } - -.ion-filing:before { content: "\f134"; } - -.ion-film-marker:before { content: "\f135"; } - -.ion-fireball:before { content: "\f319"; } - -.ion-flag:before { content: "\f279"; } - -.ion-flame:before { content: "\f31a"; } - -.ion-flash:before { content: "\f137"; } - -.ion-flash-off:before { content: "\f136"; } - -.ion-folder:before { content: "\f139"; } - -.ion-fork:before { content: "\f27a"; } - -.ion-fork-repo:before { content: "\f2c0"; } - -.ion-forward:before { content: "\f13a"; } - -.ion-funnel:before { content: "\f31b"; } - -.ion-gear-a:before { content: "\f13d"; } - -.ion-gear-b:before { content: "\f13e"; } - -.ion-grid:before { content: "\f13f"; } - -.ion-hammer:before { content: "\f27b"; } - -.ion-happy:before { content: "\f31c"; } - -.ion-happy-outline:before { content: "\f3c6"; } - -.ion-headphone:before { content: "\f140"; } - -.ion-heart:before { content: "\f141"; } - -.ion-heart-broken:before { content: "\f31d"; } - -.ion-help:before { content: "\f143"; } - -.ion-help-buoy:before { content: "\f27c"; } - -.ion-help-circled:before { content: "\f142"; } - -.ion-home:before { content: "\f144"; } - -.ion-icecream:before { content: "\f27d"; } - -.ion-image:before { content: "\f147"; } - -.ion-images:before { content: "\f148"; } - -.ion-information:before { content: "\f14a"; } - -.ion-information-circled:before { content: "\f149"; } - -.ion-ionic:before { content: "\f14b"; } - -.ion-ios-alarm:before { content: "\f3c8"; } - -.ion-ios-alarm-outline:before { content: "\f3c7"; } - -.ion-ios-albums:before { content: "\f3ca"; } - -.ion-ios-albums-outline:before { content: "\f3c9"; } - -.ion-ios-americanfootball:before { content: "\f3cc"; } - -.ion-ios-americanfootball-outline:before { content: "\f3cb"; } - -.ion-ios-analytics:before { content: "\f3ce"; } - -.ion-ios-analytics-outline:before { content: "\f3cd"; } - -.ion-ios-arrow-back:before { content: "\f3cf"; } - -.ion-ios-arrow-down:before { content: "\f3d0"; } - -.ion-ios-arrow-forward:before { content: "\f3d1"; } - -.ion-ios-arrow-left:before { content: "\f3d2"; } - -.ion-ios-arrow-right:before { content: "\f3d3"; } - -.ion-ios-arrow-thin-down:before { content: "\f3d4"; } - -.ion-ios-arrow-thin-left:before { content: "\f3d5"; } - -.ion-ios-arrow-thin-right:before { content: "\f3d6"; } - -.ion-ios-arrow-thin-up:before { content: "\f3d7"; } - -.ion-ios-arrow-up:before { content: "\f3d8"; } - -.ion-ios-at:before { content: "\f3da"; } - -.ion-ios-at-outline:before { content: "\f3d9"; } - -.ion-ios-barcode:before { content: "\f3dc"; } - -.ion-ios-barcode-outline:before { content: "\f3db"; } - -.ion-ios-baseball:before { content: "\f3de"; } - -.ion-ios-baseball-outline:before { content: "\f3dd"; } - -.ion-ios-basketball:before { content: "\f3e0"; } - -.ion-ios-basketball-outline:before { content: "\f3df"; } - -.ion-ios-bell:before { content: "\f3e2"; } - -.ion-ios-bell-outline:before { content: "\f3e1"; } - -.ion-ios-body:before { content: "\f3e4"; } - -.ion-ios-body-outline:before { content: "\f3e3"; } - -.ion-ios-bolt:before { content: "\f3e6"; } - -.ion-ios-bolt-outline:before { content: "\f3e5"; } - -.ion-ios-book:before { content: "\f3e8"; } - -.ion-ios-book-outline:before { content: "\f3e7"; } - -.ion-ios-bookmarks:before { content: "\f3ea"; } - -.ion-ios-bookmarks-outline:before { content: "\f3e9"; } - -.ion-ios-box:before { content: "\f3ec"; } - -.ion-ios-box-outline:before { content: "\f3eb"; } - -.ion-ios-briefcase:before { content: "\f3ee"; } - -.ion-ios-briefcase-outline:before { content: "\f3ed"; } - -.ion-ios-browsers:before { content: "\f3f0"; } - -.ion-ios-browsers-outline:before { content: "\f3ef"; } - -.ion-ios-calculator:before { content: "\f3f2"; } - -.ion-ios-calculator-outline:before { content: "\f3f1"; } - -.ion-ios-calendar:before { content: "\f3f4"; } - -.ion-ios-calendar-outline:before { content: "\f3f3"; } - -.ion-ios-camera:before { content: "\f3f6"; } - -.ion-ios-camera-outline:before { content: "\f3f5"; } - -.ion-ios-cart:before { content: "\f3f8"; } - -.ion-ios-cart-outline:before { content: "\f3f7"; } - -.ion-ios-chatboxes:before { content: "\f3fa"; } - -.ion-ios-chatboxes-outline:before { content: "\f3f9"; } - -.ion-ios-chatbubble:before { content: "\f3fc"; } - -.ion-ios-chatbubble-outline:before { content: "\f3fb"; } - -.ion-ios-checkmark:before { content: "\f3ff"; } - -.ion-ios-checkmark-empty:before { content: "\f3fd"; } - -.ion-ios-checkmark-outline:before { content: "\f3fe"; } - -.ion-ios-circle-filled:before { content: "\f400"; } - -.ion-ios-circle-outline:before { content: "\f401"; } - -.ion-ios-clock:before { content: "\f403"; } - -.ion-ios-clock-outline:before { content: "\f402"; } - -.ion-ios-close:before { content: "\f406"; } - -.ion-ios-close-empty:before { content: "\f404"; } - -.ion-ios-close-outline:before { content: "\f405"; } - -.ion-ios-cloud:before { content: "\f40c"; } - -.ion-ios-cloud-download:before { content: "\f408"; } - -.ion-ios-cloud-download-outline:before { content: "\f407"; } - -.ion-ios-cloud-outline:before { content: "\f409"; } - -.ion-ios-cloud-upload:before { content: "\f40b"; } - -.ion-ios-cloud-upload-outline:before { content: "\f40a"; } - -.ion-ios-cloudy:before { content: "\f410"; } - -.ion-ios-cloudy-night:before { content: "\f40e"; } - -.ion-ios-cloudy-night-outline:before { content: "\f40d"; } - -.ion-ios-cloudy-outline:before { content: "\f40f"; } - -.ion-ios-cog:before { content: "\f412"; } - -.ion-ios-cog-outline:before { content: "\f411"; } - -.ion-ios-color-filter:before { content: "\f414"; } - -.ion-ios-color-filter-outline:before { content: "\f413"; } - -.ion-ios-color-wand:before { content: "\f416"; } - -.ion-ios-color-wand-outline:before { content: "\f415"; } - -.ion-ios-compose:before { content: "\f418"; } - -.ion-ios-compose-outline:before { content: "\f417"; } - -.ion-ios-contact:before { content: "\f41a"; } - -.ion-ios-contact-outline:before { content: "\f419"; } - -.ion-ios-copy:before { content: "\f41c"; } - -.ion-ios-copy-outline:before { content: "\f41b"; } - -.ion-ios-crop:before { content: "\f41e"; } - -.ion-ios-crop-strong:before { content: "\f41d"; } - -.ion-ios-download:before { content: "\f420"; } - -.ion-ios-download-outline:before { content: "\f41f"; } - -.ion-ios-drag:before { content: "\f421"; } - -.ion-ios-email:before { content: "\f423"; } - -.ion-ios-email-outline:before { content: "\f422"; } - -.ion-ios-eye:before { content: "\f425"; } - -.ion-ios-eye-outline:before { content: "\f424"; } - -.ion-ios-fastforward:before { content: "\f427"; } - -.ion-ios-fastforward-outline:before { content: "\f426"; } - -.ion-ios-filing:before { content: "\f429"; } - -.ion-ios-filing-outline:before { content: "\f428"; } - -.ion-ios-film:before { content: "\f42b"; } - -.ion-ios-film-outline:before { content: "\f42a"; } - -.ion-ios-flag:before { content: "\f42d"; } - -.ion-ios-flag-outline:before { content: "\f42c"; } - -.ion-ios-flame:before { content: "\f42f"; } - -.ion-ios-flame-outline:before { content: "\f42e"; } - -.ion-ios-flask:before { content: "\f431"; } - -.ion-ios-flask-outline:before { content: "\f430"; } - -.ion-ios-flower:before { content: "\f433"; } - -.ion-ios-flower-outline:before { content: "\f432"; } - -.ion-ios-folder:before { content: "\f435"; } - -.ion-ios-folder-outline:before { content: "\f434"; } - -.ion-ios-football:before { content: "\f437"; } - -.ion-ios-football-outline:before { content: "\f436"; } - -.ion-ios-game-controller-a:before { content: "\f439"; } - -.ion-ios-game-controller-a-outline:before { content: "\f438"; } - -.ion-ios-game-controller-b:before { content: "\f43b"; } - -.ion-ios-game-controller-b-outline:before { content: "\f43a"; } - -.ion-ios-gear:before { content: "\f43d"; } - -.ion-ios-gear-outline:before { content: "\f43c"; } - -.ion-ios-glasses:before { content: "\f43f"; } - -.ion-ios-glasses-outline:before { content: "\f43e"; } - -.ion-ios-grid-view:before { content: "\f441"; } - -.ion-ios-grid-view-outline:before { content: "\f440"; } - -.ion-ios-heart:before { content: "\f443"; } - -.ion-ios-heart-outline:before { content: "\f442"; } - -.ion-ios-help:before { content: "\f446"; } - -.ion-ios-help-empty:before { content: "\f444"; } - -.ion-ios-help-outline:before { content: "\f445"; } - -.ion-ios-home:before { content: "\f448"; } - -.ion-ios-home-outline:before { content: "\f447"; } - -.ion-ios-infinite:before { content: "\f44a"; } - -.ion-ios-infinite-outline:before { content: "\f449"; } - -.ion-ios-information:before { content: "\f44d"; } - -.ion-ios-information-empty:before { content: "\f44b"; } - -.ion-ios-information-outline:before { content: "\f44c"; } - -.ion-ios-ionic-outline:before { content: "\f44e"; } - -.ion-ios-keypad:before { content: "\f450"; } - -.ion-ios-keypad-outline:before { content: "\f44f"; } - -.ion-ios-lightbulb:before { content: "\f452"; } - -.ion-ios-lightbulb-outline:before { content: "\f451"; } - -.ion-ios-list:before { content: "\f454"; } - -.ion-ios-list-outline:before { content: "\f453"; } - -.ion-ios-location:before { content: "\f456"; } - -.ion-ios-location-outline:before { content: "\f455"; } - -.ion-ios-locked:before { content: "\f458"; } - -.ion-ios-locked-outline:before { content: "\f457"; } - -.ion-ios-loop:before { content: "\f45a"; } - -.ion-ios-loop-strong:before { content: "\f459"; } - -.ion-ios-medical:before { content: "\f45c"; } - -.ion-ios-medical-outline:before { content: "\f45b"; } - -.ion-ios-medkit:before { content: "\f45e"; } - -.ion-ios-medkit-outline:before { content: "\f45d"; } - -.ion-ios-mic:before { content: "\f461"; } - -.ion-ios-mic-off:before { content: "\f45f"; } - -.ion-ios-mic-outline:before { content: "\f460"; } - -.ion-ios-minus:before { content: "\f464"; } - -.ion-ios-minus-empty:before { content: "\f462"; } - -.ion-ios-minus-outline:before { content: "\f463"; } - -.ion-ios-monitor:before { content: "\f466"; } - -.ion-ios-monitor-outline:before { content: "\f465"; } - -.ion-ios-moon:before { content: "\f468"; } - -.ion-ios-moon-outline:before { content: "\f467"; } - -.ion-ios-more:before { content: "\f46a"; } - -.ion-ios-more-outline:before { content: "\f469"; } - -.ion-ios-musical-note:before { content: "\f46b"; } - -.ion-ios-musical-notes:before { content: "\f46c"; } - -.ion-ios-navigate:before { content: "\f46e"; } - -.ion-ios-navigate-outline:before { content: "\f46d"; } - -.ion-ios-nutrition:before { content: "\f470"; } - -.ion-ios-nutrition-outline:before { content: "\f46f"; } - -.ion-ios-paper:before { content: "\f472"; } - -.ion-ios-paper-outline:before { content: "\f471"; } - -.ion-ios-paperplane:before { content: "\f474"; } - -.ion-ios-paperplane-outline:before { content: "\f473"; } - -.ion-ios-partlysunny:before { content: "\f476"; } - -.ion-ios-partlysunny-outline:before { content: "\f475"; } - -.ion-ios-pause:before { content: "\f478"; } - -.ion-ios-pause-outline:before { content: "\f477"; } - -.ion-ios-paw:before { content: "\f47a"; } - -.ion-ios-paw-outline:before { content: "\f479"; } - -.ion-ios-people:before { content: "\f47c"; } - -.ion-ios-people-outline:before { content: "\f47b"; } - -.ion-ios-person:before { content: "\f47e"; } - -.ion-ios-person-outline:before { content: "\f47d"; } - -.ion-ios-personadd:before { content: "\f480"; } - -.ion-ios-personadd-outline:before { content: "\f47f"; } - -.ion-ios-photos:before { content: "\f482"; } - -.ion-ios-photos-outline:before { content: "\f481"; } - -.ion-ios-pie:before { content: "\f484"; } - -.ion-ios-pie-outline:before { content: "\f483"; } - -.ion-ios-pint:before { content: "\f486"; } - -.ion-ios-pint-outline:before { content: "\f485"; } - -.ion-ios-play:before { content: "\f488"; } - -.ion-ios-play-outline:before { content: "\f487"; } - -.ion-ios-plus:before { content: "\f48b"; } - -.ion-ios-plus-empty:before { content: "\f489"; } - -.ion-ios-plus-outline:before { content: "\f48a"; } - -.ion-ios-pricetag:before { content: "\f48d"; } - -.ion-ios-pricetag-outline:before { content: "\f48c"; } - -.ion-ios-pricetags:before { content: "\f48f"; } - -.ion-ios-pricetags-outline:before { content: "\f48e"; } - -.ion-ios-printer:before { content: "\f491"; } - -.ion-ios-printer-outline:before { content: "\f490"; } - -.ion-ios-pulse:before { content: "\f493"; } - -.ion-ios-pulse-strong:before { content: "\f492"; } - -.ion-ios-rainy:before { content: "\f495"; } - -.ion-ios-rainy-outline:before { content: "\f494"; } - -.ion-ios-recording:before { content: "\f497"; } - -.ion-ios-recording-outline:before { content: "\f496"; } - -.ion-ios-redo:before { content: "\f499"; } - -.ion-ios-redo-outline:before { content: "\f498"; } - -.ion-ios-refresh:before { content: "\f49c"; } - -.ion-ios-refresh-empty:before { content: "\f49a"; } - -.ion-ios-refresh-outline:before { content: "\f49b"; } - -.ion-ios-reload:before { content: "\f49d"; } - -.ion-ios-reverse-camera:before { content: "\f49f"; } - -.ion-ios-reverse-camera-outline:before { content: "\f49e"; } - -.ion-ios-rewind:before { content: "\f4a1"; } - -.ion-ios-rewind-outline:before { content: "\f4a0"; } - -.ion-ios-rose:before { content: "\f4a3"; } - -.ion-ios-rose-outline:before { content: "\f4a2"; } - -.ion-ios-search:before { content: "\f4a5"; } - -.ion-ios-search-strong:before { content: "\f4a4"; } - -.ion-ios-settings:before { content: "\f4a7"; } - -.ion-ios-settings-strong:before { content: "\f4a6"; } - -.ion-ios-shuffle:before { content: "\f4a9"; } - -.ion-ios-shuffle-strong:before { content: "\f4a8"; } - -.ion-ios-skipbackward:before { content: "\f4ab"; } - -.ion-ios-skipbackward-outline:before { content: "\f4aa"; } - -.ion-ios-skipforward:before { content: "\f4ad"; } - -.ion-ios-skipforward-outline:before { content: "\f4ac"; } - -.ion-ios-snowy:before { content: "\f4ae"; } - -.ion-ios-speedometer:before { content: "\f4b0"; } - -.ion-ios-speedometer-outline:before { content: "\f4af"; } - -.ion-ios-star:before { content: "\f4b3"; } - -.ion-ios-star-half:before { content: "\f4b1"; } - -.ion-ios-star-outline:before { content: "\f4b2"; } - -.ion-ios-stopwatch:before { content: "\f4b5"; } - -.ion-ios-stopwatch-outline:before { content: "\f4b4"; } - -.ion-ios-sunny:before { content: "\f4b7"; } - -.ion-ios-sunny-outline:before { content: "\f4b6"; } - -.ion-ios-telephone:before { content: "\f4b9"; } - -.ion-ios-telephone-outline:before { content: "\f4b8"; } - -.ion-ios-tennisball:before { content: "\f4bb"; } - -.ion-ios-tennisball-outline:before { content: "\f4ba"; } - -.ion-ios-thunderstorm:before { content: "\f4bd"; } - -.ion-ios-thunderstorm-outline:before { content: "\f4bc"; } - -.ion-ios-time:before { content: "\f4bf"; } - -.ion-ios-time-outline:before { content: "\f4be"; } - -.ion-ios-timer:before { content: "\f4c1"; } - -.ion-ios-timer-outline:before { content: "\f4c0"; } - -.ion-ios-toggle:before { content: "\f4c3"; } - -.ion-ios-toggle-outline:before { content: "\f4c2"; } - -.ion-ios-trash:before { content: "\f4c5"; } - -.ion-ios-trash-outline:before { content: "\f4c4"; } - -.ion-ios-undo:before { content: "\f4c7"; } - -.ion-ios-undo-outline:before { content: "\f4c6"; } - -.ion-ios-unlocked:before { content: "\f4c9"; } - -.ion-ios-unlocked-outline:before { content: "\f4c8"; } - -.ion-ios-upload:before { content: "\f4cb"; } - -.ion-ios-upload-outline:before { content: "\f4ca"; } - -.ion-ios-videocam:before { content: "\f4cd"; } - -.ion-ios-videocam-outline:before { content: "\f4cc"; } - -.ion-ios-volume-high:before { content: "\f4ce"; } - -.ion-ios-volume-low:before { content: "\f4cf"; } - -.ion-ios-wineglass:before { content: "\f4d1"; } - -.ion-ios-wineglass-outline:before { content: "\f4d0"; } - -.ion-ios-world:before { content: "\f4d3"; } - -.ion-ios-world-outline:before { content: "\f4d2"; } - -.ion-ipad:before { content: "\f1f9"; } - -.ion-iphone:before { content: "\f1fa"; } - -.ion-ipod:before { content: "\f1fb"; } - -.ion-jet:before { content: "\f295"; } - -.ion-key:before { content: "\f296"; } - -.ion-knife:before { content: "\f297"; } - -.ion-laptop:before { content: "\f1fc"; } - -.ion-leaf:before { content: "\f1fd"; } - -.ion-levels:before { content: "\f298"; } - -.ion-lightbulb:before { content: "\f299"; } - -.ion-link:before { content: "\f1fe"; } - -.ion-load-a:before { content: "\f29a"; } - -.ion-load-b:before { content: "\f29b"; } - -.ion-load-c:before { content: "\f29c"; } - -.ion-load-d:before { content: "\f29d"; } - -.ion-location:before { content: "\f1ff"; } - -.ion-lock-combination:before { content: "\f4d4"; } - -.ion-locked:before { content: "\f200"; } - -.ion-log-in:before { content: "\f29e"; } - -.ion-log-out:before { content: "\f29f"; } - -.ion-loop:before { content: "\f201"; } - -.ion-magnet:before { content: "\f2a0"; } - -.ion-male:before { content: "\f2a1"; } - -.ion-man:before { content: "\f202"; } - -.ion-map:before { content: "\f203"; } - -.ion-medkit:before { content: "\f2a2"; } - -.ion-merge:before { content: "\f33f"; } - -.ion-mic-a:before { content: "\f204"; } - -.ion-mic-b:before { content: "\f205"; } - -.ion-mic-c:before { content: "\f206"; } - -.ion-minus:before { content: "\f209"; } - -.ion-minus-circled:before { content: "\f207"; } - -.ion-minus-round:before { content: "\f208"; } - -.ion-model-s:before { content: "\f2c1"; } - -.ion-monitor:before { content: "\f20a"; } - -.ion-more:before { content: "\f20b"; } - -.ion-mouse:before { content: "\f340"; } - -.ion-music-note:before { content: "\f20c"; } - -.ion-navicon:before { content: "\f20e"; } - -.ion-navicon-round:before { content: "\f20d"; } - -.ion-navigate:before { content: "\f2a3"; } - -.ion-network:before { content: "\f341"; } - -.ion-no-smoking:before { content: "\f2c2"; } - -.ion-nuclear:before { content: "\f2a4"; } - -.ion-outlet:before { content: "\f342"; } - -.ion-paintbrush:before { content: "\f4d5"; } - -.ion-paintbucket:before { content: "\f4d6"; } - -.ion-paper-airplane:before { content: "\f2c3"; } - -.ion-paperclip:before { content: "\f20f"; } - -.ion-pause:before { content: "\f210"; } - -.ion-person:before { content: "\f213"; } - -.ion-person-add:before { content: "\f211"; } - -.ion-person-stalker:before { content: "\f212"; } - -.ion-pie-graph:before { content: "\f2a5"; } - -.ion-pin:before { content: "\f2a6"; } - -.ion-pinpoint:before { content: "\f2a7"; } - -.ion-pizza:before { content: "\f2a8"; } - -.ion-plane:before { content: "\f214"; } - -.ion-planet:before { content: "\f343"; } - -.ion-play:before { content: "\f215"; } - -.ion-playstation:before { content: "\f30a"; } - -.ion-plus:before { content: "\f218"; } - -.ion-plus-circled:before { content: "\f216"; } - -.ion-plus-round:before { content: "\f217"; } - -.ion-podium:before { content: "\f344"; } - -.ion-pound:before { content: "\f219"; } - -.ion-power:before { content: "\f2a9"; } - -.ion-pricetag:before { content: "\f2aa"; } - -.ion-pricetags:before { content: "\f2ab"; } - -.ion-printer:before { content: "\f21a"; } - -.ion-pull-request:before { content: "\f345"; } - -.ion-qr-scanner:before { content: "\f346"; } - -.ion-quote:before { content: "\f347"; } - -.ion-radio-waves:before { content: "\f2ac"; } - -.ion-record:before { content: "\f21b"; } - -.ion-refresh:before { content: "\f21c"; } - -.ion-reply:before { content: "\f21e"; } - -.ion-reply-all:before { content: "\f21d"; } - -.ion-ribbon-a:before { content: "\f348"; } - -.ion-ribbon-b:before { content: "\f349"; } - -.ion-sad:before { content: "\f34a"; } - -.ion-sad-outline:before { content: "\f4d7"; } - -.ion-scissors:before { content: "\f34b"; } - -.ion-search:before { content: "\f21f"; } - -.ion-settings:before { content: "\f2ad"; } - -.ion-share:before { content: "\f220"; } - -.ion-shuffle:before { content: "\f221"; } - -.ion-skip-backward:before { content: "\f222"; } - -.ion-skip-forward:before { content: "\f223"; } - -.ion-social-android:before { content: "\f225"; } - -.ion-social-android-outline:before { content: "\f224"; } - -.ion-social-angular:before { content: "\f4d9"; } - -.ion-social-angular-outline:before { content: "\f4d8"; } - -.ion-social-apple:before { content: "\f227"; } - -.ion-social-apple-outline:before { content: "\f226"; } - -.ion-social-bitcoin:before { content: "\f2af"; } - -.ion-social-bitcoin-outline:before { content: "\f2ae"; } - -.ion-social-buffer:before { content: "\f229"; } - -.ion-social-buffer-outline:before { content: "\f228"; } - -.ion-social-chrome:before { content: "\f4db"; } - -.ion-social-chrome-outline:before { content: "\f4da"; } - -.ion-social-codepen:before { content: "\f4dd"; } - -.ion-social-codepen-outline:before { content: "\f4dc"; } - -.ion-social-css3:before { content: "\f4df"; } - -.ion-social-css3-outline:before { content: "\f4de"; } - -.ion-social-designernews:before { content: "\f22b"; } - -.ion-social-designernews-outline:before { content: "\f22a"; } - -.ion-social-dribbble:before { content: "\f22d"; } - -.ion-social-dribbble-outline:before { content: "\f22c"; } - -.ion-social-dropbox:before { content: "\f22f"; } - -.ion-social-dropbox-outline:before { content: "\f22e"; } - -.ion-social-euro:before { content: "\f4e1"; } - -.ion-social-euro-outline:before { content: "\f4e0"; } - -.ion-social-facebook:before { content: "\f231"; } - -.ion-social-facebook-outline:before { content: "\f230"; } - -.ion-social-foursquare:before { content: "\f34d"; } - -.ion-social-foursquare-outline:before { content: "\f34c"; } - -.ion-social-freebsd-devil:before { content: "\f2c4"; } - -.ion-social-github:before { content: "\f233"; } - -.ion-social-github-outline:before { content: "\f232"; } - -.ion-social-google:before { content: "\f34f"; } - -.ion-social-google-outline:before { content: "\f34e"; } - -.ion-social-googleplus:before { content: "\f235"; } - -.ion-social-googleplus-outline:before { content: "\f234"; } - -.ion-social-hackernews:before { content: "\f237"; } - -.ion-social-hackernews-outline:before { content: "\f236"; } - -.ion-social-html5:before { content: "\f4e3"; } - -.ion-social-html5-outline:before { content: "\f4e2"; } - -.ion-social-instagram:before { content: "\f351"; } - -.ion-social-instagram-outline:before { content: "\f350"; } - -.ion-social-javascript:before { content: "\f4e5"; } - -.ion-social-javascript-outline:before { content: "\f4e4"; } - -.ion-social-linkedin:before { content: "\f239"; } - -.ion-social-linkedin-outline:before { content: "\f238"; } - -.ion-social-markdown:before { content: "\f4e6"; } - -.ion-social-nodejs:before { content: "\f4e7"; } - -.ion-social-octocat:before { content: "\f4e8"; } - -.ion-social-pinterest:before { content: "\f2b1"; } - -.ion-social-pinterest-outline:before { content: "\f2b0"; } - -.ion-social-python:before { content: "\f4e9"; } - -.ion-social-reddit:before { content: "\f23b"; } - -.ion-social-reddit-outline:before { content: "\f23a"; } - -.ion-social-rss:before { content: "\f23d"; } - -.ion-social-rss-outline:before { content: "\f23c"; } - -.ion-social-sass:before { content: "\f4ea"; } - -.ion-social-skype:before { content: "\f23f"; } - -.ion-social-skype-outline:before { content: "\f23e"; } - -.ion-social-snapchat:before { content: "\f4ec"; } - -.ion-social-snapchat-outline:before { content: "\f4eb"; } - -.ion-social-tumblr:before { content: "\f241"; } - -.ion-social-tumblr-outline:before { content: "\f240"; } - -.ion-social-tux:before { content: "\f2c5"; } - -.ion-social-twitch:before { content: "\f4ee"; } - -.ion-social-twitch-outline:before { content: "\f4ed"; } - -.ion-social-twitter:before { content: "\f243"; } - -.ion-social-twitter-outline:before { content: "\f242"; } - -.ion-social-usd:before { content: "\f353"; } - -.ion-social-usd-outline:before { content: "\f352"; } - -.ion-social-vimeo:before { content: "\f245"; } - -.ion-social-vimeo-outline:before { content: "\f244"; } - -.ion-social-whatsapp:before { content: "\f4f0"; } - -.ion-social-whatsapp-outline:before { content: "\f4ef"; } - -.ion-social-windows:before { content: "\f247"; } - -.ion-social-windows-outline:before { content: "\f246"; } - -.ion-social-wordpress:before { content: "\f249"; } - -.ion-social-wordpress-outline:before { content: "\f248"; } - -.ion-social-yahoo:before { content: "\f24b"; } - -.ion-social-yahoo-outline:before { content: "\f24a"; } - -.ion-social-yen:before { content: "\f4f2"; } - -.ion-social-yen-outline:before { content: "\f4f1"; } - -.ion-social-youtube:before { content: "\f24d"; } - -.ion-social-youtube-outline:before { content: "\f24c"; } - -.ion-soup-can:before { content: "\f4f4"; } - -.ion-soup-can-outline:before { content: "\f4f3"; } - -.ion-speakerphone:before { content: "\f2b2"; } - -.ion-speedometer:before { content: "\f2b3"; } - -.ion-spoon:before { content: "\f2b4"; } - -.ion-star:before { content: "\f24e"; } - -.ion-stats-bars:before { content: "\f2b5"; } - -.ion-steam:before { content: "\f30b"; } - -.ion-stop:before { content: "\f24f"; } - -.ion-thermometer:before { content: "\f2b6"; } - -.ion-thumbsdown:before { content: "\f250"; } - -.ion-thumbsup:before { content: "\f251"; } - -.ion-toggle:before { content: "\f355"; } - -.ion-toggle-filled:before { content: "\f354"; } - -.ion-transgender:before { content: "\f4f5"; } - -.ion-trash-a:before { content: "\f252"; } - -.ion-trash-b:before { content: "\f253"; } - -.ion-trophy:before { content: "\f356"; } - -.ion-tshirt:before { content: "\f4f7"; } - -.ion-tshirt-outline:before { content: "\f4f6"; } - -.ion-umbrella:before { content: "\f2b7"; } - -.ion-university:before { content: "\f357"; } - -.ion-unlocked:before { content: "\f254"; } - -.ion-upload:before { content: "\f255"; } - -.ion-usb:before { content: "\f2b8"; } - -.ion-videocamera:before { content: "\f256"; } - -.ion-volume-high:before { content: "\f257"; } - -.ion-volume-low:before { content: "\f258"; } - -.ion-volume-medium:before { content: "\f259"; } - -.ion-volume-mute:before { content: "\f25a"; } - -.ion-wand:before { content: "\f358"; } - -.ion-waterdrop:before { content: "\f25b"; } - -.ion-wifi:before { content: "\f25c"; } - -.ion-wineglass:before { content: "\f2b9"; } - -.ion-woman:before { content: "\f25d"; } - -.ion-wrench:before { content: "\f2ba"; } - -.ion-xbox:before { content: "\f30c"; } diff --git a/src/css/ionicons.min.css b/src/css/ionicons.min.css deleted file mode 100644 index cdbfa64..0000000 --- a/src/css/ionicons.min.css +++ /dev/null @@ -1,11 +0,0 @@ -@charset "UTF-8";/*! - Ionicons, v2.0.0 - Created by Ben Sperry for the Ionic Framework, http://ionicons.com/ - https://twitter.com/benjsperry https://twitter.com/ionicframework - MIT License: https://github.com/driftyco/ionicons - - Android-style icons originally built by Google’s - Material Design Icons: https://github.com/google/material-design-icons - used under CC BY http://creativecommons.org/licenses/by/4.0/ - Modified icons to fit ionicon’s grid from original. -*/@font-face{font-family:"Ionicons";src:url("../fonts/ionicons.eot?v=2.0.0");src:url("../fonts/ionicons.eot?v=2.0.0#iefix") format("embedded-opentype"),url("../fonts/ionicons.ttf?v=2.0.0") format("truetype"),url("../fonts/ionicons.woff?v=2.0.0") format("woff"),url("../fonts/ionicons.svg?v=2.0.0#Ionicons") format("svg");font-weight:normal;font-style:normal}.ion,.ionicons,.ion-alert:before,.ion-alert-circled:before,.ion-android-add:before,.ion-android-add-circle:before,.ion-android-alarm-clock:before,.ion-android-alert:before,.ion-android-apps:before,.ion-android-archive:before,.ion-android-arrow-back:before,.ion-android-arrow-down:before,.ion-android-arrow-dropdown:before,.ion-android-arrow-dropdown-circle:before,.ion-android-arrow-dropleft:before,.ion-android-arrow-dropleft-circle:before,.ion-android-arrow-dropright:before,.ion-android-arrow-dropright-circle:before,.ion-android-arrow-dropup:before,.ion-android-arrow-dropup-circle:before,.ion-android-arrow-forward:before,.ion-android-arrow-up:before,.ion-android-attach:before,.ion-android-bar:before,.ion-android-bicycle:before,.ion-android-boat:before,.ion-android-bookmark:before,.ion-android-bulb:before,.ion-android-bus:before,.ion-android-calendar:before,.ion-android-call:before,.ion-android-camera:before,.ion-android-cancel:before,.ion-android-car:before,.ion-android-cart:before,.ion-android-chat:before,.ion-android-checkbox:before,.ion-android-checkbox-blank:before,.ion-android-checkbox-outline:before,.ion-android-checkbox-outline-blank:before,.ion-android-checkmark-circle:before,.ion-android-clipboard:before,.ion-android-close:before,.ion-android-cloud:before,.ion-android-cloud-circle:before,.ion-android-cloud-done:before,.ion-android-cloud-outline:before,.ion-android-color-palette:before,.ion-android-compass:before,.ion-android-contact:before,.ion-android-contacts:before,.ion-android-contract:before,.ion-android-create:before,.ion-android-delete:before,.ion-android-desktop:before,.ion-android-document:before,.ion-android-done:before,.ion-android-done-all:before,.ion-android-download:before,.ion-android-drafts:before,.ion-android-exit:before,.ion-android-expand:before,.ion-android-favorite:before,.ion-android-favorite-outline:before,.ion-android-film:before,.ion-android-folder:before,.ion-android-folder-open:before,.ion-android-funnel:before,.ion-android-globe:before,.ion-android-hand:before,.ion-android-hangout:before,.ion-android-happy:before,.ion-android-home:before,.ion-android-image:before,.ion-android-laptop:before,.ion-android-list:before,.ion-android-locate:before,.ion-android-lock:before,.ion-android-mail:before,.ion-android-map:before,.ion-android-menu:before,.ion-android-microphone:before,.ion-android-microphone-off:before,.ion-android-more-horizontal:before,.ion-android-more-vertical:before,.ion-android-navigate:before,.ion-android-notifications:before,.ion-android-notifications-none:before,.ion-android-notifications-off:before,.ion-android-open:before,.ion-android-options:before,.ion-android-people:before,.ion-android-person:before,.ion-android-person-add:before,.ion-android-phone-landscape:before,.ion-android-phone-portrait:before,.ion-android-pin:before,.ion-android-plane:before,.ion-android-playstore:before,.ion-android-print:before,.ion-android-radio-button-off:before,.ion-android-radio-button-on:before,.ion-android-refresh:before,.ion-android-remove:before,.ion-android-remove-circle:before,.ion-android-restaurant:before,.ion-android-sad:before,.ion-android-search:before,.ion-android-send:before,.ion-android-settings:before,.ion-android-share:before,.ion-android-share-alt:before,.ion-android-star:before,.ion-android-star-half:before,.ion-android-star-outline:before,.ion-android-stopwatch:before,.ion-android-subway:before,.ion-android-sunny:before,.ion-android-sync:before,.ion-android-textsms:before,.ion-android-time:before,.ion-android-train:before,.ion-android-unlock:before,.ion-android-upload:before,.ion-android-volume-down:before,.ion-android-volume-mute:before,.ion-android-volume-off:before,.ion-android-volume-up:before,.ion-android-walk:before,.ion-android-warning:before,.ion-android-watch:before,.ion-android-wifi:before,.ion-aperture:before,.ion-archive:before,.ion-arrow-down-a:before,.ion-arrow-down-b:before,.ion-arrow-down-c:before,.ion-arrow-expand:before,.ion-arrow-graph-down-left:before,.ion-arrow-graph-down-right:before,.ion-arrow-graph-up-left:before,.ion-arrow-graph-up-right:before,.ion-arrow-left-a:before,.ion-arrow-left-b:before,.ion-arrow-left-c:before,.ion-arrow-move:before,.ion-arrow-resize:before,.ion-arrow-return-left:before,.ion-arrow-return-right:before,.ion-arrow-right-a:before,.ion-arrow-right-b:before,.ion-arrow-right-c:before,.ion-arrow-shrink:before,.ion-arrow-swap:before,.ion-arrow-up-a:before,.ion-arrow-up-b:before,.ion-arrow-up-c:before,.ion-asterisk:before,.ion-at:before,.ion-backspace:before,.ion-backspace-outline:before,.ion-bag:before,.ion-battery-charging:before,.ion-battery-empty:before,.ion-battery-full:before,.ion-battery-half:before,.ion-battery-low:before,.ion-beaker:before,.ion-beer:before,.ion-bluetooth:before,.ion-bonfire:before,.ion-bookmark:before,.ion-bowtie:before,.ion-briefcase:before,.ion-bug:before,.ion-calculator:before,.ion-calendar:before,.ion-camera:before,.ion-card:before,.ion-cash:before,.ion-chatbox:before,.ion-chatbox-working:before,.ion-chatboxes:before,.ion-chatbubble:before,.ion-chatbubble-working:before,.ion-chatbubbles:before,.ion-checkmark:before,.ion-checkmark-circled:before,.ion-checkmark-round:before,.ion-chevron-down:before,.ion-chevron-left:before,.ion-chevron-right:before,.ion-chevron-up:before,.ion-clipboard:before,.ion-clock:before,.ion-close:before,.ion-close-circled:before,.ion-close-round:before,.ion-closed-captioning:before,.ion-cloud:before,.ion-code:before,.ion-code-download:before,.ion-code-working:before,.ion-coffee:before,.ion-compass:before,.ion-compose:before,.ion-connection-bars:before,.ion-contrast:before,.ion-crop:before,.ion-cube:before,.ion-disc:before,.ion-document:before,.ion-document-text:before,.ion-drag:before,.ion-earth:before,.ion-easel:before,.ion-edit:before,.ion-egg:before,.ion-eject:before,.ion-email:before,.ion-email-unread:before,.ion-erlenmeyer-flask:before,.ion-erlenmeyer-flask-bubbles:before,.ion-eye:before,.ion-eye-disabled:before,.ion-female:before,.ion-filing:before,.ion-film-marker:before,.ion-fireball:before,.ion-flag:before,.ion-flame:before,.ion-flash:before,.ion-flash-off:before,.ion-folder:before,.ion-fork:before,.ion-fork-repo:before,.ion-forward:before,.ion-funnel:before,.ion-gear-a:before,.ion-gear-b:before,.ion-grid:before,.ion-hammer:before,.ion-happy:before,.ion-happy-outline:before,.ion-headphone:before,.ion-heart:before,.ion-heart-broken:before,.ion-help:before,.ion-help-buoy:before,.ion-help-circled:before,.ion-home:before,.ion-icecream:before,.ion-image:before,.ion-images:before,.ion-information:before,.ion-information-circled:before,.ion-ionic:before,.ion-ios-alarm:before,.ion-ios-alarm-outline:before,.ion-ios-albums:before,.ion-ios-albums-outline:before,.ion-ios-americanfootball:before,.ion-ios-americanfootball-outline:before,.ion-ios-analytics:before,.ion-ios-analytics-outline:before,.ion-ios-arrow-back:before,.ion-ios-arrow-down:before,.ion-ios-arrow-forward:before,.ion-ios-arrow-left:before,.ion-ios-arrow-right:before,.ion-ios-arrow-thin-down:before,.ion-ios-arrow-thin-left:before,.ion-ios-arrow-thin-right:before,.ion-ios-arrow-thin-up:before,.ion-ios-arrow-up:before,.ion-ios-at:before,.ion-ios-at-outline:before,.ion-ios-barcode:before,.ion-ios-barcode-outline:before,.ion-ios-baseball:before,.ion-ios-baseball-outline:before,.ion-ios-basketball:before,.ion-ios-basketball-outline:before,.ion-ios-bell:before,.ion-ios-bell-outline:before,.ion-ios-body:before,.ion-ios-body-outline:before,.ion-ios-bolt:before,.ion-ios-bolt-outline:before,.ion-ios-book:before,.ion-ios-book-outline:before,.ion-ios-bookmarks:before,.ion-ios-bookmarks-outline:before,.ion-ios-box:before,.ion-ios-box-outline:before,.ion-ios-briefcase:before,.ion-ios-briefcase-outline:before,.ion-ios-browsers:before,.ion-ios-browsers-outline:before,.ion-ios-calculator:before,.ion-ios-calculator-outline:before,.ion-ios-calendar:before,.ion-ios-calendar-outline:before,.ion-ios-camera:before,.ion-ios-camera-outline:before,.ion-ios-cart:before,.ion-ios-cart-outline:before,.ion-ios-chatboxes:before,.ion-ios-chatboxes-outline:before,.ion-ios-chatbubble:before,.ion-ios-chatbubble-outline:before,.ion-ios-checkmark:before,.ion-ios-checkmark-empty:before,.ion-ios-checkmark-outline:before,.ion-ios-circle-filled:before,.ion-ios-circle-outline:before,.ion-ios-clock:before,.ion-ios-clock-outline:before,.ion-ios-close:before,.ion-ios-close-empty:before,.ion-ios-close-outline:before,.ion-ios-cloud:before,.ion-ios-cloud-download:before,.ion-ios-cloud-download-outline:before,.ion-ios-cloud-outline:before,.ion-ios-cloud-upload:before,.ion-ios-cloud-upload-outline:before,.ion-ios-cloudy:before,.ion-ios-cloudy-night:before,.ion-ios-cloudy-night-outline:before,.ion-ios-cloudy-outline:before,.ion-ios-cog:before,.ion-ios-cog-outline:before,.ion-ios-color-filter:before,.ion-ios-color-filter-outline:before,.ion-ios-color-wand:before,.ion-ios-color-wand-outline:before,.ion-ios-compose:before,.ion-ios-compose-outline:before,.ion-ios-contact:before,.ion-ios-contact-outline:before,.ion-ios-copy:before,.ion-ios-copy-outline:before,.ion-ios-crop:before,.ion-ios-crop-strong:before,.ion-ios-download:before,.ion-ios-download-outline:before,.ion-ios-drag:before,.ion-ios-email:before,.ion-ios-email-outline:before,.ion-ios-eye:before,.ion-ios-eye-outline:before,.ion-ios-fastforward:before,.ion-ios-fastforward-outline:before,.ion-ios-filing:before,.ion-ios-filing-outline:before,.ion-ios-film:before,.ion-ios-film-outline:before,.ion-ios-flag:before,.ion-ios-flag-outline:before,.ion-ios-flame:before,.ion-ios-flame-outline:before,.ion-ios-flask:before,.ion-ios-flask-outline:before,.ion-ios-flower:before,.ion-ios-flower-outline:before,.ion-ios-folder:before,.ion-ios-folder-outline:before,.ion-ios-football:before,.ion-ios-football-outline:before,.ion-ios-game-controller-a:before,.ion-ios-game-controller-a-outline:before,.ion-ios-game-controller-b:before,.ion-ios-game-controller-b-outline:before,.ion-ios-gear:before,.ion-ios-gear-outline:before,.ion-ios-glasses:before,.ion-ios-glasses-outline:before,.ion-ios-grid-view:before,.ion-ios-grid-view-outline:before,.ion-ios-heart:before,.ion-ios-heart-outline:before,.ion-ios-help:before,.ion-ios-help-empty:before,.ion-ios-help-outline:before,.ion-ios-home:before,.ion-ios-home-outline:before,.ion-ios-infinite:before,.ion-ios-infinite-outline:before,.ion-ios-information:before,.ion-ios-information-empty:before,.ion-ios-information-outline:before,.ion-ios-ionic-outline:before,.ion-ios-keypad:before,.ion-ios-keypad-outline:before,.ion-ios-lightbulb:before,.ion-ios-lightbulb-outline:before,.ion-ios-list:before,.ion-ios-list-outline:before,.ion-ios-location:before,.ion-ios-location-outline:before,.ion-ios-locked:before,.ion-ios-locked-outline:before,.ion-ios-loop:before,.ion-ios-loop-strong:before,.ion-ios-medical:before,.ion-ios-medical-outline:before,.ion-ios-medkit:before,.ion-ios-medkit-outline:before,.ion-ios-mic:before,.ion-ios-mic-off:before,.ion-ios-mic-outline:before,.ion-ios-minus:before,.ion-ios-minus-empty:before,.ion-ios-minus-outline:before,.ion-ios-monitor:before,.ion-ios-monitor-outline:before,.ion-ios-moon:before,.ion-ios-moon-outline:before,.ion-ios-more:before,.ion-ios-more-outline:before,.ion-ios-musical-note:before,.ion-ios-musical-notes:before,.ion-ios-navigate:before,.ion-ios-navigate-outline:before,.ion-ios-nutrition:before,.ion-ios-nutrition-outline:before,.ion-ios-paper:before,.ion-ios-paper-outline:before,.ion-ios-paperplane:before,.ion-ios-paperplane-outline:before,.ion-ios-partlysunny:before,.ion-ios-partlysunny-outline:before,.ion-ios-pause:before,.ion-ios-pause-outline:before,.ion-ios-paw:before,.ion-ios-paw-outline:before,.ion-ios-people:before,.ion-ios-people-outline:before,.ion-ios-person:before,.ion-ios-person-outline:before,.ion-ios-personadd:before,.ion-ios-personadd-outline:before,.ion-ios-photos:before,.ion-ios-photos-outline:before,.ion-ios-pie:before,.ion-ios-pie-outline:before,.ion-ios-pint:before,.ion-ios-pint-outline:before,.ion-ios-play:before,.ion-ios-play-outline:before,.ion-ios-plus:before,.ion-ios-plus-empty:before,.ion-ios-plus-outline:before,.ion-ios-pricetag:before,.ion-ios-pricetag-outline:before,.ion-ios-pricetags:before,.ion-ios-pricetags-outline:before,.ion-ios-printer:before,.ion-ios-printer-outline:before,.ion-ios-pulse:before,.ion-ios-pulse-strong:before,.ion-ios-rainy:before,.ion-ios-rainy-outline:before,.ion-ios-recording:before,.ion-ios-recording-outline:before,.ion-ios-redo:before,.ion-ios-redo-outline:before,.ion-ios-refresh:before,.ion-ios-refresh-empty:before,.ion-ios-refresh-outline:before,.ion-ios-reload:before,.ion-ios-reverse-camera:before,.ion-ios-reverse-camera-outline:before,.ion-ios-rewind:before,.ion-ios-rewind-outline:before,.ion-ios-rose:before,.ion-ios-rose-outline:before,.ion-ios-search:before,.ion-ios-search-strong:before,.ion-ios-settings:before,.ion-ios-settings-strong:before,.ion-ios-shuffle:before,.ion-ios-shuffle-strong:before,.ion-ios-skipbackward:before,.ion-ios-skipbackward-outline:before,.ion-ios-skipforward:before,.ion-ios-skipforward-outline:before,.ion-ios-snowy:before,.ion-ios-speedometer:before,.ion-ios-speedometer-outline:before,.ion-ios-star:before,.ion-ios-star-half:before,.ion-ios-star-outline:before,.ion-ios-stopwatch:before,.ion-ios-stopwatch-outline:before,.ion-ios-sunny:before,.ion-ios-sunny-outline:before,.ion-ios-telephone:before,.ion-ios-telephone-outline:before,.ion-ios-tennisball:before,.ion-ios-tennisball-outline:before,.ion-ios-thunderstorm:before,.ion-ios-thunderstorm-outline:before,.ion-ios-time:before,.ion-ios-time-outline:before,.ion-ios-timer:before,.ion-ios-timer-outline:before,.ion-ios-toggle:before,.ion-ios-toggle-outline:before,.ion-ios-trash:before,.ion-ios-trash-outline:before,.ion-ios-undo:before,.ion-ios-undo-outline:before,.ion-ios-unlocked:before,.ion-ios-unlocked-outline:before,.ion-ios-upload:before,.ion-ios-upload-outline:before,.ion-ios-videocam:before,.ion-ios-videocam-outline:before,.ion-ios-volume-high:before,.ion-ios-volume-low:before,.ion-ios-wineglass:before,.ion-ios-wineglass-outline:before,.ion-ios-world:before,.ion-ios-world-outline:before,.ion-ipad:before,.ion-iphone:before,.ion-ipod:before,.ion-jet:before,.ion-key:before,.ion-knife:before,.ion-laptop:before,.ion-leaf:before,.ion-levels:before,.ion-lightbulb:before,.ion-link:before,.ion-load-a:before,.ion-load-b:before,.ion-load-c:before,.ion-load-d:before,.ion-location:before,.ion-lock-combination:before,.ion-locked:before,.ion-log-in:before,.ion-log-out:before,.ion-loop:before,.ion-magnet:before,.ion-male:before,.ion-man:before,.ion-map:before,.ion-medkit:before,.ion-merge:before,.ion-mic-a:before,.ion-mic-b:before,.ion-mic-c:before,.ion-minus:before,.ion-minus-circled:before,.ion-minus-round:before,.ion-model-s:before,.ion-monitor:before,.ion-more:before,.ion-mouse:before,.ion-music-note:before,.ion-navicon:before,.ion-navicon-round:before,.ion-navigate:before,.ion-network:before,.ion-no-smoking:before,.ion-nuclear:before,.ion-outlet:before,.ion-paintbrush:before,.ion-paintbucket:before,.ion-paper-airplane:before,.ion-paperclip:before,.ion-pause:before,.ion-person:before,.ion-person-add:before,.ion-person-stalker:before,.ion-pie-graph:before,.ion-pin:before,.ion-pinpoint:before,.ion-pizza:before,.ion-plane:before,.ion-planet:before,.ion-play:before,.ion-playstation:before,.ion-plus:before,.ion-plus-circled:before,.ion-plus-round:before,.ion-podium:before,.ion-pound:before,.ion-power:before,.ion-pricetag:before,.ion-pricetags:before,.ion-printer:before,.ion-pull-request:before,.ion-qr-scanner:before,.ion-quote:before,.ion-radio-waves:before,.ion-record:before,.ion-refresh:before,.ion-reply:before,.ion-reply-all:before,.ion-ribbon-a:before,.ion-ribbon-b:before,.ion-sad:before,.ion-sad-outline:before,.ion-scissors:before,.ion-search:before,.ion-settings:before,.ion-share:before,.ion-shuffle:before,.ion-skip-backward:before,.ion-skip-forward:before,.ion-social-android:before,.ion-social-android-outline:before,.ion-social-angular:before,.ion-social-angular-outline:before,.ion-social-apple:before,.ion-social-apple-outline:before,.ion-social-bitcoin:before,.ion-social-bitcoin-outline:before,.ion-social-buffer:before,.ion-social-buffer-outline:before,.ion-social-chrome:before,.ion-social-chrome-outline:before,.ion-social-codepen:before,.ion-social-codepen-outline:before,.ion-social-css3:before,.ion-social-css3-outline:before,.ion-social-designernews:before,.ion-social-designernews-outline:before,.ion-social-dribbble:before,.ion-social-dribbble-outline:before,.ion-social-dropbox:before,.ion-social-dropbox-outline:before,.ion-social-euro:before,.ion-social-euro-outline:before,.ion-social-facebook:before,.ion-social-facebook-outline:before,.ion-social-foursquare:before,.ion-social-foursquare-outline:before,.ion-social-freebsd-devil:before,.ion-social-github:before,.ion-social-github-outline:before,.ion-social-google:before,.ion-social-google-outline:before,.ion-social-googleplus:before,.ion-social-googleplus-outline:before,.ion-social-hackernews:before,.ion-social-hackernews-outline:before,.ion-social-html5:before,.ion-social-html5-outline:before,.ion-social-instagram:before,.ion-social-instagram-outline:before,.ion-social-javascript:before,.ion-social-javascript-outline:before,.ion-social-linkedin:before,.ion-social-linkedin-outline:before,.ion-social-markdown:before,.ion-social-nodejs:before,.ion-social-octocat:before,.ion-social-pinterest:before,.ion-social-pinterest-outline:before,.ion-social-python:before,.ion-social-reddit:before,.ion-social-reddit-outline:before,.ion-social-rss:before,.ion-social-rss-outline:before,.ion-social-sass:before,.ion-social-skype:before,.ion-social-skype-outline:before,.ion-social-snapchat:before,.ion-social-snapchat-outline:before,.ion-social-tumblr:before,.ion-social-tumblr-outline:before,.ion-social-tux:before,.ion-social-twitch:before,.ion-social-twitch-outline:before,.ion-social-twitter:before,.ion-social-twitter-outline:before,.ion-social-usd:before,.ion-social-usd-outline:before,.ion-social-vimeo:before,.ion-social-vimeo-outline:before,.ion-social-whatsapp:before,.ion-social-whatsapp-outline:before,.ion-social-windows:before,.ion-social-windows-outline:before,.ion-social-wordpress:before,.ion-social-wordpress-outline:before,.ion-social-yahoo:before,.ion-social-yahoo-outline:before,.ion-social-yen:before,.ion-social-yen-outline:before,.ion-social-youtube:before,.ion-social-youtube-outline:before,.ion-soup-can:before,.ion-soup-can-outline:before,.ion-speakerphone:before,.ion-speedometer:before,.ion-spoon:before,.ion-star:before,.ion-stats-bars:before,.ion-steam:before,.ion-stop:before,.ion-thermometer:before,.ion-thumbsdown:before,.ion-thumbsup:before,.ion-toggle:before,.ion-toggle-filled:before,.ion-transgender:before,.ion-trash-a:before,.ion-trash-b:before,.ion-trophy:before,.ion-tshirt:before,.ion-tshirt-outline:before,.ion-umbrella:before,.ion-university:before,.ion-unlocked:before,.ion-upload:before,.ion-usb:before,.ion-videocamera:before,.ion-volume-high:before,.ion-volume-low:before,.ion-volume-medium:before,.ion-volume-mute:before,.ion-wand:before,.ion-waterdrop:before,.ion-wifi:before,.ion-wineglass:before,.ion-woman:before,.ion-wrench:before,.ion-xbox:before{display:inline-block;font-family:"Ionicons";speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;text-rendering:auto;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ion-alert:before{content:"\f101"}.ion-alert-circled:before{content:"\f100"}.ion-android-add:before{content:"\f2c7"}.ion-android-add-circle:before{content:"\f359"}.ion-android-alarm-clock:before{content:"\f35a"}.ion-android-alert:before{content:"\f35b"}.ion-android-apps:before{content:"\f35c"}.ion-android-archive:before{content:"\f2c9"}.ion-android-arrow-back:before{content:"\f2ca"}.ion-android-arrow-down:before{content:"\f35d"}.ion-android-arrow-dropdown:before{content:"\f35f"}.ion-android-arrow-dropdown-circle:before{content:"\f35e"}.ion-android-arrow-dropleft:before{content:"\f361"}.ion-android-arrow-dropleft-circle:before{content:"\f360"}.ion-android-arrow-dropright:before{content:"\f363"}.ion-android-arrow-dropright-circle:before{content:"\f362"}.ion-android-arrow-dropup:before{content:"\f365"}.ion-android-arrow-dropup-circle:before{content:"\f364"}.ion-android-arrow-forward:before{content:"\f30f"}.ion-android-arrow-up:before{content:"\f366"}.ion-android-attach:before{content:"\f367"}.ion-android-bar:before{content:"\f368"}.ion-android-bicycle:before{content:"\f369"}.ion-android-boat:before{content:"\f36a"}.ion-android-bookmark:before{content:"\f36b"}.ion-android-bulb:before{content:"\f36c"}.ion-android-bus:before{content:"\f36d"}.ion-android-calendar:before{content:"\f2d1"}.ion-android-call:before{content:"\f2d2"}.ion-android-camera:before{content:"\f2d3"}.ion-android-cancel:before{content:"\f36e"}.ion-android-car:before{content:"\f36f"}.ion-android-cart:before{content:"\f370"}.ion-android-chat:before{content:"\f2d4"}.ion-android-checkbox:before{content:"\f374"}.ion-android-checkbox-blank:before{content:"\f371"}.ion-android-checkbox-outline:before{content:"\f373"}.ion-android-checkbox-outline-blank:before{content:"\f372"}.ion-android-checkmark-circle:before{content:"\f375"}.ion-android-clipboard:before{content:"\f376"}.ion-android-close:before{content:"\f2d7"}.ion-android-cloud:before{content:"\f37a"}.ion-android-cloud-circle:before{content:"\f377"}.ion-android-cloud-done:before{content:"\f378"}.ion-android-cloud-outline:before{content:"\f379"}.ion-android-color-palette:before{content:"\f37b"}.ion-android-compass:before{content:"\f37c"}.ion-android-contact:before{content:"\f2d8"}.ion-android-contacts:before{content:"\f2d9"}.ion-android-contract:before{content:"\f37d"}.ion-android-create:before{content:"\f37e"}.ion-android-delete:before{content:"\f37f"}.ion-android-desktop:before{content:"\f380"}.ion-android-document:before{content:"\f381"}.ion-android-done:before{content:"\f383"}.ion-android-done-all:before{content:"\f382"}.ion-android-download:before{content:"\f2dd"}.ion-android-drafts:before{content:"\f384"}.ion-android-exit:before{content:"\f385"}.ion-android-expand:before{content:"\f386"}.ion-android-favorite:before{content:"\f388"}.ion-android-favorite-outline:before{content:"\f387"}.ion-android-film:before{content:"\f389"}.ion-android-folder:before{content:"\f2e0"}.ion-android-folder-open:before{content:"\f38a"}.ion-android-funnel:before{content:"\f38b"}.ion-android-globe:before{content:"\f38c"}.ion-android-hand:before{content:"\f2e3"}.ion-android-hangout:before{content:"\f38d"}.ion-android-happy:before{content:"\f38e"}.ion-android-home:before{content:"\f38f"}.ion-android-image:before{content:"\f2e4"}.ion-android-laptop:before{content:"\f390"}.ion-android-list:before{content:"\f391"}.ion-android-locate:before{content:"\f2e9"}.ion-android-lock:before{content:"\f392"}.ion-android-mail:before{content:"\f2eb"}.ion-android-map:before{content:"\f393"}.ion-android-menu:before{content:"\f394"}.ion-android-microphone:before{content:"\f2ec"}.ion-android-microphone-off:before{content:"\f395"}.ion-android-more-horizontal:before{content:"\f396"}.ion-android-more-vertical:before{content:"\f397"}.ion-android-navigate:before{content:"\f398"}.ion-android-notifications:before{content:"\f39b"}.ion-android-notifications-none:before{content:"\f399"}.ion-android-notifications-off:before{content:"\f39a"}.ion-android-open:before{content:"\f39c"}.ion-android-options:before{content:"\f39d"}.ion-android-people:before{content:"\f39e"}.ion-android-person:before{content:"\f3a0"}.ion-android-person-add:before{content:"\f39f"}.ion-android-phone-landscape:before{content:"\f3a1"}.ion-android-phone-portrait:before{content:"\f3a2"}.ion-android-pin:before{content:"\f3a3"}.ion-android-plane:before{content:"\f3a4"}.ion-android-playstore:before{content:"\f2f0"}.ion-android-print:before{content:"\f3a5"}.ion-android-radio-button-off:before{content:"\f3a6"}.ion-android-radio-button-on:before{content:"\f3a7"}.ion-android-refresh:before{content:"\f3a8"}.ion-android-remove:before{content:"\f2f4"}.ion-android-remove-circle:before{content:"\f3a9"}.ion-android-restaurant:before{content:"\f3aa"}.ion-android-sad:before{content:"\f3ab"}.ion-android-search:before{content:"\f2f5"}.ion-android-send:before{content:"\f2f6"}.ion-android-settings:before{content:"\f2f7"}.ion-android-share:before{content:"\f2f8"}.ion-android-share-alt:before{content:"\f3ac"}.ion-android-star:before{content:"\f2fc"}.ion-android-star-half:before{content:"\f3ad"}.ion-android-star-outline:before{content:"\f3ae"}.ion-android-stopwatch:before{content:"\f2fd"}.ion-android-subway:before{content:"\f3af"}.ion-android-sunny:before{content:"\f3b0"}.ion-android-sync:before{content:"\f3b1"}.ion-android-textsms:before{content:"\f3b2"}.ion-android-time:before{content:"\f3b3"}.ion-android-train:before{content:"\f3b4"}.ion-android-unlock:before{content:"\f3b5"}.ion-android-upload:before{content:"\f3b6"}.ion-android-volume-down:before{content:"\f3b7"}.ion-android-volume-mute:before{content:"\f3b8"}.ion-android-volume-off:before{content:"\f3b9"}.ion-android-volume-up:before{content:"\f3ba"}.ion-android-walk:before{content:"\f3bb"}.ion-android-warning:before{content:"\f3bc"}.ion-android-watch:before{content:"\f3bd"}.ion-android-wifi:before{content:"\f305"}.ion-aperture:before{content:"\f313"}.ion-archive:before{content:"\f102"}.ion-arrow-down-a:before{content:"\f103"}.ion-arrow-down-b:before{content:"\f104"}.ion-arrow-down-c:before{content:"\f105"}.ion-arrow-expand:before{content:"\f25e"}.ion-arrow-graph-down-left:before{content:"\f25f"}.ion-arrow-graph-down-right:before{content:"\f260"}.ion-arrow-graph-up-left:before{content:"\f261"}.ion-arrow-graph-up-right:before{content:"\f262"}.ion-arrow-left-a:before{content:"\f106"}.ion-arrow-left-b:before{content:"\f107"}.ion-arrow-left-c:before{content:"\f108"}.ion-arrow-move:before{content:"\f263"}.ion-arrow-resize:before{content:"\f264"}.ion-arrow-return-left:before{content:"\f265"}.ion-arrow-return-right:before{content:"\f266"}.ion-arrow-right-a:before{content:"\f109"}.ion-arrow-right-b:before{content:"\f10a"}.ion-arrow-right-c:before{content:"\f10b"}.ion-arrow-shrink:before{content:"\f267"}.ion-arrow-swap:before{content:"\f268"}.ion-arrow-up-a:before{content:"\f10c"}.ion-arrow-up-b:before{content:"\f10d"}.ion-arrow-up-c:before{content:"\f10e"}.ion-asterisk:before{content:"\f314"}.ion-at:before{content:"\f10f"}.ion-backspace:before{content:"\f3bf"}.ion-backspace-outline:before{content:"\f3be"}.ion-bag:before{content:"\f110"}.ion-battery-charging:before{content:"\f111"}.ion-battery-empty:before{content:"\f112"}.ion-battery-full:before{content:"\f113"}.ion-battery-half:before{content:"\f114"}.ion-battery-low:before{content:"\f115"}.ion-beaker:before{content:"\f269"}.ion-beer:before{content:"\f26a"}.ion-bluetooth:before{content:"\f116"}.ion-bonfire:before{content:"\f315"}.ion-bookmark:before{content:"\f26b"}.ion-bowtie:before{content:"\f3c0"}.ion-briefcase:before{content:"\f26c"}.ion-bug:before{content:"\f2be"}.ion-calculator:before{content:"\f26d"}.ion-calendar:before{content:"\f117"}.ion-camera:before{content:"\f118"}.ion-card:before{content:"\f119"}.ion-cash:before{content:"\f316"}.ion-chatbox:before{content:"\f11b"}.ion-chatbox-working:before{content:"\f11a"}.ion-chatboxes:before{content:"\f11c"}.ion-chatbubble:before{content:"\f11e"}.ion-chatbubble-working:before{content:"\f11d"}.ion-chatbubbles:before{content:"\f11f"}.ion-checkmark:before{content:"\f122"}.ion-checkmark-circled:before{content:"\f120"}.ion-checkmark-round:before{content:"\f121"}.ion-chevron-down:before{content:"\f123"}.ion-chevron-left:before{content:"\f124"}.ion-chevron-right:before{content:"\f125"}.ion-chevron-up:before{content:"\f126"}.ion-clipboard:before{content:"\f127"}.ion-clock:before{content:"\f26e"}.ion-close:before{content:"\f12a"}.ion-close-circled:before{content:"\f128"}.ion-close-round:before{content:"\f129"}.ion-closed-captioning:before{content:"\f317"}.ion-cloud:before{content:"\f12b"}.ion-code:before{content:"\f271"}.ion-code-download:before{content:"\f26f"}.ion-code-working:before{content:"\f270"}.ion-coffee:before{content:"\f272"}.ion-compass:before{content:"\f273"}.ion-compose:before{content:"\f12c"}.ion-connection-bars:before{content:"\f274"}.ion-contrast:before{content:"\f275"}.ion-crop:before{content:"\f3c1"}.ion-cube:before{content:"\f318"}.ion-disc:before{content:"\f12d"}.ion-document:before{content:"\f12f"}.ion-document-text:before{content:"\f12e"}.ion-drag:before{content:"\f130"}.ion-earth:before{content:"\f276"}.ion-easel:before{content:"\f3c2"}.ion-edit:before{content:"\f2bf"}.ion-egg:before{content:"\f277"}.ion-eject:before{content:"\f131"}.ion-email:before{content:"\f132"}.ion-email-unread:before{content:"\f3c3"}.ion-erlenmeyer-flask:before{content:"\f3c5"}.ion-erlenmeyer-flask-bubbles:before{content:"\f3c4"}.ion-eye:before{content:"\f133"}.ion-eye-disabled:before{content:"\f306"}.ion-female:before{content:"\f278"}.ion-filing:before{content:"\f134"}.ion-film-marker:before{content:"\f135"}.ion-fireball:before{content:"\f319"}.ion-flag:before{content:"\f279"}.ion-flame:before{content:"\f31a"}.ion-flash:before{content:"\f137"}.ion-flash-off:before{content:"\f136"}.ion-folder:before{content:"\f139"}.ion-fork:before{content:"\f27a"}.ion-fork-repo:before{content:"\f2c0"}.ion-forward:before{content:"\f13a"}.ion-funnel:before{content:"\f31b"}.ion-gear-a:before{content:"\f13d"}.ion-gear-b:before{content:"\f13e"}.ion-grid:before{content:"\f13f"}.ion-hammer:before{content:"\f27b"}.ion-happy:before{content:"\f31c"}.ion-happy-outline:before{content:"\f3c6"}.ion-headphone:before{content:"\f140"}.ion-heart:before{content:"\f141"}.ion-heart-broken:before{content:"\f31d"}.ion-help:before{content:"\f143"}.ion-help-buoy:before{content:"\f27c"}.ion-help-circled:before{content:"\f142"}.ion-home:before{content:"\f144"}.ion-icecream:before{content:"\f27d"}.ion-image:before{content:"\f147"}.ion-images:before{content:"\f148"}.ion-information:before{content:"\f14a"}.ion-information-circled:before{content:"\f149"}.ion-ionic:before{content:"\f14b"}.ion-ios-alarm:before{content:"\f3c8"}.ion-ios-alarm-outline:before{content:"\f3c7"}.ion-ios-albums:before{content:"\f3ca"}.ion-ios-albums-outline:before{content:"\f3c9"}.ion-ios-americanfootball:before{content:"\f3cc"}.ion-ios-americanfootball-outline:before{content:"\f3cb"}.ion-ios-analytics:before{content:"\f3ce"}.ion-ios-analytics-outline:before{content:"\f3cd"}.ion-ios-arrow-back:before{content:"\f3cf"}.ion-ios-arrow-down:before{content:"\f3d0"}.ion-ios-arrow-forward:before{content:"\f3d1"}.ion-ios-arrow-left:before{content:"\f3d2"}.ion-ios-arrow-right:before{content:"\f3d3"}.ion-ios-arrow-thin-down:before{content:"\f3d4"}.ion-ios-arrow-thin-left:before{content:"\f3d5"}.ion-ios-arrow-thin-right:before{content:"\f3d6"}.ion-ios-arrow-thin-up:before{content:"\f3d7"}.ion-ios-arrow-up:before{content:"\f3d8"}.ion-ios-at:before{content:"\f3da"}.ion-ios-at-outline:before{content:"\f3d9"}.ion-ios-barcode:before{content:"\f3dc"}.ion-ios-barcode-outline:before{content:"\f3db"}.ion-ios-baseball:before{content:"\f3de"}.ion-ios-baseball-outline:before{content:"\f3dd"}.ion-ios-basketball:before{content:"\f3e0"}.ion-ios-basketball-outline:before{content:"\f3df"}.ion-ios-bell:before{content:"\f3e2"}.ion-ios-bell-outline:before{content:"\f3e1"}.ion-ios-body:before{content:"\f3e4"}.ion-ios-body-outline:before{content:"\f3e3"}.ion-ios-bolt:before{content:"\f3e6"}.ion-ios-bolt-outline:before{content:"\f3e5"}.ion-ios-book:before{content:"\f3e8"}.ion-ios-book-outline:before{content:"\f3e7"}.ion-ios-bookmarks:before{content:"\f3ea"}.ion-ios-bookmarks-outline:before{content:"\f3e9"}.ion-ios-box:before{content:"\f3ec"}.ion-ios-box-outline:before{content:"\f3eb"}.ion-ios-briefcase:before{content:"\f3ee"}.ion-ios-briefcase-outline:before{content:"\f3ed"}.ion-ios-browsers:before{content:"\f3f0"}.ion-ios-browsers-outline:before{content:"\f3ef"}.ion-ios-calculator:before{content:"\f3f2"}.ion-ios-calculator-outline:before{content:"\f3f1"}.ion-ios-calendar:before{content:"\f3f4"}.ion-ios-calendar-outline:before{content:"\f3f3"}.ion-ios-camera:before{content:"\f3f6"}.ion-ios-camera-outline:before{content:"\f3f5"}.ion-ios-cart:before{content:"\f3f8"}.ion-ios-cart-outline:before{content:"\f3f7"}.ion-ios-chatboxes:before{content:"\f3fa"}.ion-ios-chatboxes-outline:before{content:"\f3f9"}.ion-ios-chatbubble:before{content:"\f3fc"}.ion-ios-chatbubble-outline:before{content:"\f3fb"}.ion-ios-checkmark:before{content:"\f3ff"}.ion-ios-checkmark-empty:before{content:"\f3fd"}.ion-ios-checkmark-outline:before{content:"\f3fe"}.ion-ios-circle-filled:before{content:"\f400"}.ion-ios-circle-outline:before{content:"\f401"}.ion-ios-clock:before{content:"\f403"}.ion-ios-clock-outline:before{content:"\f402"}.ion-ios-close:before{content:"\f406"}.ion-ios-close-empty:before{content:"\f404"}.ion-ios-close-outline:before{content:"\f405"}.ion-ios-cloud:before{content:"\f40c"}.ion-ios-cloud-download:before{content:"\f408"}.ion-ios-cloud-download-outline:before{content:"\f407"}.ion-ios-cloud-outline:before{content:"\f409"}.ion-ios-cloud-upload:before{content:"\f40b"}.ion-ios-cloud-upload-outline:before{content:"\f40a"}.ion-ios-cloudy:before{content:"\f410"}.ion-ios-cloudy-night:before{content:"\f40e"}.ion-ios-cloudy-night-outline:before{content:"\f40d"}.ion-ios-cloudy-outline:before{content:"\f40f"}.ion-ios-cog:before{content:"\f412"}.ion-ios-cog-outline:before{content:"\f411"}.ion-ios-color-filter:before{content:"\f414"}.ion-ios-color-filter-outline:before{content:"\f413"}.ion-ios-color-wand:before{content:"\f416"}.ion-ios-color-wand-outline:before{content:"\f415"}.ion-ios-compose:before{content:"\f418"}.ion-ios-compose-outline:before{content:"\f417"}.ion-ios-contact:before{content:"\f41a"}.ion-ios-contact-outline:before{content:"\f419"}.ion-ios-copy:before{content:"\f41c"}.ion-ios-copy-outline:before{content:"\f41b"}.ion-ios-crop:before{content:"\f41e"}.ion-ios-crop-strong:before{content:"\f41d"}.ion-ios-download:before{content:"\f420"}.ion-ios-download-outline:before{content:"\f41f"}.ion-ios-drag:before{content:"\f421"}.ion-ios-email:before{content:"\f423"}.ion-ios-email-outline:before{content:"\f422"}.ion-ios-eye:before{content:"\f425"}.ion-ios-eye-outline:before{content:"\f424"}.ion-ios-fastforward:before{content:"\f427"}.ion-ios-fastforward-outline:before{content:"\f426"}.ion-ios-filing:before{content:"\f429"}.ion-ios-filing-outline:before{content:"\f428"}.ion-ios-film:before{content:"\f42b"}.ion-ios-film-outline:before{content:"\f42a"}.ion-ios-flag:before{content:"\f42d"}.ion-ios-flag-outline:before{content:"\f42c"}.ion-ios-flame:before{content:"\f42f"}.ion-ios-flame-outline:before{content:"\f42e"}.ion-ios-flask:before{content:"\f431"}.ion-ios-flask-outline:before{content:"\f430"}.ion-ios-flower:before{content:"\f433"}.ion-ios-flower-outline:before{content:"\f432"}.ion-ios-folder:before{content:"\f435"}.ion-ios-folder-outline:before{content:"\f434"}.ion-ios-football:before{content:"\f437"}.ion-ios-football-outline:before{content:"\f436"}.ion-ios-game-controller-a:before{content:"\f439"}.ion-ios-game-controller-a-outline:before{content:"\f438"}.ion-ios-game-controller-b:before{content:"\f43b"}.ion-ios-game-controller-b-outline:before{content:"\f43a"}.ion-ios-gear:before{content:"\f43d"}.ion-ios-gear-outline:before{content:"\f43c"}.ion-ios-glasses:before{content:"\f43f"}.ion-ios-glasses-outline:before{content:"\f43e"}.ion-ios-grid-view:before{content:"\f441"}.ion-ios-grid-view-outline:before{content:"\f440"}.ion-ios-heart:before{content:"\f443"}.ion-ios-heart-outline:before{content:"\f442"}.ion-ios-help:before{content:"\f446"}.ion-ios-help-empty:before{content:"\f444"}.ion-ios-help-outline:before{content:"\f445"}.ion-ios-home:before{content:"\f448"}.ion-ios-home-outline:before{content:"\f447"}.ion-ios-infinite:before{content:"\f44a"}.ion-ios-infinite-outline:before{content:"\f449"}.ion-ios-information:before{content:"\f44d"}.ion-ios-information-empty:before{content:"\f44b"}.ion-ios-information-outline:before{content:"\f44c"}.ion-ios-ionic-outline:before{content:"\f44e"}.ion-ios-keypad:before{content:"\f450"}.ion-ios-keypad-outline:before{content:"\f44f"}.ion-ios-lightbulb:before{content:"\f452"}.ion-ios-lightbulb-outline:before{content:"\f451"}.ion-ios-list:before{content:"\f454"}.ion-ios-list-outline:before{content:"\f453"}.ion-ios-location:before{content:"\f456"}.ion-ios-location-outline:before{content:"\f455"}.ion-ios-locked:before{content:"\f458"}.ion-ios-locked-outline:before{content:"\f457"}.ion-ios-loop:before{content:"\f45a"}.ion-ios-loop-strong:before{content:"\f459"}.ion-ios-medical:before{content:"\f45c"}.ion-ios-medical-outline:before{content:"\f45b"}.ion-ios-medkit:before{content:"\f45e"}.ion-ios-medkit-outline:before{content:"\f45d"}.ion-ios-mic:before{content:"\f461"}.ion-ios-mic-off:before{content:"\f45f"}.ion-ios-mic-outline:before{content:"\f460"}.ion-ios-minus:before{content:"\f464"}.ion-ios-minus-empty:before{content:"\f462"}.ion-ios-minus-outline:before{content:"\f463"}.ion-ios-monitor:before{content:"\f466"}.ion-ios-monitor-outline:before{content:"\f465"}.ion-ios-moon:before{content:"\f468"}.ion-ios-moon-outline:before{content:"\f467"}.ion-ios-more:before{content:"\f46a"}.ion-ios-more-outline:before{content:"\f469"}.ion-ios-musical-note:before{content:"\f46b"}.ion-ios-musical-notes:before{content:"\f46c"}.ion-ios-navigate:before{content:"\f46e"}.ion-ios-navigate-outline:before{content:"\f46d"}.ion-ios-nutrition:before{content:"\f470"}.ion-ios-nutrition-outline:before{content:"\f46f"}.ion-ios-paper:before{content:"\f472"}.ion-ios-paper-outline:before{content:"\f471"}.ion-ios-paperplane:before{content:"\f474"}.ion-ios-paperplane-outline:before{content:"\f473"}.ion-ios-partlysunny:before{content:"\f476"}.ion-ios-partlysunny-outline:before{content:"\f475"}.ion-ios-pause:before{content:"\f478"}.ion-ios-pause-outline:before{content:"\f477"}.ion-ios-paw:before{content:"\f47a"}.ion-ios-paw-outline:before{content:"\f479"}.ion-ios-people:before{content:"\f47c"}.ion-ios-people-outline:before{content:"\f47b"}.ion-ios-person:before{content:"\f47e"}.ion-ios-person-outline:before{content:"\f47d"}.ion-ios-personadd:before{content:"\f480"}.ion-ios-personadd-outline:before{content:"\f47f"}.ion-ios-photos:before{content:"\f482"}.ion-ios-photos-outline:before{content:"\f481"}.ion-ios-pie:before{content:"\f484"}.ion-ios-pie-outline:before{content:"\f483"}.ion-ios-pint:before{content:"\f486"}.ion-ios-pint-outline:before{content:"\f485"}.ion-ios-play:before{content:"\f488"}.ion-ios-play-outline:before{content:"\f487"}.ion-ios-plus:before{content:"\f48b"}.ion-ios-plus-empty:before{content:"\f489"}.ion-ios-plus-outline:before{content:"\f48a"}.ion-ios-pricetag:before{content:"\f48d"}.ion-ios-pricetag-outline:before{content:"\f48c"}.ion-ios-pricetags:before{content:"\f48f"}.ion-ios-pricetags-outline:before{content:"\f48e"}.ion-ios-printer:before{content:"\f491"}.ion-ios-printer-outline:before{content:"\f490"}.ion-ios-pulse:before{content:"\f493"}.ion-ios-pulse-strong:before{content:"\f492"}.ion-ios-rainy:before{content:"\f495"}.ion-ios-rainy-outline:before{content:"\f494"}.ion-ios-recording:before{content:"\f497"}.ion-ios-recording-outline:before{content:"\f496"}.ion-ios-redo:before{content:"\f499"}.ion-ios-redo-outline:before{content:"\f498"}.ion-ios-refresh:before{content:"\f49c"}.ion-ios-refresh-empty:before{content:"\f49a"}.ion-ios-refresh-outline:before{content:"\f49b"}.ion-ios-reload:before{content:"\f49d"}.ion-ios-reverse-camera:before{content:"\f49f"}.ion-ios-reverse-camera-outline:before{content:"\f49e"}.ion-ios-rewind:before{content:"\f4a1"}.ion-ios-rewind-outline:before{content:"\f4a0"}.ion-ios-rose:before{content:"\f4a3"}.ion-ios-rose-outline:before{content:"\f4a2"}.ion-ios-search:before{content:"\f4a5"}.ion-ios-search-strong:before{content:"\f4a4"}.ion-ios-settings:before{content:"\f4a7"}.ion-ios-settings-strong:before{content:"\f4a6"}.ion-ios-shuffle:before{content:"\f4a9"}.ion-ios-shuffle-strong:before{content:"\f4a8"}.ion-ios-skipbackward:before{content:"\f4ab"}.ion-ios-skipbackward-outline:before{content:"\f4aa"}.ion-ios-skipforward:before{content:"\f4ad"}.ion-ios-skipforward-outline:before{content:"\f4ac"}.ion-ios-snowy:before{content:"\f4ae"}.ion-ios-speedometer:before{content:"\f4b0"}.ion-ios-speedometer-outline:before{content:"\f4af"}.ion-ios-star:before{content:"\f4b3"}.ion-ios-star-half:before{content:"\f4b1"}.ion-ios-star-outline:before{content:"\f4b2"}.ion-ios-stopwatch:before{content:"\f4b5"}.ion-ios-stopwatch-outline:before{content:"\f4b4"}.ion-ios-sunny:before{content:"\f4b7"}.ion-ios-sunny-outline:before{content:"\f4b6"}.ion-ios-telephone:before{content:"\f4b9"}.ion-ios-telephone-outline:before{content:"\f4b8"}.ion-ios-tennisball:before{content:"\f4bb"}.ion-ios-tennisball-outline:before{content:"\f4ba"}.ion-ios-thunderstorm:before{content:"\f4bd"}.ion-ios-thunderstorm-outline:before{content:"\f4bc"}.ion-ios-time:before{content:"\f4bf"}.ion-ios-time-outline:before{content:"\f4be"}.ion-ios-timer:before{content:"\f4c1"}.ion-ios-timer-outline:before{content:"\f4c0"}.ion-ios-toggle:before{content:"\f4c3"}.ion-ios-toggle-outline:before{content:"\f4c2"}.ion-ios-trash:before{content:"\f4c5"}.ion-ios-trash-outline:before{content:"\f4c4"}.ion-ios-undo:before{content:"\f4c7"}.ion-ios-undo-outline:before{content:"\f4c6"}.ion-ios-unlocked:before{content:"\f4c9"}.ion-ios-unlocked-outline:before{content:"\f4c8"}.ion-ios-upload:before{content:"\f4cb"}.ion-ios-upload-outline:before{content:"\f4ca"}.ion-ios-videocam:before{content:"\f4cd"}.ion-ios-videocam-outline:before{content:"\f4cc"}.ion-ios-volume-high:before{content:"\f4ce"}.ion-ios-volume-low:before{content:"\f4cf"}.ion-ios-wineglass:before{content:"\f4d1"}.ion-ios-wineglass-outline:before{content:"\f4d0"}.ion-ios-world:before{content:"\f4d3"}.ion-ios-world-outline:before{content:"\f4d2"}.ion-ipad:before{content:"\f1f9"}.ion-iphone:before{content:"\f1fa"}.ion-ipod:before{content:"\f1fb"}.ion-jet:before{content:"\f295"}.ion-key:before{content:"\f296"}.ion-knife:before{content:"\f297"}.ion-laptop:before{content:"\f1fc"}.ion-leaf:before{content:"\f1fd"}.ion-levels:before{content:"\f298"}.ion-lightbulb:before{content:"\f299"}.ion-link:before{content:"\f1fe"}.ion-load-a:before{content:"\f29a"}.ion-load-b:before{content:"\f29b"}.ion-load-c:before{content:"\f29c"}.ion-load-d:before{content:"\f29d"}.ion-location:before{content:"\f1ff"}.ion-lock-combination:before{content:"\f4d4"}.ion-locked:before{content:"\f200"}.ion-log-in:before{content:"\f29e"}.ion-log-out:before{content:"\f29f"}.ion-loop:before{content:"\f201"}.ion-magnet:before{content:"\f2a0"}.ion-male:before{content:"\f2a1"}.ion-man:before{content:"\f202"}.ion-map:before{content:"\f203"}.ion-medkit:before{content:"\f2a2"}.ion-merge:before{content:"\f33f"}.ion-mic-a:before{content:"\f204"}.ion-mic-b:before{content:"\f205"}.ion-mic-c:before{content:"\f206"}.ion-minus:before{content:"\f209"}.ion-minus-circled:before{content:"\f207"}.ion-minus-round:before{content:"\f208"}.ion-model-s:before{content:"\f2c1"}.ion-monitor:before{content:"\f20a"}.ion-more:before{content:"\f20b"}.ion-mouse:before{content:"\f340"}.ion-music-note:before{content:"\f20c"}.ion-navicon:before{content:"\f20e"}.ion-navicon-round:before{content:"\f20d"}.ion-navigate:before{content:"\f2a3"}.ion-network:before{content:"\f341"}.ion-no-smoking:before{content:"\f2c2"}.ion-nuclear:before{content:"\f2a4"}.ion-outlet:before{content:"\f342"}.ion-paintbrush:before{content:"\f4d5"}.ion-paintbucket:before{content:"\f4d6"}.ion-paper-airplane:before{content:"\f2c3"}.ion-paperclip:before{content:"\f20f"}.ion-pause:before{content:"\f210"}.ion-person:before{content:"\f213"}.ion-person-add:before{content:"\f211"}.ion-person-stalker:before{content:"\f212"}.ion-pie-graph:before{content:"\f2a5"}.ion-pin:before{content:"\f2a6"}.ion-pinpoint:before{content:"\f2a7"}.ion-pizza:before{content:"\f2a8"}.ion-plane:before{content:"\f214"}.ion-planet:before{content:"\f343"}.ion-play:before{content:"\f215"}.ion-playstation:before{content:"\f30a"}.ion-plus:before{content:"\f218"}.ion-plus-circled:before{content:"\f216"}.ion-plus-round:before{content:"\f217"}.ion-podium:before{content:"\f344"}.ion-pound:before{content:"\f219"}.ion-power:before{content:"\f2a9"}.ion-pricetag:before{content:"\f2aa"}.ion-pricetags:before{content:"\f2ab"}.ion-printer:before{content:"\f21a"}.ion-pull-request:before{content:"\f345"}.ion-qr-scanner:before{content:"\f346"}.ion-quote:before{content:"\f347"}.ion-radio-waves:before{content:"\f2ac"}.ion-record:before{content:"\f21b"}.ion-refresh:before{content:"\f21c"}.ion-reply:before{content:"\f21e"}.ion-reply-all:before{content:"\f21d"}.ion-ribbon-a:before{content:"\f348"}.ion-ribbon-b:before{content:"\f349"}.ion-sad:before{content:"\f34a"}.ion-sad-outline:before{content:"\f4d7"}.ion-scissors:before{content:"\f34b"}.ion-search:before{content:"\f21f"}.ion-settings:before{content:"\f2ad"}.ion-share:before{content:"\f220"}.ion-shuffle:before{content:"\f221"}.ion-skip-backward:before{content:"\f222"}.ion-skip-forward:before{content:"\f223"}.ion-social-android:before{content:"\f225"}.ion-social-android-outline:before{content:"\f224"}.ion-social-angular:before{content:"\f4d9"}.ion-social-angular-outline:before{content:"\f4d8"}.ion-social-apple:before{content:"\f227"}.ion-social-apple-outline:before{content:"\f226"}.ion-social-bitcoin:before{content:"\f2af"}.ion-social-bitcoin-outline:before{content:"\f2ae"}.ion-social-buffer:before{content:"\f229"}.ion-social-buffer-outline:before{content:"\f228"}.ion-social-chrome:before{content:"\f4db"}.ion-social-chrome-outline:before{content:"\f4da"}.ion-social-codepen:before{content:"\f4dd"}.ion-social-codepen-outline:before{content:"\f4dc"}.ion-social-css3:before{content:"\f4df"}.ion-social-css3-outline:before{content:"\f4de"}.ion-social-designernews:before{content:"\f22b"}.ion-social-designernews-outline:before{content:"\f22a"}.ion-social-dribbble:before{content:"\f22d"}.ion-social-dribbble-outline:before{content:"\f22c"}.ion-social-dropbox:before{content:"\f22f"}.ion-social-dropbox-outline:before{content:"\f22e"}.ion-social-euro:before{content:"\f4e1"}.ion-social-euro-outline:before{content:"\f4e0"}.ion-social-facebook:before{content:"\f231"}.ion-social-facebook-outline:before{content:"\f230"}.ion-social-foursquare:before{content:"\f34d"}.ion-social-foursquare-outline:before{content:"\f34c"}.ion-social-freebsd-devil:before{content:"\f2c4"}.ion-social-github:before{content:"\f233"}.ion-social-github-outline:before{content:"\f232"}.ion-social-google:before{content:"\f34f"}.ion-social-google-outline:before{content:"\f34e"}.ion-social-googleplus:before{content:"\f235"}.ion-social-googleplus-outline:before{content:"\f234"}.ion-social-hackernews:before{content:"\f237"}.ion-social-hackernews-outline:before{content:"\f236"}.ion-social-html5:before{content:"\f4e3"}.ion-social-html5-outline:before{content:"\f4e2"}.ion-social-instagram:before{content:"\f351"}.ion-social-instagram-outline:before{content:"\f350"}.ion-social-javascript:before{content:"\f4e5"}.ion-social-javascript-outline:before{content:"\f4e4"}.ion-social-linkedin:before{content:"\f239"}.ion-social-linkedin-outline:before{content:"\f238"}.ion-social-markdown:before{content:"\f4e6"}.ion-social-nodejs:before{content:"\f4e7"}.ion-social-octocat:before{content:"\f4e8"}.ion-social-pinterest:before{content:"\f2b1"}.ion-social-pinterest-outline:before{content:"\f2b0"}.ion-social-python:before{content:"\f4e9"}.ion-social-reddit:before{content:"\f23b"}.ion-social-reddit-outline:before{content:"\f23a"}.ion-social-rss:before{content:"\f23d"}.ion-social-rss-outline:before{content:"\f23c"}.ion-social-sass:before{content:"\f4ea"}.ion-social-skype:before{content:"\f23f"}.ion-social-skype-outline:before{content:"\f23e"}.ion-social-snapchat:before{content:"\f4ec"}.ion-social-snapchat-outline:before{content:"\f4eb"}.ion-social-tumblr:before{content:"\f241"}.ion-social-tumblr-outline:before{content:"\f240"}.ion-social-tux:before{content:"\f2c5"}.ion-social-twitch:before{content:"\f4ee"}.ion-social-twitch-outline:before{content:"\f4ed"}.ion-social-twitter:before{content:"\f243"}.ion-social-twitter-outline:before{content:"\f242"}.ion-social-usd:before{content:"\f353"}.ion-social-usd-outline:before{content:"\f352"}.ion-social-vimeo:before{content:"\f245"}.ion-social-vimeo-outline:before{content:"\f244"}.ion-social-whatsapp:before{content:"\f4f0"}.ion-social-whatsapp-outline:before{content:"\f4ef"}.ion-social-windows:before{content:"\f247"}.ion-social-windows-outline:before{content:"\f246"}.ion-social-wordpress:before{content:"\f249"}.ion-social-wordpress-outline:before{content:"\f248"}.ion-social-yahoo:before{content:"\f24b"}.ion-social-yahoo-outline:before{content:"\f24a"}.ion-social-yen:before{content:"\f4f2"}.ion-social-yen-outline:before{content:"\f4f1"}.ion-social-youtube:before{content:"\f24d"}.ion-social-youtube-outline:before{content:"\f24c"}.ion-soup-can:before{content:"\f4f4"}.ion-soup-can-outline:before{content:"\f4f3"}.ion-speakerphone:before{content:"\f2b2"}.ion-speedometer:before{content:"\f2b3"}.ion-spoon:before{content:"\f2b4"}.ion-star:before{content:"\f24e"}.ion-stats-bars:before{content:"\f2b5"}.ion-steam:before{content:"\f30b"}.ion-stop:before{content:"\f24f"}.ion-thermometer:before{content:"\f2b6"}.ion-thumbsdown:before{content:"\f250"}.ion-thumbsup:before{content:"\f251"}.ion-toggle:before{content:"\f355"}.ion-toggle-filled:before{content:"\f354"}.ion-transgender:before{content:"\f4f5"}.ion-trash-a:before{content:"\f252"}.ion-trash-b:before{content:"\f253"}.ion-trophy:before{content:"\f356"}.ion-tshirt:before{content:"\f4f7"}.ion-tshirt-outline:before{content:"\f4f6"}.ion-umbrella:before{content:"\f2b7"}.ion-university:before{content:"\f357"}.ion-unlocked:before{content:"\f254"}.ion-upload:before{content:"\f255"}.ion-usb:before{content:"\f2b8"}.ion-videocamera:before{content:"\f256"}.ion-volume-high:before{content:"\f257"}.ion-volume-low:before{content:"\f258"}.ion-volume-medium:before{content:"\f259"}.ion-volume-mute:before{content:"\f25a"}.ion-wand:before{content:"\f358"}.ion-waterdrop:before{content:"\f25b"}.ion-wifi:before{content:"\f25c"}.ion-wineglass:before{content:"\f2b9"}.ion-woman:before{content:"\f25d"}.ion-wrench:before{content:"\f2ba"}.ion-xbox:before{content:"\f30c"} diff --git a/src/fonts/Julia.eot b/src/fonts/Julia.eot new file mode 100644 index 0000000..357bf64 Binary files /dev/null and b/src/fonts/Julia.eot differ diff --git a/src/fonts/Julia.svg b/src/fonts/Julia.svg new file mode 100644 index 0000000..12561a0 --- /dev/null +++ b/src/fonts/Julia.svg @@ -0,0 +1,73 @@ + + + + + +Created by FontForge 20120731 at Tue Aug 16 20:52:28 2016 + By Apache +Created by Apache with FontForge 2.0 (http://fontforge.sf.net) + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/fonts/Julia.ttf b/src/fonts/Julia.ttf new file mode 100644 index 0000000..94d24f2 Binary files /dev/null and b/src/fonts/Julia.ttf differ diff --git a/src/fonts/Julia.woff b/src/fonts/Julia.woff new file mode 100644 index 0000000..b35cf52 Binary files /dev/null and b/src/fonts/Julia.woff differ diff --git a/src/fonts/ionicons.eot b/src/fonts/ionicons.eot deleted file mode 100644 index 92a3f20..0000000 Binary files a/src/fonts/ionicons.eot and /dev/null differ diff --git a/src/fonts/ionicons.svg b/src/fonts/ionicons.svg deleted file mode 100644 index 49fc8f3..0000000 --- a/src/fonts/ionicons.svg +++ /dev/null @@ -1,2230 +0,0 @@ - - - - - -Created by FontForge 20120731 at Thu Dec 4 09:51:48 2014 - By Adam Bradley -Created by Adam Bradley with FontForge 2.0 (http://fontforge.sf.net) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/fonts/ionicons.ttf b/src/fonts/ionicons.ttf deleted file mode 100644 index c4e4632..0000000 Binary files a/src/fonts/ionicons.ttf and /dev/null differ diff --git a/src/fonts/ionicons.woff b/src/fonts/ionicons.woff deleted file mode 100644 index 5f3a14e..0000000 Binary files a/src/fonts/ionicons.woff and /dev/null differ diff --git a/src/js/julia-core.js b/src/js/julia-core.js new file mode 100644 index 0000000..8e7e42b --- /dev/null +++ b/src/js/julia-core.js @@ -0,0 +1,1633 @@ +/* *********************************** +* Julia player +* +* @author prochor666@gmail.com +* version: 0.9.11 +* build: 2016-08-16 +* licensed under the MIT License +* +* @requires: +* jquery [required] +* hls.js [required] +* rangeslider.js [required] +* +************************************* */ + +var Julia = function(options) +{ + if(!window.jQuery) + { + alert('jQuery is required'); + window.stop(); + } + + var self = this; + + // Import self.options + options = typeof options === 'undefined' ? {}: options; + + // Root path workaround + var __JULIA_ROOT_PATH__ = 'julia'; + dir = $('script[src*="julia-player"]').attr('src'); + name = dir.split('/').pop(); + __JULIA_ROOT_PATH__ = dir.replace('/js/'+name,""); + $('head').append(''); + //$('head').append(''); + + + + // Default self.options + self.options = { + source: false, + autoplay: false, + volume: 25, + element: $('video'), + muted: false, + width: 512, + height: 288, + debug: false, + debugPlayback: false, + forceHls: false, + live: false, + responsive: true, + dimensions: [ + [1920, 1080], + [1280,720], + [960,540], + [640,360], + [512,288] + ], + pauseOnClick: false, + poster: '', + hlsConfig: { +/* + debug : false, + autoStartLoad : true, + autoRecoverError : true, + maxBufferLength : 60, + maxBufferSize : 120*1000*1000, + liveSyncDurationCount : 5, // D: 3 + liveMaxLatencyDurationCount: 10, + enableWorker : true, + levelLoadingTimeOut: 10000, + levelLoadingMaxRetry: 6, + levelLoadingRetryDelay: 500, + fragLoadingTimeOut : 5000, + fragLoadingMaxRetry : 6, + fragLoadingRetryDelay : 100, + manifestLoadingTimeOut : 10000, + manifestLoadingMaxRetry : 6, + manifestLoadingRetryDelay : 500, + fpsDroppedMonitoringPeriod : 5000, + fpsDroppedMonitoringThreshold : 0.2, + appendErrorMaxRetry : 200, + + xhrSetup: function(xhr, url) { + xhr.withCredentials = true; + xhr.setRequestHeader("Cache-Control","no-cache,max-age=0"); + xhr.setRequestHeader("pragma", "no-cache"); + }*/ + }, + dashConfig: { + + }, + suggest: [], + suggestLimit: 2, + suggestTimeout: 10000, + themePath: __JULIA_ROOT_PATH__+'/css/themes', + pluginPath: __JULIA_ROOT_PATH__+'/js/plugins', + theme: 'default', + i18n: { + liveText: 'Live' + }, + onTime: {}, + triggerHls: {}, + onPlay: false, + onPause: false, + onStop: false, + onPosition: false, + onSuggest: false, + }; + + + + + + + // Environment + self.env = { + shield: '', + element: self.options.element, + suggest: '', + toolbar: '', + poster: '', + api: '', + apiId: Math.floor((Math.random()*10000000)+1), // Create a shadow api unique ID + player: '', + isLive: false, + hls: {}, + canPlayMedia: '', + canPlayMediaString: '', + isHls: false, + useHlsLib: false, + tries: 0, + source: '', + duration: 0, + apiOk: false, + onTimeRised: [], + seeking: false, + dimensions: { + width: 0, + height: 0, + }, + started: false, + publicApi: {}, + suggestPointer: 0, + suggestClicked: false, + progressStep: 0.01, // Full sense: 100, so .01 is enough accurate + }; + + + + + + + + + + // Extend self.options + var _extend = function() + { + for(o in self.options) + { + if(options.hasOwnProperty(o)) + { + self.options[o] = options[o]; + } + } + }; + + + + + // Extend default self.options with external self.options + _extend(); + + + + + + + // Console debug + var _debug = function(data) + { + if(self.options.debug === true) + { + if(window.console) + { + for(d in data) + { + console.log(' - [instance: '+self.env.apiId+'] '+d+' ['+(typeof data[d])+']', data[d]); + } + } + } + }; + + + + + + + + + + // Persistent user data in cookies + var _client = { + + set: function(name, value, days) + { + dateObj = new Date(); + dateObj.setTime(dateObj.getTime() + (days*24*60*60*1000)); + var expires = 'expires=' + dateObj.toUTCString(); + document.cookie = name + '=' + value + '; ' + expires + '; path=/'; + }, + + get: function(name) + { + var name = name + '='; + var ca = document.cookie.split(';'); + + for(var i=0; i'); + self.env.player.prepend(apiElement); + self.env.api = document.getElementById('julia-api-'+self.env.apiId); + self.env.api.controls = false; + self.env.apiOk = true; + + _debug({ + 'apiId': self.env.apiId, + 'api': self.env.api, + }); + } + }; + + + + + + + + + + + + + + + + + // UI kit + var _ui = { + + // Video shield for helpers, buttons, preloaders, advertising etc... + shield: function() + { + self.env.shield = $('
' + +' ' + +'
' + +'
' + ); + + self.env.suggest = $('
'); + }, + + posterSet: function() + { + _ui.posterUnset(); + if(self.env.poster.length > 0) + { + img = $('') + + self.env.shield.append(img); + + _debug({ + poster: self.env.poster, + }) + } + }, + + posterUnset: function() + { + self.env.shield.find('img').remove(); + }, + + // Button toolbar + toolbar: function() + { + self.env.toolbar = $('
' + +'
' + +' ' + +'
' + +'
' + +' '+self.options.i18n.liveText+'' + +'
' + +'
' + +' 00:00:00 / ' + +'
' + +'
' + +' 00:00:00' + +'
' + +'' + +'' + +'
' + +' ' + +'
' + +'' + +'
'); + }, + + // Create player object + player: function() + { + _ui.shield(); + _ui.toolbar(); + + self.env.player = $('
' + +'
'); + + self.env.player.append(self.env.shield); + self.env.player.append(self.env.suggest); + self.env.player.append(self.env.toolbar); + + self.env.element.hide(); + self.env.player.insertAfter(self.env.element); + + // Simulate preload + self.env.shield.find('.julia-big-play').hide(); + self.env.toolbar.hide(); + + // Rangeslider polyfill + $('#julia-toolbar-'+self.env.apiId+'>div.julia-progress>input, #julia-toolbar-'+self.env.apiId+'>div.julia-volume>input').rangeslider({ + polyfill: false, + rangeClass: 'julia-rangeslider', + disabledClass: 'julia-rangeslider--disabled', + horizontalClass: 'julia-rangeslider--horizontal', + verticalClass: 'julia-rangeslider--vertical', + fillClass: 'julia-rangeslider__fill', + handleClass: 'julia-rangeslider__handle', + onInit: function(){}, + onSlide : function(position, value){}, + onSlideEnd : function(position, value){} + }); + + _debug({ + 'element': self.env.element, + 'toolbar': self.env.toolbar, + 'shield': self.env.shield, + 'player': self.env.player, + }); + } + }; + + + + + + + + + + + + + + // Fullscreen on + var _fullscreen = { + + on: function() + { + var videoFrame = document.querySelector('#julia-player-'+self.env.apiId); + + if(videoFrame.requestFullscreen) + { + videoFrame.requestFullscreen(); + } else if (videoFrame.msRequestFullscreen) + { + videoFrame.msRequestFullscreen(); + } else if (videoFrame.mozRequestFullScreen) + { + videoFrame.mozRequestFullScreen(); + } else if(videoFrame.webkitRequestFullscreen) + { + videoFrame.webkitRequestFullscreen(); + } + }, + + // Fullscreen off + off: function() + { + if(document.exitFullscreen) + { + document.exitFullscreen(); + }else if(document.msExitFullscreen) + { + document.msExitFullscreen(); + } else if(document.mozCancelFullScreen) + { + document.mozCancelFullScreen(); + } else if(document.webkitExitFullscreen) + { + document.webkitExitFullscreen(); + } + } + }; + + + + + + + + + + + + // Timeline numbers coonversion + var _timecode = { + + toPercents: function(currentTime) + { + p = (currentTime/self.env.duration)*100; + return p; + }, + + toSeconds: function(percent) + { + t = (self.env.duration/100)*percent; + return t; + }, + + toNum: function(human) + { + human = human.split(':'); + human.reverse(); + s = parseInt(human[0]); + m = human.length>1 ? parseInt(human[1]): 0; + h = human.length>2 ? parseInt(human[3]): 0; + t = s + m*60 + h*60*60; + return t; + }, + + toHuman: function(time) + { + time = time.toString().split('.'); + s = time[0]; + H = Math.floor(s/3600); + M = Math.floor( ( s - (H*3600) ) / 60 ); + S = Math.floor( ( s - (H*3600) - (M*60) ) ); + + H = ('0'+H.toString()).slice(-2); + M = ('0'+M.toString()).slice(-2); + S = ('0'+S.toString()).slice(-2); + + str = H>0 ? H+':'+M+':'+S: M+':'+S; + + return str; + } + }; + + + + + + + + + + + + + + + // Suggest engine + var _suggest = { + + run: function() + { + self.env.suggest.html(''); + _control.press('stop'); + self.env.suggestClicked = false; + self.env.tries = 0; + + if(self.options.suggest.length > 0) + { + x = 0; + for(var i in self.options.suggest) + { + if(x < self.options.suggestLimit && self.options.suggest[i].played === false) + { + mode = !!self.options.suggest[i].live && self.options.suggest[i].live === true ? 'live': 'vod'; + liveText = !!self.options.suggest[i].liveText ? self.options.suggest[i].liveText: 'Live'; + var poster = !!self.options.suggest[i].poster ? self.options.suggest[i].poster: ''; + posterImage = poster.length>0 ? '': ''; + suggestItemWidget = $('
' + + posterImage + +'
'+self.options.suggest[i].title+'
' + +'
'); + + suggestItemWidget.on('click', function(e) + { + + if(self.options.onSuggest !== false) + { + _call.fn(self.options.onSuggest, self.options.suggest[i]); + } + + self.options.muted = self.env.api.muted; + + self.options.poster = $(this).data('poster'); + self.env.suggestClicked = true; + self.env.shield.find('.julia-big-play').hide(); + self.env.started = false; + self.options.source = $(this).data('file'); + _boot.selectSource(); + self.options.autoplay = true; + self.options.live = $(this).data('mode') == 'live' ? true: false; + self.options.i18n.liveText = $(this).data('live-text'); + + self.env.toolbar.find('.julia-live-indicator>span').text(self.options.i18n.liveText); + + _debug({ + suggestRemoveIndex: $(this).data('index'), + suggestRemove: $(this).data('file') + }); + + self.options.suggest[$(this).data('index')].played = true; + self.env.suggest.removeClass('on'); + + _boot.init(); + _boot.load(); + _support.resize(); + }); + + self.env.suggest.append(suggestItemWidget); + x++; + } + } + + if(x > 0) + { + if(self.options.suggestTimeout > 0 && _support.isMobile() === false) + { + setTimeout( function() + { + if(self.env.suggestClicked === false) + { + self.env.suggest.find('div.julia-suggest-item:first').click(); + } + }, self.options.suggestTimeout); + } + self.env.suggest.addClass('on'); + } + + }else{ + _fullscreen.off(); + } + + _debug({ + 'Suggest' : 'raised' + }); + } + }; + + + + + + + + + + + + + + + + + + + // Support + var _support = { + + aspect: function(w,h) + { + return w>0 && h>0 ? h/w: 0; + }, + + isMobile: function() + { + if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) + { + return true; + } + + return false; + }, + + forceReady: function() + { + if( /Firefox/i.test(navigator.userAgent) ) + { + return true; + } + + return false; + }, + + theme: function() + { + _debug({ + 'theme': self.options.themePath+'/'+self.options.theme+'/julia.css' + }); + + $('head').append(''); + }, + + canPlayMedia: function() + { + var vid = document.createElement('video'); + vid.id = 'video-cap-test-'+self.env.apiId; + self.env.canPlayMediaString = vid.canPlayType('application/vnd.apple.mpegURL'); + $('#video-cap-test'+self.env.apiId).remove(); + return (self.env.canPlayMediaString == 'probably' || self.env.canPlayMediaString == 'maybe'); + }, + + resize: function() + { + // Player dimensions + defaultDim = self.env.element.width() ? [self.env.element.width(), self.env.element.height()]: [self.options.width, self.options.height]; + dimensions = self.options.responsive === true ? _support.getSize(): defaultDim; + + _debug({ + 'resizeDefaults': defaultDim, + 'resize': dimensions + }); + + self.env.player.width(dimensions[0]); + self.env.player.height(dimensions[1]); + + self.env.dimensions.width = dimensions[0]; + self.env.dimensions.height = dimensions[1]; + + self.env.api.setAttribute('width', '100%'); + self.env.api.setAttribute('height', '100%'); + }, + + getSize: function() + { + // Fix video wrapped in inline block, can not get size properlym if inline element detected + var parentBlock = self.env.element.parent().css('display').toLowerCase(); + if(parentBlock == 'inline') + { + self.env.element.parent().css({'display': 'block'}); + } + + var parentWidth = self.env.element.parent().width(); + for(i in self.options.dimensions) + { + var dim = self.options.dimensions[i]; + if(parentWidth>=dim[0]) + { + a = _support.aspect(parentWidth) == 0 ? dim[1]/dim[0]: _support.aspect(self.env.api.videoWidth, self.env.api.videoHeight); + + dimensions = [dim[0],(dim[0]*a)]; + _debug({ + 'resizePredefined': dimensions + }); + return dimensions; + } + } + + a = _support.aspect() == 0 ? dim[1]/dim[0]: _support.aspect(self.env.api.videoWidth, self.env.api.videoHeight); + dimensions = [parentWidth, (parentWidth*a)]; + + _debug({ + 'resizeFallback': dimensions + }); + + return dimensions; + } + }; + + + + + + + + + + + + // Callback + var _call = { + + fn: function(f, data) + { + data = data||{}; + if(f !== false) + { + f(self.options, self.env, data); + } + } + }; + + + + + + + + + + + + + + + // Api && UI control + var _control = { + + press: function(action, data) + { + data = data||{}; + + _debug({ + 'action': action, + 'action-data': data, + }); + + switch(action) + { + case 'play': + + if(self.options.onPlay !== false) + { + _call.fn(self.options.onPlay, data); + } + + self.env.api.play(); + + break; case 'pause': + + if(self.options.onPause !== false) + { + _call.fn(self.options.onPause, data); + } + + self.env.api.pause(); + + break; case 'stop': + + if(self.options.onStop !== false) + { + _call.fn(self.options.onStop, data); + } + + self.env.api.pause(); + self.env.api.currentTime = 0; + + self.env.toolbar.find('.julia-playback.pause') + .removeClass('pause') + .addClass('play') + .find('i') + .removeClass('julia-pause') + .addClass('julia-play'); + self.env.shield.find('.julia-big-play').show(); + self.env.toolbar.find('.julia-progress>input').val(0).rangeslider('update', true); + + break; case 'goto': + + if(self.options.onPosition !== false) + { + _call.fn(self.options.onPosition, data); + } + + self.env.api.currentTime = data.currentTime; + + break; case 'setDuration': + + self.env.toolbar.find('.julia-panel.julia-duration>span').text(data.duration); + + if(self.env.started === false) + { + self.env.toolbar.find('.julia-progress>input').val(0).rangeslider('update', true); + } + + _debug({ + 'setDuration': data.duration + }); + + break; case 'volume': + + self.options.volume = data.volume; + self.env.api.volume = data.volume/100; + + _debug({ + 'volume is': self.env.api.volume + }); + + self.env.toolbar.find('.julia-volume>input').val(data.volume).rangeslider('update', true); + + if(data.volume>0) + { + _control.press('sound-on'); + + }else{ + _control.press('sound-off'); + } + + break; case 'sound-on': + + self.env.api.muted = false; + self.options.muted = false; + _client.set('volume', self.options.volume, 30); + _client.set('muted', self.options.muted, 30); + + self.env.toolbar + .find('.julia-sound.off') + .removeClass('off') + .addClass('on') + .find('i') + .removeClass('julia-sound-off') + .addClass('julia-sound-on'); + + break; case 'sound-off': + + self.env.api.muted = true; + self.options.muted = true; + _client.set('volume', self.options.volume, 30); + _client.set('muted', self.options.muted, 30); + + self.env.toolbar + .find('.julia-sound.on') + .removeClass('on') + .addClass('off') + .find('i') + .removeClass('julia-sound-on') + .addClass('julia-sound-off'); + + break; case 'fullscreen-on': + _fullscreen.on(); + + break; case 'fullscreen-off': + _fullscreen.off(); + + break; case 'destroy': + + setTiemout( function(){ + self.env.player.remove(); + }, 100); + + break; default: + + } + + return; + } + }; + + + + + + + + + + + + + + // Bindings + var _events = { + + // First play with some handlers + playAllowStart: function(e) + { + self.env.shield.find('.julia-preloader').removeClass('on'); + self.env.shield.find('.julia-big-play').show(); + self.env.toolbar.show(); + + // Init actions + _control.press('setDuration', { + 'duration': _timecode.toHuman( self.env.duration ) + }); + + // Set mute if needed + if(self.options.muted === true) + { + _control.press('sound-off'); + }else{ + _control.press('sound-on'); + + // Set initial volume + _control.press('volume', { + 'volume': self.options.volume + }); + } + + // Autostart playback, if possible + if(self.options.autoplay === true && _support.isMobile() === false) + { + _control.press('play'); + } + + _debug({ + 'eventType': e.type, + 'duration': self.env.api.duration, + 'readyState': self.env.api.readyState + }); + }, + + // Bind can play by ready state / fake readyState + // Because of Firefox cannot bind canplaythrough event with HLS.js properly + canplaythrough: function() + { + if(self.env.started === false) + { + // don't let mobile Firefox make decision about readyState, mobile Firefox lie! + if(self.env.api.readyState>=3 || (_support.isMobile() === true && self.env.api.readyState>=2) ) + { + _events.playAllowStart({ + type: '_events.canplaythrough' + }); + }else{ + setTimeout( function() + { + _events.canplaythrough(); + }, 250); + } + } + }, + + + // Bind user action & DOM events + DOM: function() + { + // Buttons + self.env.toolbar.on('contextmenu', function(e) + { + e.preventDefault(); + }) + .on('click', '.julia-playback.play', function(e) + { + e.preventDefault(); + _control.press('play'); + }) + .on('click', '.julia-playback.pause', function(e) + { + e.preventDefault(); + _control.press('pause'); + }) + .on('click', '.julia-sound.on', function(e) + { + e.preventDefault(); + _control.press('sound-off'); + }) + .on('click', '.julia-sound.off', function(e) + { + e.preventDefault(); + _control.press('sound-on'); + }) + .on('click', '.julia-fullscreen-toggle.on', function(e) + { + e.preventDefault(); + _control.press('fullscreen-on'); + }) + .on('click', '.julia-fullscreen-toggle.off', function(e) + { + e.preventDefault(); + _control.press('fullscreen-off'); + }); + + // Big play + self.env.shield.on('click contextmenu', '.julia-big-play', function(e) + { + e.preventDefault(); + e.stopPropagation(); + if(e.type == 'click') + { + _control.press('play'); + } + }); + + // Area click + self.env.shield.on('click', function(e) + { + e.preventDefault(); + e.stopPropagation(); + if(self.options.pauseOnClick === true && _support.isMobile() === false) + { + _control.press('pause'); + } + }); + + // Fullscreen toolbar behavior bindings + var mouseMoveCleaner; + + self.env.player.on('mousemove', '#julia-shield-'+self.env.apiId+', #julia-suggest-'+self.env.apiId, function(e) + { + e.preventDefault(); + self.env.toolbar.addClass('julia-toolbar-visible'); + clearTimeout(mouseMoveCleaner); + + mouseMoveCleaner = setTimeout(function() + { + self.env.toolbar.removeClass('julia-toolbar-visible'); + }, 1750); + }) + .on('mouseover mousemove mouseout', '#julia-toolbar-'+self.env.apiId+'.julia-toolbar-visible', function(e) + { + e.preventDefault(); + self.env.toolbar.addClass('julia-toolbar-visible'); + clearTimeout(mouseMoveCleaner); + + if(e.type == 'mouseout') + { + mouseMoveCleaner = setTimeout(function(e) + { + self.env.toolbar.removeClass('julia-toolbar-visible'); + }, 1750); + } + }); + + // Bind progressbar change + self.env.toolbar.on('change input', '.julia-progress>input', function(e) + { + if(e.type == 'input') + { + self.env.seeking = true; + }else{ + + seekTo = _timecode.toSeconds( $(this).val() ); + seekTo = seekTo >= self.env.duration ? self.env.duration: seekTo.toFixed(2); + + _control.press('goto', { + currentTime: seekTo + }); + + self.env.seeking = false; + } + }); + + // Bind volumebar change + self.env.toolbar.on('change', '.julia-volume>input', function() + { + _control.press('volume', { + volume: $(this).val(), + 'event': 'slideChange' + }); + }); + + // Fullscreen event included + $(window).on('resize', function() + { + _support.resize(); + }); + + // Fullscreen change event handler + $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', function(e) + { + if(!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) + { + $('.julia-player') + .removeClass('julia-fullscreen-on') + .addClass('julia-fullscreen-off') + .find('button.julia-fullscreen-toggle') + .removeClass('off') + .addClass('on') + .find('i') + .removeClass('julia-fullscreen-exit') + .addClass('julia-fullscreen'); + + // Turn off landscape on mobile + if(_support.isMobile()) + { + screen.orientation.unlock(); + screen.msLockOrientation.unlock(); + screen.mozLockOrientation.unlock(); + } + + _debug({ + 'fullscreen off' : '#julia-player-'+self.env.apiId + }); + + _support.resize(); + + }else{ + + $('.julia-player') + .removeClass('julia-fullscreen-off') + .addClass('julia-fullscreen-on') + .find('button.julia-fullscreen-toggle') + .removeClass('on').addClass('off') + .find('i') + .removeClass('julia-fullscreen') + .addClass('julia-fullscreen-exit'); + + // Force landscape in fullscreen mode on mobile + if(_support.isMobile()) + { + screen.orientation.lock('landscape-primary'); + screen.msLockOrientation.lock('landscape-primary'); + screen.mozLockOrientation.lock('landscape-primary'); + } + + _debug({ + 'fullscreen on' : '#julia-player-'+self.env.apiId + }); + } + }); + }, + + + // Native video api + nativeEvents: function() + { + if(_support.forceReady()===true && self.env.isHls === true) + { + _events.canplaythrough(); + }else{ + self.env.api.oncanplaythrough = function(e) + { + self.env.duration = self.env.api.duration; + + if(self.env.started === false && self.env.api.readyState >= 3) + { + _events.playAllowStart(e); + } + } + } + + // Video playback detect + self.env.api.onplay = function(e) + { + self.env.toolbar + .find('.julia-playback.play') + .removeClass('play') + .addClass('pause') + .find('i') + .removeClass('julia-play') + .addClass('julia-pause'); + self.env.shield.find('.julia-big-play').hide(); + self.env.shield.find('.julia-preloader').removeClass('on'); + _ui.posterUnset(); + self.env.toolbar.show(); + } + + self.env.api.onplaying = function(e) + { + self.env.toolbar + .find('.julia-playback.play') + .removeClass('play') + .addClass('pause') + .find('i') + .removeClass('julia-play') + .addClass('julia-pause'); + self.env.shield.find('.julia-big-play').hide(); + self.env.shield.find('.julia-preloader').removeClass('on'); + self.env.suggest.html('').removeClass('on'); + self.env.toolbar.show(); + _control.press('setDuration', { + 'duration': _timecode.toHuman( self.env.duration ) + }); + self.env.started = true; + } + + + // Video pause + self.env.api.onpause = function(e) + { + self.env.toolbar + .find('.julia-playback.pause') + .removeClass('pause') + .addClass('play') + .find('i') + .removeClass('julia-pause') + .addClass('julia-play'); + self.env.shield.find('.julia-big-play').show(); + } + + + // Errors + self.env.api.onerror = function(e) + { + // Bring to life again + if(self.env.tries<11) + { + _boot.init(); + } + } + + self.env.api.onemptied = function(e) + { + } + + self.env.api.onstalled = function(e) + { + } + + self.env.api.onsuspend = function(e) + { + } + + // Video position + self.env.api.ontimeupdate = function(e) + { + if(self.env.seeking === false) + { + currentTimeReadable = _timecode.toHuman( self.env.api.currentTime.toFixed(2) ); + self.env.toolbar.find('.julia-progress>input').val( _timecode.toPercents( self.env.api.currentTime.toFixed(2) ) ).rangeslider('update', true); + self.env.toolbar.find('.julia-panel.julia-currentTime>span').text(currentTimeReadable); + } + + _events.onTime(currentTimeReadable, self.env.api.currentTime); + + if(self.options.debugPlayback === true) + { + _debug({ + 'duration/current': self.env.duration+'/'+self.env.api.currentTime.toFixed(2)+' > '+currentTimeReadable + }); + } + + /* + // Fix for corrupted video end + // For development purposes only + if(api.currentTime>=(duration-1)) + { + if(_support.forceReady()===true) + { + _suggest.run(); + } + } + */ + } + + // Video position + self.env.api.seeked = function(e) + { + self.env.seeking = false; + } + + // Video position + self.env.api.seeking = function(e) + { + self.env.seeking = true; + } + + // Volume + self.env.api.onvolumechange = function(e) + { + if(self.env.api.muted === false) + { + self.env.toolbar.find('.julia-volume>input').val(self.env.api.volume*100).rangeslider('update', true); + }else{ + self.env.toolbar.find('.julia-volume>input').val(0).rangeslider('update', true); + } + } + + // Set video duration + self.env.api.ondurationchange = function(e) + { + self.env.duration = self.env.api.duration; + + if(self.env.started === false) + { + self.env.duration = self.env.api.duration; + self.env.seeking = false; + + _debug({ + 'duration': self.env.duration, + 'readyState': self.env.api.readyState, + 'started': self.env.started + }); + } + } + + // Bind playback end event + self.env.api.onended = function(e) + { + _suggest.run(); + }; + }, + + + // Specific events, error handlers + hlsLibEvents: function() + { + self.env.hls.on(Hls.Events.ERROR, function(event, data) + { + switch(data.details) + { + case Hls.ErrorDetails.MANIFEST_LOAD_ERROR: + case Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT: + case Hls.ErrorDetails.MANIFEST_PARSING_ERROR: + case Hls.ErrorDetails.LEVEL_LOAD_ERROR: + case Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT: + case Hls.ErrorDetails.LEVEL_SWITCH_ERROR: + case Hls.ErrorDetails.FRAG_LOAD_ERROR: + case Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR: + case Hls.ErrorDetails.FRAG_LOAD_TIMEOUT: + case Hls.ErrorDetails.FRAG_DECRYPT_ERROR: + case Hls.ErrorDetails.FRAG_PARSING_ERROR: + case Hls.ErrorDetails.BUFFER_APPEND_ERROR: + case Hls.ErrorDetails.BUFFER_APPENDING_ERROR: + + _debug({ + recoveringError: data.details, + errorType: data.type, + errorFatal: data.fatal, + data: data, + tries: self.env.tries + }); + + if(data.fatal === true && self.env.tries<11) + { + // Bring to life again + _boot.load(); + } + + break; default: + } + }); + }, + + + // Time update event callbacks + onTime: function(time, timeNum) + { + if( (time in self.options.onTime) && self.env.onTimeRised.indexOf(time) == -1 ) + { + handle = self.options.onTime[time]; + self.env.onTimeRised.push(time); + + if(typeof window[handle] === 'function') + { + window[handle](time, self.env.publicApi); + _debug({ + 'onTime': handle+' raised' + }); + + }else{ + + _debug({ + 'onTimeError': handle+' is not a function, but: '+(typeof handle) + }); + } + } + } + }; + + + + + + + + + + + + + + + + + // Create player + var _boot = { + + create: function() + { + self.env.element = self.options.element; + + // Degbug header + if(self.options.debug === true && window.console ) + { + console.info('=== Julia console debug start for '+self.env.apiId+' ==='); + } + + _debug(self.options); + + // Suggest init + for(i in self.options.suggest) + { + self.options.suggest[i].played = false; + } + + // Set theme CSS + _support.theme(); + + // User data + volume = _client.get('volume'); + muted = _client.get('muted'); + + if(volume.length>0) + { + self.options.volume = parseInt(volume); + } + + if(muted.length>0) + { + self.options.muted = muted == 'false' ? false: true; + } + + // Create UI + _ui.player(); + }, + + // Select playback url + selectSource: function() + { + self.env.element.prop('preload', 'none'); + protoSource = self.env.element.prop('src') ? self.env.element.prop('src'): self.env.element.find('source').prop('src'); + self.env.source = self.options.source && self.options.source.length>0 ? self.options.source: protoSource; + + self.env.isHls = self.env.source.indexOf('m3u8') == -1 ? false: true; + if(self.options.forceHls === true) + { + self.env.isHls = true; + } + + _debug({ + 'sourceType': (self.env.isHls === false ? 'file': 'hls') + }); + + self.env.poster = self.options.poster && self.options.poster.length>0 ? self.options.poster: self.env.element.prop('poster'); + _ui.posterSet(); + }, + + + // load media + load: function() + { + self.env.shield.find('.julia-preloader').addClass('on'); + + // ************************ + // HLS library supported + // and HLS requested + // ************************ + if(self.env.useHlsLib === true) + { + _events.hlsLibEvents(); + self.env.hls.autoLevelCapping = -1; + self.env.hls.attachMedia(self.env.api); + self.env.hls.loadSource(self.env.source); + + // API READY + self.env.hls.on(Hls.Events.MEDIA_ATTACHED, function(event, data) + { + + // DETECT LEVEL DATA + self.env.hls.on(Hls.Events.LEVEL_LOADED, function(event, data) + { + // SET LIVE EVENT STATE + if(data.details.live === true || self.options.live === true) + { + self.env.isLive = true; + self.env.toolbar.addClass('live'); + }else{ + self.env.toolbar.removeClass('live'); + } + }); + + for(x in self.options.triggerHls) + { + handle = self.options.triggerHls[x]; + + if(typeof window[handle] === 'function') + { + self.env.hls.on(Hls.Events[x], function(event, data) + { + window[handle](self.env.apiId, event, data); + }); + + }else{ + + _debug({ + 'triggerHlsError': handle+' is not a function' + }); + } + } + + }); + + // ************************ + // Classic VOD file + // ************************ + }else{ + + self.env.api.load(); + } + + // ************************ + // Bind all events + // ************************ + if(self.env.apiOk === true) + { + _events.DOM(); + // Classic html5 api + _events.nativeEvents(); + } + + stats = { + 'isHls': self.env.isHls, + 'useHlsLib': self.env.useHlsLib, + 'live': self.env.isLive, + 'canPlayMediaString': self.env.canPlayMediaString, + 'canPlayMedia': self.env.canPlayMedia, + }; + + _debug(stats); + + // Define publicApi + self.env.publicApi = { + control: _control, + options: self.options, + support: _support, + dimensions: self.env.dimensions, + timecode: _timecode, + shield: self.env.shield, + toolbar: self.env.toolbar, + media: self.env.api, + id: self.env.apiId, + stats: stats + }; + }, + + // Initilize player + init: function() + { + // Create source + _boot.selectSource(); + self.env.useHlsLib = false; + self.env.isLive = false; + self.env.canPlayMedia = _support.canPlayMedia(); + self.env.tries+=1; + + if(self.env.isHls === true) + { + self.env.useHlsLib = self.env.canPlayMedia === false && Hls.isSupported() ? true: false; + } + + // ************************ + // HLS library supported + // and HLS requested + // ************************ + if(self.env.useHlsLib === true) + { + _api.create(); + self.env.hls = new Hls(self.options.hlsConfig); + + // ************************ + // Classic VOD file + // ************************ + }else{ + + _api.create(); + self.env.api.src = self.env.source; + } + + if(self.options.live === true) + { + self.env.isLive = true; + self.env.toolbar.addClass('live'); + }else{ + self.env.toolbar.removeClass('live'); + } + } + }; + + + + + + + + // Build player object + _boot.create(); + + // Bring to life + _boot.init(); + + // Bring api + _boot.load(); + + // Player dimensions + _support.resize(); + + // Populate public API + return self.env.publicApi; +}; diff --git a/src/js/julia-jquery-plugin.js b/src/js/julia-jquery-plugin.js new file mode 100644 index 0000000..6e446ec --- /dev/null +++ b/src/js/julia-jquery-plugin.js @@ -0,0 +1,81 @@ +// Build jQuery plugin +$.fn.julia = function(options) +{ + return this.each(function() + { + // Return if this element already has a plugin instance + if($(this).data('julia')) + { + return; + } + + options = typeof options === 'undefined' ? {}: options; + options.element = $(this); + + // Pass options to constructor + var julia = new Julia(options); + + // Store plugin object in element's data + $(this).data('julia', julia); + }); +}; + +// API wrappers +$.fn.play = function() +{ + $(this).data('julia').control.press('play'); +}; + +$.fn.destroy = function() +{ + $(this).data('julia').control.press('destroy'); +}; + +$.fn.media = function() +{ + return $(this).data('julia').media; +}; + +$.fn.pause = function() +{ + $(this).data('julia').control.press('pause'); +}; + +$.fn.stop = function() +{ + $(this).data('julia').control.press('stop'); +}; + +$.fn.goto = function(t) +{ + $(this).data('julia').control.press('goto', { + currentTime: t + }); +}; + +$.fn.mute = function() +{ + if($(this).data('julia').media.muted === false) + { + $(this).data('julia').control.press('sound-off'); + }else{ + $(this).data('julia').control.press('sound-on'); + } +}; + +$.fn.volume = function(volume) +{ + $(this).data('julia').control.press('volume', { + volume: volume + }); +}; + +$.fn.getID = function() +{ + return $(this).data('julia').id; +}; + +$.fn.stats = function() +{ + return $(this).data('julia').stats; +}; diff --git a/src/js/julia-player.js b/src/js/julia-player.js deleted file mode 100644 index 5d7429c..0000000 --- a/src/js/julia-player.js +++ /dev/null @@ -1,2217 +0,0 @@ -/* *********************************** -* Julia player -* -* @author prochor666@gmail.com -* version: 0.9.10 -* build: 2016-04-21 -* licensed under the MIT License -* -* @requires: -* hls.js [required] -* jquery [required] -* ionicons [required] -* rangeslider.js [required] -* -************************************* */ - -// Support libs -if(!window.jQuery) -{ - alert('jQuery is required'); - window.stop(); -} - -(function($) -{ - // Root path workaround - var __JULIA_ROOT_PATH__ = 'julia'; - dir = document.querySelector('script[src*="julia-player"]').getAttribute('src'); - name = dir.split('/').pop(); - __JULIA_ROOT_PATH__ = dir.replace('/js/'+name,""); - $('head').append(''); - - // Support libs - try { - h = new Hls; - - }catch(err) - { - /*! hls.js 0.5.22, handle error or insert source */ - - } - - try { - $.rangeslider(); - }catch(err) - { - /*! rangeslider.js - v2.1.1, handle error or insert source */ - - } - - // Julia main class - _julia = function(el, opts) - { - // Custom options - var options = typeof opts === 'undefined' ? {}: opts; - var _element = typeof el === 'undefined' ? $('video'): el; - - // Default options - var _options = { - source: false, - autoplay: false, - volume: 25, - muted: false, - width: 512, - height: 288, - debug: false, - debugPlayback: false, - forceHls: false, - live: false, - responsive: true, - dimensions: [ - [1920, 1080], - [1280,720], - [960,540], - [640,360], - [512,288] - ], - pauseOnClick: false, - poster: '', - hlsConfig: { - debug : false, - autoStartLoad : true, - maxBufferLength : 60, - maxBufferSize : 120*1000*1000, - liveSyncDurationCount : 5, // D: 3 - liveMaxLatencyDurationCount: 20, - enableWorker : true, - fragLoadingTimeOut : 5000, - fragLoadingMaxRetry : 6, - fragLoadingRetryDelay : 100, - manifestLoadingTimeOut : 10000, - manifestLoadingMaxRetry : 6, - manifestLoadingRetryDelay : 500, - fpsDroppedMonitoringPeriod : 5000, - fpsDroppedMonitoringThreshold : 0.2, - appendErrorMaxRetry : 200, - }, - suggest: [], - suggestLimit: 2, - suggestTimeout: 10000, - swf: __JULIA_ROOT_PATH__+'/swf/flashlsChromeless.swf', - themePath: __JULIA_ROOT_PATH__+'/css/themes', - pluginPath: __JULIA_ROOT_PATH__+'/js/plugins', - theme: 'default', - i18n: { - liveText: 'Live' - }, - onTime: {}, - triggerHls: {}, - onPlay: false, - onPause: false, - onStop: false, - onPosition: false, - onSuggest: false, - }; - - - // UI & behavior globals - var _env = { - shield: '', - element: _element, - suggest: '', - toolbar: '', - poster: '', - api: '', - apiId: Math.floor((Math.random()*10000000)+1), // Create a shadow api unique ID - player: '', - isLive: false, - hls: {}, - canPlayMedia: '', - canPlayMediaString: '', - isHls: false, - useHlsLib: false, - tries: 0, - source: '', - flashApi: false, - duration: 0, - apiOk: false, - onTimeRised: [], - seeking: false, - dimensions: { - width: 0, - height: 0, - }, - flashCallbackName: '', - started: false, - publicApi: {}, - suggestPointer: 0, - suggestClicked: false, - progressStep: 0.01, // Full sense: 100, so .01 is enough accurate - } - - // Extend options - var _system = { - - extend: function() - { - for(o in _options) - { - if(options.hasOwnProperty(o)) - { - _options[o] = options[o]; - } - } - - options = _options; - } - }; - - // Console debug - var _debug = { - - run: function(data) - { - if(options.debug === true) - { - if(window.console) - { - for(d in data) - { - console.log(' - [instance: '+_env.apiId+'] '+d+' ['+(typeof data[d])+']', data[d]); - } - } - } - } - }; - - // Persistent user data in cookies - var _persist = { - - set: function(name, value, days) - { - dateObj = new Date(); - dateObj.setTime(dateObj.getTime() + (days*24*60*60*1000)); - var expires = 'expires=' + dateObj.toUTCString(); - document.cookie = name + '=' + value + '; ' + expires + '; path=/'; - }, - - get: function(name) - { - var name = name + '='; - var ca = document.cookie.split(';'); - - for(var i=0; i'); - _env.player.prepend(apiElement); - _env.api = document.getElementById('julia-api-'+_env.apiId); - _env.api.controls = false; - _env.apiOk = true; - - }else{ - - var flash = _flash.detect(); - var flashOk = flash.installed; - - if( (flash.major==11 && flash.minor>=2) || flash.major>11 ) - { - _debug.run({ - 'apiType': 'flashls', - }); - - _env.apiOk = true; - _env.flashCallbackName = 'flashlsCallback'+_env.apiId; - - apiElement = $('' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +'' - +''); - - _env.player.prepend(apiElement); - - flashlsAPI = function(flashObject) - { - this.constructor = function(flashObject) - { - this.flashObject = flashObject; - } - - this.constructor(flashObject); - - this.load = function(url) - { - this.flashObject.playerLoad(url); - } - - this.play = function(offset) - { - started = true; - this.flashObject.playerPlay(offset); - } - - this.pause = function() - { - this.flashObject.playerPause(); - } - - this.resume = function() { - this.flashObject.playerResume(); - } - - this.seek = function(offset) { - this.flashObject.playerSeek(offset); - } - - this.stop = function() { - this.flashObject.playerStop(); - } - - this.volume = function(volume) { - this.flashObject.playerVolume(volume); - } - - this.setCurrentLevel = function(level) { - this.flashObject.playerSetCurrentLevel(level); - } - - this.setNextLevel = function(level) { - this.flashObject.playerSetNextLevel(level); - } - - this.setLoadLevel = function(level) { - this.flashObject.playerSetLoadLevel(level); - } - - this.setMaxBufferLength = function(len) { - this.flashObject.playerSetmaxBufferLength(len); - } - - this.getPosition = function() { - return this.flashObject.getPosition(); - } - - this.getDuration = function() { - return this.flashObject.getDuration(); - } - - this.getbufferLength = function() { - return this.flashObject.getbufferLength(); - } - - this.getbackBufferLength = function() { - return this.flashObject.getbackBufferLength(); - } - - this.getLowBufferLength = function() { - return this.flashObject.getlowBufferLength(); - } - - this.getMinBufferLength = function() { - return this.flashObject.getminBufferLength(); - } - - this.getMaxBufferLength = function() { - return this.flashObject.getmaxBufferLength(); - } - - this.getLevels = function() { - return this.flashObject.getLevels(); - } - - this.getAutoLevel = function() { - return this.flashObject.getAutoLevel(); - } - - this.getCurrentLevel = function() { - return this.flashObject.getCurrentLevel(); - } - - this.getNextLevel = function() { - return this.flashObject.getNextLevel(); - } - - this.getLoadLevel = function() { - return this.flashObject.getLoadLevel(); - } - - this.getAudioTrackList = function() { - return this.flashObject.getAudioTrackList(); - } - - this.getStats = function() { - return this.flashObject.getStats(); - } - - this.setAudioTrack = function(trackId) { - this.flashObject.playerSetAudioTrack(trackId); - } - - this.playerSetLogDebug = function(state) { - this.flashObject.playerSetLogDebug(state); - } - - this.getLogDebug = function() { - return this.flashObject.getLogDebug(); - } - - this.playerSetLogDebug2 = function(state) { - this.flashObject.playerSetLogDebug2(state); - } - - this.getLogDebug2 = function() { - return this.flashObject.getLogDebug2(); - } - - this.playerSetUseHardwareVideoDecoder = function(state) { - this.flashObject.playerSetUseHardwareVideoDecoder(state); - } - - this.getUseHardwareVideoDecoder = function() { - return this.flashObject.getUseHardwareVideoDecoder(); - } - - this.playerSetflushLiveURLCache = function(state) { - this.flashObject.playerSetflushLiveURLCache(state); - } - - this.getflushLiveURLCache = function() { - return this.flashObject.getflushLiveURLCache(); - } - - this.playerSetJSURLStream = function(state) { - this.flashObject.playerSetJSURLStream(state); - } - - this.getJSURLStream = function() { - return this.flashObject.getJSURLStream(); - } - - this.playerCapLeveltoStage = function(state) { - this.flashObject.playerCapLeveltoStage(state); - } - - this.getCapLeveltoStage = function() { - return this.flashObject.getCapLeveltoStage(); - } - - this.playerSetAutoLevelCapping = function(level) { - this.flashObject.playerSetAutoLevelCapping(level); - } - - this.getAutoLevelCapping = function() { - return this.flashObject.getAutoLevelCapping(); - } - }; - - getFlashMovieObject = function(movieName) - { - if (window.document[movieName]) - { - return window.document[movieName]; - } - if (navigator.appName.indexOf("Microsoft Internet")==-1) - { - if (document.embeds && document.embeds[movieName]) - { - return document.embeds[movieName]; - }else // if (navigator.appName.indexOf("Microsoft Internet")!=-1) - { - return document.getElementById(movieName); - } - } - } - - _env.api = new flashlsAPI(getFlashMovieObject('julia-api-'+_env.apiId)); - - }else{ - - _env.api = {}; - _env.shield.find('.julia-preloader').html('
Adobe Flash Player is required
'); - _env.api.flashObject = $('
'); - _env.player.prepend(_env.api.flashObject); - } - } - - _debug.run({ - 'apiId': _env.apiId, - 'api': _env.api, - }); - } - }; - - - var _flash = { - - detect: function() - { - var self = this; - self.installed = false; - self.raw = ""; - self.major = -1; - self.minor = -1; - self.revision = -1; - self.revisionStr = ""; - var activeXDetectRules = [ - { - "name":"ShockwaveFlash.ShockwaveFlash.7", - "version":function(obj){ - return getActiveXVersion(obj); - } - }, - { - "name":"ShockwaveFlash.ShockwaveFlash.6", - "version":function(obj){ - var version = "6,0,21"; - try{ - obj.AllowScriptAccess = "always"; - version = getActiveXVersion(obj); - }catch(err){} - return version; - } - }, - { - "name":"ShockwaveFlash.ShockwaveFlash", - "version":function(obj){ - return getActiveXVersion(obj); - } - } - ]; - - /** - * Extract the ActiveX version of the plugin. - * - * @param {Object} The flash ActiveX object. - * @type String - */ - var getActiveXVersion = function(activeXObj) - { - var version = -1; - try - { - version = activeXObj.GetVariable("$version"); - }catch(err) - {} - return version; - }; - - /** - * Try and retrieve an ActiveX object having a specified name. - * - * @param {String} name The ActiveX object name lookup. - * @return One of ActiveX object or a simple object having an attribute of activeXError with a value of true. - * @type Object - */ - var getActiveXObject = function(name) - { - var obj = -1; - try - { - obj = new ActiveXObject(name); - }catch(err) - { - obj = {activeXError:true}; - } - return obj; - }; - - /** - * Parse an ActiveX $version string into an object. - * - * @param {String} str The ActiveX Object GetVariable($version) return value. - * @return An object having raw, major, minor, revision and revisionStr attributes. - * @type Object - */ - var parseActiveXVersion = function(str) - { - var versionArray = str.split(",");//replace with regex - return { - "raw":str, - "major":parseInt(versionArray[0].split(" ")[1], 10), - "minor":parseInt(versionArray[1], 10), - "revision":parseInt(versionArray[2], 10), - "revisionStr":versionArray[2] - }; - }; - - /** - * Parse a standard enabledPlugin.description into an object. - * - * @param {String} str The enabledPlugin.description value. - * @return An object having raw, major, minor, revision and revisionStr attributes. - * @type Object - */ - var parseStandardVersion = function(str) - { - var descParts = str.split(/ +/); - var majorMinor = descParts[2].split(/\./); - var revisionStr = descParts[3]; - return { - "raw":str, - "major":parseInt(majorMinor[0], 10), - "minor":parseInt(majorMinor[1], 10), - "revisionStr":revisionStr, - "revision":parseRevisionStrToInt(revisionStr) - }; - }; - - /** - * Parse the plugin revision string into an integer. - * - * @param {String} The revision in string format. - * @type Number - */ - var parseRevisionStrToInt = function(str) - { - return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision; - }; - - /** - * Constructor, sets raw, major, minor, revisionStr, revision and installed public properties. - */ - if(navigator.plugins && navigator.plugins.length>0) - { - var type = 'application/x-shockwave-flash'; - var mimeTypes = navigator.mimeTypes; - if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description) - { - var version = mimeTypes[type].enabledPlugin.description; - var versionObj = parseStandardVersion(version); - self.raw = versionObj.raw; - self.major = versionObj.major; - self.minor = versionObj.minor; - self.revisionStr = versionObj.revisionStr; - self.revision = versionObj.revision; - self.installed = true; - } - }else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript) - { - var version = -1; - for(var i=0; i' - +' ' - +'
' - +'
' - ); - - _env.suggest = $('
'); - }, - - posterSet: function() - { - _ui.posterUnset(); - if(_env.poster.length > 0) - { - img = $('') - - _env.shield.append(img); - - _debug.run({ - poster: _env.poster, - }) - } - }, - - posterUnset: function() - { - _env.shield.find('img').remove(); - }, - - // Button toolbar - toolbar: function() - { - _env.toolbar = $('
' - +'
' - +' ' - +'
' - +'
' - +' '+options.i18n.liveText+'' - +'
' - +'
' - +' 00:00:00 / ' - +'
' - +'
' - +' 00:00:00' - +'
' - +'' - +'' - +'
' - +' ' - +'
' - +'' - +'
'); - }, - - // Create player object - player: function() - { - _ui.shield(); - _ui.toolbar(); - - _env.player = $('
' - +'
'); - - _env.player.append(_env.shield); - _env.player.append(_env.suggest); - _env.player.append(_env.toolbar); - - _env.element.hide(); - _env.player.insertAfter(_env.element); - - // Simulate preload - _env.shield.find('.julia-big-play').hide(); - _env.toolbar.hide(); - - // Rangeslider polyfill - $('#julia-toolbar-'+_env.apiId+'>div.julia-progress>input, #julia-toolbar-'+_env.apiId+'>div.julia-volume>input').rangeslider({ - polyfill: false, - rangeClass: 'julia-rangeslider', - disabledClass: 'julia-rangeslider--disabled', - horizontalClass: 'julia-rangeslider--horizontal', - verticalClass: 'julia-rangeslider--vertical', - fillClass: 'julia-rangeslider__fill', - handleClass: 'julia-rangeslider__handle', - onInit: function(){}, - onSlide : function(position, value){}, - onSlideEnd : function(position, value){} - }); - - _debug.run({ - 'element': _env.element, - 'toolbar': _env.toolbar, - 'shield': _env.shield, - 'player': _env.player, - }); - } - }; - - // Fullscreen on - var _fullscreen = { - - on: function() - { - var videoFrame = document.querySelector('#julia-player-'+_env.apiId); - - if(videoFrame.requestFullscreen) - { - videoFrame.requestFullscreen(); - } else if (videoFrame.msRequestFullscreen) - { - videoFrame.msRequestFullscreen(); - } else if (videoFrame.mozRequestFullScreen) - { - videoFrame.mozRequestFullScreen(); - } else if(videoFrame.webkitRequestFullscreen) - { - videoFrame.webkitRequestFullscreen(); - } - }, - - // Fullscreen off - off: function() - { - if(document.exitFullscreen) - { - document.exitFullscreen(); - }else if(document.msExitFullscreen) - { - document.msExitFullscreen(); - } else if(document.mozCancelFullScreen) - { - document.mozCancelFullScreen(); - } else if(document.webkitExitFullscreen) - { - document.webkitExitFullscreen(); - } - } - }; - - // Timeline numbers coonversion - var _timeline = { - - toPercents: function(currentTime) - { - p = (currentTime/_env.duration)*100; - return p; - }, - - toSeconds: function(percent) - { - t = (_env.duration/100)*percent; - return t; - }, - - toNum: function(human) - { - human = human.split(':'); - human.reverse(); - s = parseInt(human[0]); - m = human.length>1 ? parseInt(human[1]): 0; - h = human.length>2 ? parseInt(human[3]): 0; - t = s + m*60 + h*60*60; - return t; - }, - - toHuman: function(time) - { - time = time.toString().split('.'); - s = time[0]; - H = Math.floor(s/3600); - M = Math.floor( ( s - (H*3600) ) / 60 ); - S = Math.floor( ( s - (H*3600) - (M*60) ) ); - - H = ('0'+H.toString()).slice(-2); - M = ('0'+M.toString()).slice(-2); - S = ('0'+S.toString()).slice(-2); - - str = H>0 ? H+':'+M+':'+S: M+':'+S; - - return str; - } - }; - - - // Suggest engine - var _suggest = { - - run: function() - { - _env.suggest.html(''); - _control.press('stop'); - _env.suggestClicked = false; - _env.tries = 0; - - if(options.suggest.length > 0) - { - x = 0; - for(var i in options.suggest) - { - if(x < options.suggestLimit && options.suggest[i].played === false) - { - mode = !!options.suggest[i].live && options.suggest[i].live === true ? 'live': 'vod'; - liveText = !!options.suggest[i].liveText ? options.suggest[i].liveText: 'Live'; - var poster = !!options.suggest[i].poster ? options.suggest[i].poster: ''; - posterImage = poster.length>0 ? '': ''; - suggestItemWidget = $('
' - + posterImage - +'
'+options.suggest[i].title+'
' - +'
'); - - suggestItemWidget.on('click', function(e) - { - - if(options.onSuggest !== false) - { - _call.fn(options.onSuggest, options.suggest[i]); - } - - - if(_env.flashApi===false) - { - options.muted = _env.api.muted; - }else{ - - } - - options.poster = $(this).data('poster'); - _env.suggestClicked = true; - _env.shield.find('.julia-big-play').hide(); - _env.started = false; - options.source = $(this).data('file'); - _boot.selectSource(); - options.autoplay = true; - options.live = $(this).data('mode') == 'live' ? true: false; - options.i18n.liveText = $(this).data('live-text'); - - _env.toolbar.find('.julia-live-indicator>span').text(options.i18n.liveText); - - _debug.run({ - suggestRemoveIndex: $(this).data('index'), - suggestRemove: $(this).data('file') - }); - - options.suggest[$(this).data('index')].played = true; - _env.suggest.removeClass('on'); - - _boot.init(); - _boot.load(); - _support.resize(); - }); - - _env.suggest.append(suggestItemWidget); - x++; - } - } - - if(x > 0) - { - if(options.suggestTimeout > 0 && _support.isMobile() === false) - { - setTimeout( function() - { - if(_env.suggestClicked === false) - { - _env.suggest.find('div.julia-suggest-item:first').click(); - } - }, options.suggestTimeout); - } - _env.suggest.addClass('on'); - } - - }else{ - _fullscreen.off(); - } - - _debug.run({ - 'Suggest' : 'raised' - }); - } - }; - - // Support - var _support = { - - aspect: function(w,h) - { - return w>0 && h>0 ? h/w: 0; - }, - - isMobile: function() - { - if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) - { - return true; - } - - return false; - }, - - forceReady: function() - { - if( /Firefox/i.test(navigator.userAgent) ) - { - return true; - } - - return false; - }, - - theme: function() - { - _debug.run({ - 'theme': options.themePath+'/'+options.theme+'/julia.css' - }); - - $('head').append(''); - }, - - canPlayMedia: function() - { - var vid = document.createElement('video'); - vid.id = 'video-cap-test-'+_env.apiId; - _env.canPlayMediaString = vid.canPlayType('application/vnd.apple.mpegURL'); - $('#video-cap-test'+_env.apiId).remove(); - return (_env.canPlayMediaString == 'probably' || _env.canPlayMediaString == 'maybe'); - }, - - resize: function() - { - // Player dimensions - defaultDim = _env.element.width() ? [_env.element.width(), _env.element.height()]: [options.width, options.height]; - dimensions = options.responsive === true ? _support.getSize(): defaultDim; - - _debug.run({ - 'resizeDefaults': defaultDim, - 'resize': dimensions - }); - - _env.player.width(dimensions[0]); - _env.player.height(dimensions[1]); - - _env.dimensions.width = dimensions[0]; - _env.dimensions.height = dimensions[1]; - - if(_env.flashApi===false) - { - _env.api.setAttribute('width', '100%'); - _env.api.setAttribute('height', '100%'); - }else{ - - if(_env.apiOk === true) - { - _env.api.flashObject.width = '100%'; - _env.api.flashObject.height = '100%'; - }else{ - _env.api.flashObject.width('100%'); - _env.api.flashObject.height('100%'); - } - } - }, - - getSize: function() - { - // Fix video wrapped in inline block, can not get size properlym if inline element detected - var parentBlock = _env.element.parent().css('display').toLowerCase(); - if(parentBlock == 'inline') - { - _env.element.parent().css({'display': 'block'}); - } - - var parentWidth = _env.element.parent().width(); - for(i in options.dimensions) - { - var dim = options.dimensions[i]; - if(parentWidth>=dim[0]) - { - if(_env.flashApi===false) - { - a = _support.aspect(parentWidth) == 0 ? dim[1]/dim[0]: _support.aspect(_env.api.videoWidth, _env.api.videoHeight); - }else{ - a = _support.aspect(parentWidth) == 0 ? dim[1]/dim[0]: _support.aspect(_env.api.width(), _env.api.height()); - } - - dimensions = [dim[0],(dim[0]*a)]; - _debug.run({ - 'resizePredefined': dimensions - }); - return dimensions; - } - } - - a = _support.aspect() == 0 ? dim[1]/dim[0]: _support.aspect(_env.api.videoWidth, _env.api.videoHeight); - dimensions = [parentWidth, (parentWidth*a)]; - - _debug.run({ - 'resizeFallback': dimensions - }); - - return dimensions; - } - }; - - - // Callback - var _call = { - - fn: function(f, data) - { - data = data||{}; - if(f !== false) - { - f(_options, _env, data); - } - } - }; - - // Api && UI control - var _control = { - - press: function(action, data) - { - data = data||{}; - - if(data.length>0) - { - _debug.run({ - 'action': action, - 'action-data': data, - }); - - }else{ - - _debug.run({ - 'action': action, - }); - } - - switch(action) - { - case 'play': - - if(options.onPlay !== false) - { - _call.fn(options.onPlay, data); - } - - if(_env.flashApi === false) - { - _env.api.play(); - - }else{ - - _env.shield.find('.julia-big-play').hide(); - - if(_env.started === false) - { - _env.api.play(-1); - - _debug.run({ - 'FlashPlay': 'play', - 'FlashPosition': _env.api.getPosition() - }); - - }else{ - - _env.api.resume(); //(api.getPosition()); - - _debug.run({ - 'FlashPlay': 'resume', - 'FlashPosition': _env.api.getPosition() - }); - } - } - - break; case 'pause': - - if(options.onPause !== false) - { - _call.fn(options.onPause, data); - } - - if(_env.flashApi === false) - { - _env.api.pause(); - - }else{ - - _env.api.pause(); - _env.toolbar.find('.julia-playback.pause').removeClass('pause').addClass('play') - .find('i').removeClass('ion-pause').addClass('ion-play'); - _env.shield.find('.julia-big-play').show(); - } - - break; case 'stop': - - if(options.onStop !== false) - { - _call.fn(options.onStop, data); - } - - if(_env.flashApi === false) - { - _env.api.pause(); - _env.api.currentTime = 0; - - }else{ - - _env.started = false; - _env.api.stop(); - } - - _env.toolbar.find('.julia-playback.pause').removeClass('pause').addClass('play') - .find('i').removeClass('ion-pause').addClass('ion-play'); - _env.shield.find('.julia-big-play').show(); - _env.toolbar.find('.julia-progress>input').val(0).rangeslider('update', true); - - break; case 'goto': - - if(options.onPosition !== false) - { - _call.fn(options.onPosition, data); - } - - if(_env.flashApi === false) - { - _env.api.currentTime = data.currentTime; - - }else{ - - _env.api.seek(data.currentTime); - } - - break; case 'setDuration': - - _env.toolbar.find('.julia-panel.julia-duration>span').text(data.duration); - - if(_env.started === false) - { - _env.toolbar.find('.julia-progress>input').val(0).rangeslider('update', true); - } - - _debug.run({ - 'setDuration': data.duration - }); - - break; case 'volume': - - if(_env.flashApi === false) - { - options.volume = data.volume; - _env.api.volume = data.volume/100; - - _debug.run({ - 'volume is': _env.api.volume - }); - - }else{ - - options.volume = data.volume; - _env.api.volume(options.volume); - - _debug.run({ - 'volume is': options.volume - }); - } - - _env.toolbar.find('.julia-volume>input').val(data.volume).rangeslider('update', true); - - if(data.volume>0) - { - _control.press('sound-on'); - - }else{ - _control.press('sound-off'); - } - - break; case 'sound-on': - - if(_env.flashApi === false) - { - _env.api.muted = false; - - }else{ - - _env.api.volume(options.volume); - _env.toolbar.find('.julia-volume>input').val(options.volume).rangeslider('update', true); - } - - options.muted = false; - _persist.set('volume', options.volume, 30); - _persist.set('muted', options.muted, 30); - - _env.toolbar.find('.julia-sound.off').removeClass('off').addClass('on') - .find('i').removeClass('ion-android-volume-off').addClass('ion-android-volume-up'); - - break; case 'sound-off': - - if(_env.flashApi === false) - { - _env.api.muted = true; - - }else{ - - _env.api.volume(0); - _env.toolbar.find('.julia-volume>input').val(0).rangeslider('update', true); - } - - options.muted = true; - _persist.set('volume', options.volume, 30); - _persist.set('muted', options.muted, 30); - - _env.toolbar.find('.julia-sound.on').removeClass('on').addClass('off') - .find('i').removeClass('ion-android-volume-up').addClass('ion-android-volume-off'); - - break; case 'fullscreen-on': - _fullscreen.on(); - - break; case 'fullscreen-off': - _fullscreen.off(); - - break; case 'destroy': - - setTiemout( function(){ - _env.player.remove(); - }, 100); - - break; default: - - } - - return; - } - }; - - - // Bindings - var _bind = { - - // First play with some handlers - playAllowStart: function(e) - { - _env.shield.find('.julia-preloader').removeClass('on'); - _env.shield.find('.julia-big-play').show(); - _env.toolbar.show(); - - // Init actions - _control.press('setDuration', { - 'duration': _timeline.toHuman( _env.duration ) - }); - - // Set mute if needed - if(options.muted === true) - { - _control.press('sound-off'); - }else{ - _control.press('sound-on'); - - // Set initial volume - _control.press('volume', { - 'volume': options.volume - }); - } - - // Autostart playback, if possible - if(options.autoplay === true && _support.isMobile() === false) - { - _control.press('play'); - } - - _debug.run({ - 'eventType': e.type, - 'duration': _env.api.duration, - 'readyState': _env.api.readyState - }); - }, - - // Bind can play by ready state / fake readyState - // Because of Firefox cannot bind canplaythrough event with HLS.js properly - canplaythrough: function() - { - if(_env.started === false) - { - // don't let mobile Firefox make decision about readyState, mobile Firefox lie! - if(_env.api.readyState>=3 || (_support.isMobile() === true && _env.api.readyState>=2) ) - { - _bind.playAllowStart({ - type: '_bind.canplaythrough' - }); - }else{ - setTimeout( function() - { - _bind.canplaythrough(); - }, 250); - } - } - }, - - - // Bind user action & DOM events - domEvents: function() - { - // Buttons - _env.toolbar.on('contextmenu', function(e) - { - e.preventDefault(); - }) - .on('click', '.julia-playback.play', function(e) - { - e.preventDefault(); - _control.press('play'); - }) - .on('click', '.julia-playback.pause', function(e) - { - e.preventDefault(); - _control.press('pause'); - }) - .on('click', '.julia-sound.on', function(e) - { - e.preventDefault(); - _control.press('sound-off'); - }) - .on('click', '.julia-sound.off', function(e) - { - e.preventDefault(); - _control.press('sound-on'); - }) - .on('click', '.julia-fullscreen-toggle.on', function(e) - { - e.preventDefault(); - _control.press('fullscreen-on'); - }) - .on('click', '.julia-fullscreen-toggle.off', function(e) - { - e.preventDefault(); - _control.press('fullscreen-off'); - }); - - // Big play - _env.shield.on('click contextmenu', '.julia-big-play', function(e) - { - e.preventDefault(); - e.stopPropagation(); - if(e.type == 'click') - { - _control.press('play'); - } - }); - - // Area click - _env.shield.on('click', function(e) - { - e.preventDefault(); - e.stopPropagation(); - if(options.pauseOnClick === true && _support.isMobile() === false) - { - _control.press('pause'); - } - }); - - // Fullscreen toolbar behavior bindings - var mouseMoveCleaner; - - _env.player.on('mousemove', '#julia-shield-'+_env.apiId+', #julia-suggest-'+_env.apiId, function(e) - { - e.preventDefault(); - _env.toolbar.addClass('julia-toolbar-visible'); - clearTimeout(mouseMoveCleaner); - - mouseMoveCleaner = setTimeout(function() - { - _env.toolbar.removeClass('julia-toolbar-visible'); - }, 1750); - }) - .on('mouseover mousemove mouseout', '#julia-toolbar-'+_env.apiId+'.julia-toolbar-visible', function(e) - { - e.preventDefault(); - _env.toolbar.addClass('julia-toolbar-visible'); - clearTimeout(mouseMoveCleaner); - - if(e.type == 'mouseout') - { - mouseMoveCleaner = setTimeout(function(e) - { - _env.toolbar.removeClass('julia-toolbar-visible'); - }, 1750); - } - }); - - // Bind progressbar change - _env.toolbar.on('change input', '.julia-progress>input', function(e) - { - if(e.type == 'input') - { - _env.seeking = true; - }else{ - - seekTo = _timeline.toSeconds( $(this).val() ); - seekTo = seekTo >= _env.duration ? _env.duration: seekTo.toFixed(2); - - _control.press('goto', { - currentTime: seekTo - }); - - _env.seeking = false; - } - }); - - // Bind volumebar change - _env.toolbar.on('change', '.julia-volume>input', function() - { - _control.press('volume', { - volume: $(this).val(), - 'event': 'slideChange' - }); - }); - - // Fullscreen event included - $(window).on('resize', function() - { - _support.resize(); - }); - - // Fullscreen change event handler - $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', function(e) - { - if(!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) - { - $('.julia-player').removeClass('julia-fullscreen-on').addClass('julia-fullscreen-off') - .find('button.julia-fullscreen-toggle').removeClass('off').addClass('on') - .find('i').removeClass('ion-android-contract').addClass('ion-android-expand'); - - // Turn off landscape on mobile - if(_support.isMobile()) - { - screen.orientation.unlock(); - screen.msLockOrientation.unlock(); - screen.mozLockOrientation.unlock(); - } - - _debug.run({ - 'fullscreen off' : '#julia-player-'+_env.apiId - }); - - _support.resize(); - - }else{ - - $('.julia-player').removeClass('julia-fullscreen-off').addClass('julia-fullscreen-on') - .find('button.julia-fullscreen-toggle').removeClass('on').addClass('off') - .find('i').removeClass('ion-android-expand').addClass('ion-android-contract'); - - // Force landscape in fullscreen mode on mobile - if(_support.isMobile()) - { - screen.orientation.lock('landscape-primary'); - screen.msLockOrientation.lock('landscape-primary'); - screen.mozLockOrientation.lock('landscape-primary'); - } - - _debug.run({ - 'fullscreen on' : '#julia-player-'+_env.apiId - }); - } - }); - }, - - - // Native video api - nativeEvents: function() - { - if(_support.forceReady()===true && _env.isHls === true) - { - _bind.canplaythrough(); - }else{ - _env.api.oncanplaythrough = function(e) - { - _env.duration = _env.api.duration; - - if(_env.started === false && _env.api.readyState >= 3) - { - _bind.playAllowStart(e); - } - } - } - - // Video playback detect - _env.api.onplay = function(e) - { - _env.toolbar.find('.julia-playback.play').removeClass('play').addClass('pause') - .find('i').removeClass('ion-play').addClass('ion-pause'); - _env.shield.find('.julia-big-play').hide(); - _env.shield.find('.julia-preloader').removeClass('on'); - _ui.posterUnset(); - _env.toolbar.show(); - } - - _env.api.onplaying = function(e) - { - _env.toolbar.find('.julia-playback.play').removeClass('play').addClass('pause') - .find('i').removeClass('ion-play').addClass('ion-pause'); - _env.shield.find('.julia-big-play').hide(); - _env.shield.find('.julia-preloader').removeClass('on'); - _env.suggest.html('').removeClass('on'); - _env.toolbar.show(); - _control.press('setDuration', { - 'duration': _timeline.toHuman( _env.duration ) - }); - _env.started = true; - } - - - // Video pause - _env.api.onpause = function(e) - { - _env.toolbar.find('.julia-playback.pause').removeClass('pause').addClass('play') - .find('i').removeClass('ion-pause').addClass('ion-play'); - _env.shield.find('.julia-big-play').show(); - } - - - // Errors - _env.api.onerror = function(e) - { - // Bring to life again - if(_env.tries<11) - { - _boot.init(); - } - } - - _env.api.onemptied = function(e) - { - } - - _env.api.onstalled = function(e) - { - } - - _env.api.onsuspend = function(e) - { - } - - // Video position - _env.api.ontimeupdate = function(e) - { - if(_env.seeking === false) - { - currentTimeReadable = _timeline.toHuman( _env.api.currentTime.toFixed(2) ); - _env.toolbar.find('.julia-progress>input').val( _timeline.toPercents( _env.api.currentTime.toFixed(2) ) ).rangeslider('update', true); - _env.toolbar.find('.julia-panel.julia-currentTime>span').text(currentTimeReadable); - } - - _bind.onTime(currentTimeReadable, _env.api.currentTime); - - if(options.debugPlayback === true) - { - _debug.run({ - 'duration/current': _env.duration+'/'+_env.api.currentTime.toFixed(2)+' > '+currentTimeReadable - }); - } - - // Fix for corrupted video end - // For development purposes only - /* - if(api.currentTime>=(duration-1)) - { - if(_support.forceReady()===true) - { - _suggest.run(); - } - } - */ - } - - // Video position - _env.api.seeked = function(e) - { - _env.seeking = false; - } - - // Video position - _env.api.seeking = function(e) - { - _env.seeking = true; - } - - // Volume - _env.api.onvolumechange = function(e) - { - if(_env.api.muted === false) - { - _env.toolbar.find('.julia-volume>input').val(_env.api.volume*100).rangeslider('update', true); - }else{ - _env.toolbar.find('.julia-volume>input').val(0).rangeslider('update', true); - } - } - - // Set video duration - _env.api.ondurationchange = function(e) - { - _env.duration = _env.api.duration; - - if(_env.started === false) - { - _env.duration = _env.api.duration; - _env.seeking = false; - - _debug.run({ - 'duration': _env.duration, - 'readyState': _env.api.readyState, - 'started': _env.started - }); - } - } - - // Bind playback end event - _env.api.onended = function(e) - { - _suggest.run(); - }; - }, - - - // Specific events, error handlers - hlsLibEvents: function() - { - _env.hls.on(Hls.Events.ERROR, function(event, data) - { - switch(data.details) - { - case Hls.ErrorDetails.MANIFEST_LOAD_ERROR: - case Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT: - case Hls.ErrorDetails.MANIFEST_PARSING_ERROR: - case Hls.ErrorDetails.LEVEL_LOAD_ERROR: - case Hls.ErrorDetails.LEVEL_LOAD_TIMEOUT: - case Hls.ErrorDetails.LEVEL_SWITCH_ERROR: - case Hls.ErrorDetails.FRAG_LOAD_ERROR: - case Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR: - case Hls.ErrorDetails.FRAG_LOAD_TIMEOUT: - case Hls.ErrorDetails.FRAG_DECRYPT_ERROR: - case Hls.ErrorDetails.FRAG_PARSING_ERROR: - case Hls.ErrorDetails.BUFFER_APPEND_ERROR: - case Hls.ErrorDetails.BUFFER_APPENDING_ERROR: - - _debug.run({ - recoveringError: data.details, - errorType: data.type, - errorFatal: data.fatal - }); - - if(data.fatal === true && _env.tries<11) - { - // Bring to life again - _boot.init(); - } - - break; default: - } - }); - }, - - - // Flash fallback for legacy browsers - flashEvents: function() - { - // Flash event object - var flashlsEvents = { - - ready: function(flashTime) - { - _env.api.load(_env.source); - - _debug.run({ - 'ready': flashTime - }); - }, - - videoSize: function(width, height) { - _support.resize(); - }, - - complete: function() - { - _debug.run({ - 'suggest': 'call', - 'flashPlayback': 'completed' - }); - - setTimeout( function() - { - _suggest.run(); - }, 1500); - }, - - error: function(code, url, message) - { - _debug.run({ - 'flashErrorCode': code, - 'flashErrorUrl': url, - 'flashErrorMessage': message, - }); - - // Bring to life again - if(_env.tries<10) - { - _boot.init(); - } - }, - - manifest: function(flashDuration, levels_, loadmetrics) - { - _env.duration = flashDuration.toFixed(2); - levels = levels_; - _debug.run({ - 'durationOrigin': flashDuration, - 'duration': _env.duration, - 'durationHuman': _timeline.toHuman( _env.duration ), - 'levels': levels, - 'metrics': loadmetrics, - }); - - if(_env.started === false) - { - _env.shield.find('.julia-preloader').removeClass('on'); - _env.shield.find('.julia-big-play').show(); - _env.toolbar.show(); - - // Init actions - _control.press('setDuration', { - 'duration': _timeline.toHuman( _env.duration ) - }); - - // Set initial volume - if(options.muted === false) - { - _control.press('volume', { - 'volume': options.volume - }); - } - // Set mute if needed - if(options.muted === true) - { - _control.press('sound-off'); - } - - // Autostart playback, if possible - if(options.autoplay === true) - { - _env.api.play(-1); - } - - _debug.run({ - 'duration': _env.api.duration, - 'readyState': true - }); - } - }, - - levelLoaded: function(loadmetrics) - { - }, - - fragmentLoaded: function(loadmetrics) - { - }, - - fragmentPlaying: function(playmetrics) - { - _env.toolbar.find('.julia-playback.play').removeClass('play').addClass('pause') - .find('i').removeClass('ion-play').addClass('ion-pause'); - _env.shield.find('.julia-big-play').hide(); - _env.shield.find('.julia-preloader').removeClass('on'); - _ui.posterUnset(); - _env.suggest.html('').removeClass('on'); - _env.toolbar.show(); - _env.started = true; - }, - - position: function(timemetrics) - { - if(_env.seeking === false) - { - currentTimeReadable = _timeline.toHuman( _env.api.getPosition() ); - _env.toolbar.find('.julia-progress>input').val( _timeline.toPercents( _env.api.getPosition() ) ).rangeslider('update', true); - _env.toolbar.find('.julia-panel.julia-currentTime>span').text(currentTimeReadable); - } - } - }; - - // Create a single global callback function and pass it's name - // to the SWF with the name `callback` in the FlashVars parameter. - window[_env.flashCallbackName] = function(eventName, args) - { - flashlsEvents[eventName].apply(null, args); - }; - }, - - // Time update event callbacks - onTime: function(time, timeNum) - { - if( (time in options.onTime) && _env.onTimeRised.indexOf(time) == -1 ) - { - handle = options.onTime[time]; - _env.onTimeRised.push(time); - - if(typeof window[handle] === 'function') - { - window[handle](time, _env.publicApi); - _debug.run({ - 'onTime': handle+' raised' - }); - - }else{ - - _debug.run({ - 'onTimeError': handle+' is not a function, but: '+(typeof handle) - }); - } - } - } - }; - - - // Create player - var _boot = { - - create: function() - { - // Extend default options with external options - _system.extend(); - - // Degbug header - if(options.debug === true && window.console ) - { - console.info('=== Julia console debug start for '+_env.apiId+' ==='); - } - - _debug.run(options); - - // Suggest init - for(i in options.suggest) - { - options.suggest[i].played = false; - } - - // Set theme CSS - _support.theme(); - - // User data - volume = _persist.get('volume'); - muted = _persist.get('muted'); - - if(volume.length>0) - { - options.volume = parseInt(volume); - } - - if(muted.length>0) - { - options.muted = muted == 'false' ? false: true; - } - - // Create UI - _ui.player(); - }, - - // Select playback url - selectSource: function() - { - _env.element.prop('preload', 'none'); - protoSource = _env.element.prop('src') ? _env.element.prop('src'): _env.element.find('source').prop('src'); - _env.source = options.source && options.source.length>0 ? options.source: protoSource; - - _env.isHls = _env.source.indexOf('m3u8') == -1 ? false: true; - if(options.forceHls === true) - { - //_env.source += _env.source.indexOf('?') == -1 ? '?m3u8=yes': '&m3u8=yes'; - _env.isHls = true; - } - - _debug.run({ - 'sourceType': (_env.isHls === false ? 'file': 'hls') - }); - - _env.poster = options.poster && options.poster.length>0 ? options.poster: _env.element.prop('poster'); - _ui.posterSet(); - }, - - - // load media - load: function() - { - _env.shield.find('.julia-preloader').addClass('on'); - - // ************************ - // HLS library supported - // and HLS requested - // ************************ - if(_env.useHlsLib === true) - { - _bind.hlsLibEvents(); - _env.hls.loadSource(_env.source); - _env.hls.attachMedia(_env.api); - - // DETECT LEVEL DATA - _env.hls.on(Hls.Events.LEVEL_LOADED,function(event, data) - { - // SET LIVE EVENT STATE - if(data.details.live === true || options.live === true) - { - _env.isLive = true; - _env.toolbar.addClass('live'); - }else{ - _env.toolbar.removeClass('live'); - } - }); - - for(x in options.triggerHls) - { - handle = options.triggerHls[x]; - - if(typeof window[handle] === 'function') - { - _env.hls.on(Hls.Events[x], function(event, data) - { - window[handle](_env.apiId, event, data); - }); - - }else{ - - _debug.run({ - 'triggerHlsError': handle+' is not a function' - }); - } - } - - // ************************ - // No HLS library support, - // but HLS is requested - // ************************ - }else if(_env.flashApi === true) - { - _api.create(); - - // ************************ - // Classic VOD file - // ************************ - }else{ - - _env.api.load(); - } - - // ************************ - // Bind all events - // ************************ - if(_env.apiOk === true) - { - _bind.domEvents(); - - if(_env.flashApi === false) - { - // Classic html5 api - _bind.nativeEvents(); - }else{ - // Flash api - _bind.flashEvents(); - } - } - - stats = { - 'isHls': _env.isHls, - 'flashApi': _env.flashApi, - 'useHlsLib': _env.useHlsLib, - 'live': _env.isLive, - 'canPlayMediaString': _env.canPlayMediaString, - 'canPlayMedia': _env.canPlayMedia, - }; - - _debug.run(stats); - - // Define publicApi - _env.publicApi = { - control: _control, - options: options, - support: _support, - dimensions: _env.dimensions, - timeline: _timeline, - shield: _env.shield, - toolbar: _env.toolbar, - media: _env.api, - id: _env.apiId, - stats: stats - }; - - }, - - // Initilize player - init: function() - { - // Create source - _boot.selectSource(); - _env.useHlsLib = false; - _env.flashApi = false; - _env.isLive = false; - _env.canPlayMedia = _support.canPlayMedia(); - _env.tries+=1; - - if(_env.isHls === true) - { - _env.useHlsLib = _env.canPlayMedia === false && Hls.isSupported() ? true: false; - } - - // ************************ - // HLS library supported - // and HLS requested - // ************************ - if(_env.useHlsLib === true) - { - _api.create(); - _env.hls = new Hls(options.hlsConfig); - - // ************************ - // No HLS library support, - // but HLS is requested - // ************************ - }else if(_env.isHls === true && _env.useHlsLib === false && _env.canPlayMedia === false) - { - _env.flashApi = true; - - // ************************ - // Classic VOD file - // ************************ - }else{ - - _api.create(); - _env.api.src = _env.source; - } - - if(options.live === true) - { - _env.isLive = true; - _env.toolbar.addClass('live'); - }else{ - _env.toolbar.removeClass('live'); - } - } - } - - // Build player object - _boot.create(); - - // Bring to life - _boot.init(); - - // Bring to life - _boot.load(); - - // Player dimensions - _support.resize(); - - // Populate public API - return _env.publicApi; - } - - // Build plugin instances - $.fn.julia = function(opts) - { - var resize = []; - return this.each(function() - { - var element = $(this); - - // Return if this element already has a plugin instance - if ($(this).data('julia')) return; - - // Pass options to constructor - var __julia = new _julia($(this), opts); - - // Store plugin object in element's data - $(this).data('julia', __julia); - }); - }; - - // API wrappers - $.fn.play = function() - { - $(this).data('julia').control.press('play'); - }; - - $.fn.destroy = function() - { - $(this).data('julia').control.press('destroy'); - }; - - $.fn.media = function() - { - return $(this).data('julia').media; - }; - - $.fn.pause = function() - { - $(this).data('julia').control.press('pause'); - }; - - $.fn.stop = function() - { - $(this).data('julia').control.press('stop'); - }; - - $.fn.goto = function(t) - { - $(this).data('julia').control.press('goto', { - currentTime: t - }); - }; - - $.fn.mute = function() - { - if($(this).data('julia').media.muted === false) - { - $(this).data('julia').control.press('sound-off'); - }else{ - $(this).data('julia').control.press('sound-on'); - } - }; - - $.fn.volume = function(volume) - { - $(this).data('julia').control.press('volume', { - volume: volume - }); - }; - - $.fn.getID = function() - { - return $(this).data('julia').id; - }; - - $.fn.stats = function() - { - return $(this).data('julia').stats; - }; - -})(jQuery); diff --git a/src/js/julia-pre.js b/src/js/julia-pre.js new file mode 100644 index 0000000..9925feb --- /dev/null +++ b/src/js/julia-pre.js @@ -0,0 +1,4 @@ +/* *********************** +| Julia player pre boot file +************************ */ + diff --git a/src/js/lib/hls.js b/src/js/lib/hls.js index 96abe57..0e94935 100644 --- a/src/js/lib/hls.js +++ b/src/js/lib/hls.js @@ -390,6 +390,10 @@ var _errors = require('../errors'); var _logger = require('../utils/logger'); +var _ewmaBandwidthEstimator = require('./ewma-bandwidth-estimator'); + +var _ewmaBandwidthEstimator2 = _interopRequireDefault(_ewmaBandwidthEstimator); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -408,7 +412,7 @@ var AbrController = function (_EventHandler) { function AbrController(hls) { _classCallCheck(this, AbrController); - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AbrController).call(this, hls, _events2.default.FRAG_LOADING, _events2.default.FRAG_LOAD_PROGRESS, _events2.default.FRAG_LOADED, _events2.default.ERROR)); + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AbrController).call(this, hls, _events2.default.FRAG_LOADING, _events2.default.FRAG_LOADED, _events2.default.ERROR)); _this.lastLoadedFragLevel = 0; _this._autoLevelCapping = -1; @@ -430,20 +434,30 @@ var AbrController = function (_EventHandler) { if (!this.timer) { this.timer = setInterval(this.onCheck, 100); } - this.fragCurrent = data.frag; - } - }, { - key: 'onFragLoadProgress', - value: function onFragLoadProgress(data) { - var stats = data.stats; - // only update stats if first frag loading - // if same frag is loaded multiple times, it might be in browser cache, and loaded quickly - // and leading to wrong bw estimation - if (stats.aborted === undefined && data.frag.loadCounter === 1) { - this.lastfetchduration = (performance.now() - stats.trequest) / 1000; - this.lastbw = stats.loaded * 8 / this.lastfetchduration; - //console.log(`fetchDuration:${this.lastfetchduration},bw:${(this.lastbw/1000).toFixed(0)}/${stats.aborted}`); + + // lazy init of bw Estimator, rationale is that we use different params for Live/VoD + // so we need to wait for stream manifest / playlist type to instantiate it. + if (!this.bwEstimator) { + var hls = this.hls, + level = data.frag.level, + isLive = hls.levels[level].details.live, + config = hls.config, + ewmaFast = void 0, + ewmaSlow = void 0; + + if (isLive) { + ewmaFast = config.abrEwmaFastLive; + ewmaSlow = config.abrEwmaSlowLive; + } else { + ewmaFast = config.abrEwmaFastVoD; + ewmaSlow = config.abrEwmaSlowVoD; + } + this.bwEstimator = new _ewmaBandwidthEstimator2.default(hls, ewmaSlow, ewmaFast, config.abrEwmaDefaultEstimate); } + + var frag = data.frag; + frag.trequest = performance.now(); + this.fragCurrent = frag; } }, { key: 'abandonRulesCheck', @@ -469,12 +483,14 @@ var AbrController = function (_EventHandler) { var requestDelay = performance.now() - frag.trequest; // monitor fragment load progress after half of expected fragment duration,to stabilize bitrate if (requestDelay > 500 * frag.duration) { - var loadRate = Math.max(1, frag.loaded * 1000 / requestDelay); // byte/s; at least 1 byte/s to avoid division by zero - if (frag.expectedLen < frag.loaded) { - frag.expectedLen = frag.loaded; - } + var levels = hls.levels, + loadRate = Math.max(1, frag.loaded * 1000 / requestDelay), + // byte/s; at least 1 byte/s to avoid division by zero + // compute expected fragment length using frag duration and level bitrate. also ensure that expected len is gte than already loaded size + expectedLen = Math.max(frag.loaded, Math.round(frag.duration * levels[frag.level].bitrate / 8)); + var pos = v.currentTime; - var fragLoadedDelay = (frag.expectedLen - frag.loaded) / loadRate; + var fragLoadedDelay = (expectedLen - frag.loaded) / loadRate; var bufferStarvationDelay = _bufferHelper2.default.bufferInfo(v, pos, hls.config.maxBufferHole).end - pos; // consider emergency switch down only if we have less than 2 frag buffered AND // time to finish loading current fragment is bigger than buffer starvation delay @@ -488,7 +504,7 @@ var AbrController = function (_EventHandler) { // compute time to load next fragment at lower level // 0.8 : consider only 80% of current bw to be conservative // 8 = bits per byte (bps/Bps) - fragLevelNextLoadedDelay = frag.duration * hls.levels[nextLoadLevel].bitrate / (8 * 0.8 * loadRate); + fragLevelNextLoadedDelay = frag.duration * levels[nextLoadLevel].bitrate / (8 * 0.8 * loadRate); _logger.logger.log('fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay[' + nextLoadLevel + '] :' + fragLoadedDelay.toFixed(1) + '/' + bufferStarvationDelay.toFixed(1) + '/' + fragLevelNextLoadedDelay.toFixed(1)); if (fragLevelNextLoadedDelay < bufferStarvationDelay) { // we found a lower level that be rebuffering free with current estimated bw ! @@ -502,6 +518,8 @@ var AbrController = function (_EventHandler) { nextLoadLevel = Math.max(0, nextLoadLevel); // force next load level in auto mode hls.nextLoadLevel = nextLoadLevel; + // update bw estimate for this fragment before cancelling load (this will help reducing the bw) + this.bwEstimator.sample(requestDelay, frag.loaded); // abort fragment loading ... _logger.logger.warn('loading too slow, abort fragment loading and switch to level ' + nextLoadLevel); //abort fragment loading @@ -516,6 +534,14 @@ var AbrController = function (_EventHandler) { }, { key: 'onFragLoaded', value: function onFragLoaded(data) { + var stats = data.stats; + // only update stats on first frag loading + // if same frag is loaded multiple times, it might be in browser cache, and loaded quickly + // and leading to wrong bw estimation + if (stats.aborted === undefined && data.frag.loadCounter === 1) { + this.bwEstimator.sample(performance.now() - stats.trequest, stats.loaded); + } + // stop monitoring bw once frag loaded this.clearTimer(); // store level id after successful fragment load @@ -561,13 +587,13 @@ var AbrController = function (_EventHandler) { }, { key: 'nextAutoLevel', get: function get() { - var lastbw = this.lastbw, - hls = this.hls, - adjustedbw, + var hls = this.hls, i, - maxAutoLevel; - if (this._autoLevelCapping === -1 && hls.levels && hls.levels.length) { - maxAutoLevel = hls.levels.length - 1; + maxAutoLevel, + levels = hls.levels, + config = hls.config; + if (this._autoLevelCapping === -1 && levels && levels.length) { + maxAutoLevel = levels.length - 1; } else { maxAutoLevel = this._autoLevelCapping; } @@ -577,6 +603,8 @@ var AbrController = function (_EventHandler) { return Math.min(this._nextAutoLevel, maxAutoLevel); } + var avgbw = this.bwEstimator ? this.bwEstimator.getEstimate() : config.abrEwmaDefaultEstimate, + adjustedbw = void 0; // follow algorithm captured from stagefright : // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp // Pick the highest bandwidth stream below or equal to estimated bandwidth. @@ -585,11 +613,11 @@ var AbrController = function (_EventHandler) { // be even more conservative (70%) to avoid overestimating and immediately // switching back. if (i <= this.lastLoadedFragLevel) { - adjustedbw = 0.8 * lastbw; + adjustedbw = config.abrBandWidthFactor * avgbw; } else { - adjustedbw = 0.7 * lastbw; + adjustedbw = config.abrBandWidthUpFactor * avgbw; } - if (adjustedbw < hls.levels[i].bitrate) { + if (adjustedbw < levels[i].bitrate) { return Math.max(0, i - 1); } } @@ -605,7 +633,7 @@ var AbrController = function (_EventHandler) { exports.default = AbrController; -},{"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../utils/logger":36}],4:[function(require,module,exports){ +},{"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../utils/logger":38,"./ewma-bandwidth-estimator":6}],4:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -642,10 +670,16 @@ var BufferController = function (_EventHandler) { function BufferController(hls) { _classCallCheck(this, BufferController); - // Source Buffer listeners + // the value that we have set mediasource.duration to + // (the actual duration may be tweaked slighly by the browser) - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(BufferController).call(this, hls, _events2.default.MEDIA_ATTACHING, _events2.default.MEDIA_DETACHING, _events2.default.BUFFER_RESET, _events2.default.BUFFER_APPENDING, _events2.default.BUFFER_CODECS, _events2.default.BUFFER_EOS, _events2.default.BUFFER_FLUSHING)); + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(BufferController).call(this, hls, _events2.default.MEDIA_ATTACHING, _events2.default.MEDIA_DETACHING, _events2.default.BUFFER_RESET, _events2.default.BUFFER_APPENDING, _events2.default.BUFFER_CODECS, _events2.default.BUFFER_EOS, _events2.default.BUFFER_FLUSHING, _events2.default.LEVEL_UPDATED)); + _this._msDuration = null; + // the value that we want to set mediaSource.duration to + _this._levelDuration = null; + + // Source Buffer listeners _this.onsbue = _this.onSBUpdateEnd.bind(_this); _this.onsbe = _this.onSBUpdateError.bind(_this); return _this; @@ -660,17 +694,19 @@ var BufferController = function (_EventHandler) { key: 'onMediaAttaching', value: function onMediaAttaching(data) { var media = this.media = data.media; - // setup the media source - var ms = this.mediaSource = new MediaSource(); - //Media Source listeners - this.onmso = this.onMediaSourceOpen.bind(this); - this.onmse = this.onMediaSourceEnded.bind(this); - this.onmsc = this.onMediaSourceClose.bind(this); - ms.addEventListener('sourceopen', this.onmso); - ms.addEventListener('sourceended', this.onmse); - ms.addEventListener('sourceclose', this.onmsc); - // link video and media Source - media.src = URL.createObjectURL(ms); + if (media) { + // setup the media source + var ms = this.mediaSource = new MediaSource(); + //Media Source listeners + this.onmso = this.onMediaSourceOpen.bind(this); + this.onmse = this.onMediaSourceEnded.bind(this); + this.onmsc = this.onMediaSourceClose.bind(this); + ms.addEventListener('sourceopen', this.onmso); + ms.addEventListener('sourceended', this.onmse); + ms.addEventListener('sourceclose', this.onmsc); + // link video and media Source + media.src = URL.createObjectURL(ms); + } } }, { key: 'onMediaDetaching', @@ -691,9 +727,14 @@ var BufferController = function (_EventHandler) { ms.removeEventListener('sourceopen', this.onmso); ms.removeEventListener('sourceended', this.onmse); ms.removeEventListener('sourceclose', this.onmsc); - // unlink MediaSource from video tag - this.media.src = ''; - this.media.removeAttribute('src'); + + try { + // unlink MediaSource from video tag + this.media.src = ''; + this.media.removeAttribute('src'); + } catch (err) { + _logger.logger.warn('onMediaDetaching:' + err.message + ' while unlinking video.src'); + } this.mediaSource = null; this.media = null; this.pendingTracks = null; @@ -774,23 +815,23 @@ var BufferController = function (_EventHandler) { }, { key: 'onBufferCodecs', value: function onBufferCodecs(tracks) { - var sb, trackName, track, codec, mimeType; + var mediaSource = this.mediaSource; - if (!this.media) { + // delay sourcebuffer creation if media source not opened yet + if (!mediaSource || mediaSource.readyState !== 'open') { this.pendingTracks = tracks; return; } if (!this.sourceBuffer) { - var sourceBuffer = {}, - mediaSource = this.mediaSource; - for (trackName in tracks) { - track = tracks[trackName]; + var sourceBuffer = {}; + for (var trackName in tracks) { + var track = tracks[trackName]; // use levelCodec as first priority - codec = track.levelCodec || track.codec; - mimeType = track.container + ';codecs=' + codec; + var codec = track.levelCodec || track.codec; + var mimeType = track.container + ';codecs=' + codec; _logger.logger.log('creating sourceBuffer with mimeType:' + mimeType); - sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType); + var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType); sb.addEventListener('updateend', this.onsbue); sb.addEventListener('error', this.onsbe); } @@ -841,6 +882,51 @@ var BufferController = function (_EventHandler) { this.flushBufferCounter = 0; this.doFlush(); } + }, { + key: 'onLevelUpdated', + value: function onLevelUpdated(event) { + var details = event.details; + if (details.fragments.length === 0) { + return; + } + this._levelDuration = details.totalduration + details.fragments[0].start; + this.updateMediaElementDuration(); + } + + // https://github.com/dailymotion/hls.js/issues/355 + + }, { + key: 'updateMediaElementDuration', + value: function updateMediaElementDuration() { + if (this._levelDuration === null) { + return; + } + var media = this.media, + mediaSource = this.mediaSource, + sourceBuffer = this.sourceBuffer; + if (!media || !mediaSource || !sourceBuffer || media.readyState === 0 || mediaSource.readyState !== 'open') { + return; + } + for (var type in sourceBuffer) { + if (sourceBuffer[type].updating) { + // can't set duration whilst a buffer is updating + return; + } + } + if (this._msDuration === null) { + // initialise to the value that the media source is reporting + this._msDuration = mediaSource.duration; + } + // this._levelDuration was the last value we set. + // not using mediaSource.duration as the browser may tweak this value + // only update mediasource duration if its value increase, this is to avoid + // flushing already buffered portion when switching between quality level, as they + if (this._levelDuration > this._msDuration) { + _logger.logger.log('Updating mediasource duration to ' + this._levelDuration); + mediaSource.duration = this._levelDuration; + this._msDuration = this._levelDuration; + } + } }, { key: 'doFlush', value: function doFlush() { @@ -928,9 +1014,10 @@ var BufferController = function (_EventHandler) { } else { // QuotaExceededError: http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror // let's stop appending any segments, and report BUFFER_FULL_ERROR error - segments = []; + this.segments = []; event.details = _errors.ErrorDetails.BUFFER_FULL_ERROR; hls.trigger(_events2.default.ERROR, event); + return; } } } @@ -998,7 +1085,7 @@ var BufferController = function (_EventHandler) { exports.default = BufferController; -},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],5:[function(require,module,exports){ +},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],5:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1141,7 +1228,76 @@ var CapLevelController = function (_EventHandler) { exports.default = CapLevelController; -},{"../event-handler":21,"../events":22}],6:[function(require,module,exports){ +},{"../event-handler":22,"../events":23}],6:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* + * EWMA Bandwidth Estimator + * - heavily inspired from shaka-player + * Tracks bandwidth samples and estimates available bandwidth. + * Based on the minimum of two exponentially-weighted moving averages with + * different half-lives. + */ + +var _ewma = require('../utils/ewma'); + +var _ewma2 = _interopRequireDefault(_ewma); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var EwmaBandWidthEstimator = function () { + function EwmaBandWidthEstimator(hls, slow, fast, defaultEstimate) { + _classCallCheck(this, EwmaBandWidthEstimator); + + this.hls = hls; + this.defaultEstimate_ = defaultEstimate; + this.minWeight_ = 0.001; + this.minDelayMs_ = 50; + this.slow_ = new _ewma2.default(slow); + this.fast_ = new _ewma2.default(fast); + } + + _createClass(EwmaBandWidthEstimator, [{ + key: 'sample', + value: function sample(durationMs, numBytes) { + durationMs = Math.max(durationMs, this.minDelayMs_); + var bandwidth = 8000 * numBytes / durationMs, + + //console.log('instant bw:'+ Math.round(bandwidth)); + // we weight sample using loading duration.... + weight = durationMs / 1000; + this.fast_.sample(weight, bandwidth); + this.slow_.sample(weight, bandwidth); + } + }, { + key: 'getEstimate', + value: function getEstimate() { + if (!this.fast_ || !this.slow_ || this.fast_.getTotalWeight() < this.minWeight_) { + return this.defaultEstimate_; + } + //console.log('slow estimate:'+ Math.round(this.slow_.getEstimate())); + //console.log('fast estimate:'+ Math.round(this.fast_.getEstimate())); + // Take the minimum of these two estimates. This should have the effect of + // adapting down quickly, but up more slowly. + return Math.min(this.fast_.getEstimate(), this.slow_.getEstimate()); + } + }, { + key: 'destroy', + value: function destroy() {} + }]); + + return EwmaBandWidthEstimator; +}(); + +exports.default = EwmaBandWidthEstimator; + +},{"../utils/ewma":37}],7:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1189,7 +1345,7 @@ var LevelController = function (_EventHandler) { key: 'destroy', value: function destroy() { if (this.timer) { - clearInterval(this.timer); + clearTimeout(this.timer); this.timer = null; } this._manualLevel = -1; @@ -1289,17 +1445,18 @@ var LevelController = function (_EventHandler) { }, { key: 'setLevelInternal', value: function setLevelInternal(newLevel) { + var levels = this._levels; // check if level idx is valid - if (newLevel >= 0 && newLevel < this._levels.length) { + if (newLevel >= 0 && newLevel < levels.length) { // stopping live reloading timer if any if (this.timer) { - clearInterval(this.timer); + clearTimeout(this.timer); this.timer = null; } this._level = newLevel; _logger.logger.log('switching to level ' + newLevel); this.hls.trigger(_events2.default.LEVEL_SWITCH, { level: newLevel }); - var level = this._levels[newLevel]; + var level = levels[newLevel]; // check if we need to load playlist for this level if (level.details === undefined || level.details.live === true) { // level not retrieved yet, or live playlist we need to (re)load it @@ -1321,8 +1478,9 @@ var LevelController = function (_EventHandler) { var details = data.details, hls = this.hls, - levelId, - level; + levelId = void 0, + level = void 0, + levelError = false; // try to recover not fatal errors switch (details) { case _errors.ErrorDetails.FRAG_LOAD_ERROR: @@ -1335,6 +1493,7 @@ var LevelController = function (_EventHandler) { case _errors.ErrorDetails.LEVEL_LOAD_ERROR: case _errors.ErrorDetails.LEVEL_LOAD_TIMEOUT: levelId = data.level; + levelError = true; break; default: break; @@ -1358,13 +1517,17 @@ var LevelController = function (_EventHandler) { hls.abrController.nextAutoLevel = 0; } else if (level && level.details && level.details.live) { _logger.logger.warn('level controller,' + details + ' on live stream, discard'); + if (levelError) { + // reset this._level so that another call to set level() will retrigger a frag load + this._level = undefined; + } // FRAG_LOAD_ERROR and FRAG_LOAD_TIMEOUT are handled by mediaController } else if (details !== _errors.ErrorDetails.FRAG_LOAD_ERROR && details !== _errors.ErrorDetails.FRAG_LOAD_TIMEOUT) { _logger.logger.error('cannot recover ' + details + ' error'); this._level = undefined; // stopping live reloading timer if any if (this.timer) { - clearInterval(this.timer); + clearTimeout(this.timer); this.timer = null; } // redispatch same error but with fatal set to true @@ -1377,16 +1540,30 @@ var LevelController = function (_EventHandler) { }, { key: 'onLevelLoaded', value: function onLevelLoaded(data) { - // check if current playlist is a live playlist - if (data.details.live && !this.timer) { - // if live playlist we will have to reload it periodically - // set reload period to playlist target duration - this.timer = setInterval(this.ontick, 1000 * data.details.targetduration); - } - if (!data.details.live && this.timer) { - // playlist is not live and timer is armed : stopping it - clearInterval(this.timer); - this.timer = null; + // only process level loaded events matching with expected level + if (data.level === this._level) { + var newDetails = data.details; + // if current playlist is a live playlist, arm a timer to reload it + if (newDetails.live) { + var reloadInterval = 1000 * newDetails.targetduration, + curLevel = this._levels[data.level], + curDetails = curLevel.details; + if (curDetails && newDetails.endSN === curDetails.endSN) { + // follow HLS Spec, If the client reloads a Playlist file and finds that it has not + // changed then it MUST wait for a period of one-half the target + // duration before retrying. + reloadInterval /= 2; + _logger.logger.log('same live playlist, reload twice faster'); + } + // decrement reloadInterval with level loading delay + reloadInterval -= performance.now() - data.stats.trequest; + // in any case, don't reload more than every second + reloadInterval = Math.max(1000, Math.round(reloadInterval)); + _logger.logger.log('live playlist, reload in ' + reloadInterval + ' ms'); + this.timer = setTimeout(this.ontick, reloadInterval); + } else { + this.timer = null; + } } } }, { @@ -1410,8 +1587,11 @@ var LevelController = function (_EventHandler) { return this._level; }, set: function set(newLevel) { - if (this._level !== newLevel || this._levels[newLevel].details === undefined) { - this.setLevelInternal(newLevel); + var levels = this._levels; + if (levels && levels.length > newLevel) { + if (this._level !== newLevel || levels[newLevel].details === undefined) { + this.setLevelInternal(newLevel); + } } } }, { @@ -1421,6 +1601,9 @@ var LevelController = function (_EventHandler) { }, set: function set(newLevel) { this._manualLevel = newLevel; + if (this._startLevel === undefined) { + this._startLevel = newLevel; + } if (newLevel !== -1) { this.level = newLevel; } @@ -1467,7 +1650,7 @@ var LevelController = function (_EventHandler) { exports.default = LevelController; -},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],7:[function(require,module,exports){ +},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],8:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -1557,9 +1740,7 @@ var StreamController = function (_EventHandler) { } }, { key: 'startLoad', - value: function startLoad() { - var startPosition = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; - + value: function startLoad(startPosition) { if (this.levels) { var media = this.media, lastCurrentTime = this.lastCurrentTime; @@ -1570,7 +1751,7 @@ var StreamController = function (_EventHandler) { } this.level = -1; this.fragLoadError = 0; - if (media && lastCurrentTime) { + if (media && lastCurrentTime > 0) { _logger.logger.log('configure startPosition @' + lastCurrentTime); if (!this.lastPaused) { _logger.logger.log('resuming video'); @@ -1620,13 +1801,13 @@ var StreamController = function (_EventHandler) { }, { key: 'doTick', value: function doTick() { - var _this2 = this; - var pos, level, levelDetails, hls = this.hls, - config = hls.config; + config = hls.config, + media = this.media, + isSeeking = media && media.seeking; //logger.log(this.state); switch (this.state) { case State.ERROR: @@ -1636,14 +1817,15 @@ var StreamController = function (_EventHandler) { break; case State.STARTING: // determine load level - this.startLevel = hls.startLevel; - if (this.startLevel === -1) { + var startLevel = hls.startLevel; + if (startLevel === -1) { // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level - this.startLevel = 0; + startLevel = 0; this.fragBitrateTest = true; } // set new level to playlist loader : this will trigger start level load - this.level = hls.nextLoadLevel = this.startLevel; + // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded + this.level = hls.nextLoadLevel = startLevel; this.state = State.WAITING_LEVEL; this.loadedmetadata = false; break; @@ -1652,7 +1834,7 @@ var StreamController = function (_EventHandler) { // start fragment already requested OR start frag prefetch disable // exit loop // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop - if (!this.media && (this.startFragRequested || !config.startFragPrefetch)) { + if (!media && (this.startFragRequested || !config.startFragPrefetch)) { break; } // determine next candidate fragment to be loaded, based on current position and @@ -1660,18 +1842,12 @@ var StreamController = function (_EventHandler) { // ensure 60s of buffer upfront // if we have not yet loaded any fragment, start loading from start position if (this.loadedmetadata) { - pos = this.media.currentTime; + pos = media.currentTime; } else { pos = this.nextLoadPosition; } - // determine next load level - if (this.startFragRequested === false) { - level = this.startLevel; - } else { - // we are not at playback start, get next load level from level Controller - level = hls.nextLoadLevel; - } - var bufferInfo = _bufferHelper2.default.bufferInfo(this.media, pos, config.maxBufferHole), + level = hls.nextLoadLevel; + var bufferInfo = _bufferHelper2.default.bufferInfo(media, pos, config.maxBufferHole), bufferLen = bufferInfo.len, bufferEnd = bufferInfo.end, fragPrevious = this.fragPrevious, @@ -1706,14 +1882,17 @@ var StreamController = function (_EventHandler) { // in case of live playlist we need to ensure that requested position is not located before playlist start if (levelDetails.live) { // check if requested position is within seekable boundaries : - //logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`); + //logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${media.seeking}`); var maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount * levelDetails.targetduration; if (bufferEnd < Math.max(start, end - maxLatency)) { var targetLatency = config.liveSyncDuration !== undefined ? config.liveSyncDuration : config.liveSyncDurationCount * levelDetails.targetduration; - this.seekAfterBuffered = start + Math.max(0, levelDetails.totalduration - targetLatency); - _logger.logger.log('buffer end: ' + bufferEnd + ' is located too far from the end of live sliding playlist, media position will be reseted to: ' + this.seekAfterBuffered.toFixed(3)); - bufferEnd = this.seekAfterBuffered; + var liveSyncPosition = start + Math.max(0, levelDetails.totalduration - targetLatency); + _logger.logger.log('buffer end: ' + bufferEnd + ' is located too far from the end of live sliding playlist, reset currentTime to : ' + liveSyncPosition.toFixed(3)); + bufferEnd = liveSyncPosition; + if (media && media.readyState && media.duration > liveSyncPosition) { + media.currentTime = liveSyncPosition; + } } // if end of buffer greater than live edge, don't load any fragment @@ -1725,7 +1904,7 @@ var StreamController = function (_EventHandler) { // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168 // level 1 loaded [182580164,182580171] // - if (bufferEnd > end) { + if (levelDetails.PTSKnown && bufferEnd > end) { break; } @@ -1757,13 +1936,13 @@ var StreamController = function (_EventHandler) { } if (!frag) { (function () { - var foundFrag = void 0; var maxFragLookUpTolerance = config.maxFragLookUpTolerance; if (bufferEnd < end) { - if (bufferEnd > end - maxFragLookUpTolerance) { + // no frag look up tolerance in case bufferEnd close to end, or media seeking + if (bufferEnd > end - maxFragLookUpTolerance || isSeeking) { maxFragLookUpTolerance = 0; } - foundFrag = _binarySearch2.default.search(fragments, function (candidate) { + frag = _binarySearch2.default.search(fragments, function (candidate) { // offset should be within fragment boundary - config.maxFragLookUpTolerance // this is to cope with situations like // bufferEnd = 9.991 @@ -1786,29 +1965,49 @@ var StreamController = function (_EventHandler) { }); } else { // reach end of playlist - foundFrag = fragments[fragLen - 1]; - } - if (foundFrag) { - frag = foundFrag; - start = foundFrag.start; - //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn); - if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) { - if (frag.sn < levelDetails.endSN) { - frag = fragments[frag.sn + 1 - levelDetails.startSN]; - _logger.logger.log('SN just loaded, load next one: ' + frag.sn); - } else { - // have we reached end of VOD playlist ? - if (!levelDetails.live) { - _this2.hls.trigger(_events2.default.BUFFER_EOS); - _this2.state = State.ENDED; - } - frag = null; - } - } + frag = fragments[fragLen - 1]; } })(); } if (frag) { + start = frag.start; + //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn); + if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) { + if (frag.sn < levelDetails.endSN) { + var deltaPTS = fragPrevious.deltaPTS, + curSNIdx = frag.sn - levelDetails.startSN; + // if there is a significant delta between audio and video, larger than max allowed hole, + // and if previous remuxed fragment did not start with a keyframe. (fragPrevious.dropped) + // let's try to load previous fragment again to get last keyframe + // then we will reload again current fragment (that way we should be able to fill the buffer hole ...) + if (deltaPTS && deltaPTS > config.maxBufferHole && fragPrevious.dropped) { + frag = fragments[curSNIdx - 1]; + _logger.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'); + // decrement previous frag load counter to avoid frag loop loading error when next fragment will get reloaded + fragPrevious.loadCounter--; + } else { + frag = fragments[curSNIdx + 1]; + _logger.logger.log('SN just loaded, load next one: ' + frag.sn); + } + // ensure frag is not undefined + if (!frag) { + break; + } + } else { + // have we reached end of VOD playlist ? + if (!levelDetails.live) { + // Finalize the media stream + this.hls.trigger(_events2.default.BUFFER_EOS); + // We might be loading the last fragment but actually the media + // is currently processing a seek command and waiting for new data to resume at another point. + // Going to ended state while media is seeking can spawn an infinite buffering broken state. + if (!isSeeking) { + this.state = State.ENDED; + } + } + break; + } + } //logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3)); if (frag.decryptdata.uri != null && frag.decryptdata.key == null) { _logger.logger.log('Loading key for ' + frag.sn + ' of [' + levelDetails.startSN + ' ,' + levelDetails.endSN + '],level ' + level); @@ -1816,11 +2015,6 @@ var StreamController = function (_EventHandler) { hls.trigger(_events2.default.KEY_LOADING, { frag: frag }); } else { _logger.logger.log('Loading ' + frag.sn + ' of [' + levelDetails.startSN + ' ,' + levelDetails.endSN + '],level ' + level + ', currentTime:' + pos + ',bufferEnd:' + bufferEnd.toFixed(3)); - frag.autoLevel = hls.autoLevelEnabled; - if (this.levels.length > 1) { - frag.expectedLen = Math.round(frag.duration * this.levels[level].bitrate / 8); - frag.trequest = performance.now(); - } // ensure that we are not reloading the same fragments in loop ... if (this.fragLoadIdx !== undefined) { this.fragLoadIdx++; @@ -1841,6 +2035,7 @@ var StreamController = function (_EventHandler) { frag.loadIdx = this.fragLoadIdx; this.fragCurrent = frag; this.startFragRequested = true; + frag.autoLevel = hls.autoLevelEnabled; hls.trigger(_events2.default.FRAG_LOADING, { frag: frag }); this.state = State.FRAG_LOADING; } @@ -1857,8 +2052,6 @@ var StreamController = function (_EventHandler) { case State.FRAG_LOADING_WAITING_RETRY: var now = performance.now(); var retryDate = this.retryDate; - var media = this.media; - var isSeeking = media && media.seeking; // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading if (!retryDate || now >= retryDate || isSeeking) { _logger.logger.log('mediaController: retryDate reached, switch back to IDLE state'); @@ -1907,11 +2100,13 @@ var StreamController = function (_EventHandler) { }, { key: 'isBuffered', value: function isBuffered(position) { - var v = this.media, - buffered = v.buffered; - for (var i = 0; i < buffered.length; i++) { - if (position >= buffered.start(i) && position <= buffered.end(i)) { - return true; + var media = this.media; + if (media) { + var buffered = media.buffered; + for (var i = 0; i < buffered.length; i++) { + if (position >= buffered.start(i) && position <= buffered.end(i)) { + return true; + } } } return false; @@ -1966,21 +2161,27 @@ var StreamController = function (_EventHandler) { _logger.logger.log('immediateLevelSwitch'); if (!this.immediateSwitch) { this.immediateSwitch = true; - this.previouslyPaused = this.media.paused; - this.media.pause(); + var media = this.media, + previouslyPaused = void 0; + if (media) { + previouslyPaused = media.paused; + media.pause(); + } else { + // don't restart playback after instant level switch in case media not attached + previouslyPaused = true; + } + this.previouslyPaused = previouslyPaused; } var fragCurrent = this.fragCurrent; if (fragCurrent && fragCurrent.loader) { fragCurrent.loader.abort(); } this.fragCurrent = null; - // flush everything - this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY }); - this.state = State.PAUSED; // increase fragment load Index to avoid frag loop loading error after buffer flush this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold; - // speed up switching, trigger timer function - this.tick(); + this.state = State.PAUSED; + // flush everything + this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY }); } /* @@ -1993,9 +2194,12 @@ var StreamController = function (_EventHandler) { key: 'immediateLevelSwitchEnd', value: function immediateLevelSwitchEnd() { this.immediateSwitch = false; - this.media.currentTime -= 0.0001; - if (!this.previouslyPaused) { - this.media.play(); + var media = this.media; + if (media && media.readyState) { + media.currentTime -= 0.0001; + if (!this.previouslyPaused) { + media.play(); + } } } }, { @@ -2006,45 +2210,51 @@ var StreamController = function (_EventHandler) { we need to find the next flushable buffer range we should take into account new segment fetch time */ - var fetchdelay, currentRange, nextRange; - currentRange = this.getBufferRange(this.media.currentTime); - if (currentRange && currentRange.start > 1) { - // flush buffer preceding current fragment (flush until current fragment start offset) - // minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ... - this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: currentRange.start - 1 }); - this.state = State.PAUSED; - } - if (!this.media.paused) { - // add a safety delay of 1s - var nextLevelId = this.hls.nextLoadLevel, - nextLevel = this.levels[nextLevelId], - fragLastKbps = this.fragLastKbps; - if (fragLastKbps && this.fragCurrent) { - fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1; + var media = this.media; + // ensure that media is defined and that metadata are available (to retrieve currentTime) + if (media && media.readyState) { + var fetchdelay = void 0, + currentRange = void 0, + nextRange = void 0; + // increase fragment load Index to avoid frag loop loading error after buffer flush + this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold; + currentRange = this.getBufferRange(media.currentTime); + if (currentRange && currentRange.start > 1) { + // flush buffer preceding current fragment (flush until current fragment start offset) + // minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ... + this.state = State.PAUSED; + this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: 0, endOffset: currentRange.start - 1 }); + } + if (!media.paused) { + // add a safety delay of 1s + var nextLevelId = this.hls.nextLoadLevel, + nextLevel = this.levels[nextLevelId], + fragLastKbps = this.fragLastKbps; + if (fragLastKbps && this.fragCurrent) { + fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1; + } else { + fetchdelay = 0; + } } else { fetchdelay = 0; } - } else { - fetchdelay = 0; - } - //logger.log('fetchdelay:'+fetchdelay); - // find buffer range that will be reached once new fragment will be fetched - nextRange = this.getBufferRange(this.media.currentTime + fetchdelay); - if (nextRange) { - // we can flush buffer range following this one without stalling playback - nextRange = this.followingBufferRange(nextRange); + //logger.log('fetchdelay:'+fetchdelay); + // find buffer range that will be reached once new fragment will be fetched + nextRange = this.getBufferRange(media.currentTime + fetchdelay); if (nextRange) { - // flush position is the start position of this new buffer - this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: nextRange.start, endOffset: Number.POSITIVE_INFINITY }); - this.state = State.PAUSED; - // if we are here, we can also cancel any loading/demuxing in progress, as they are useless - var fragCurrent = this.fragCurrent; - if (fragCurrent && fragCurrent.loader) { - fragCurrent.loader.abort(); + // we can flush buffer range following this one without stalling playback + nextRange = this.followingBufferRange(nextRange); + if (nextRange) { + // if we are here, we can also cancel any loading/demuxing in progress, as they are useless + var fragCurrent = this.fragCurrent; + if (fragCurrent && fragCurrent.loader) { + fragCurrent.loader.abort(); + } + this.fragCurrent = null; + // flush position is the start position of this new buffer + this.state = State.PAUSED; + this.hls.trigger(_events2.default.BUFFER_FLUSHING, { startOffset: nextRange.start, endOffset: Number.POSITIVE_INFINITY }); } - this.fragCurrent = null; - // increase fragment load Index to avoid frag loop loading error after buffer flush - this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold; } } } @@ -2058,8 +2268,9 @@ var StreamController = function (_EventHandler) { media.addEventListener('seeking', this.onvseeking); media.addEventListener('seeked', this.onvseeked); media.addEventListener('ended', this.onvended); - if (this.levels && this.config.autoStartLoad) { - this.hls.startLoad(); + var config = this.config; + if (this.levels && config.autoStartLoad) { + this.hls.startLoad(config.startPosition); } } }, { @@ -2174,8 +2385,9 @@ var StreamController = function (_EventHandler) { this.levels = data.levels; this.startLevelLoaded = false; this.startFragRequested = false; - if (this.config.autoStartLoad) { - this.hls.startLoad(); + var config = this.config; + if (config.autoStartLoad) { + this.hls.startLoad(config.startPosition); } } }, { @@ -2212,12 +2424,23 @@ var StreamController = function (_EventHandler) { curLevel.details = newDetails; this.hls.trigger(_events2.default.LEVEL_UPDATED, { details: newDetails, level: newLevelId }); - // compute start position if (this.startFragRequested === false) { - // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3) - if (newDetails.live) { - var targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * newDetails.targetduration; - this.startPosition = Math.max(0, sliding + duration - targetLatency); + // compute start position if set to -1. use it straight away if value is defined + if (this.startPosition === -1) { + // first, check if start time offset has been set in playlist, if yes, use this value + var startTimeOffset = newDetails.startTimeOffset; + if (!isNaN(startTimeOffset)) { + _logger.logger.log('start time offset found in playlist, adjust startPosition to ' + startTimeOffset); + this.startPosition = startTimeOffset; + } else { + // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3) + if (newDetails.live) { + var targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * newDetails.targetduration; + this.startPosition = Math.max(0, sliding + duration - targetLatency); + } else { + this.startPosition = 0; + } + } } this.nextLoadPosition = this.startPosition; } @@ -2241,10 +2464,13 @@ var StreamController = function (_EventHandler) { value: function onFragLoaded(data) { var fragCurrent = this.fragCurrent; if (this.state === State.FRAG_LOADING && fragCurrent && data.frag.level === fragCurrent.level && data.frag.sn === fragCurrent.sn) { + + _logger.logger.log('Loaded ' + fragCurrent.sn + ' of level ' + fragCurrent.level); if (this.fragBitrateTest === true) { // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo this.state = State.IDLE; this.fragBitrateTest = false; + this.startFragRequested = false; data.stats.tparsed = data.stats.tbuffered = performance.now(); this.hls.trigger(_events2.default.FRAG_BUFFERED, { stats: data.stats, frag: fragCurrent }); } else { @@ -2254,7 +2480,7 @@ var StreamController = function (_EventHandler) { var currentLevel = this.levels[this.level], details = currentLevel.details, duration = details.totalduration, - start = fragCurrent.start, + start = fragCurrent.startDTS !== undefined && !isNaN(fragCurrent.startDTS) ? fragCurrent.startDTS : fragCurrent.start, level = fragCurrent.level, sn = fragCurrent.sn, audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec; @@ -2272,8 +2498,11 @@ var StreamController = function (_EventHandler) { } } this.pendingAppending = 0; - _logger.logger.log('Demuxing ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],level ' + level); - this.demuxer.push(data.payload, audioCodec, currentLevel.videoCodec, start, fragCurrent.cc, level, sn, duration, fragCurrent.decryptdata); + _logger.logger.log('Demuxing ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],level ' + level + ', cc ' + fragCurrent.cc); + var demuxer = this.demuxer; + if (demuxer) { + demuxer.push(data.payload, audioCodec, currentLevel.videoCodec, start, fragCurrent.cc, level, sn, duration, fragCurrent.decryptdata); + } } } this.fragLoadError = 0; @@ -2364,22 +2593,27 @@ var StreamController = function (_EventHandler) { }, { key: 'onFragParsingData', value: function onFragParsingData(data) { - var _this3 = this; + var _this2 = this; if (this.state === State.PARSING) { this.tparse2 = Date.now(); var level = this.levels[this.level], frag = this.fragCurrent; - _logger.logger.log('parsed ' + data.type + ',PTS:[' + data.startPTS.toFixed(3) + ',' + data.endPTS.toFixed(3) + '],DTS:[' + data.startDTS.toFixed(3) + '/' + data.endDTS.toFixed(3) + '],nb:' + data.nb); + _logger.logger.log('parsed ' + data.type + ',PTS:[' + data.startPTS.toFixed(3) + ',' + data.endPTS.toFixed(3) + '],DTS:[' + data.startDTS.toFixed(3) + '/' + data.endDTS.toFixed(3) + '],nb:' + data.nb + ',dropped:' + (data.dropped || 0)); - var drift = _levelHelper2.default.updateFragPTS(level.details, frag.sn, data.startPTS, data.endPTS), + var drift = _levelHelper2.default.updateFragPTSDTS(level.details, frag.sn, data.startPTS, data.endPTS, data.startDTS, data.endDTS), hls = this.hls; hls.trigger(_events2.default.LEVEL_PTS_UPDATED, { details: level.details, level: this.level, drift: drift }); + // has remuxer dropped video frames located before first keyframe ? + if (data.type === 'video') { + frag.dropped = data.dropped; + } + [data.data1, data.data2].forEach(function (buffer) { if (buffer) { - _this3.pendingAppending++; + _this2.pendingAppending++; hls.trigger(_events2.default.BUFFER_APPENDING, { type: data.type, data: buffer }); } }); @@ -2478,11 +2712,15 @@ var StreamController = function (_EventHandler) { } break; case _errors.ErrorDetails.BUFFER_FULL_ERROR: - // trigger a smooth level switch to empty buffers - // also reduce max buffer length as it might be too high. we do this to avoid loop flushing ... - this.config.maxMaxBufferLength /= 2; - _logger.logger.warn('reduce max buffer length to ' + this.config.maxMaxBufferLength + 's and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError'); - this.nextLevelSwitch(); + // only reduce max buf len if in appending state + if (this.state === State.PARSING || this.state === State.PARSED) { + // reduce max buffer length as it might be too high. we do this to avoid loop flushing ... + this.config.maxMaxBufferLength /= 2; + _logger.logger.warn('reduce max buffer length to ' + this.config.maxMaxBufferLength + 's and switch to IDLE state'); + // increase fragment load Index to avoid frag loop loading error after buffer flush + this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold; + this.state = State.IDLE; + } break; default: break; @@ -2492,39 +2730,38 @@ var StreamController = function (_EventHandler) { key: '_checkBuffer', value: function _checkBuffer() { var media = this.media; - if (media) { - // compare readyState - var readyState = media.readyState; - // if ready state different from HAVE_NOTHING (numeric value 0), we are allowed to seek - if (readyState) { - var targetSeekPosition, currentTime; - // if seek after buffered defined, let's seek if within acceptable range - var seekAfterBuffered = this.seekAfterBuffered; - if (seekAfterBuffered) { - if (media.duration >= seekAfterBuffered) { - targetSeekPosition = seekAfterBuffered; - this.seekAfterBuffered = undefined; - } - } else { - currentTime = media.currentTime; - var loadedmetadata = this.loadedmetadata; - - // adjust currentTime to start position on loaded metadata - if (!loadedmetadata && media.buffered.length) { - this.loadedmetadata = true; - // only adjust currentTime if not equal to 0 - if (!currentTime && currentTime !== this.startPosition) { - targetSeekPosition = this.startPosition; + // if ready state different from HAVE_NOTHING (numeric value 0), we are allowed to seek + if (media && media.readyState) { + var currentTime = media.currentTime, + buffered = media.buffered; + // adjust currentTime to start position on loaded metadata + if (!this.loadedmetadata && buffered.length) { + this.loadedmetadata = true; + // only adjust currentTime if startPosition not equal to 0 + var startPosition = this.startPosition; + // if currentTime === 0 AND not matching with expected startPosition + if (!currentTime && currentTime !== startPosition) { + if (startPosition) { + _logger.logger.log('target start position:' + startPosition); + // at that stage, there should be only one buffered range, as we reach that code after first fragment has been + var bufferStart = buffered.start(0), + bufferEnd = buffered.end(0); + // if startPosition not buffered, let's seek to buffered.start(0) + if (startPosition < bufferStart || startPosition > bufferEnd) { + startPosition = bufferStart; + _logger.logger.log('target start position not buffered, seek to buffered.start(0) ' + bufferStart); } + _logger.logger.log('adjust currentTime from ' + currentTime + ' to ' + startPosition); + media.currentTime = startPosition; } } - if (targetSeekPosition) { - currentTime = targetSeekPosition; - _logger.logger.log('target seek position:' + targetSeekPosition); - } + } else { var bufferInfo = _bufferHelper2.default.bufferInfo(media, currentTime, 0), - expectedPlaying = !(media.paused || media.ended || media.seeking || readyState < 2), - jumpThreshold = 0.4, + expectedPlaying = !(media.paused || // not playing when media is paused + media.ended || // not playing when media is ended + media.buffered.length === 0), + // not playing if nothing buffered + jumpThreshold = 0.4, // tolerance needed as some browsers stalls playback before reaching buffered range end playheadMoving = currentTime > media.playbackRate * this.lastCurrentTime; @@ -2533,8 +2770,7 @@ var StreamController = function (_EventHandler) { _logger.logger.log('playback not stuck anymore @' + currentTime); } // check buffer upfront - // if less than jumpThreshold second is buffered, and media is expected to play but playhead is not moving, - // and we have a new buffer range available upfront, let's seek to that one + // if less than jumpThreshold second is buffered, let's check in more details if (expectedPlaying && bufferInfo.len <= jumpThreshold) { if (playheadMoving) { // playhead moving @@ -2551,24 +2787,20 @@ var StreamController = function (_EventHandler) { this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration; } } - // if we are below threshold, try to jump if next buffer range is close + // if we are below threshold, try to jump to start of next buffer range if close if (bufferInfo.len <= jumpThreshold) { // no buffer available @ currentTime, check if next buffer is close (within a config.maxSeekHole second range) var nextBufferStart = bufferInfo.nextStart, delta = nextBufferStart - currentTime; - if (nextBufferStart && delta < this.config.maxSeekHole && delta > 0 && !media.seeking) { + if (nextBufferStart && delta < this.config.maxSeekHole && delta > 0) { // next buffer is close ! adjust currentTime to nextBufferStart // this will ensure effective video decoding _logger.logger.log('adjust currentTime from ' + media.currentTime + ' to next buffered @ ' + nextBufferStart + ' + nudge ' + this.seekHoleNudgeDuration); + var hole = nextBufferStart + this.seekHoleNudgeDuration - media.currentTime; media.currentTime = nextBufferStart + this.seekHoleNudgeDuration; - this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false }); + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false, hole: hole }); } } - } else { - if (targetSeekPosition && media.currentTime !== targetSeekPosition) { - _logger.logger.log('adjust currentTime from ' + media.currentTime + ' to ' + targetSeekPosition); - media.currentTime = targetSeekPosition; - } } } } @@ -2659,7 +2891,7 @@ var StreamController = function (_EventHandler) { exports.default = StreamController; -},{"../demux/demuxer":16,"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../helper/level-helper":24,"../utils/binary-search":34,"../utils/logger":36}],8:[function(require,module,exports){ +},{"../demux/demuxer":17,"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../helper/level-helper":25,"../utils/binary-search":35,"../utils/logger":38}],9:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -2757,7 +2989,7 @@ var TimelineController = function (_EventHandler) { exports.default = TimelineController; -},{"../event-handler":21,"../events":22,"../utils/cea-708-interpreter":35}],9:[function(require,module,exports){ +},{"../event-handler":22,"../events":23,"../utils/cea-708-interpreter":36}],10:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3001,7 +3233,7 @@ var AES = function () { exports.default = AES; -},{}],10:[function(require,module,exports){ +},{}],11:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3187,7 +3419,7 @@ var AES128Decrypter = function () { exports.default = AES128Decrypter; -},{"./aes":9}],11:[function(require,module,exports){ +},{"./aes":10}],12:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3284,7 +3516,7 @@ var Decrypter = function () { exports.default = Decrypter; -},{"../errors":20,"../utils/logger":36,"./aes128-decrypter":10}],12:[function(require,module,exports){ +},{"../errors":21,"../utils/logger":38,"./aes128-decrypter":11}],13:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3412,7 +3644,7 @@ var AACDemuxer = function () { exports.default = AACDemuxer; -},{"../demux/id3":18,"../utils/logger":36,"./adts":13}],13:[function(require,module,exports){ +},{"../demux/id3":19,"../utils/logger":38,"./adts":14}],14:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3559,7 +3791,7 @@ var ADTS = function () { exports.default = ADTS; -},{"../errors":20,"../utils/logger":36}],14:[function(require,module,exports){ +},{"../errors":21,"../utils/logger":38}],15:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3642,7 +3874,7 @@ var DemuxerInline = function () { exports.default = DemuxerInline; -},{"../demux/aacdemuxer":12,"../demux/tsdemuxer":19,"../errors":20,"../events":22,"../remux/mp4-remuxer":31,"../remux/passthrough-remuxer":32}],15:[function(require,module,exports){ +},{"../demux/aacdemuxer":13,"../demux/tsdemuxer":20,"../errors":21,"../events":23,"../remux/mp4-remuxer":32,"../remux/passthrough-remuxer":33}],16:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3702,7 +3934,7 @@ var DemuxerWorker = function DemuxerWorker(self) { }); observer.on(_events2.default.FRAG_PARSING_DATA, function (ev, data) { - var objData = { event: ev, type: data.type, startPTS: data.startPTS, endPTS: data.endPTS, startDTS: data.startDTS, endDTS: data.endDTS, data1: data.data1.buffer, data2: data.data2.buffer, nb: data.nb }; + var objData = { event: ev, type: data.type, startPTS: data.startPTS, endPTS: data.endPTS, startDTS: data.startDTS, endDTS: data.endDTS, data1: data.data1.buffer, data2: data.data2.buffer, nb: data.nb, dropped: data.dropped }; // pass data1/data2 as transferable object (no copy) self.postMessage(objData, [objData.data1, objData.data2]); }); @@ -3731,7 +3963,7 @@ var DemuxerWorker = function DemuxerWorker(self) { exports.default = DemuxerWorker; -},{"../demux/demuxer-inline":14,"../events":22,"events":1}],16:[function(require,module,exports){ +},{"../demux/demuxer-inline":15,"../events":23,"events":1}],17:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3852,7 +4084,8 @@ var Demuxer = function () { startDTS: data.startDTS, endDTS: data.endDTS, type: data.type, - nb: data.nb + nb: data.nb, + dropped: data.dropped }); break; case _events2.default.FRAG_PARSING_METADATA: @@ -3877,7 +4110,7 @@ var Demuxer = function () { exports.default = Demuxer; -},{"../crypt/decrypter":11,"../demux/demuxer-inline":14,"../demux/demuxer-worker":15,"../events":22,"../utils/logger":36,"webworkify":2}],17:[function(require,module,exports){ +},{"../crypt/decrypter":12,"../demux/demuxer-inline":15,"../demux/demuxer-worker":16,"../events":23,"../utils/logger":38,"webworkify":2}],18:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4241,7 +4474,7 @@ var ExpGolomb = function () { exports.default = ExpGolomb; -},{"../utils/logger":36}],18:[function(require,module,exports){ +},{"../utils/logger":38}],19:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4394,7 +4627,7 @@ var ID3 = function () { exports.default = ID3; -},{"../utils/logger":36}],19:[function(require,module,exports){ +},{"../utils/logger":38}],20:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4450,12 +4683,14 @@ var TSDemuxer = function () { value: function switchLevel() { this.pmtParsed = false; this._pmtId = -1; - this.lastAacPTS = null; - this.aacOverFlow = null; - this._avcTrack = { container: 'video/mp2t', type: 'video', id: -1, sequenceNumber: 0, samples: [], len: 0, nbNalu: 0 }; + this._avcTrack = { container: 'video/mp2t', type: 'video', id: -1, sequenceNumber: 0, samples: [], len: 0, nbNalu: 0, dropped: 0 }; this._aacTrack = { container: 'video/mp2t', type: 'audio', id: -1, sequenceNumber: 0, samples: [], len: 0 }; this._id3Track = { type: 'id3', id: -1, sequenceNumber: 0, samples: [], len: 0 }; this._txtTrack = { type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0 }; + // flush any partial content + this.aacOverFlow = null; + this.aacLastPTS = null; + this.avcNaluState = 0; this.remuxer.switchLevel(); } }, { @@ -4479,7 +4714,8 @@ var TSDemuxer = function () { pid, atf, offset, - codecsOnly = this.remuxer.passthrough; + codecsOnly = this.remuxer.passthrough, + unknownPIDs = false; this.audioCodec = audioCodec; this.videoCodec = videoCodec; @@ -4490,7 +4726,8 @@ var TSDemuxer = function () { _logger.logger.log('discontinuity detected'); this.insertDiscontinuity(); this.lastCC = cc; - } else if (level !== this.lastLevel) { + } + if (level !== this.lastLevel) { _logger.logger.log('level switch detected'); this.switchLevel(); this.lastLevel = level; @@ -4499,11 +4736,6 @@ var TSDemuxer = function () { } this.lastSN = sn; - if (!this.contiguous) { - // flush any partial content - this.aacOverFlow = null; - } - var pmtParsed = this.pmtParsed, avcId = this._avcTrack.id, aacId = this._aacTrack.id, @@ -4593,6 +4825,15 @@ var TSDemuxer = function () { avcId = this._avcTrack.id; aacId = this._aacTrack.id; id3Id = this._id3Track.id; + if (unknownPIDs) { + _logger.logger.log('reparse from beginning'); + unknownPIDs = false; + // we set it to -188, the += 188 in the for loop will reset start to 0 + start = -188; + } + } else { + _logger.logger.log('unknown PID found before PAT/PMT'); + unknownPIDs = true; } } } else { @@ -4778,6 +5019,25 @@ var TSDemuxer = function () { pes.data = null; var debugString = ''; + var pushAccesUnit = function () { + if (units2.length) { + // only push AVC sample if keyframe already found in this fragment OR + // keyframe found in last fragment (track.sps) AND + // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous + if (key === true || track.sps && (samples.length || this.contiguous)) { + avcSample = { units: { units: units2, length: length }, pts: pes.pts, dts: pes.dts, key: key }; + samples.push(avcSample); + track.len += length; + track.nbNalu += units2.length; + } else { + // dropped samples, track it + track.dropped++; + } + units2 = []; + length = 0; + } + }.bind(this); + units.forEach(function (unit) { switch (unit.type) { //NDR @@ -4890,6 +5150,7 @@ var TSDemuxer = function () { if (debug) { debugString += 'AUD '; } + pushAccesUnit(); break; default: push = false; @@ -4904,17 +5165,7 @@ var TSDemuxer = function () { if (debug || debugString.length) { _logger.logger.log(debugString); } - //build sample from PES - // Annex B to MP4 conversion to be done - if (units2.length) { - // only push AVC sample if keyframe already found. browsers expect a keyframe at first to start decoding - if (key === true || track.sps) { - avcSample = { units: { units: units2, length: length }, pts: pes.pts, dts: pes.dts, key: key }; - samples.push(avcSample); - track.len += length; - track.nbNalu += units2.length; - } - } + pushAccesUnit(); } }, { key: '_parseAVCNALu', @@ -4923,7 +5174,7 @@ var TSDemuxer = function () { len = array.byteLength, value, overflow, - state = 0; + state = this.avcNaluState; var units = [], unit, unitType, @@ -4958,22 +5209,45 @@ var TSDemuxer = function () { //logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength); units.push(unit); } else { - // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit. - overflow = i - state - 1; - if (overflow) { + // lastUnitStart is undefined => this is the first start code found in this PES packet + // first check if start code delimiter is overlapping between 2 PES packets, + // ie it started in last packet (lastState not zero) + // and ended at the beginning of this PES packet (i <= 4 - lastState) + var lastState = this.avcNaluState; + if (lastState && i <= 4 - lastState) { + // start delimiter overlapping between PES packets + // strip start delimiter bytes from the end of last NAL unit var track = this._avcTrack, samples = track.samples; - //logger.log('first NALU found with overflow:' + overflow); if (samples.length) { var lastavcSample = samples[samples.length - 1], lastUnits = lastavcSample.units.units, - lastUnit = lastUnits[lastUnits.length - 1], - tmp = new Uint8Array(lastUnit.data.byteLength + overflow); - tmp.set(lastUnit.data, 0); - tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength); - lastUnit.data = tmp; - lastavcSample.units.length += overflow; - track.len += overflow; + lastUnit = lastUnits[lastUnits.length - 1]; + // check if lastUnit had a state different from zero + if (lastUnit.state) { + // strip last bytes + lastUnit.data = lastUnit.data.subarray(0, lastUnit.data.byteLength - lastState); + lastavcSample.units.length -= lastState; + track.len -= lastState; + } + } + } + // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit. + overflow = i - state - 1; + if (overflow > 0) { + var _track = this._avcTrack, + _samples = _track.samples; + //logger.log('first NALU found with overflow:' + overflow); + if (_samples.length) { + var _lastavcSample = _samples[_samples.length - 1], + _lastUnits = _lastavcSample.units.units, + _lastUnit = _lastUnits[_lastUnits.length - 1], + tmp = new Uint8Array(_lastUnit.data.byteLength + overflow); + tmp.set(_lastUnit.data, 0); + tmp.set(array.subarray(0, overflow), _lastUnit.data.byteLength); + _lastUnit.data = tmp; + _lastavcSample.units.length += overflow; + _track.len += overflow; } } } @@ -4989,9 +5263,10 @@ var TSDemuxer = function () { } } if (lastUnitStart) { - unit = { data: array.subarray(lastUnitStart, len), type: lastUnitType }; + unit = { data: array.subarray(lastUnitStart, len), type: lastUnitType, state: state }; units.push(unit); - //logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength); + //logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state); + this.avcNaluState = state; } return units; } @@ -5005,7 +5280,7 @@ var TSDemuxer = function () { duration = this._duration, audioCodec = this.audioCodec, aacOverFlow = this.aacOverFlow, - lastAacPTS = this.lastAacPTS, + aacLastPTS = this.aacLastPTS, config, frameLength, frameDuration, @@ -5057,8 +5332,8 @@ var TSDemuxer = function () { // if last AAC frame is overflowing, we should ensure timestamps are contiguous: // first sample PTS should be equal to last sample PTS + frameDuration - if (aacOverFlow && lastAacPTS) { - var newPTS = lastAacPTS + frameDuration; + if (aacOverFlow && aacLastPTS) { + var newPTS = aacLastPTS + frameDuration; if (Math.abs(newPTS - pts) > 1) { _logger.logger.log('AAC: align PTS for overlapping frames by ' + Math.round((newPTS - pts) / 90)); pts = newPTS; @@ -5098,7 +5373,7 @@ var TSDemuxer = function () { aacOverFlow = null; } this.aacOverFlow = aacOverFlow; - this.lastAacPTS = stamp; + this.aacLastPTS = stamp; } }, { key: '_parseID3PES', @@ -5122,7 +5397,7 @@ var TSDemuxer = function () { exports.default = TSDemuxer; -},{"../errors":20,"../events":22,"../utils/logger":36,"./adts":13,"./exp-golomb":17}],20:[function(require,module,exports){ +},{"../errors":21,"../events":23,"../utils/logger":38,"./adts":14,"./exp-golomb":18}],21:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5180,7 +5455,7 @@ var ErrorDetails = exports.ErrorDetails = { INTERNAL_EXCEPTION: 'internalException' }; -},{}],21:[function(require,module,exports){ +},{}],22:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5199,6 +5474,12 @@ var _logger = require('./utils/logger'); var _errors = require('./errors'); +var _events = require('./events'); + +var _events2 = _interopRequireDefault(_events); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var EventHandler = function () { @@ -5273,7 +5554,7 @@ var EventHandler = function () { eventToFunction.call(this, event, data).call(); } catch (err) { _logger.logger.error('internal error happened while processing ' + event + ':' + err.message); - this.hls.trigger(Event.ERROR, { type: _errors.ErrorTypes.OTHER_ERROR, details: _errors.ErrorDetails.INTERNAL_EXCEPTION, fatal: false, event: event, err: err }); + this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.OTHER_ERROR, details: _errors.ErrorDetails.INTERNAL_EXCEPTION, fatal: false, event: event, err: err }); } } }]); @@ -5283,7 +5564,7 @@ var EventHandler = function () { exports.default = EventHandler; -},{"./errors":20,"./utils/logger":36}],22:[function(require,module,exports){ +},{"./errors":21,"./events":23,"./utils/logger":38}],23:[function(require,module,exports){ 'use strict'; module.exports = { @@ -5359,7 +5640,7 @@ module.exports = { KEY_LOADED: 'hlsKeyLoaded' }; -},{}],23:[function(require,module,exports){ +},{}],24:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -5462,7 +5743,7 @@ var BufferHelper = function () { exports.default = BufferHelper; -},{}],24:[function(require,module,exports){ +},{}],25:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5502,12 +5783,14 @@ var LevelHelper = function () { for (var i = start; i <= end; i++) { var oldFrag = oldfragments[delta + i], newFrag = newfragments[i]; - ccOffset = oldFrag.cc - newFrag.cc; - if (!isNaN(oldFrag.startPTS)) { - newFrag.start = newFrag.startPTS = oldFrag.startPTS; - newFrag.endPTS = oldFrag.endPTS; - newFrag.duration = oldFrag.duration; - PTSFrag = newFrag; + if (newFrag && oldFrag) { + ccOffset = oldFrag.cc - newFrag.cc; + if (!isNaN(oldFrag.startPTS)) { + newFrag.start = newFrag.startPTS = oldFrag.startPTS; + newFrag.endPTS = oldFrag.endPTS; + newFrag.duration = oldFrag.duration; + PTSFrag = newFrag; + } } } @@ -5520,7 +5803,7 @@ var LevelHelper = function () { // if at least one fragment contains PTS info, recompute PTS information for all fragments if (PTSFrag) { - LevelHelper.updateFragPTS(newDetails, PTSFrag.sn, PTSFrag.startPTS, PTSFrag.endPTS); + LevelHelper.updateFragPTSDTS(newDetails, PTSFrag.sn, PTSFrag.startPTS, PTSFrag.endPTS, PTSFrag.startDTS, PTSFrag.endDTS); } else { // ensure that delta is within oldfragments range // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61]) @@ -5539,8 +5822,8 @@ var LevelHelper = function () { return; } }, { - key: 'updateFragPTS', - value: function updateFragPTS(details, sn, startPTS, endPTS) { + key: 'updateFragPTSDTS', + value: function updateFragPTSDTS(details, sn, startPTS, endPTS, startDTS, endDTS) { var fragIdx, fragments, frag, i; // exit if sn out of range if (sn < details.startSN || sn > details.endSN) { @@ -5550,14 +5833,25 @@ var LevelHelper = function () { fragments = details.fragments; frag = fragments[fragIdx]; if (!isNaN(frag.startPTS)) { + // delta PTS between audio and video + var deltaPTS = Math.abs(frag.startPTS - startPTS); + if (isNaN(frag.deltaPTS)) { + frag.deltaPTS = deltaPTS; + } else { + frag.deltaPTS = Math.max(deltaPTS, frag.deltaPTS); + } startPTS = Math.min(startPTS, frag.startPTS); endPTS = Math.max(endPTS, frag.endPTS); + startDTS = Math.min(startDTS, frag.startDTS); + endDTS = Math.max(endDTS, frag.endDTS); } var drift = startPTS - frag.start; frag.start = frag.startPTS = startPTS; frag.endPTS = endPTS; + frag.startDTS = startDTS; + frag.endDTS = endDTS; frag.duration = endPTS - startPTS; // adjust fragment PTS/duration from seqnum-1 to frag 0 for (i = fragIdx; i > 0; i--) { @@ -5610,7 +5904,7 @@ var LevelHelper = function () { exports.default = LevelHelper; -},{"../utils/logger":36}],25:[function(require,module,exports){ +},{"../utils/logger":38}],26:[function(require,module,exports){ /** * HLS interface */ @@ -5684,7 +5978,7 @@ var Hls = function () { _createClass(Hls, null, [{ key: 'isSupported', value: function isSupported() { - return window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'); + return window.MediaSource && typeof window.MediaSource.isTypeSupported === 'function' && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'); } }, { key: 'Events', @@ -5707,6 +6001,7 @@ var Hls = function () { if (!Hls.defaultConfig) { Hls.defaultConfig = { autoStartLoad: true, + startPosition: -1, debug: false, capLevelToPlayerSize: false, maxBufferLength: 30, @@ -5714,6 +6009,7 @@ var Hls = function () { maxBufferHole: 0.5, maxSeekHole: 2, seekHoleNudgeDuration: 0.01, + stalledInBufferedNudgeThreshold: 10, maxFragLookUpTolerance: 0.2, liveSyncDurationCount: 3, liveMaxLatencyDurationCount: Infinity, @@ -5745,7 +6041,14 @@ var Hls = function () { streamController: _streamController2.default, timelineController: _timelineController2.default, enableCEA708Captions: true, - enableMP2TPassThrough: false + enableMP2TPassThrough: false, + abrEwmaFastLive: 5, + abrEwmaSlowLive: 9, + abrEwmaFastVoD: 4, + abrEwmaSlowVoD: 15, + abrEwmaDefaultEstimate: 5e5, // 500 kbps + abrBandWidthFactor: 0.8, + abrBandWidthUpFactor: 0.7 }; } return Hls.defaultConfig; @@ -5859,7 +6162,7 @@ var Hls = function () { }, { key: 'startLoad', value: function startLoad() { - var startPosition = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; + var startPosition = arguments.length <= 0 || arguments[0] === undefined ? -1 : arguments[0]; _logger.logger.log('startLoad'); this.levelController.startLoad(); @@ -6031,7 +6334,7 @@ var Hls = function () { exports.default = Hls; -},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":6,"./controller/stream-controller":7,"./controller/timeline-controller":8,"./errors":20,"./events":22,"./loader/fragment-loader":27,"./loader/key-loader":28,"./loader/playlist-loader":29,"./utils/logger":36,"./utils/xhr-loader":38,"events":1}],26:[function(require,module,exports){ +},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":7,"./controller/stream-controller":8,"./controller/timeline-controller":9,"./errors":21,"./events":23,"./loader/fragment-loader":28,"./loader/key-loader":29,"./loader/playlist-loader":30,"./utils/logger":38,"./utils/xhr-loader":40,"events":1}],27:[function(require,module,exports){ 'use strict'; // This is mostly for support of the es6 module export @@ -6039,7 +6342,7 @@ exports.default = Hls; // function exports like we are used to in node/commonjs module.exports = require('./hls.js').default; -},{"./hls.js":25}],27:[function(require,module,exports){ +},{"./hls.js":26}],28:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6134,7 +6437,7 @@ var FragmentLoader = function (_EventHandler) { exports.default = FragmentLoader; -},{"../errors":20,"../event-handler":21,"../events":22}],28:[function(require,module,exports){ +},{"../errors":21,"../event-handler":22,"../events":23}],29:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6239,7 +6542,7 @@ var KeyLoader = function (_EventHandler) { exports.default = KeyLoader; -},{"../errors":20,"../event-handler":21,"../events":22}],29:[function(require,module,exports){ +},{"../errors":21,"../event-handler":22,"../events":23}],30:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6266,6 +6569,8 @@ var _attrList = require('../utils/attr-list'); var _attrList2 = _interopRequireDefault(_attrList); +var _logger = require('../utils/logger'); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -6276,8 +6581,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" * Playlist Loader */ -//import {logger} from '../utils/logger'; - var PlaylistLoader = function (_EventHandler) { _inherits(PlaylistLoader, _EventHandler); @@ -6314,6 +6617,17 @@ var PlaylistLoader = function (_EventHandler) { retry, timeout, retryDelay; + + if (this.loading && this.loader) { + if (this.url === url && this.id === id1 && this.id2 === id2) { + // same request than last pending one, don't do anything + return; + } else { + // one playlist load request is pending, but with different params, abort it before loading new playlist + this.loader.abort(); + } + } + this.url = url; this.id = id1; this.id2 = id2; @@ -6327,6 +6641,7 @@ var PlaylistLoader = function (_EventHandler) { retryDelay = config.levelLoadingRetryDelay; } this.loader = typeof config.pLoader !== 'undefined' ? new config.pLoader(config) : new config.loader(config); + this.loading = true; this.loader.load(url, '', this.loadsuccess.bind(this), this.loaderror.bind(this), this.loadtimeout.bind(this), timeout, retry, retryDelay); } }, { @@ -6373,6 +6688,43 @@ var PlaylistLoader = function (_EventHandler) { } return levels; } + + /** + * Utility method for parseLevelPlaylist to create an initialization vector for a given segment + * @returns {Uint8Array} + */ + + }, { + key: 'createInitializationVector', + value: function createInitializationVector(segmentNumber) { + var uint8View = new Uint8Array(16); + + for (var i = 12; i < 16; i++) { + uint8View[i] = segmentNumber >> 8 * (15 - i) & 0xff; + } + + return uint8View; + } + + /** + * Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data + * @param levelkey - a playlist's encryption info + * @param segmentNumber - the fragment's segment number + * @returns {*} - an object to be applied as a fragment's decryptdata + */ + + }, { + key: 'fragmentDecryptdataFromLevelkey', + value: function fragmentDecryptdataFromLevelkey(levelkey, segmentNumber) { + var decryptdata = levelkey; + + if (levelkey && levelkey.method && levelkey.uri && !levelkey.iv) { + decryptdata = this.cloneObj(levelkey); + decryptdata.iv = this.createInitializationVector(segmentNumber); + } + + return decryptdata; + } }, { key: 'avc1toavcoti', value: function avc1toavcoti(codec) { @@ -6396,30 +6748,41 @@ var PlaylistLoader = function (_EventHandler) { key: 'parseLevelPlaylist', value: function parseLevelPlaylist(string, baseurl, id) { var currentSN = 0, + fragdecryptdata, totalduration = 0, - level = { url: baseurl, fragments: [], live: true, startSN: 0 }, + level = { version: null, type: null, url: baseurl, fragments: [], live: true, startSN: 0 }, levelkey = { method: null, key: null, iv: null, uri: null }, cc = 0, programDateTime = null, frag = null, result, regexp, - byteRangeEndOffset, - byteRangeStartOffset; + duration = null, + title = null, + byteRangeEndOffset = null, + byteRangeStartOffset = null; - regexp = /(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*))/g; + regexp = /(?:(?:#(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-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g; while ((result = regexp.exec(string)) !== null) { result.shift(); result = result.filter(function (n) { return n !== undefined; }); switch (result[0]) { + case 'VERSION': + level.version = parseInt(result[1]); + break; + case 'PLAYLIST-TYPE': + level.type = result[1].toUpperCase(); + break; case 'MEDIA-SEQUENCE': currentSN = level.startSN = parseInt(result[1]); break; case 'TARGETDURATION': level.targetduration = parseFloat(result[1]); break; + case 'EXTM3U': + break; case 'ENDLIST': level.live = false; break; @@ -6434,31 +6797,35 @@ var PlaylistLoader = function (_EventHandler) { byteRangeStartOffset = parseInt(params[1]); } byteRangeEndOffset = parseInt(params[0]) + byteRangeStartOffset; - if (frag && !frag.url) { - frag.byteRangeStartOffset = byteRangeStartOffset; - frag.byteRangeEndOffset = byteRangeEndOffset; - frag.url = this.resolve(result[2], baseurl); - } break; case 'INF': - var duration = parseFloat(result[1]); + duration = parseFloat(result[1]); + title = result[2] ? result[2] : null; + break; + case '': + // url if (!isNaN(duration)) { - var fragdecryptdata, - sn = currentSN++; - if (levelkey.method && levelkey.uri && !levelkey.iv) { - fragdecryptdata = this.cloneObj(levelkey); - var uint8View = new Uint8Array(16); - for (var i = 12; i < 16; i++) { - uint8View[i] = sn >> 8 * (15 - i) & 0xff; - } - fragdecryptdata.iv = uint8View; - } else { - fragdecryptdata = levelkey; + var sn = currentSN++; + fragdecryptdata = this.fragmentDecryptdataFromLevelkey(levelkey, sn); + var url = result[1] ? this.resolve(result[1], baseurl) : null; + frag = { url: url, + duration: duration, + title: title, + start: totalduration, + sn: sn, + level: id, + cc: cc, + decryptdata: fragdecryptdata, + programDateTime: programDateTime }; + // only include byte range options if used/needed + if (byteRangeStartOffset !== null) { + frag.byteRangeStartOffset = byteRangeStartOffset; + frag.byteRangeEndOffset = byteRangeEndOffset; } - var url = result[2] ? this.resolve(result[2], baseurl) : null; - frag = { url: url, duration: duration, start: totalduration, sn: sn, level: id, cc: cc, byteRangeStartOffset: byteRangeStartOffset, byteRangeEndOffset: byteRangeEndOffset, decryptdata: fragdecryptdata, programDateTime: programDateTime }; level.fragments.push(frag); totalduration += duration; + duration = null; + title = null; byteRangeStartOffset = null; programDateTime = null; } @@ -6482,10 +6849,22 @@ var PlaylistLoader = function (_EventHandler) { } } break; + case 'START': + var startParams = result[1]; + var startAttrs = new _attrList2.default(startParams); + var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET'); + if (startTimeOffset) { + level.startTimeOffset = startTimeOffset; + } + break; case 'PROGRAM-DATE-TIME': programDateTime = new Date(Date.parse(result[1])); break; + case '#': + result.shift(); + break; default: + _logger.logger.warn('line parsed but not handled: ' + result); break; } } @@ -6508,6 +6887,8 @@ var PlaylistLoader = function (_EventHandler) { id2 = this.id2, hls = this.hls, levels; + + this.loading = false; // responseURL not supported on some browsers (it is used to detect URL redirection) if (url === undefined) { // fallback to initial URL @@ -6554,6 +6935,7 @@ var PlaylistLoader = function (_EventHandler) { if (this.loader) { this.loader.abort(); } + this.loading = false; this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: details, fatal: fatal, url: this.url, loader: this.loader, response: event.currentTarget, level: this.id, id: this.id2 }); } }, { @@ -6570,6 +6952,7 @@ var PlaylistLoader = function (_EventHandler) { if (this.loader) { this.loader.abort(); } + this.loading = false; this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.NETWORK_ERROR, details: details, fatal: fatal, url: this.url, loader: this.loader, level: this.id, id: this.id2 }); } }]); @@ -6579,7 +6962,7 @@ var PlaylistLoader = function (_EventHandler) { exports.default = PlaylistLoader; -},{"../errors":20,"../event-handler":21,"../events":22,"../utils/attr-list":33,"../utils/url":37}],30:[function(require,module,exports){ +},{"../errors":21,"../event-handler":22,"../events":23,"../utils/attr-list":34,"../utils/logger":38,"../utils/url":39}],31:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -7088,7 +7471,7 @@ var MP4 = function () { exports.default = MP4; -},{}],31:[function(require,module,exports){ +},{}],32:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -7132,7 +7515,7 @@ var MP4Remuxer = function () { }, { key: 'insertDiscontinuity', value: function insertDiscontinuity() { - this._initPTS = this._initDTS = this.nextAacPts = this.nextAvcDts = undefined; + this._initPTS = this._initDTS = undefined; } }, { key: 'switchLevel', @@ -7265,6 +7648,14 @@ var MP4Remuxer = function () { dtsnorm, flags, samples = []; + + // handle broken streams with PTS < DTS, tolerance up 200ms (18000 in 90kHz timescale) + var PTSDTSshift = track.samples.reduce(function (prev, curr) { + return Math.max(Math.min(prev, curr.pts - curr.dts), -18000); + }, 0); + if (PTSDTSshift < 0) { + _logger.logger.warn('PTS < DTS detected in video samples, shifting DTS by ' + Math.round(PTSDTSshift / 90) + ' ms to overcome this issue'); + } /* concatenate the video data and construct the mdat in place (need 8 more bytes to fill length and mpdat type) */ mdat = new Uint8Array(track.len + 4 * track.nbNalu + 8); @@ -7284,10 +7675,11 @@ var MP4Remuxer = function () { mp4SampleLength += 4 + unit.data.byteLength; } pts = avcSample.pts - this._initDTS; - dts = avcSample.dts - this._initDTS; - // ensure DTS is not bigger than PTS + // shift dts by PTSDTSshift, to ensure that PTS >= DTS + dts = avcSample.dts - this._initDTS + PTSDTSshift; + // ensure DTS is not bigger than PTS // strap belt !!! dts = Math.min(pts, dts); - //logger.log(`Video/PTS/DTS:${Math.round(pts/90)}/${Math.round(dts/90)}`); + //logger.log(`Video/PTS/DTS/ptsnorm/DTSnorm:${Math.round(avcSample.pts/90)}/${Math.round(avcSample.dts/90)}/${Math.round(pts/90)}/${Math.round(dts/90)}`); // if not first AVC sample of video track, normalize PTS/DTS with previous sample value // and ensure that sample duration is positive if (lastDTS !== undefined) { @@ -7311,8 +7703,8 @@ var MP4Remuxer = function () { ptsnorm = this._PTSNormalize(pts, nextAvcDts); dtsnorm = this._PTSNormalize(dts, nextAvcDts); delta = Math.round((dtsnorm - nextAvcDts) / 90); - // if fragment are contiguous, or if there is a huge delta (more than 10s) between expected PTS and sample PTS - if (contiguous || Math.abs(delta) > 10000) { + // if fragment are contiguous, detect hole/overlapping between fragments + if (contiguous) { if (delta) { if (delta > 1) { _logger.logger.log('AVC:' + delta + ' ms hole between fragments detected,filling it'); @@ -7330,7 +7722,7 @@ var MP4Remuxer = function () { firstPTS = Math.max(0, ptsnorm); firstDTS = Math.max(0, dtsnorm); } - //console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${this._initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}'); + //console.log(`PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${this._initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}); mp4Sample = { size: mp4SampleLength, duration: 0, @@ -7361,8 +7753,10 @@ var MP4Remuxer = function () { } // next AVC sample DTS should be equal to last sample DTS + last sample duration this.nextAvcDts = dtsnorm + lastSampleDuration * pes2mp4ScaleFactor; + var dropped = track.dropped; track.len = 0; track.nbNalu = 0; + track.dropped = 0; if (samples.length && navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { flags = samples[0].flags; // chrome workaround, mark first sample as being a Random Access Point to avoid sourcebuffer append issue @@ -7381,7 +7775,8 @@ var MP4Remuxer = function () { startDTS: firstDTS / pesTimeScale, endDTS: this.nextAvcDts / pesTimeScale, type: 'video', - nb: samples.length + nb: samples.length, + dropped: dropped }); } }, { @@ -7432,7 +7827,7 @@ var MP4Remuxer = function () { } // always adjust sample duration to avoid av sync issue mp4Sample.duration = expectedSampleDuration; - dtsnorm = expectedSampleDuration * pes2mp4ScaleFactor + lastDTS; + ptsnorm = dtsnorm = expectedSampleDuration * pes2mp4ScaleFactor + lastDTS; } else { var nextAacPts = void 0, delta = void 0; @@ -7444,13 +7839,13 @@ var MP4Remuxer = function () { ptsnorm = this._PTSNormalize(pts, nextAacPts); dtsnorm = this._PTSNormalize(dts, nextAacPts); delta = Math.round(1000 * (ptsnorm - nextAacPts) / pesTimeScale); - // if fragment are contiguous, or if there is a huge delta (more than 10s) between expected PTS and sample PTS - if (contiguous || Math.abs(delta) > 10000) { + // if fragment are contiguous, detect hole/overlapping between fragments + if (contiguous) { // log delta if (delta) { if (delta > 0) { _logger.logger.log(delta + ' ms hole between AAC samples detected,filling it'); - // if we have frame overlap, overlapping for more than half a frame duraion + // if we have frame overlap, overlapping for more than half a frame duration } else if (delta < -12) { // drop overlapping audio frames... browser will deal with it _logger.logger.log(-delta + ' ms overlapping between AAC samples detected, drop frame'); @@ -7602,7 +7997,7 @@ var MP4Remuxer = function () { exports.default = MP4Remuxer; -},{"../errors":20,"../events":22,"../remux/mp4-generator":30,"../utils/logger":36}],32:[function(require,module,exports){ +},{"../errors":21,"../events":23,"../remux/mp4-generator":31,"../utils/logger":38}],33:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -7682,7 +8077,8 @@ var PassThroughRemuxer = function () { startPTS: timeOffset, startDTS: timeOffset, type: 'audiovideo', - nb: 1 + nb: 1, + dropped: 0 }); } }, { @@ -7697,7 +8093,7 @@ var PassThroughRemuxer = function () { exports.default = PassThroughRemuxer; -},{"../events":22}],33:[function(require,module,exports){ +},{"../events":23}],34:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -7804,7 +8200,7 @@ var AttrList = function () { exports.default = AttrList; -},{}],34:[function(require,module,exports){ +},{}],35:[function(require,module,exports){ "use strict"; var BinarySearch = { @@ -7849,7 +8245,7 @@ var BinarySearch = { module.exports = BinarySearch; -},{}],35:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -8269,7 +8665,66 @@ var CEA708Interpreter = function () { exports.default = CEA708Interpreter; -},{}],36:[function(require,module,exports){ +},{}],37:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/* + * compute an Exponential Weighted moving average + * - https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average + * - heavily inspired from shaka-player + */ + +var EWMA = function () { + + // About half of the estimated value will be from the last |halfLife| samples by weight. + + function EWMA(halfLife) { + _classCallCheck(this, EWMA); + + // Larger values of alpha expire historical data more slowly. + this.alpha_ = halfLife ? Math.exp(Math.log(0.5) / halfLife) : 0; + this.estimate_ = 0; + this.totalWeight_ = 0; + } + + _createClass(EWMA, [{ + key: "sample", + value: function sample(weight, value) { + var adjAlpha = Math.pow(this.alpha_, weight); + this.estimate_ = value * (1 - adjAlpha) + adjAlpha * this.estimate_; + this.totalWeight_ += weight; + } + }, { + key: "getTotalWeight", + value: function getTotalWeight() { + return this.totalWeight_; + } + }, { + key: "getEstimate", + value: function getEstimate() { + if (this.alpha_) { + var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_); + return this.estimate_ / zeroFactor; + } else { + return this.estimate_; + } + } + }]); + + return EWMA; +}(); + +exports.default = EWMA; + +},{}],38:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -8352,11 +8807,10 @@ var enableLogs = exports.enableLogs = function enableLogs(debugConfig) { var logger = exports.logger = exportedLogger; -},{}],37:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ 'use strict'; var URLHelper = { - // build an absolute URL from a relative one using the provided baseURL // if relativeURL is an absolute URL it will be returned as is. buildAbsoluteURL: function buildAbsoluteURL(baseURL, relativeURL) { @@ -8390,18 +8844,27 @@ var URLHelper = { baseURL = baseURLQuerySplit[1]; } - var baseURLDomainSplit = /^((([a-z]+):)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?\/)(.*)$/i.exec(baseURL); - var baseURLProtocol = baseURLDomainSplit[3]; - var baseURLDomain = baseURLDomainSplit[1]; - var baseURLPath = baseURLDomainSplit[5]; + var baseURLDomainSplit = /^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(baseURL); + if (!baseURLDomainSplit) { + throw new Error('Error trying to parse base URL.'); + } + + // e.g. 'http:', 'https:', '' + var baseURLProtocol = baseURLDomainSplit[2] || ''; + // e.g. 'http://example.com', '//example.com', '' + var baseURLProtocolDomain = baseURLDomainSplit[1] || ''; + // e.g. '/a/b/c/playlist.m3u8' + var baseURLPath = baseURLDomainSplit[4]; var builtURL = null; if (/^\/\//.test(relativeURL)) { - builtURL = baseURLProtocol + '://' + URLHelper.buildAbsolutePath('', relativeURL.substring(2)); + // relative url starts wth '//' so copy protocol (which may be '' if baseUrl didn't provide one) + builtURL = baseURLProtocol + '//' + URLHelper.buildAbsolutePath('', relativeURL.substring(2)); } else if (/^\//.test(relativeURL)) { - builtURL = baseURLDomain + URLHelper.buildAbsolutePath('', relativeURL.substring(1)); + // relative url starts with '/' so start from root of domain + builtURL = baseURLProtocolDomain + '/' + URLHelper.buildAbsolutePath('', relativeURL.substring(1)); } else { - builtURL = URLHelper.buildAbsolutePath(baseURLDomain + baseURLPath, relativeURL); + builtURL = URLHelper.buildAbsolutePath(baseURLProtocolDomain + baseURLPath, relativeURL); } // put the query and hash parts back @@ -8432,7 +8895,7 @@ var URLHelper = { module.exports = URLHelper; -},{}],38:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -8515,8 +8978,9 @@ var XhrLoader = function () { xhr.setRequestHeader('Range', 'bytes=' + this.byteRange); } xhr.responseType = this.responseType; - this.stats.tfirst = null; - this.stats.loaded = 0; + var stats = this.stats; + stats.tfirst = 0; + stats.loaded = 0; if (this.xhrSetup) { this.xhrSetup(xhr, this.url); } @@ -8534,21 +8998,21 @@ var XhrLoader = function () { // http status between 200 to 299 are all successful if (status >= 200 && status < 300) { window.clearTimeout(this.timeoutHandle); - stats.tload = performance.now(); + stats.tload = Math.max(stats.tfirst, performance.now()); this.onSuccess(event, stats); } else { - // error ... - if (stats.retry < this.maxRetry) { + // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error + if (stats.retry >= this.maxRetry || status >= 400 && status < 499) { + window.clearTimeout(this.timeoutHandle); + _logger.logger.error(status + ' while loading ' + this.url); + this.onError(event); + } else { _logger.logger.warn(status + ' while loading ' + this.url + ', retrying in ' + this.retryDelay + '...'); this.destroy(); window.setTimeout(this.loadInternal.bind(this), this.retryDelay); // exponential backoff this.retryDelay = Math.min(2 * this.retryDelay, 64000); stats.retry++; - } else { - window.clearTimeout(this.timeoutHandle); - _logger.logger.error(status + ' while loading ' + this.url); - this.onError(event); } } } @@ -8563,8 +9027,8 @@ var XhrLoader = function () { key: 'loadprogress', value: function loadprogress(event) { var stats = this.stats; - if (stats.tfirst === null) { - stats.tfirst = performance.now(); + if (stats.tfirst === 0) { + stats.tfirst = Math.max(performance.now(), stats.trequest); } stats.loaded = event.loaded; if (this.onProgress) { @@ -8578,6 +9042,6 @@ var XhrLoader = function () { exports.default = XhrLoader; -},{"../utils/logger":36}]},{},[26])(26) +},{"../utils/logger":38}]},{},[27])(27) }); //# sourceMappingURL=hls.js.map diff --git a/src/js/lib/hls.js.map b/src/js/lib/hls.js.map deleted file mode 100644 index 3ea86e1..0000000 --- a/src/js/lib/hls.js.map +++ /dev/null @@ -1,89 +0,0 @@ -{ - "version": 3, - "sources": [ - "node_modules/browser-pack/_prelude.js", - "node_modules/events/events.js", - "node_modules/webworkify/index.js", - "src/controller/abr-controller.js", - "src/controller/buffer-controller.js", - "src/controller/cap-level-controller.js", - "src/controller/level-controller.js", - "src/controller/stream-controller.js", - "src/controller/timeline-controller.js", - "src/crypt/aes.js", - "src/crypt/aes128-decrypter.js", - "src/crypt/decrypter.js", - "src/demux/aacdemuxer.js", - "src/demux/adts.js", - "src/demux/demuxer-inline.js", - "src/demux/demuxer-worker.js", - "src/demux/demuxer.js", - "src/demux/exp-golomb.js", - "src/demux/id3.js", - "src/demux/tsdemuxer.js", - "src/errors.js", - "src/event-handler.js", - "src/events.js", - "src/helper/buffer-helper.js", - "src/helper/level-helper.js", - "src/hls.js", - "src/index.js", - "src/loader/fragment-loader.js", - "src/loader/key-loader.js", - "src/loader/playlist-loader.js", - "src/remux/mp4-generator.js", - "src/remux/mp4-remuxer.js", - "src/remux/passthrough-remuxer.js", - "src/utils/attr-list.js", - "src/utils/binary-search.js", - "src/utils/cea-708-interpreter.js", - "src/utils/logger.js", - "src/utils/url.js", - "src/utils/xhr-loader.js" - ], - "names": [], - "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3DA;;;;AACA;;;;AACA;;;;AACA;;AACA;;;;;;;;;;;;;;IAEM;;;AAEJ,WAFI,aAEJ,CAAY,GAAZ,EAAiB;0BAFb,eAEa;;uEAFb,0BAGI,KAAK,iBAAM,YAAN,EACA,iBAAM,kBAAN,EACA,iBAAM,WAAN,EACA,iBAAM,KAAN,GAJI;;AAKf,UAAK,mBAAL,GAA2B,CAA3B,CALe;AAMf,UAAK,iBAAL,GAAyB,CAAC,CAAD,CANV;AAOf,UAAK,cAAL,GAAsB,CAAC,CAAD,CAPP;AAQf,UAAK,GAAL,GAAW,GAAX,CARe;AASf,UAAK,OAAL,G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,CAAa,KAAb,EAHK;WAPP;SANA;OAFJ;;;;gCAwBU,OAAO;AACjB,qBAAO,IAAP,4BAAqC,KAAK,GAAL,CAArC,CADiB;AAEjB,WAAK,SAAL,CAAe,KAAf,EAAsB,KAAK,KAAL,CAAtB,CAFiB;;;;iCAKN,OAAO;AAClB,UAAI,QAAQ,KAAK,KAAL,CADM;AAElB,UAAI,MAAM,MAAN,KAAiB,IAAjB,EAAuB;AACzB,cAAM,MAAN,GAAe,YAAY,GAAZ,EAAf,CADyB;OAA3B;AAGA,YAAM,MAAN,GAAe,MAAM,MAAN,CALG;AAMlB,UAAI,KAAK,UAAL,EAAiB;AACnB,aAAK,UAAL,CAAgB,KAAhB,EAAuB,KAAvB,EADmB;OAArB;;;;SA5GE;;;kBAkHS", - "file": "generated.js", - "sourceRoot": "", - "sourcesContent": [ - "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n", - "var bundleFn = arguments[3];\nvar sources = arguments[4];\nvar cache = arguments[5];\n\nvar stringify = JSON.stringify;\n\nmodule.exports = function (fn) {\n var keys = [];\n var wkey;\n var cacheKeys = Object.keys(cache);\n\n for (var i = 0, l = cacheKeys.length; i < l; i++) {\n var key = cacheKeys[i];\n var exp = cache[key].exports;\n // Using babel as a transpiler to use esmodule, the export will always\n // be an object with the default export as a property of it. To ensure\n // the existing api and babel esmodule exports are both supported we\n // check for both\n if (exp === fn || exp.default === fn) {\n wkey = key;\n break;\n }\n }\n\n if (!wkey) {\n wkey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);\n var wcache = {};\n for (var i = 0, l = cacheKeys.length; i < l; i++) {\n var key = cacheKeys[i];\n wcache[key] = key;\n }\n sources[wkey] = [\n Function(['require','module','exports'], '(' + fn + ')(self)'),\n wcache\n ];\n }\n var skey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);\n\n var scache = {}; scache[wkey] = wkey;\n sources[skey] = [\n Function(['require'], (\n // try to call default if defined to also support babel esmodule\n // exports\n 'var f = require(' + stringify(wkey) + ');' +\n '(f.default ? f.default : f)(self);'\n )),\n scache\n ];\n\n var src = '(' + bundleFn + ')({'\n + Object.keys(sources).map(function (key) {\n return stringify(key) + ':['\n + sources[key][0]\n + ',' + stringify(sources[key][1]) + ']'\n ;\n }).join(',')\n + '},{},[' + stringify(skey) + '])'\n ;\n\n var URL = window.URL || window.webkitURL || window.mozURL || window.msURL;\n\n return new Worker(URL.createObjectURL(\n new Blob([src], { type: 'text/javascript' })\n ));\n};\n", - "/*\n * simple ABR Controller\n * - compute next level based on last fragment bw heuristics\n * - implement an abandon rules triggered if we have less than 2 frag buffered and if computed bw shows that we risk buffer stalling\n */\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport BufferHelper from '../helper/buffer-helper';\nimport {ErrorDetails} from '../errors';\nimport {logger} from '../utils/logger';\n\nclass AbrController extends EventHandler {\n\n constructor(hls) {\n super(hls, Event.FRAG_LOADING,\n Event.FRAG_LOAD_PROGRESS,\n Event.FRAG_LOADED,\n Event.ERROR);\n this.lastLoadedFragLevel = 0;\n this._autoLevelCapping = -1;\n this._nextAutoLevel = -1;\n this.hls = hls;\n this.onCheck = this.abandonRulesCheck.bind(this);\n }\n\n destroy() {\n this.clearTimer();\n EventHandler.prototype.destroy.call(this);\n }\n\n onFragLoading(data) {\n if (!this.timer) {\n this.timer = setInterval(this.onCheck, 100);\n }\n this.fragCurrent = data.frag;\n }\n\n onFragLoadProgress(data) {\n var stats = data.stats;\n // only update stats if first frag loading\n // if same frag is loaded multiple times, it might be in browser cache, and loaded quickly\n // and leading to wrong bw estimation\n if (stats.aborted === undefined && data.frag.loadCounter === 1) {\n this.lastfetchduration = (performance.now() - stats.trequest) / 1000;\n this.lastbw = (stats.loaded * 8) / this.lastfetchduration;\n //console.log(`fetchDuration:${this.lastfetchduration},bw:${(this.lastbw/1000).toFixed(0)}/${stats.aborted}`);\n }\n }\n\n abandonRulesCheck() {\n /*\n monitor fragment retrieval time...\n we compute expected time of arrival of the complete fragment.\n we compare it to expected time of buffer starvation\n */\n let hls = this.hls, v = hls.media,frag = this.fragCurrent;\n\n // if loader has been destroyed or loading has been aborted, stop timer and return\n if(!frag.loader || ( frag.loader.stats && frag.loader.stats.aborted)) {\n logger.warn(`frag loader destroy or aborted, disarm abandonRulesCheck`);\n this.clearTimer();\n return;\n }\n /* only monitor frag retrieval time if\n (video not paused OR first fragment being loaded(ready state === HAVE_NOTHING = 0)) AND autoswitching enabled AND not lowest level (=> means that we have several levels) */\n if (v && (!v.paused || !v.readyState) && frag.autoLevel && frag.level) {\n let requestDelay = performance.now() - frag.trequest;\n // monitor fragment load progress after half of expected fragment duration,to stabilize bitrate\n if (requestDelay > (500 * frag.duration)) {\n let loadRate = Math.max(1,frag.loaded * 1000 / requestDelay); // byte/s; at least 1 byte/s to avoid division by zero\n if (frag.expectedLen < frag.loaded) {\n frag.expectedLen = frag.loaded;\n }\n let pos = v.currentTime;\n let fragLoadedDelay = (frag.expectedLen - frag.loaded) / loadRate;\n let bufferStarvationDelay = BufferHelper.bufferInfo(v,pos,hls.config.maxBufferHole).end - pos;\n // consider emergency switch down only if we have less than 2 frag buffered AND\n // time to finish loading current fragment is bigger than buffer starvation delay\n // ie if we risk buffer starvation if bw does not increase quickly\n if (bufferStarvationDelay < 2*frag.duration && fragLoadedDelay > bufferStarvationDelay) {\n let fragLevelNextLoadedDelay, nextLoadLevel;\n // lets iterate through lower level and try to find the biggest one that could avoid rebuffering\n // we start from current level - 1 and we step down , until we find a matching level\n for (nextLoadLevel = frag.level - 1 ; nextLoadLevel >=0 ; nextLoadLevel--) {\n // compute time to load next fragment at lower level\n // 0.8 : consider only 80% of current bw to be conservative\n // 8 = bits per byte (bps/Bps)\n fragLevelNextLoadedDelay = frag.duration * hls.levels[nextLoadLevel].bitrate / (8 * 0.8 * loadRate);\n logger.log(`fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay[${nextLoadLevel}] :${fragLoadedDelay.toFixed(1)}/${bufferStarvationDelay.toFixed(1)}/${fragLevelNextLoadedDelay.toFixed(1)}`);\n if (fragLevelNextLoadedDelay < bufferStarvationDelay) {\n // we found a lower level that be rebuffering free with current estimated bw !\n break;\n }\n }\n // only emergency switch down if it takes less time to load new fragment at lowest level instead\n // of finishing loading current one ...\n if (fragLevelNextLoadedDelay < fragLoadedDelay) {\n // ensure nextLoadLevel is not negative\n nextLoadLevel = Math.max(0,nextLoadLevel);\n // force next load level in auto mode\n hls.nextLoadLevel = nextLoadLevel;\n // abort fragment loading ...\n logger.warn(`loading too slow, abort fragment loading and switch to level ${nextLoadLevel}`);\n //abort fragment loading\n frag.loader.abort();\n this.clearTimer();\n hls.trigger(Event.FRAG_LOAD_EMERGENCY_ABORTED, {frag: frag});\n }\n }\n }\n }\n }\n\n onFragLoaded(data) {\n // stop monitoring bw once frag loaded\n this.clearTimer();\n // store level id after successful fragment load\n this.lastLoadedFragLevel = data.frag.level;\n // reset forced auto level value so that next level will be selected\n this._nextAutoLevel = -1;\n }\n\n onError(data) {\n // stop timer in case of frag loading error\n switch(data.details) {\n case ErrorDetails.FRAG_LOAD_ERROR:\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n this.clearTimer();\n break;\n default:\n break;\n }\n }\n\n clearTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n }\n\n /** Return the capping/max level value that could be used by automatic level selection algorithm **/\n get autoLevelCapping() {\n return this._autoLevelCapping;\n }\n\n /** set the capping/max level value that could be used by automatic level selection algorithm **/\n set autoLevelCapping(newLevel) {\n this._autoLevelCapping = newLevel;\n }\n\n get nextAutoLevel() {\n var lastbw = this.lastbw, hls = this.hls,adjustedbw, i, maxAutoLevel;\n if (this._autoLevelCapping === -1 && hls.levels && hls.levels.length) {\n maxAutoLevel = hls.levels.length - 1;\n } else {\n maxAutoLevel = this._autoLevelCapping;\n }\n\n // in case next auto level has been forced, return it straight-away (but capped)\n if (this._nextAutoLevel !== -1) {\n return Math.min(this._nextAutoLevel,maxAutoLevel);\n }\n\n // follow algorithm captured from stagefright :\n // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp\n // Pick the highest bandwidth stream below or equal to estimated bandwidth.\n for (i = 0; i <= maxAutoLevel; i++) {\n // consider only 80% of the available bandwidth, but if we are switching up,\n // be even more conservative (70%) to avoid overestimating and immediately\n // switching back.\n if (i <= this.lastLoadedFragLevel) {\n adjustedbw = 0.8 * lastbw;\n } else {\n adjustedbw = 0.7 * lastbw;\n }\n if (adjustedbw < hls.levels[i].bitrate) {\n return Math.max(0, i - 1);\n }\n }\n return i - 1;\n }\n\n set nextAutoLevel(nextLevel) {\n this._nextAutoLevel = nextLevel;\n }\n}\n\nexport default AbrController;\n\n", - "/*\n * Buffer Controller\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {logger} from '../utils/logger';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\n\nclass BufferController extends EventHandler {\n\n constructor(hls) {\n super(hls,\n Event.MEDIA_ATTACHING,\n Event.MEDIA_DETACHING,\n Event.BUFFER_RESET,\n Event.BUFFER_APPENDING,\n Event.BUFFER_CODECS,\n Event.BUFFER_EOS,\n Event.BUFFER_FLUSHING);\n\n // Source Buffer listeners\n this.onsbue = this.onSBUpdateEnd.bind(this);\n this.onsbe = this.onSBUpdateError.bind(this);\n }\n\n destroy() {\n EventHandler.prototype.destroy.call(this);\n }\n\n onMediaAttaching(data) {\n var media = this.media = data.media;\n // setup the media source\n var ms = this.mediaSource = new MediaSource();\n //Media Source listeners\n this.onmso = this.onMediaSourceOpen.bind(this);\n this.onmse = this.onMediaSourceEnded.bind(this);\n this.onmsc = this.onMediaSourceClose.bind(this);\n ms.addEventListener('sourceopen', this.onmso);\n ms.addEventListener('sourceended', this.onmse);\n ms.addEventListener('sourceclose', this.onmsc);\n // link video and media Source\n media.src = URL.createObjectURL(ms);\n }\n\n onMediaDetaching() {\n var ms = this.mediaSource;\n if (ms) {\n if (ms.readyState === 'open') {\n try {\n // endOfStream could trigger exception if any sourcebuffer is in updating state\n // we don't really care about checking sourcebuffer state here,\n // as we are anyway detaching the MediaSource\n // let's just avoid this exception to propagate\n ms.endOfStream();\n } catch(err) {\n logger.warn(`onMediaDetaching:${err.message} while calling endOfStream`);\n }\n }\n ms.removeEventListener('sourceopen', this.onmso);\n ms.removeEventListener('sourceended', this.onmse);\n ms.removeEventListener('sourceclose', this.onmsc);\n // unlink MediaSource from video tag\n this.media.src = '';\n this.media.removeAttribute('src');\n this.mediaSource = null;\n this.media = null;\n this.pendingTracks = null;\n this.sourceBuffer = null;\n }\n this.onmso = this.onmse = this.onmsc = null;\n this.hls.trigger(Event.MEDIA_DETACHED);\n }\n\n onMediaSourceOpen() {\n logger.log('media source opened');\n this.hls.trigger(Event.MEDIA_ATTACHED, { media : this.media });\n // once received, don't listen anymore to sourceopen event\n this.mediaSource.removeEventListener('sourceopen', this.onmso);\n // if any buffer codecs pending, treat it here.\n var pendingTracks = this.pendingTracks;\n if (pendingTracks) {\n this.onBufferCodecs(pendingTracks);\n this.pendingTracks = null;\n this.doAppending();\n }\n }\n\n onMediaSourceClose() {\n logger.log('media source closed');\n }\n\n onMediaSourceEnded() {\n logger.log('media source ended');\n }\n\n\n onSBUpdateEnd() {\n\n if (this._needsFlush) {\n this.doFlush();\n }\n\n if (this._needsEos) {\n this.onBufferEos();\n }\n\n this.hls.trigger(Event.BUFFER_APPENDED);\n\n this.doAppending();\n }\n\n onSBUpdateError(event) {\n logger.error(`sourceBuffer error:${event}`);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_APPENDING_ERROR, fatal: false});\n // we don't need to do more than that, as accordin to the spec, updateend will be fired just after\n }\n\n onBufferReset() {\n var sourceBuffer = this.sourceBuffer;\n if (sourceBuffer) {\n for(var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n try {\n this.mediaSource.removeSourceBuffer(sb);\n sb.removeEventListener('updateend', this.onsbue);\n sb.removeEventListener('error', this.onsbe);\n } catch(err) {\n }\n }\n this.sourceBuffer = null;\n }\n this.flushRange = [];\n this.appended = 0;\n }\n\n onBufferCodecs(tracks) {\n var sb,trackName,track, codec, mimeType;\n\n if (!this.media) {\n this.pendingTracks = tracks;\n return;\n }\n\n if (!this.sourceBuffer) {\n var sourceBuffer = {}, mediaSource = this.mediaSource;\n for (trackName in tracks) {\n track = tracks[trackName];\n // use levelCodec as first priority\n codec = track.levelCodec || track.codec;\n mimeType = `${track.container};codecs=${codec}`;\n logger.log(`creating sourceBuffer with mimeType:${mimeType}`);\n sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType);\n sb.addEventListener('updateend', this.onsbue);\n sb.addEventListener('error', this.onsbe);\n }\n this.sourceBuffer = sourceBuffer;\n }\n }\n\n onBufferAppending(data) {\n if (!this.segments) {\n this.segments = [ data ];\n } else {\n this.segments.push(data);\n }\n this.doAppending();\n }\n\n onBufferAppendFail(data) {\n logger.error(`sourceBuffer error:${data.event}`);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_APPENDING_ERROR, fatal: false, frag: this.fragCurrent});\n }\n\n onBufferEos() {\n var sb = this.sourceBuffer, mediaSource = this.mediaSource;\n if (!mediaSource || mediaSource.readyState !== 'open') {\n return;\n }\n if (!((sb.audio && sb.audio.updating) || (sb.video && sb.video.updating))) {\n logger.log('all media data available, signal endOfStream() to MediaSource and stop loading fragment');\n //Notify the media element that it now has all of the media data\n mediaSource.endOfStream();\n this._needsEos = false;\n } else {\n this._needsEos = true;\n }\n }\n\n onBufferFlushing(data) {\n this.flushRange.push({start: data.startOffset, end: data.endOffset});\n // attempt flush immediatly\n this.flushBufferCounter = 0;\n this.doFlush();\n }\n\n doFlush() {\n // loop through all buffer ranges to flush\n while(this.flushRange.length) {\n var range = this.flushRange[0];\n // flushBuffer will abort any buffer append in progress and flush Audio/Video Buffer\n if (this.flushBuffer(range.start, range.end)) {\n // range flushed, remove from flush array\n this.flushRange.shift();\n this.flushBufferCounter = 0;\n } else {\n this._needsFlush = true;\n // avoid looping, wait for SB update end to retrigger a flush\n return;\n }\n }\n if (this.flushRange.length === 0) {\n // everything flushed\n this._needsFlush = false;\n\n // let's recompute this.appended, which is used to avoid flush looping\n var appended = 0;\n var sourceBuffer = this.sourceBuffer;\n if (sourceBuffer) {\n for (var type in sourceBuffer) {\n appended += sourceBuffer[type].buffered.length;\n }\n }\n this.appended = appended;\n this.hls.trigger(Event.BUFFER_FLUSHED);\n }\n }\n\n doAppending() {\n var hls = this.hls, sourceBuffer = this.sourceBuffer, segments = this.segments;\n if (sourceBuffer) {\n if (this.media.error) {\n segments = [];\n logger.error('trying to append although a media error occured, flush segment and abort');\n return;\n }\n for (var type in sourceBuffer) {\n if (sourceBuffer[type].updating) {\n //logger.log('sb update in progress');\n return;\n }\n }\n if (segments.length) {\n var segment = segments.shift();\n try {\n //logger.log(`appending ${segment.type} SB, size:${segment.data.length});\n sourceBuffer[segment.type].appendBuffer(segment.data);\n this.appendError = 0;\n this.appended++;\n } catch(err) {\n // in case any error occured while appending, put back segment in segments table\n logger.error(`error while trying to append buffer:${err.message}`);\n segments.unshift(segment);\n var event = {type: ErrorTypes.MEDIA_ERROR};\n if(err.code !== 22) {\n if (this.appendError) {\n this.appendError++;\n } else {\n this.appendError = 1;\n }\n event.details = ErrorDetails.BUFFER_APPEND_ERROR;\n event.frag = this.fragCurrent;\n /* with UHD content, we could get loop of quota exceeded error until\n browser is able to evict some data from sourcebuffer. retrying help recovering this\n */\n if (this.appendError > hls.config.appendErrorMaxRetry) {\n logger.log(`fail ${hls.config.appendErrorMaxRetry} times to append segment in sourceBuffer`);\n segments = [];\n event.fatal = true;\n hls.trigger(Event.ERROR, event);\n return;\n } else {\n event.fatal = false;\n hls.trigger(Event.ERROR, event);\n }\n } else {\n // QuotaExceededError: http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror\n // let's stop appending any segments, and report BUFFER_FULL_ERROR error\n segments = [];\n event.details = ErrorDetails.BUFFER_FULL_ERROR;\n hls.trigger(Event.ERROR,event);\n }\n }\n }\n }\n }\n\n /*\n flush specified buffered range,\n return true once range has been flushed.\n as sourceBuffer.remove() is asynchronous, flushBuffer will be retriggered on sourceBuffer update end\n */\n flushBuffer(startOffset, endOffset) {\n var sb, i, bufStart, bufEnd, flushStart, flushEnd;\n //logger.log('flushBuffer,pos/start/end: ' + this.media.currentTime + '/' + startOffset + '/' + endOffset);\n // safeguard to avoid infinite looping : don't try to flush more than the nb of appended segments\n if (this.flushBufferCounter < this.appended && this.sourceBuffer) {\n for (var type in this.sourceBuffer) {\n sb = this.sourceBuffer[type];\n if (!sb.updating) {\n for (i = 0; i < sb.buffered.length; i++) {\n bufStart = sb.buffered.start(i);\n bufEnd = sb.buffered.end(i);\n // workaround firefox not able to properly flush multiple buffered range.\n if (navigator.userAgent.toLowerCase().indexOf('firefox') !== -1 && endOffset === Number.POSITIVE_INFINITY) {\n flushStart = startOffset;\n flushEnd = endOffset;\n } else {\n flushStart = Math.max(bufStart, startOffset);\n flushEnd = Math.min(bufEnd, endOffset);\n }\n /* sometimes sourcebuffer.remove() does not flush\n the exact expected time range.\n to avoid rounding issues/infinite loop,\n only flush buffer range of length greater than 500ms.\n */\n if (Math.min(flushEnd,bufEnd) - flushStart > 0.5 ) {\n this.flushBufferCounter++;\n logger.log(`flush ${type} [${flushStart},${flushEnd}], of [${bufStart},${bufEnd}], pos:${this.media.currentTime}`);\n sb.remove(flushStart, flushEnd);\n return false;\n }\n }\n } else {\n //logger.log('abort ' + type + ' append in progress');\n // this will abort any appending in progress\n //sb.abort();\n logger.warn('cannot flush, sb updating in progress');\n return false;\n }\n }\n } else {\n logger.warn('abort flushing too many retries');\n }\n logger.log('buffer flushed');\n // everything flushed !\n return true;\n }\n}\n\nexport default BufferController;\n", - "/*\n * cap stream level to media size dimension controller\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\n\nclass CapLevelController extends EventHandler {\n\tconstructor(hls) {\n super(hls,\n Event.MEDIA_ATTACHING,\n Event.MANIFEST_PARSED); \n\t}\n\t\n\tdestroy() {\n if (this.hls.config.capLevelToPlayerSize) {\n this.media = null;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n if (this.timer) {\n this.timer = clearInterval(this.timer);\n }\n }\n }\n\t \n\tonMediaAttaching(data) {\n this.media = data.media instanceof HTMLVideoElement ? data.media : null; \n }\n\n onManifestParsed(data) {\n if (this.hls.config.capLevelToPlayerSize) {\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.levels = data.levels;\n this.hls.firstLevel = this.getMaxLevel(data.firstLevel);\n clearInterval(this.timer);\n this.timer = setInterval(this.detectPlayerSize.bind(this), 1000);\n this.detectPlayerSize();\n }\n }\n \n detectPlayerSize() {\n if (this.media) {\n let levelsLength = this.levels ? this.levels.length : 0;\n if (levelsLength) {\n this.hls.autoLevelCapping = this.getMaxLevel(levelsLength - 1);\n if (this.hls.autoLevelCapping > this.autoLevelCapping) {\n // if auto level capping has a higher value for the previous one, flush the buffer using nextLevelSwitch\n // usually happen when the user go to the fullscreen mode.\n this.hls.streamController.nextLevelSwitch();\n }\n this.autoLevelCapping = this.hls.autoLevelCapping; \n } \n }\n }\n \n /*\n * returns level should be the one with the dimensions equal or greater than the media (player) dimensions (so the video will be downscaled)\n */\n getMaxLevel(capLevelIndex) {\n let result,\n i,\n level,\n mWidth = this.mediaWidth,\n mHeight = this.mediaHeight,\n lWidth = 0,\n lHeight = 0;\n \n for (i = 0; i <= capLevelIndex; i++) {\n level = this.levels[i];\n result = i;\n lWidth = level.width;\n lHeight = level.height;\n if (mWidth <= lWidth || mHeight <= lHeight) {\n break;\n }\n } \n return result;\n }\n \n get contentScaleFactor() {\n let pixelRatio = 1;\n try {\n pixelRatio = window.devicePixelRatio;\n } catch(e) {}\n return pixelRatio;\n }\n \n get mediaWidth() {\n let width;\n if (this.media) {\n width = this.media.width || this.media.clientWidth || this.media.offsetWidth;\n width *= this.contentScaleFactor;\n }\n return width;\n }\n \n get mediaHeight() {\n let height;\n if (this.media) {\n height = this.media.height || this.media.clientHeight || this.media.offsetHeight;\n height *= this.contentScaleFactor; \n }\n return height;\n }\n}\n\nexport default CapLevelController;", - "/*\n * Level Controller\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {logger} from '../utils/logger';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\nclass LevelController extends EventHandler {\n\n constructor(hls) {\n super(hls,\n Event.MANIFEST_LOADED,\n Event.LEVEL_LOADED,\n Event.ERROR);\n this.ontick = this.tick.bind(this);\n this._manualLevel = this._autoLevelCapping = -1;\n }\n\n destroy() {\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n this._manualLevel = -1;\n }\n\n startLoad() {\n this.canload = true;\n // speed up live playlist refresh if timer exists\n if (this.timer) {\n this.tick();\n }\n }\n\n stopLoad() {\n this.canload = false;\n }\n\n onManifestLoaded(data) {\n var levels0 = [], levels = [], bitrateStart, i, bitrateSet = {}, videoCodecFound = false, audioCodecFound = false, hls = this.hls;\n\n // regroup redundant level together\n data.levels.forEach(level => {\n if(level.videoCodec) {\n videoCodecFound = true;\n }\n if(level.audioCodec) {\n audioCodecFound = true;\n }\n var redundantLevelId = bitrateSet[level.bitrate];\n if (redundantLevelId === undefined) {\n bitrateSet[level.bitrate] = levels0.length;\n level.url = [level.url];\n level.urlId = 0;\n levels0.push(level);\n } else {\n levels0[redundantLevelId].url.push(level.url);\n }\n });\n\n // remove audio-only level if we also have levels with audio+video codecs signalled\n if(videoCodecFound && audioCodecFound) {\n levels0.forEach(level => {\n if(level.videoCodec) {\n levels.push(level);\n }\n });\n } else {\n levels = levels0;\n }\n\n // only keep level with supported audio/video codecs\n levels = levels.filter(function(level) {\n var checkSupportedAudio = function(codec) { return MediaSource.isTypeSupported(`audio/mp4;codecs=${codec}`);};\n var checkSupportedVideo = function(codec) { return MediaSource.isTypeSupported(`video/mp4;codecs=${codec}`);};\n var audioCodec = level.audioCodec, videoCodec = level.videoCodec;\n\n return (!audioCodec || checkSupportedAudio(audioCodec)) &&\n (!videoCodec || checkSupportedVideo(videoCodec));\n });\n\n if(levels.length) {\n // start bitrate is the first bitrate of the manifest\n bitrateStart = levels[0].bitrate;\n // sort level on bitrate\n levels.sort(function (a, b) {\n return a.bitrate - b.bitrate;\n });\n this._levels = levels;\n // find index of first level in sorted levels\n for (i = 0; i < levels.length; i++) {\n if (levels[i].bitrate === bitrateStart) {\n this._firstLevel = i;\n logger.log(`manifest loaded,${levels.length} level(s) found, first bitrate:${bitrateStart}`);\n break;\n }\n }\n hls.trigger(Event.MANIFEST_PARSED, {levels: this._levels, firstLevel: this._firstLevel, stats: data.stats});\n } else {\n hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal: true, url: hls.url, reason: 'no level with compatible codecs found in manifest'});\n }\n return;\n }\n\n get levels() {\n return this._levels;\n }\n\n get level() {\n return this._level;\n }\n\n set level(newLevel) {\n if (this._level !== newLevel || this._levels[newLevel].details === undefined) {\n this.setLevelInternal(newLevel);\n }\n }\n\n setLevelInternal(newLevel) {\n // check if level idx is valid\n if (newLevel >= 0 && newLevel < this._levels.length) {\n // stopping live reloading timer if any\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n this._level = newLevel;\n logger.log(`switching to level ${newLevel}`);\n this.hls.trigger(Event.LEVEL_SWITCH, {level: newLevel});\n var level = this._levels[newLevel];\n // check if we need to load playlist for this level\n if (level.details === undefined || level.details.live === true) {\n // level not retrieved yet, or live playlist we need to (re)load it\n logger.log(`(re)loading playlist for level ${newLevel}`);\n var urlId = level.urlId;\n this.hls.trigger(Event.LEVEL_LOADING, {url: level.url[urlId], level: newLevel, id: urlId});\n }\n } else {\n // invalid level id given, trigger error\n this.hls.trigger(Event.ERROR, {type : ErrorTypes.OTHER_ERROR, details: ErrorDetails.LEVEL_SWITCH_ERROR, level: newLevel, fatal: false, reason: 'invalid level idx'});\n }\n }\n\n get manualLevel() {\n return this._manualLevel;\n }\n\n set manualLevel(newLevel) {\n this._manualLevel = newLevel;\n if (newLevel !== -1) {\n this.level = newLevel;\n }\n }\n\n get firstLevel() {\n return this._firstLevel;\n }\n\n set firstLevel(newLevel) {\n this._firstLevel = newLevel;\n }\n\n get startLevel() {\n if (this._startLevel === undefined) {\n return this._firstLevel;\n } else {\n return this._startLevel;\n }\n }\n\n set startLevel(newLevel) {\n this._startLevel = newLevel;\n }\n\n onError(data) {\n if(data.fatal) {\n return;\n }\n\n var details = data.details, hls = this.hls, levelId, level;\n // try to recover not fatal errors\n switch(details) {\n case ErrorDetails.FRAG_LOAD_ERROR:\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n case ErrorDetails.FRAG_LOOP_LOADING_ERROR:\n case ErrorDetails.KEY_LOAD_ERROR:\n case ErrorDetails.KEY_LOAD_TIMEOUT:\n levelId = data.frag.level;\n break;\n case ErrorDetails.LEVEL_LOAD_ERROR:\n case ErrorDetails.LEVEL_LOAD_TIMEOUT:\n levelId = data.level;\n break;\n default:\n break;\n }\n /* try to switch to a redundant stream if any available.\n * if no redundant stream available, emergency switch down (if in auto mode and current level not 0)\n * otherwise, we cannot recover this network error ...\n * don't raise FRAG_LOAD_ERROR and FRAG_LOAD_TIMEOUT as fatal, as it is handled by mediaController\n */\n if (levelId !== undefined) {\n level = this._levels[levelId];\n if (level.urlId < (level.url.length - 1)) {\n level.urlId++;\n level.details = undefined;\n logger.warn(`level controller,${details} for level ${levelId}: switching to redundant stream id ${level.urlId}`);\n } else {\n // we could try to recover if in auto mode and current level not lowest level (0)\n let recoverable = ((this._manualLevel === -1) && levelId);\n if (recoverable) {\n logger.warn(`level controller,${details}: emergency switch-down for next fragment`);\n hls.abrController.nextAutoLevel = 0;\n } else if(level && level.details && level.details.live) {\n logger.warn(`level controller,${details} on live stream, discard`);\n // FRAG_LOAD_ERROR and FRAG_LOAD_TIMEOUT are handled by mediaController\n } else if (details !== ErrorDetails.FRAG_LOAD_ERROR && details !== ErrorDetails.FRAG_LOAD_TIMEOUT) {\n logger.error(`cannot recover ${details} error`);\n this._level = undefined;\n // stopping live reloading timer if any\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n // redispatch same error but with fatal set to true\n data.fatal = true;\n hls.trigger(Event.ERROR, data);\n }\n }\n }\n }\n\n onLevelLoaded(data) {\n // check if current playlist is a live playlist\n if (data.details.live && !this.timer) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n this.timer = setInterval(this.ontick, 1000 * data.details.targetduration);\n }\n if (!data.details.live && this.timer) {\n // playlist is not live and timer is armed : stopping it\n clearInterval(this.timer);\n this.timer = null;\n }\n }\n\n tick() {\n var levelId = this._level;\n if (levelId !== undefined && this.canload) {\n var level = this._levels[levelId], urlId = level.urlId;\n this.hls.trigger(Event.LEVEL_LOADING, {url: level.url[urlId], level: levelId, id: urlId});\n }\n }\n\n get nextLoadLevel() {\n if (this._manualLevel !== -1) {\n return this._manualLevel;\n } else {\n return this.hls.abrController.nextAutoLevel;\n }\n }\n\n set nextLoadLevel(nextLevel) {\n this.level = nextLevel;\n if (this._manualLevel === -1) {\n this.hls.abrController.nextAutoLevel = nextLevel;\n }\n }\n}\n\nexport default LevelController;\n\n", - "/*\n * Stream Controller\n*/\n\nimport Demuxer from '../demux/demuxer';\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {logger} from '../utils/logger';\nimport BinarySearch from '../utils/binary-search';\nimport BufferHelper from '../helper/buffer-helper';\nimport LevelHelper from '../helper/level-helper';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\nconst State = {\n STOPPED : 'STOPPED',\n STARTING : 'STARTING',\n IDLE : 'IDLE',\n PAUSED : 'PAUSED',\n KEY_LOADING : 'KEY_LOADING',\n FRAG_LOADING : 'FRAG_LOADING',\n FRAG_LOADING_WAITING_RETRY : 'FRAG_LOADING_WAITING_RETRY',\n WAITING_LEVEL : 'WAITING_LEVEL',\n PARSING : 'PARSING',\n PARSED : 'PARSED',\n ENDED : 'ENDED',\n ERROR : 'ERROR'\n};\n\nclass StreamController extends EventHandler {\n\n constructor(hls) {\n super(hls,\n Event.MEDIA_ATTACHED,\n Event.MEDIA_DETACHING,\n Event.MANIFEST_LOADING,\n Event.MANIFEST_PARSED,\n Event.LEVEL_LOADED,\n Event.KEY_LOADED,\n Event.FRAG_LOADED,\n Event.FRAG_LOAD_EMERGENCY_ABORTED,\n Event.FRAG_PARSING_INIT_SEGMENT,\n Event.FRAG_PARSING_DATA,\n Event.FRAG_PARSED,\n Event.ERROR,\n Event.BUFFER_APPENDED,\n Event.BUFFER_FLUSHED);\n\n this.config = hls.config;\n this.audioCodecSwap = false;\n this.ticks = 0;\n this.ontick = this.tick.bind(this);\n }\n\n destroy() {\n this.stopLoad();\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n EventHandler.prototype.destroy.call(this);\n this.state = State.STOPPED;\n }\n\n startLoad(startPosition=0) {\n if (this.levels) {\n var media = this.media, lastCurrentTime = this.lastCurrentTime;\n this.stopLoad();\n this.demuxer = new Demuxer(this.hls);\n if (!this.timer) {\n this.timer = setInterval(this.ontick, 100);\n }\n this.level = -1;\n this.fragLoadError = 0;\n if (media && lastCurrentTime) {\n logger.log(`configure startPosition @${lastCurrentTime}`);\n if (!this.lastPaused) {\n logger.log('resuming video');\n media.play();\n }\n this.state = State.IDLE;\n } else {\n this.lastCurrentTime = this.startPosition ? this.startPosition : startPosition;\n this.state = State.STARTING;\n }\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime;\n this.tick();\n } else {\n logger.warn('cannot start loading as manifest not parsed yet');\n this.state = State.STOPPED;\n }\n }\n\n stopLoad() {\n var frag = this.fragCurrent;\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n this.state = State.STOPPED;\n }\n\n tick() {\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n }\n\n doTick() {\n var pos, level, levelDetails, hls = this.hls, config = hls.config;\n //logger.log(this.state);\n switch(this.state) {\n case State.ERROR:\n //don't do anything in error state to avoid breaking further ...\n case State.PAUSED:\n //don't do anything in paused state either ...\n break;\n case State.STARTING:\n // determine load level\n this.startLevel = hls.startLevel;\n if (this.startLevel === -1) {\n // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level\n this.startLevel = 0;\n this.fragBitrateTest = true;\n }\n // set new level to playlist loader : this will trigger start level load\n this.level = hls.nextLoadLevel = this.startLevel;\n this.state = State.WAITING_LEVEL;\n this.loadedmetadata = false;\n break;\n case State.IDLE:\n // if video not attached AND\n // start fragment already requested OR start frag prefetch disable\n // exit loop\n // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop\n if (!this.media &&\n (this.startFragRequested || !config.startFragPrefetch)) {\n break;\n }\n // determine next candidate fragment to be loaded, based on current position and\n // end of buffer position\n // ensure 60s of buffer upfront\n // if we have not yet loaded any fragment, start loading from start position\n if (this.loadedmetadata) {\n pos = this.media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n }\n // determine next load level\n if (this.startFragRequested === false) {\n level = this.startLevel;\n } else {\n // we are not at playback start, get next load level from level Controller\n level = hls.nextLoadLevel;\n }\n var bufferInfo = BufferHelper.bufferInfo(this.media,pos,config.maxBufferHole),\n bufferLen = bufferInfo.len,\n bufferEnd = bufferInfo.end,\n fragPrevious = this.fragPrevious,\n maxBufLen;\n // compute max Buffer Length that we could get from this load level, based on level bitrate. don't buffer more than 60 MB and more than 30s\n if ((this.levels[level]).hasOwnProperty('bitrate')) {\n maxBufLen = Math.max(8 * config.maxBufferSize / this.levels[level].bitrate, config.maxBufferLength);\n maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength);\n } else {\n maxBufLen = config.maxBufferLength;\n }\n // if buffer length is less than maxBufLen try to load a new fragment\n if (bufferLen < maxBufLen) {\n // set next load level : this will trigger a playlist load if needed\n hls.nextLoadLevel = level;\n this.level = level;\n levelDetails = this.levels[level].details;\n // if level info not retrieved yet, switch state and wait for level retrieval\n // if live playlist, ensure that new playlist has been refreshed to avoid loading/try to load\n // a useless and outdated fragment (that might even introduce load error if it is already out of the live playlist)\n if (typeof levelDetails === 'undefined' || levelDetails.live && this.levelLastLoaded !== level) {\n this.state = State.WAITING_LEVEL;\n break;\n }\n // find fragment index, contiguous with end of buffer position\n let fragments = levelDetails.fragments,\n fragLen = fragments.length,\n start = fragments[0].start,\n end = fragments[fragLen-1].start + fragments[fragLen-1].duration,\n frag;\n\n // in case of live playlist we need to ensure that requested position is not located before playlist start\n if (levelDetails.live) {\n // check if requested position is within seekable boundaries :\n //logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);\n let maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount*levelDetails.targetduration;\n\n if (bufferEnd < Math.max(start, end - maxLatency)) {\n let targetLatency = config.liveSyncDuration !== undefined ? config.liveSyncDuration : config.liveSyncDurationCount * levelDetails.targetduration;\n this.seekAfterBuffered = start + Math.max(0, levelDetails.totalduration - targetLatency);\n logger.log(`buffer end: ${bufferEnd} is located too far from the end of live sliding playlist, media position will be reseted to: ${this.seekAfterBuffered.toFixed(3)}`);\n bufferEnd = this.seekAfterBuffered;\n }\n\n // if end of buffer greater than live edge, don't load any fragment\n // this could happen if live playlist intermittently slides in the past.\n // level 1 loaded [182580161,182580167]\n // level 1 loaded [182580162,182580169]\n // Loading 182580168 of [182580162 ,182580169],level 1 ..\n // Loading 182580169 of [182580162 ,182580169],level 1 ..\n // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168\n // level 1 loaded [182580164,182580171]\n //\n if (bufferEnd > end) {\n break;\n }\n\n if (this.startFragRequested && !levelDetails.PTSKnown) {\n /* we are switching level on live playlist, but we don't have any PTS info for that quality level ...\n try to load frag matching with next SN.\n even if SN are not synchronized between playlists, loading this frag will help us\n compute playlist sliding and find the right one after in case it was not the right consecutive one */\n if (fragPrevious) {\n var targetSN = fragPrevious.sn + 1;\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n frag = fragments[targetSN - levelDetails.startSN];\n logger.log(`live playlist, switching playlist, load frag with next SN: ${frag.sn}`);\n }\n }\n if (!frag) {\n /* we have no idea about which fragment should be loaded.\n so let's load mid fragment. it will help computing playlist sliding and find the right one\n */\n frag = fragments[Math.min(fragLen - 1, Math.round(fragLen / 2))];\n logger.log(`live playlist, switching playlist, unknown, load middle frag : ${frag.sn}`);\n }\n }\n } else {\n // VoD playlist: if bufferEnd before start of playlist, load first fragment\n if (bufferEnd < start) {\n frag = fragments[0];\n }\n }\n if (!frag) {\n let foundFrag;\n let maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n }\n foundFrag = BinarySearch.search(fragments, (candidate) => {\n // offset should be within fragment boundary - config.maxFragLookUpTolerance\n // this is to cope with situations like\n // bufferEnd = 9.991\n // frag[Ø] : [0,10]\n // frag[1] : [10,20]\n // bufferEnd is within frag[0] range ... although what we are expecting is to return frag[1] here\n // frag start frag start+duration\n // |-----------------------------|\n // <---> <--->\n // ...--------><-----------------------------><---------....\n // previous frag matching fragment next frag\n // return -1 return 0 return 1\n //logger.log(`level/sn/start/end/bufEnd:${level}/${candidate.sn}/${candidate.start}/${(candidate.start+candidate.duration)}/${bufferEnd}`);\n if ((candidate.start + candidate.duration - maxFragLookUpTolerance) <= bufferEnd) {\n return 1;\n }\n else if (candidate.start - maxFragLookUpTolerance > bufferEnd) {\n return -1;\n }\n return 0;\n });\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen-1];\n }\n if (foundFrag) {\n frag = foundFrag;\n start = foundFrag.start;\n //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) {\n if (frag.sn < levelDetails.endSN) {\n frag = fragments[frag.sn + 1 - levelDetails.startSN];\n logger.log(`SN just loaded, load next one: ${frag.sn}`);\n } else {\n // have we reached end of VOD playlist ?\n if (!levelDetails.live) {\n this.hls.trigger(Event.BUFFER_EOS);\n this.state = State.ENDED;\n }\n frag = null;\n }\n }\n }\n }\n if(frag) {\n //logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if ((frag.decryptdata.uri != null) && (frag.decryptdata.key == null)) {\n logger.log(`Loading key for ${frag.sn} of [${levelDetails.startSN} ,${levelDetails.endSN}],level ${level}`);\n this.state = State.KEY_LOADING;\n hls.trigger(Event.KEY_LOADING, {frag: frag});\n } else {\n logger.log(`Loading ${frag.sn} of [${levelDetails.startSN} ,${levelDetails.endSN}],level ${level}, currentTime:${pos},bufferEnd:${bufferEnd.toFixed(3)}`);\n frag.autoLevel = hls.autoLevelEnabled;\n if (this.levels.length > 1) {\n frag.expectedLen = Math.round(frag.duration * this.levels[level].bitrate / 8);\n frag.trequest = performance.now();\n }\n // ensure that we are not reloading the same fragments in loop ...\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx++;\n } else {\n this.fragLoadIdx = 0;\n }\n if (frag.loadCounter) {\n frag.loadCounter++;\n let maxThreshold = config.fragLoadingLoopThreshold;\n // if this frag has already been loaded 3 times, and if it has been reloaded recently\n if (frag.loadCounter > maxThreshold && (Math.abs(this.fragLoadIdx - frag.loadIdx) < maxThreshold)) {\n hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal: false, frag: frag});\n return;\n }\n } else {\n frag.loadCounter = 1;\n }\n frag.loadIdx = this.fragLoadIdx;\n this.fragCurrent = frag;\n this.startFragRequested = true;\n hls.trigger(Event.FRAG_LOADING, {frag: frag});\n this.state = State.FRAG_LOADING;\n }\n }\n }\n break;\n case State.WAITING_LEVEL:\n level = this.levels[this.level];\n // check if playlist is already loaded\n if (level && level.details) {\n this.state = State.IDLE;\n }\n break;\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = performance.now();\n var retryDate = this.retryDate;\n var media = this.media;\n var isSeeking = media && media.seeking;\n // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n if(!retryDate || (now >= retryDate) || isSeeking) {\n logger.log(`mediaController: retryDate reached, switch back to IDLE state`);\n this.state = State.IDLE;\n }\n break;\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n default:\n break;\n }\n // check buffer\n this._checkBuffer();\n // check/update current fragment\n this._checkFragmentChanged();\n }\n\n\n\n\n getBufferRange(position) {\n var i, range,\n bufferRange = this.bufferRange;\n if (bufferRange) {\n for (i = bufferRange.length - 1; i >=0; i--) {\n range = bufferRange[i];\n if (position >= range.start && position <= range.end) {\n return range;\n }\n }\n }\n return null;\n }\n\n get currentLevel() {\n if (this.media) {\n var range = this.getBufferRange(this.media.currentTime);\n if (range) {\n return range.frag.level;\n }\n }\n return -1;\n }\n\n get nextBufferRange() {\n if (this.media) {\n // first get end range of current fragment\n return this.followingBufferRange(this.getBufferRange(this.media.currentTime));\n } else {\n return null;\n }\n }\n\n followingBufferRange(range) {\n if (range) {\n // try to get range of next fragment (500ms after this range)\n return this.getBufferRange(range.end + 0.5);\n }\n return null;\n }\n\n get nextLevel() {\n var range = this.nextBufferRange;\n if (range) {\n return range.frag.level;\n } else {\n return -1;\n }\n }\n\n isBuffered(position) {\n var v = this.media, buffered = v.buffered;\n for (var i = 0; i < buffered.length; i++) {\n if (position >= buffered.start(i) && position <= buffered.end(i)) {\n return true;\n }\n }\n return false;\n }\n\n _checkFragmentChanged() {\n var rangeCurrent, currentTime, video = this.media;\n if (video && video.seeking === false) {\n currentTime = video.currentTime;\n /* if video element is in seeked state, currentTime can only increase.\n (assuming that playback rate is positive ...)\n As sometimes currentTime jumps back to zero after a\n media decode error, check this, to avoid seeking back to\n wrong position after a media decode error\n */\n if(currentTime > video.playbackRate*this.lastCurrentTime) {\n this.lastCurrentTime = currentTime;\n }\n if (this.isBuffered(currentTime)) {\n rangeCurrent = this.getBufferRange(currentTime);\n } else if (this.isBuffered(currentTime + 0.1)) {\n /* ensure that FRAG_CHANGED event is triggered at startup,\n when first video frame is displayed and playback is paused.\n add a tolerance of 100ms, in case current position is not buffered,\n check if current pos+100ms is buffered and use that buffer range\n for FRAG_CHANGED event reporting */\n rangeCurrent = this.getBufferRange(currentTime + 0.1);\n }\n if (rangeCurrent) {\n var fragPlaying = rangeCurrent.frag;\n if (fragPlaying !== this.fragPlaying) {\n this.fragPlaying = fragPlaying;\n this.hls.trigger(Event.FRAG_CHANGED, {frag: fragPlaying});\n }\n }\n }\n }\n\n /*\n on immediate level switch :\n - pause playback if playing\n - cancel any pending load request\n - and trigger a buffer flush\n */\n immediateLevelSwitch() {\n logger.log('immediateLevelSwitch');\n if (!this.immediateSwitch) {\n this.immediateSwitch = true;\n this.previouslyPaused = this.media.paused;\n this.media.pause();\n }\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // flush everything\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: 0, endOffset: Number.POSITIVE_INFINITY});\n this.state = State.PAUSED;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n // speed up switching, trigger timer function\n this.tick();\n }\n\n /*\n on immediate level switch end, after new fragment has been buffered :\n - nudge video decoder by slightly adjusting video currentTime\n - resume the playback if needed\n */\n immediateLevelSwitchEnd() {\n this.immediateSwitch = false;\n this.media.currentTime -= 0.0001;\n if (!this.previouslyPaused) {\n this.media.play();\n }\n }\n\n nextLevelSwitch() {\n /* try to switch ASAP without breaking video playback :\n in order to ensure smooth but quick level switching,\n we need to find the next flushable buffer range\n we should take into account new segment fetch time\n */\n var fetchdelay, currentRange, nextRange;\n currentRange = this.getBufferRange(this.media.currentTime);\n if (currentRange && currentRange.start > 1) {\n // flush buffer preceding current fragment (flush until current fragment start offset)\n // minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ...\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: 0, endOffset: currentRange.start - 1});\n this.state = State.PAUSED;\n }\n if (!this.media.paused) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel,nextLevel = this.levels[nextLevelId], fragLastKbps = this.fragLastKbps;\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1;\n } else {\n fetchdelay = 0;\n }\n } else {\n fetchdelay = 0;\n }\n //logger.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n nextRange = this.getBufferRange(this.media.currentTime + fetchdelay);\n if (nextRange) {\n // we can flush buffer range following this one without stalling playback\n nextRange = this.followingBufferRange(nextRange);\n if (nextRange) {\n // flush position is the start position of this new buffer\n this.hls.trigger(Event.BUFFER_FLUSHING, {startOffset: nextRange.start, endOffset: Number.POSITIVE_INFINITY});\n this.state = State.PAUSED;\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n }\n }\n\n onMediaAttached(data) {\n var media = this.media = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('seeked', this.onvseeked);\n media.addEventListener('ended', this.onvended);\n if(this.levels && this.config.autoStartLoad) {\n this.hls.startLoad();\n }\n }\n\n onMediaDetaching() {\n var media = this.media;\n if (media && media.ended) {\n logger.log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n // reset fragment loading counter on MSE detaching to avoid reporting FRAG_LOOP_LOADING_ERROR after error recovery\n var levels = this.levels;\n if (levels) {\n // reset fragment load counter\n levels.forEach(level => {\n if(level.details) {\n level.details.fragments.forEach(fragment => {\n fragment.loadCounter = undefined;\n });\n }\n });\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('seeked', this.onvseeked);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = null;\n this.loadedmetadata = false;\n this.stopLoad();\n }\n\n onMediaSeeking() {\n if (this.state === State.FRAG_LOADING) {\n // check if currently loaded fragment is inside buffer.\n //if outside, cancel fragment loading, otherwise do nothing\n if (BufferHelper.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len === 0) {\n logger.log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n var fragCurrent = this.fragCurrent;\n if (fragCurrent) {\n if (fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n // switch to IDLE state to load new fragment\n this.state = State.IDLE;\n }\n } else if (this.state === State.ENDED) {\n // switch to IDLE state to check for potential new fragment\n this.state = State.IDLE;\n }\n if (this.media) {\n this.lastCurrentTime = this.media.currentTime;\n }\n // avoid reporting fragment loop loading error in case user is seeking several times on same position\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // tick to speed up processing\n this.tick();\n }\n\n onMediaSeeked() {\n // tick to speed up FRAGMENT_PLAYING triggering\n this.tick();\n }\n\n onMediaEnded() {\n logger.log('media ended');\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n\n onManifestLoading() {\n // reset buffer on manifest loading\n logger.log('trigger BUFFER_RESET');\n this.hls.trigger(Event.BUFFER_RESET);\n this.bufferRange = [];\n this.stalled = false;\n }\n\n onManifestParsed(data) {\n var aac = false, heaac = false, codec;\n data.levels.forEach(level => {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = (aac && heaac);\n if (this.audioCodecSwitch) {\n logger.log('both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC');\n }\n this.levels = data.levels;\n this.startLevelLoaded = false;\n this.startFragRequested = false;\n if (this.config.autoStartLoad) {\n this.hls.startLoad();\n }\n }\n\n onLevelLoaded(data) {\n var newDetails = data.details,\n newLevelId = data.level,\n curLevel = this.levels[newLevelId],\n duration = newDetails.totalduration,\n sliding = 0;\n\n logger.log(`level ${newLevelId} loaded [${newDetails.startSN},${newDetails.endSN}],duration:${duration}`);\n this.levelLastLoaded = newLevelId;\n\n if (newDetails.live) {\n var curDetails = curLevel.details;\n if (curDetails) {\n // we already have details for that level, merge them\n LevelHelper.mergeDetails(curDetails,newDetails);\n sliding = newDetails.fragments[0].start;\n if (newDetails.PTSKnown) {\n logger.log(`live playlist sliding:${sliding.toFixed(3)}`);\n } else {\n logger.log('live playlist - outdated PTS, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n logger.log('live playlist - first load, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n }\n // override level info\n curLevel.details = newDetails;\n this.hls.trigger(Event.LEVEL_UPDATED, { details: newDetails, level: newLevelId });\n\n // compute start position\n if (this.startFragRequested === false) {\n // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)\n if (newDetails.live) {\n let targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * newDetails.targetduration;\n this.startPosition = Math.max(0, sliding + duration - targetLatency);\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment\n if (this.state === State.WAITING_LEVEL) {\n this.state = State.IDLE;\n }\n //trigger handler right now\n this.tick();\n }\n\n onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n }\n\n onFragLoaded(data) {\n var fragCurrent = this.fragCurrent;\n if (this.state === State.FRAG_LOADING &&\n fragCurrent &&\n data.frag.level === fragCurrent.level &&\n data.frag.sn === fragCurrent.sn) {\n if (this.fragBitrateTest === true) {\n // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo\n this.state = State.IDLE;\n this.fragBitrateTest = false;\n data.stats.tparsed = data.stats.tbuffered = performance.now();\n this.hls.trigger(Event.FRAG_BUFFERED, {stats: data.stats, frag: fragCurrent});\n } else {\n this.state = State.PARSING;\n // transmux the MPEG-TS data to ISO-BMFF segments\n this.stats = data.stats;\n var currentLevel = this.levels[this.level],\n details = currentLevel.details,\n duration = details.totalduration,\n start = fragCurrent.start,\n level = fragCurrent.level,\n sn = fragCurrent.sn,\n audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec;\n if(this.audioCodecSwap) {\n logger.log('swapping playlist audio codec');\n if(audioCodec === undefined) {\n audioCodec = this.lastAudioCodec;\n }\n if(audioCodec) {\n if(audioCodec.indexOf('mp4a.40.5') !==-1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n }\n }\n this.pendingAppending = 0;\n logger.log(`Demuxing ${sn} of [${details.startSN} ,${details.endSN}],level ${level}`);\n this.demuxer.push(data.payload, audioCodec, currentLevel.videoCodec, start, fragCurrent.cc, level, sn, duration, fragCurrent.decryptdata);\n }\n }\n this.fragLoadError = 0;\n }\n\n onFragParsingInitSegment(data) {\n if (this.state === State.PARSING) {\n var tracks = data.tracks, trackName, track;\n\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if(track) {\n var audioCodec = this.levels[this.level].audioCodec,\n ua = navigator.userAgent.toLowerCase();\n if(audioCodec && this.audioCodecSwap) {\n logger.log('swapping playlist audio codec');\n if(audioCodec.indexOf('mp4a.40.5') !==-1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n }\n // in case AAC and HE-AAC audio codecs are signalled in manifest\n // force HE-AAC , as it seems that most browsers prefers that way,\n // except for mono streams OR on FF\n // these conditions might need to be reviewed ...\n if (this.audioCodecSwitch) {\n // don't force HE-AAC if mono stream\n if(track.metadata.channelCount !== 1 &&\n // don't force HE-AAC if firefox\n ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n }\n // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n if(ua.indexOf('android') !== -1) {\n audioCodec = 'mp4a.40.2';\n logger.log(`Android: force audio codec to` + audioCodec);\n }\n track.levelCodec = audioCodec;\n }\n track = tracks.video;\n if(track) {\n track.levelCodec = this.levels[this.level].videoCodec;\n }\n\n // if remuxer specify that a unique track needs to generated,\n // let's merge all tracks together\n if (data.unique) {\n var mergedTrack = {\n codec : '',\n levelCodec : ''\n };\n for (trackName in data.tracks) {\n track = tracks[trackName];\n mergedTrack.container = track.container;\n if (mergedTrack.codec) {\n mergedTrack.codec += ',';\n mergedTrack.levelCodec += ',';\n }\n if(track.codec) {\n mergedTrack.codec += track.codec;\n }\n if (track.levelCodec) {\n mergedTrack.levelCodec += track.levelCodec;\n }\n }\n tracks = { audiovideo : mergedTrack };\n }\n this.hls.trigger(Event.BUFFER_CODECS,tracks);\n // loop through tracks that are going to be provided to bufferController\n for (trackName in tracks) {\n track = tracks[trackName];\n logger.log(`track:${trackName},container:${track.container},codecs[level/parsed]=[${track.levelCodec}/${track.codec}]`);\n var initSegment = track.initSegment;\n if (initSegment) {\n this.pendingAppending++;\n this.hls.trigger(Event.BUFFER_APPENDING, {type: trackName, data: initSegment});\n }\n }\n //trigger handler right now\n this.tick();\n }\n }\n\n onFragParsingData(data) {\n if (this.state === State.PARSING) {\n this.tparse2 = Date.now();\n var level = this.levels[this.level],\n frag = this.fragCurrent;\n\n logger.log(`parsed ${data.type},PTS:[${data.startPTS.toFixed(3)},${data.endPTS.toFixed(3)}],DTS:[${data.startDTS.toFixed(3)}/${data.endDTS.toFixed(3)}],nb:${data.nb}`);\n\n var drift = LevelHelper.updateFragPTS(level.details,frag.sn,data.startPTS,data.endPTS),\n hls = this.hls;\n hls.trigger(Event.LEVEL_PTS_UPDATED, {details: level.details, level: this.level, drift: drift});\n\n [data.data1, data.data2].forEach(buffer => {\n if (buffer) {\n this.pendingAppending++;\n hls.trigger(Event.BUFFER_APPENDING, {type: data.type, data: buffer});\n }\n });\n\n this.nextLoadPosition = data.endPTS;\n this.bufferRange.push({type: data.type, start: data.startPTS, end: data.endPTS, frag: frag});\n\n //trigger handler right now\n this.tick();\n } else {\n logger.warn(`not in PARSING state but ${this.state}, ignoring FRAG_PARSING_DATA event`);\n }\n }\n\n onFragParsed() {\n if (this.state === State.PARSING) {\n this.stats.tparsed = performance.now();\n this.state = State.PARSED;\n this._checkAppendedParsed();\n }\n }\n\n onBufferAppended() {\n switch (this.state) {\n case State.PARSING:\n case State.PARSED:\n this.pendingAppending--;\n this._checkAppendedParsed();\n break;\n default:\n break;\n }\n }\n\n _checkAppendedParsed() {\n //trigger handler right now\n if (this.state === State.PARSED && this.pendingAppending === 0) {\n var frag = this.fragCurrent, stats = this.stats;\n if (frag) {\n this.fragPrevious = frag;\n stats.tbuffered = performance.now();\n this.fragLastKbps = Math.round(8 * stats.length / (stats.tbuffered - stats.tfirst));\n this.hls.trigger(Event.FRAG_BUFFERED, {stats: stats, frag: frag});\n logger.log(`media buffered : ${this.timeRangesToString(this.media.buffered)}`);\n this.state = State.IDLE;\n }\n this.tick();\n }\n }\n\n onError(data) {\n switch(data.details) {\n case ErrorDetails.FRAG_LOAD_ERROR:\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n if(!data.fatal) {\n var loadError = this.fragLoadError;\n if(loadError) {\n loadError++;\n } else {\n loadError=1;\n }\n if (loadError <= this.config.fragLoadingMaxRetry) {\n this.fragLoadError = loadError;\n // reset load counter to avoid frag loop loading error\n data.frag.loadCounter = 0;\n // exponential backoff capped to 64s\n var delay = Math.min(Math.pow(2,loadError-1)*this.config.fragLoadingRetryDelay,64000);\n logger.warn(`mediaController: frag loading failed, retry in ${delay} ms`);\n this.retryDate = performance.now() + delay;\n // retry loading state\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger.error(`mediaController: ${data.details} reaches max retry, redispatch as fatal ...`);\n // redispatch same error but with fatal set to true\n data.fatal = true;\n this.hls.trigger(Event.ERROR, data);\n this.state = State.ERROR;\n }\n }\n break;\n case ErrorDetails.FRAG_LOOP_LOADING_ERROR:\n case ErrorDetails.LEVEL_LOAD_ERROR:\n case ErrorDetails.LEVEL_LOAD_TIMEOUT:\n case ErrorDetails.KEY_LOAD_ERROR:\n case ErrorDetails.KEY_LOAD_TIMEOUT:\n // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received\n if(this.state !== State.ERROR) {\n // if fatal error, stop processing, otherwise move to IDLE to retry loading\n this.state = data.fatal ? State.ERROR : State.IDLE;\n logger.warn(`mediaController: ${data.details} while loading frag,switch to ${this.state} state ...`);\n }\n break;\n case ErrorDetails.BUFFER_FULL_ERROR:\n // trigger a smooth level switch to empty buffers\n // also reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n this.config.maxMaxBufferLength/=2;\n logger.warn(`reduce max buffer length to ${this.config.maxMaxBufferLength}s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError`);\n this.nextLevelSwitch();\n break;\n default:\n break;\n }\n }\n\n_checkBuffer() {\n var media = this.media;\n if(media) {\n // compare readyState\n var readyState = media.readyState;\n // if ready state different from HAVE_NOTHING (numeric value 0), we are allowed to seek\n if(readyState) {\n var targetSeekPosition, currentTime;\n // if seek after buffered defined, let's seek if within acceptable range\n var seekAfterBuffered = this.seekAfterBuffered;\n if(seekAfterBuffered) {\n if(media.duration >= seekAfterBuffered) {\n targetSeekPosition = seekAfterBuffered;\n this.seekAfterBuffered = undefined;\n }\n } else {\n currentTime = media.currentTime;\n var loadedmetadata = this.loadedmetadata;\n\n // adjust currentTime to start position on loaded metadata\n if(!loadedmetadata && media.buffered.length) {\n this.loadedmetadata = true;\n // only adjust currentTime if not equal to 0\n if (!currentTime && currentTime !== this.startPosition) {\n targetSeekPosition = this.startPosition;\n }\n }\n }\n if (targetSeekPosition) {\n currentTime = targetSeekPosition;\n logger.log(`target seek position:${targetSeekPosition}`);\n }\n var bufferInfo = BufferHelper.bufferInfo(media,currentTime,0),\n expectedPlaying = !(media.paused || media.ended || media.seeking || readyState < 2),\n jumpThreshold = 0.4, // tolerance needed as some browsers stalls playback before reaching buffered range end\n playheadMoving = currentTime > media.playbackRate*this.lastCurrentTime;\n\n if (this.stalled && playheadMoving) {\n this.stalled = false;\n logger.log(`playback not stuck anymore @${currentTime}`);\n }\n // check buffer upfront\n // if less than jumpThreshold second is buffered, and media is expected to play but playhead is not moving,\n // and we have a new buffer range available upfront, let's seek to that one\n if(expectedPlaying && bufferInfo.len <= jumpThreshold) {\n if(playheadMoving) {\n // playhead moving\n jumpThreshold = 0;\n this.seekHoleNudgeDuration = 0;\n } else {\n // playhead not moving AND media expected to play\n if(!this.stalled) {\n this.seekHoleNudgeDuration = 0;\n logger.log(`playback seems stuck @${currentTime}`);\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_STALLED_ERROR, fatal: false});\n this.stalled = true;\n } else {\n this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration;\n }\n }\n // if we are below threshold, try to jump if next buffer range is close\n if(bufferInfo.len <= jumpThreshold) {\n // no buffer available @ currentTime, check if next buffer is close (within a config.maxSeekHole second range)\n var nextBufferStart = bufferInfo.nextStart, delta = nextBufferStart-currentTime;\n if(nextBufferStart &&\n (delta < this.config.maxSeekHole) &&\n (delta > 0) &&\n !media.seeking) {\n // next buffer is close ! adjust currentTime to nextBufferStart\n // this will ensure effective video decoding\n logger.log(`adjust currentTime from ${media.currentTime} to next buffered @ ${nextBufferStart} + nudge ${this.seekHoleNudgeDuration}`);\n media.currentTime = nextBufferStart + this.seekHoleNudgeDuration;\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false});\n }\n }\n } else {\n if (targetSeekPosition && media.currentTime !== targetSeekPosition) {\n logger.log(`adjust currentTime from ${media.currentTime} to ${targetSeekPosition}`);\n media.currentTime = targetSeekPosition;\n }\n }\n }\n }\n }\n\n onFragLoadEmergencyAborted() {\n this.state = State.IDLE;\n this.tick();\n }\n\n onBufferFlushed() {\n /* after successful buffer flushing, rebuild buffer Range array\n loop through existing buffer range and check if\n corresponding range is still buffered. only push to new array already buffered range\n */\n var newRange = [],range,i;\n for (i = 0; i < this.bufferRange.length; i++) {\n range = this.bufferRange[i];\n if (this.isBuffered((range.start + range.end) / 2)) {\n newRange.push(range);\n }\n }\n this.bufferRange = newRange;\n\n // handle end of immediate switching if needed\n if (this.immediateSwitch) {\n this.immediateLevelSwitchEnd();\n }\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n }\n\n swapAudioCodec() {\n this.audioCodecSwap = !this.audioCodecSwap;\n }\n\n timeRangesToString(r) {\n var log = '', len = r.length;\n for (var i=0; i OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation\n * are those of the authors and should not be interpreted as representing\n * official policies, either expressed or implied, of the authors.\n */\nclass AES {\n\n /**\n * Schedule out an AES key for both encryption and decryption. This\n * is a low-level class. Use a cipher mode to do bulk encryption.\n *\n * @constructor\n * @param key {Array} The key as an array of 4, 6 or 8 words.\n */\n constructor(key) {\n /**\n * The expanded S-box and inverse S-box tables. These will be computed\n * on the client so that we don't have to send them down the wire.\n *\n * There are two tables, _tables[0] is for encryption and\n * _tables[1] is for decryption.\n *\n * The first 4 sub-tables are the expanded S-box with MixColumns. The\n * last (_tables[01][4]) is the S-box itself.\n *\n * @private\n */\n this._tables = [[[],[],[],[],[]],[[],[],[],[],[]]];\n\n this._precompute();\n\n var i, j, tmp,\n encKey, decKey,\n sbox = this._tables[0][4], decTable = this._tables[1],\n keyLen = key.length, rcon = 1;\n\n if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {\n throw new Error('Invalid aes key size=' + keyLen);\n }\n\n encKey = key.slice(0);\n decKey = [];\n this._key = [encKey, decKey];\n\n // schedule encryption keys\n for (i = keyLen; i < 4 * keyLen + 28; i++) {\n tmp = encKey[i-1];\n\n // apply sbox\n if (i%keyLen === 0 || (keyLen === 8 && i%keyLen === 4)) {\n tmp = sbox[tmp>>>24]<<24 ^ sbox[tmp>>16&255]<<16 ^ sbox[tmp>>8&255]<<8 ^ sbox[tmp&255];\n\n // shift rows and add rcon\n if (i%keyLen === 0) {\n tmp = tmp<<8 ^ tmp>>>24 ^ rcon<<24;\n rcon = rcon<<1 ^ (rcon>>7)*283;\n }\n }\n\n encKey[i] = encKey[i-keyLen] ^ tmp;\n }\n\n // schedule decryption keys\n for (j = 0; i; j++, i--) {\n tmp = encKey[j&3 ? i : i - 4];\n if (i<=4 || j<4) {\n decKey[j] = tmp;\n } else {\n decKey[j] = decTable[0][sbox[tmp>>>24 ]] ^\n decTable[1][sbox[tmp>>16 & 255]] ^\n decTable[2][sbox[tmp>>8 & 255]] ^\n decTable[3][sbox[tmp & 255]];\n }\n }\n }\n\n /**\n * Expand the S-box tables.\n *\n * @private\n */\n _precompute() {\n var encTable = this._tables[0], decTable = this._tables[1],\n sbox = encTable[4], sboxInv = decTable[4],\n i, x, xInv, d=[], th=[], x2, x4, x8, s, tEnc, tDec;\n\n // Compute double and third tables\n for (i = 0; i < 256; i++) {\n th[( d[i] = i<<1 ^ (i>>7)*283 )^i]=i;\n }\n\n for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n // Compute sbox\n s = xInv ^ xInv<<1 ^ xInv<<2 ^ xInv<<3 ^ xInv<<4;\n s = s>>8 ^ s&255 ^ 99;\n sbox[x] = s;\n sboxInv[s] = x;\n\n // Compute MixColumns\n x8 = d[x4 = d[x2 = d[x]]];\n tDec = x8*0x1010101 ^ x4*0x10001 ^ x2*0x101 ^ x*0x1010100;\n tEnc = d[s]*0x101 ^ s*0x1010100;\n\n for (i = 0; i < 4; i++) {\n encTable[i][x] = tEnc = tEnc<<24 ^ tEnc>>>8;\n decTable[i][s] = tDec = tDec<<24 ^ tDec>>>8;\n }\n }\n\n // Compactify. Considerable speedup on Firefox.\n for (i = 0; i < 5; i++) {\n encTable[i] = encTable[i].slice(0);\n decTable[i] = decTable[i].slice(0);\n }\n }\n\n /**\n * Decrypt 16 bytes, specified as four 32-bit words.\n * @param encrypted0 {number} the first word to decrypt\n * @param encrypted1 {number} the second word to decrypt\n * @param encrypted2 {number} the third word to decrypt\n * @param encrypted3 {number} the fourth word to decrypt\n * @param out {Int32Array} the array to write the decrypted words\n * into\n * @param offset {number} the offset into the output array to start\n * writing results\n * @return {Array} The plaintext.\n */\n decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {\n var key = this._key[1],\n // state variables a,b,c,d are loaded with pre-whitened data\n a = encrypted0 ^ key[0],\n b = encrypted3 ^ key[1],\n c = encrypted2 ^ key[2],\n d = encrypted1 ^ key[3],\n a2, b2, c2,\n\n nInnerRounds = key.length / 4 - 2, // key.length === 2 ?\n i,\n kIndex = 4,\n table = this._tables[1],\n\n // load up the tables\n table0 = table[0],\n table1 = table[1],\n table2 = table[2],\n table3 = table[3],\n sbox = table[4];\n\n // Inner rounds. Cribbed from OpenSSL.\n for (i = 0; i < nInnerRounds; i++) {\n a2 = table0[a>>>24] ^ table1[b>>16 & 255] ^ table2[c>>8 & 255] ^ table3[d & 255] ^ key[kIndex];\n b2 = table0[b>>>24] ^ table1[c>>16 & 255] ^ table2[d>>8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];\n c2 = table0[c>>>24] ^ table1[d>>16 & 255] ^ table2[a>>8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];\n d = table0[d>>>24] ^ table1[a>>16 & 255] ^ table2[b>>8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];\n kIndex += 4;\n a=a2; b=b2; c=c2;\n }\n\n // Last round.\n for (i = 0; i < 4; i++) {\n out[(3 & -i) + offset] =\n sbox[a>>>24 ]<<24 ^\n sbox[b>>16 & 255]<<16 ^\n sbox[c>>8 & 255]<<8 ^\n sbox[d & 255] ^\n key[kIndex++];\n a2=a; a=b; b=c; c=d; d=a2;\n }\n }\n}\n\nexport default AES;\n", - "/*\n *\n * This file contains an adaptation of the AES decryption algorithm\n * from the Standford Javascript Cryptography Library. That work is\n * covered by the following copyright and permissions notice:\n *\n * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation\n * are those of the authors and should not be interpreted as representing\n * official policies, either expressed or implied, of the authors.\n */\n\nimport AES from './aes';\n\nclass AES128Decrypter {\n\n constructor(key, initVector) {\n this.key = key;\n this.iv = initVector;\n }\n\n /**\n * Convert network-order (big-endian) bytes into their little-endian\n * representation.\n */\n ntoh(word) {\n return (word << 24) |\n ((word & 0xff00) << 8) |\n ((word & 0xff0000) >> 8) |\n (word >>> 24);\n }\n\n\n /**\n * Decrypt bytes using AES-128 with CBC and PKCS#7 padding.\n * @param encrypted {Uint8Array} the encrypted bytes\n * @param key {Uint32Array} the bytes of the decryption key\n * @param initVector {Uint32Array} the initialization vector (IV) to\n * use for the first round of CBC.\n * @return {Uint8Array} the decrypted bytes\n *\n * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard\n * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29\n * @see https://tools.ietf.org/html/rfc2315\n */\n doDecrypt(encrypted, key, initVector) {\n var\n // word-level access to the encrypted bytes\n encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2),\n\n decipher = new AES(Array.prototype.slice.call(key)),\n\n // byte and word-level access for the decrypted output\n decrypted = new Uint8Array(encrypted.byteLength),\n decrypted32 = new Int32Array(decrypted.buffer),\n\n // temporary variables for working with the IV, encrypted, and\n // decrypted data\n init0, init1, init2, init3,\n encrypted0, encrypted1, encrypted2, encrypted3,\n\n // iteration variable\n wordIx;\n\n // pull out the words of the IV to ensure we don't modify the\n // passed-in reference and easier access\n init0 = ~~initVector[0];\n init1 = ~~initVector[1];\n init2 = ~~initVector[2];\n init3 = ~~initVector[3];\n\n // decrypt four word sequences, applying cipher-block chaining (CBC)\n // to each decrypted block\n for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {\n // convert big-endian (network order) words into little-endian\n // (javascript order)\n encrypted0 = ~~this.ntoh(encrypted32[wordIx]);\n encrypted1 = ~~this.ntoh(encrypted32[wordIx + 1]);\n encrypted2 = ~~this.ntoh(encrypted32[wordIx + 2]);\n encrypted3 = ~~this.ntoh(encrypted32[wordIx + 3]);\n\n // decrypt the block\n decipher.decrypt(encrypted0,\n encrypted1,\n encrypted2,\n encrypted3,\n decrypted32,\n wordIx);\n\n // XOR with the IV, and restore network byte-order to obtain the\n // plaintext\n decrypted32[wordIx] = this.ntoh(decrypted32[wordIx] ^ init0);\n decrypted32[wordIx + 1] = this.ntoh(decrypted32[wordIx + 1] ^ init1);\n decrypted32[wordIx + 2] = this.ntoh(decrypted32[wordIx + 2] ^ init2);\n decrypted32[wordIx + 3] = this.ntoh(decrypted32[wordIx + 3] ^ init3);\n\n // setup the IV for the next round\n init0 = encrypted0;\n init1 = encrypted1;\n init2 = encrypted2;\n init3 = encrypted3;\n }\n\n return decrypted;\n }\n\n localDecrypt(encrypted, key, initVector, decrypted) {\n var bytes = this.doDecrypt(encrypted,\n key,\n initVector);\n decrypted.set(bytes, encrypted.byteOffset);\n }\n\n decrypt(encrypted) {\n var\n step = 4 * 8000,\n //encrypted32 = new Int32Array(encrypted.buffer),\n encrypted32 = new Int32Array(encrypted),\n decrypted = new Uint8Array(encrypted.byteLength),\n i = 0;\n\n // split up the encryption job and do the individual chunks asynchronously\n var key = this.key;\n var initVector = this.iv;\n this.localDecrypt(encrypted32.subarray(i, i + step), key, initVector, decrypted);\n\n for (i = step; i < encrypted32.length; i += step) {\n initVector = new Uint32Array([\n this.ntoh(encrypted32[i - 4]),\n this.ntoh(encrypted32[i - 3]),\n this.ntoh(encrypted32[i - 2]),\n this.ntoh(encrypted32[i - 1])\n ]);\n this.localDecrypt(encrypted32.subarray(i, i + step), key, initVector, decrypted);\n }\n\n return decrypted;\n }\n}\n\nexport default AES128Decrypter;\n", - "/*\n * AES128 decryption.\n */\n\nimport AES128Decrypter from './aes128-decrypter';\nimport {ErrorTypes, ErrorDetails} from '../errors';\nimport {logger} from '../utils/logger';\n\nclass Decrypter {\n\n constructor(hls) {\n this.hls = hls;\n try {\n const browserCrypto = window ? window.crypto : crypto;\n this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;\n this.disableWebCrypto = !this.subtle;\n } catch (e) {\n this.disableWebCrypto = true;\n }\n }\n\n destroy() {\n }\n\n decrypt(data, key, iv, callback) {\n if (this.disableWebCrypto && this.hls.config.enableSoftwareAES) {\n this.decryptBySoftware(data, key, iv, callback);\n } else {\n this.decryptByWebCrypto(data, key, iv, callback);\n }\n }\n\n decryptByWebCrypto(data, key, iv, callback) {\n logger.log('decrypting by WebCrypto API');\n\n this.subtle.importKey('raw', key, { name : 'AES-CBC', length : 128 }, false, ['decrypt']).\n then((importedKey) => {\n this.subtle.decrypt({ name : 'AES-CBC', iv : iv.buffer }, importedKey, data).\n then(callback).\n catch ((err) => {\n this.onWebCryptoError(err, data, key, iv, callback);\n });\n }).\n catch ((err) => {\n this.onWebCryptoError(err, data, key, iv, callback);\n });\n }\n\n decryptBySoftware(data, key8, iv8, callback) {\n logger.log('decrypting by JavaScript Implementation');\n\n var view = new DataView(key8.buffer);\n var key = new Uint32Array([\n view.getUint32(0),\n view.getUint32(4),\n view.getUint32(8),\n view.getUint32(12)\n ]);\n\n view = new DataView(iv8.buffer);\n var iv = new Uint32Array([\n view.getUint32(0),\n view.getUint32(4),\n view.getUint32(8),\n view.getUint32(12)\n ]);\n\n var decrypter = new AES128Decrypter(key, iv);\n callback(decrypter.decrypt(data).buffer);\n }\n\n onWebCryptoError(err, data, key, iv, callback) {\n if (this.hls.config.enableSoftwareAES) {\n logger.log('disabling to use WebCrypto API');\n this.disableWebCrypto = true;\n this.decryptBySoftware(data, key, iv, callback);\n }\n else {\n logger.error(`decrypting error : ${err.message}`);\n this.hls.trigger(Event.ERROR, {type : ErrorTypes.MEDIA_ERROR, details : ErrorDetails.FRAG_DECRYPT_ERROR, fatal : true, reason : err.message});\n }\n }\n\n}\n\nexport default Decrypter;\n", - "/**\n * AAC demuxer\n */\nimport ADTS from './adts';\nimport {logger} from '../utils/logger';\nimport ID3 from '../demux/id3';\n\n class AACDemuxer {\n\n constructor(observer,remuxerClass) {\n this.observer = observer;\n this.remuxerClass = remuxerClass;\n this.remuxer = new this.remuxerClass(observer);\n this._aacTrack = {container : 'audio/adts', type: 'audio', id :-1, sequenceNumber: 0, samples : [], len : 0};\n }\n\n static probe(data) {\n // check if data contains ID3 timestamp and ADTS sync worc\n var id3 = new ID3(data), offset,len;\n if(id3.hasTimeStamp) {\n // look for ADTS header (0xFFFx)\n for (offset = id3.length, len = data.length; offset < len - 1; offset++) {\n if ((data[offset] === 0xff) && (data[offset+1] & 0xf0) === 0xf0) {\n //logger.log('ADTS sync word found !');\n return true;\n }\n }\n }\n return false;\n }\n\n\n // feed incoming data to the front of the parsing pipeline\n push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) {\n var track = this._aacTrack,\n id3 = new ID3(data),\n pts = 90*id3.timeStamp,\n config, frameLength, frameDuration, frameIndex, offset, headerLength, stamp, len, aacSample;\n // look for ADTS header (0xFFFx)\n for (offset = id3.length, len = data.length; offset < len - 1; offset++) {\n if ((data[offset] === 0xff) && (data[offset+1] & 0xf0) === 0xf0) {\n break;\n }\n }\n\n if (!track.audiosamplerate) {\n config = ADTS.getAudioConfig(this.observer,data, offset, audioCodec);\n track.config = config.config;\n track.audiosamplerate = config.samplerate;\n track.channelCount = config.channelCount;\n track.codec = config.codec;\n track.duration = duration;\n logger.log(`parsed codec:${track.codec},rate:${config.samplerate},nb channel:${config.channelCount}`);\n }\n frameIndex = 0;\n frameDuration = 1024 * 90000 / track.audiosamplerate;\n while ((offset + 5) < len) {\n // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n headerLength = (!!(data[offset + 1] & 0x01) ? 7 : 9);\n // retrieve frame size\n frameLength = ((data[offset + 3] & 0x03) << 11) |\n (data[offset + 4] << 3) |\n ((data[offset + 5] & 0xE0) >>> 5);\n frameLength -= headerLength;\n //stamp = pes.pts;\n\n if ((frameLength > 0) && ((offset + headerLength + frameLength) <= len)) {\n stamp = pts + frameIndex * frameDuration;\n //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n aacSample = {unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp};\n track.samples.push(aacSample);\n track.len += frameLength;\n offset += frameLength + headerLength;\n frameIndex++;\n // look for ADTS header (0xFFFx)\n for ( ; offset < (len - 1); offset++) {\n if ((data[offset] === 0xff) && ((data[offset + 1] & 0xf0) === 0xf0)) {\n break;\n }\n }\n } else {\n break;\n }\n }\n this.remuxer.remux(this._aacTrack,{samples : []}, {samples : [ { pts: pts, dts : pts, unit : id3.payload} ]}, { samples: [] }, timeOffset);\n }\n\n destroy() {\n }\n\n}\n\nexport default AACDemuxer;\n", - "/**\n * ADTS parser helper\n */\nimport {logger} from '../utils/logger';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\n class ADTS {\n\n static getAudioConfig(observer, data, offset, audioCodec) {\n var adtsObjectType, // :int\n adtsSampleingIndex, // :int\n adtsExtensionSampleingIndex, // :int\n adtsChanelConfig, // :int\n config,\n userAgent = navigator.userAgent.toLowerCase(),\n adtsSampleingRates = [\n 96000, 88200,\n 64000, 48000,\n 44100, 32000,\n 24000, 22050,\n 16000, 12000,\n 11025, 8000,\n 7350];\n // byte 2\n adtsObjectType = ((data[offset + 2] & 0xC0) >>> 6) + 1;\n adtsSampleingIndex = ((data[offset + 2] & 0x3C) >>> 2);\n if(adtsSampleingIndex > adtsSampleingRates.length-1) {\n observer.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: true, reason: `invalid ADTS sampling index:${adtsSampleingIndex}`});\n return;\n }\n adtsChanelConfig = ((data[offset + 2] & 0x01) << 2);\n // byte 3\n adtsChanelConfig |= ((data[offset + 3] & 0xC0) >>> 6);\n logger.log(`manifest codec:${audioCodec},ADTS data:type:${adtsObjectType},sampleingIndex:${adtsSampleingIndex}[${adtsSampleingRates[adtsSampleingIndex]}Hz],channelConfig:${adtsChanelConfig}`);\n // firefox: freq less than 24kHz = AAC SBR (HE-AAC)\n if (userAgent.indexOf('firefox') !== -1) {\n if (adtsSampleingIndex >= 6) {\n adtsObjectType = 5;\n config = new Array(4);\n // HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies\n // there is a factor 2 between frame sample rate and output sample rate\n // multiply frequency by 2 (see table below, equivalent to substract 3)\n adtsExtensionSampleingIndex = adtsSampleingIndex - 3;\n } else {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n }\n // Android : always use AAC\n } else if (userAgent.indexOf('android') !== -1) {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n } else {\n /* for other browsers (chrome ...)\n always force audio type to be HE-AAC SBR, as some browsers do not support audio codec switch properly (like Chrome ...)\n */\n adtsObjectType = 5;\n config = new Array(4);\n // if (manifest codec is HE-AAC or HE-AACv2) OR (manifest codec not specified AND frequency less than 24kHz)\n if ((audioCodec && ((audioCodec.indexOf('mp4a.40.29') !== -1) ||\n (audioCodec.indexOf('mp4a.40.5') !== -1))) ||\n (!audioCodec && adtsSampleingIndex >= 6)) {\n // HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies\n // there is a factor 2 between frame sample rate and output sample rate\n // multiply frequency by 2 (see table below, equivalent to substract 3)\n adtsExtensionSampleingIndex = adtsSampleingIndex - 3;\n } else {\n // if (manifest codec is AAC) AND (frequency less than 24kHz AND nb channel is 1) OR (manifest codec not specified and mono audio)\n // Chrome fails to play back with low frequency AAC LC mono when initialized with HE-AAC. This is not a problem with stereo.\n if (audioCodec && audioCodec.indexOf('mp4a.40.2') !== -1 && (adtsSampleingIndex >= 6 && adtsChanelConfig === 1) ||\n (!audioCodec && adtsChanelConfig === 1)) {\n adtsObjectType = 2;\n config = new Array(2);\n }\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n }\n }\n /* refer to http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config\n ISO 14496-3 (AAC).pdf - Table 1.13 — Syntax of AudioSpecificConfig()\n Audio Profile / Audio Object Type\n 0: Null\n 1: AAC Main\n 2: AAC LC (Low Complexity)\n 3: AAC SSR (Scalable Sample Rate)\n 4: AAC LTP (Long Term Prediction)\n 5: SBR (Spectral Band Replication)\n 6: AAC Scalable\n sampling freq\n 0: 96000 Hz\n 1: 88200 Hz\n 2: 64000 Hz\n 3: 48000 Hz\n 4: 44100 Hz\n 5: 32000 Hz\n 6: 24000 Hz\n 7: 22050 Hz\n 8: 16000 Hz\n 9: 12000 Hz\n 10: 11025 Hz\n 11: 8000 Hz\n 12: 7350 Hz\n 13: Reserved\n 14: Reserved\n 15: frequency is written explictly\n Channel Configurations\n These are the channel configurations:\n 0: Defined in AOT Specifc Config\n 1: 1 channel: front-center\n 2: 2 channels: front-left, front-right\n */\n // audioObjectType = profile => profile, the MPEG-4 Audio Object Type minus 1\n config[0] = adtsObjectType << 3;\n // samplingFrequencyIndex\n config[0] |= (adtsSampleingIndex & 0x0E) >> 1;\n config[1] |= (adtsSampleingIndex & 0x01) << 7;\n // channelConfiguration\n config[1] |= adtsChanelConfig << 3;\n if (adtsObjectType === 5) {\n // adtsExtensionSampleingIndex\n config[1] |= (adtsExtensionSampleingIndex & 0x0E) >> 1;\n config[2] = (adtsExtensionSampleingIndex & 0x01) << 7;\n // adtsObjectType (force to 2, chrome is checking that object type is less than 5 ???\n // https://chromium.googlesource.com/chromium/src.git/+/master/media/formats/mp4/aac.cc\n config[2] |= 2 << 2;\n config[3] = 0;\n }\n return {config: config, samplerate: adtsSampleingRates[adtsSampleingIndex], channelCount: adtsChanelConfig, codec: ('mp4a.40.' + adtsObjectType)};\n }\n}\n\nexport default ADTS;\n", - "/* inline demuxer.\n * probe fragments and instantiate appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...)\n */\n\nimport Event from '../events';\nimport {ErrorTypes, ErrorDetails} from '../errors';\nimport AACDemuxer from '../demux/aacdemuxer';\nimport TSDemuxer from '../demux/tsdemuxer';\nimport MP4Remuxer from '../remux/mp4-remuxer';\nimport PassThroughRemuxer from '../remux/passthrough-remuxer';\n\nclass DemuxerInline {\n\n constructor(hls,typeSupported) {\n this.hls = hls;\n this.typeSupported = typeSupported;\n }\n\n destroy() {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.destroy();\n }\n }\n\n push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) {\n var demuxer = this.demuxer;\n if (!demuxer) {\n var hls = this.hls;\n // probe for content type\n if (TSDemuxer.probe(data)) {\n if (this.typeSupported.mp2t === true) {\n demuxer = new TSDemuxer(hls,PassThroughRemuxer);\n } else {\n demuxer = new TSDemuxer(hls,MP4Remuxer);\n }\n } else if(AACDemuxer.probe(data)) {\n demuxer = new AACDemuxer(hls,MP4Remuxer);\n } else {\n hls.trigger(Event.ERROR, {type : ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: true, reason: 'no demux matching with content found'});\n return;\n }\n this.demuxer = demuxer;\n }\n demuxer.push(data,audioCodec,videoCodec,timeOffset,cc,level,sn,duration);\n }\n}\n\nexport default DemuxerInline;\n", - "/* demuxer web worker.\n * - listen to worker message, and trigger DemuxerInline upon reception of Fragments.\n * - provides MP4 Boxes back to main thread using [transferable objects](https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast) in order to minimize message passing overhead.\n */\n\n import DemuxerInline from '../demux/demuxer-inline';\n import Event from '../events';\n import EventEmitter from 'events';\n\nvar DemuxerWorker = function (self) {\n // observer setup\n var observer = new EventEmitter();\n observer.trigger = function trigger (event, ...data) {\n observer.emit(event, event, ...data);\n };\n\n observer.off = function off (event, ...data) {\n observer.removeListener(event, ...data);\n };\n self.addEventListener('message', function (ev) {\n var data = ev.data;\n //console.log('demuxer cmd:' + data.cmd);\n switch (data.cmd) {\n case 'init':\n self.demuxer = new DemuxerInline(observer, data.typeSupported);\n break;\n case 'demux':\n self.demuxer.push(new Uint8Array(data.data), data.audioCodec, data.videoCodec, data.timeOffset, data.cc, data.level, data.sn, data.duration);\n break;\n default:\n break;\n }\n });\n\n // listen to events triggered by Demuxer\n observer.on(Event.FRAG_PARSING_INIT_SEGMENT, function(ev, data) {\n self.postMessage({event: ev, tracks : data.tracks, unique : data.unique });\n });\n\n observer.on(Event.FRAG_PARSING_DATA, function(ev, data) {\n var objData = {event: ev, type: data.type, startPTS: data.startPTS, endPTS: data.endPTS, startDTS: data.startDTS, endDTS: data.endDTS, data1: data.data1.buffer, data2: data.data2.buffer, nb: data.nb};\n // pass data1/data2 as transferable object (no copy)\n self.postMessage(objData, [objData.data1, objData.data2]);\n });\n\n observer.on(Event.FRAG_PARSED, function(event) {\n self.postMessage({event: event});\n });\n\n observer.on(Event.ERROR, function(event, data) {\n self.postMessage({event: event, data: data});\n });\n\n observer.on(Event.FRAG_PARSING_METADATA, function(event, data) {\n var objData = {event: event, samples: data.samples};\n self.postMessage(objData);\n });\n\n observer.on(Event.FRAG_PARSING_USERDATA, function(event, data) {\n var objData = {event: event, samples: data.samples};\n self.postMessage(objData);\n });\n\n};\n\nexport default DemuxerWorker;\n\n", - "import Event from '../events';\nimport DemuxerInline from '../demux/demuxer-inline';\nimport DemuxerWorker from '../demux/demuxer-worker';\nimport {logger} from '../utils/logger';\nimport Decrypter from '../crypt/decrypter';\n\nclass Demuxer {\n\n constructor(hls) {\n this.hls = hls;\n var typeSupported = {\n mp4 : MediaSource.isTypeSupported('video/mp4'),\n mp2t : hls.config.enableMP2TPassThrough && MediaSource.isTypeSupported('video/mp2t')\n };\n if (hls.config.enableWorker && (typeof(Worker) !== 'undefined')) {\n logger.log('demuxing in webworker');\n try {\n var work = require('webworkify');\n this.w = work(DemuxerWorker);\n this.onwmsg = this.onWorkerMessage.bind(this);\n this.w.addEventListener('message', this.onwmsg);\n this.w.postMessage({cmd: 'init', typeSupported : typeSupported});\n } catch(err) {\n logger.error('error while initializing DemuxerWorker, fallback on DemuxerInline');\n this.demuxer = new DemuxerInline(hls,typeSupported);\n }\n } else {\n this.demuxer = new DemuxerInline(hls,typeSupported);\n }\n this.demuxInitialized = true;\n }\n\n destroy() {\n if (this.w) {\n this.w.removeEventListener('message', this.onwmsg);\n this.w.terminate();\n this.w = null;\n } else {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n if (this.decrypter) {\n this.decrypter.destroy();\n this.decrypter = null;\n }\n }\n\n pushDecrypted(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) {\n if (this.w) {\n // post fragment payload as transferable objects (no copy)\n this.w.postMessage({cmd: 'demux', data: data, audioCodec: audioCodec, videoCodec: videoCodec, timeOffset: timeOffset, cc: cc, level: level, sn : sn, duration: duration}, [data]);\n } else {\n this.demuxer.push(new Uint8Array(data), audioCodec, videoCodec, timeOffset, cc, level, sn, duration);\n }\n }\n\n push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration, decryptdata) {\n if ((data.byteLength > 0) && (decryptdata != null) && (decryptdata.key != null) && (decryptdata.method === 'AES-128')) {\n if (this.decrypter == null) {\n this.decrypter = new Decrypter(this.hls);\n }\n\n var localthis = this;\n this.decrypter.decrypt(data, decryptdata.key, decryptdata.iv, function(decryptedData){\n localthis.pushDecrypted(decryptedData, audioCodec, videoCodec, timeOffset, cc, level, sn, duration);\n });\n } else {\n this.pushDecrypted(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration);\n }\n }\n\n onWorkerMessage(ev) {\n var data = ev.data;\n //console.log('onWorkerMessage:' + data.event);\n switch(data.event) {\n case Event.FRAG_PARSING_INIT_SEGMENT:\n var obj = {};\n obj.tracks = data.tracks;\n obj.unique = data.unique;\n this.hls.trigger(Event.FRAG_PARSING_INIT_SEGMENT, obj);\n break;\n case Event.FRAG_PARSING_DATA:\n this.hls.trigger(Event.FRAG_PARSING_DATA,{\n data1: new Uint8Array(data.data1),\n data2: new Uint8Array(data.data2),\n startPTS: data.startPTS,\n endPTS: data.endPTS,\n startDTS: data.startDTS,\n endDTS: data.endDTS,\n type: data.type,\n nb: data.nb\n });\n break;\n case Event.FRAG_PARSING_METADATA:\n this.hls.trigger(Event.FRAG_PARSING_METADATA, {\n samples: data.samples\n });\n break;\n case Event.FRAG_PARSING_USERDATA:\n this.hls.trigger(Event.FRAG_PARSING_USERDATA, {\n samples: data.samples\n });\n break;\n default:\n this.hls.trigger(data.event, data.data);\n break;\n }\n }\n}\n\nexport default Demuxer;\n\n", - "/**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.\n*/\n\nimport {logger} from '../utils/logger';\n\nclass ExpGolomb {\n\n constructor(data) {\n this.data = data;\n // the number of bytes left to examine in this.data\n this.bytesAvailable = this.data.byteLength;\n // the current word being examined\n this.word = 0; // :uint\n // the number of bits left to examine in the current word\n this.bitsAvailable = 0; // :uint\n }\n\n // ():void\n loadWord() {\n var\n position = this.data.byteLength - this.bytesAvailable,\n workingBytes = new Uint8Array(4),\n availableBytes = Math.min(4, this.bytesAvailable);\n if (availableBytes === 0) {\n throw new Error('no bytes available');\n }\n workingBytes.set(this.data.subarray(position, position + availableBytes));\n this.word = new DataView(workingBytes.buffer).getUint32(0);\n // track the amount of this.data that has been processed\n this.bitsAvailable = availableBytes * 8;\n this.bytesAvailable -= availableBytes;\n }\n\n // (count:int):void\n skipBits(count) {\n var skipBytes; // :int\n if (this.bitsAvailable > count) {\n this.word <<= count;\n this.bitsAvailable -= count;\n } else {\n count -= this.bitsAvailable;\n skipBytes = count >> 3;\n count -= (skipBytes >> 3);\n this.bytesAvailable -= skipBytes;\n this.loadWord();\n this.word <<= count;\n this.bitsAvailable -= count;\n }\n }\n\n // (size:int):uint\n readBits(size) {\n var\n bits = Math.min(this.bitsAvailable, size), // :uint\n valu = this.word >>> (32 - bits); // :uint\n if (size > 32) {\n logger.error('Cannot read more than 32 bits at a time');\n }\n this.bitsAvailable -= bits;\n if (this.bitsAvailable > 0) {\n this.word <<= bits;\n } else if (this.bytesAvailable > 0) {\n this.loadWord();\n }\n bits = size - bits;\n if (bits > 0) {\n return valu << bits | this.readBits(bits);\n } else {\n return valu;\n }\n }\n\n // ():uint\n skipLZ() {\n var leadingZeroCount; // :uint\n for (leadingZeroCount = 0; leadingZeroCount < this.bitsAvailable; ++leadingZeroCount) {\n if (0 !== (this.word & (0x80000000 >>> leadingZeroCount))) {\n // the first bit of working word is 1\n this.word <<= leadingZeroCount;\n this.bitsAvailable -= leadingZeroCount;\n return leadingZeroCount;\n }\n }\n // we exhausted word and still have not found a 1\n this.loadWord();\n return leadingZeroCount + this.skipLZ();\n }\n\n // ():void\n skipUEG() {\n this.skipBits(1 + this.skipLZ());\n }\n\n // ():void\n skipEG() {\n this.skipBits(1 + this.skipLZ());\n }\n\n // ():uint\n readUEG() {\n var clz = this.skipLZ(); // :uint\n return this.readBits(clz + 1) - 1;\n }\n\n // ():int\n readEG() {\n var valu = this.readUEG(); // :int\n if (0x01 & valu) {\n // the number is odd if the low order bit is set\n return (1 + valu) >>> 1; // add 1 to make it even, and divide by 2\n } else {\n return -1 * (valu >>> 1); // divide by two then make it negative\n }\n }\n\n // Some convenience functions\n // :Boolean\n readBoolean() {\n return 1 === this.readBits(1);\n }\n\n // ():int\n readUByte() {\n return this.readBits(8);\n }\n\n // ():int\n readUShort() {\n return this.readBits(16);\n }\n // ():int\n readUInt() {\n return this.readBits(32);\n }\n\n /**\n * Advance the ExpGolomb decoder past a scaling list. The scaling\n * list is optionally transmitted as part of a sequence parameter\n * set and is not relevant to transmuxing.\n * @param count {number} the number of entries in this scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n skipScalingList(count) {\n var\n lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n for (j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = this.readEG();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n lastScale = (nextScale === 0) ? lastScale : nextScale;\n }\n }\n\n /**\n * Read a sequence parameter set and return some interesting video\n * properties. A sequence parameter set is the H264 metadata that\n * describes the properties of upcoming video frames.\n * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n readSPS() {\n var\n frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n sarScale = 1,\n profileIdc,profileCompat,levelIdc,\n numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n i;\n this.readUByte();\n profileIdc = this.readUByte(); // profile_idc\n profileCompat = this.readBits(5); // constraint_set[0-4]_flag, u(5)\n this.skipBits(3); // reserved_zero_3bits u(3),\n levelIdc = this.readUByte(); //level_idc u(8)\n this.skipUEG(); // seq_parameter_set_id\n // some profiles have more optional data we don't need\n if (profileIdc === 100 ||\n profileIdc === 110 ||\n profileIdc === 122 ||\n profileIdc === 244 ||\n profileIdc === 44 ||\n profileIdc === 83 ||\n profileIdc === 86 ||\n profileIdc === 118 ||\n profileIdc === 128) {\n var chromaFormatIdc = this.readUEG();\n if (chromaFormatIdc === 3) {\n this.skipBits(1); // separate_colour_plane_flag\n }\n this.skipUEG(); // bit_depth_luma_minus8\n this.skipUEG(); // bit_depth_chroma_minus8\n this.skipBits(1); // qpprime_y_zero_transform_bypass_flag\n if (this.readBoolean()) { // seq_scaling_matrix_present_flag\n scalingListCount = (chromaFormatIdc !== 3) ? 8 : 12;\n for (i = 0; i < scalingListCount; i++) {\n if (this.readBoolean()) { // seq_scaling_list_present_flag[ i ]\n if (i < 6) {\n this.skipScalingList(16);\n } else {\n this.skipScalingList(64);\n }\n }\n }\n }\n }\n this.skipUEG(); // log2_max_frame_num_minus4\n var picOrderCntType = this.readUEG();\n if (picOrderCntType === 0) {\n this.readUEG(); //log2_max_pic_order_cnt_lsb_minus4\n } else if (picOrderCntType === 1) {\n this.skipBits(1); // delta_pic_order_always_zero_flag\n this.skipEG(); // offset_for_non_ref_pic\n this.skipEG(); // offset_for_top_to_bottom_field\n numRefFramesInPicOrderCntCycle = this.readUEG();\n for(i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n this.skipEG(); // offset_for_ref_frame[ i ]\n }\n }\n this.skipUEG(); // max_num_ref_frames\n this.skipBits(1); // gaps_in_frame_num_value_allowed_flag\n picWidthInMbsMinus1 = this.readUEG();\n picHeightInMapUnitsMinus1 = this.readUEG();\n frameMbsOnlyFlag = this.readBits(1);\n if (frameMbsOnlyFlag === 0) {\n this.skipBits(1); // mb_adaptive_frame_field_flag\n }\n this.skipBits(1); // direct_8x8_inference_flag\n if (this.readBoolean()) { // frame_cropping_flag\n frameCropLeftOffset = this.readUEG();\n frameCropRightOffset = this.readUEG();\n frameCropTopOffset = this.readUEG();\n frameCropBottomOffset = this.readUEG();\n }\n if (this.readBoolean()) {\n // vui_parameters_present_flag\n if (this.readBoolean()) {\n // aspect_ratio_info_present_flag\n let sarRatio;\n const aspectRatioIdc = this.readUByte();\n switch (aspectRatioIdc) {\n case 1: sarRatio = [1,1]; break;\n case 2: sarRatio = [12,11]; break;\n case 3: sarRatio = [10,11]; break;\n case 4: sarRatio = [16,11]; break;\n case 5: sarRatio = [40,33]; break;\n case 6: sarRatio = [24,11]; break;\n case 7: sarRatio = [20,11]; break;\n case 8: sarRatio = [32,11]; break;\n case 9: sarRatio = [80,33]; break;\n case 10: sarRatio = [18,11]; break;\n case 11: sarRatio = [15,11]; break;\n case 12: sarRatio = [64,33]; break;\n case 13: sarRatio = [160,99]; break;\n case 14: sarRatio = [4,3]; break;\n case 15: sarRatio = [3,2]; break;\n case 16: sarRatio = [2,1]; break;\n case 255: {\n sarRatio = [this.readUByte() << 8 | this.readUByte(), this.readUByte() << 8 | this.readUByte()];\n break;\n }\n }\n if (sarRatio) {\n sarScale = sarRatio[0] / sarRatio[1];\n }\n }\n }\n return {\n width: Math.ceil((((picWidthInMbsMinus1 + 1) * 16) - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale),\n height: ((2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16) - ((frameMbsOnlyFlag? 2 : 4) * (frameCropTopOffset + frameCropBottomOffset))\n };\n }\n\n readSliceType() {\n // skip NALu type\n this.readUByte();\n // discard first_mb_in_slice\n this.readUEG();\n // return slice_type\n return this.readUEG();\n }\n}\n\nexport default ExpGolomb;\n", - "/**\n * ID3 parser\n */\nimport {logger} from '../utils/logger';\n//import Hex from '../utils/hex';\n\n class ID3 {\n\n constructor(data) {\n this._hasTimeStamp = false;\n var offset = 0, byte1,byte2,byte3,byte4,tagSize,endPos,header,len;\n do {\n header = this.readUTF(data,offset,3);\n offset+=3;\n // first check for ID3 header\n if (header === 'ID3') {\n // skip 24 bits\n offset += 3;\n // retrieve tag(s) length\n byte1 = data[offset++] & 0x7f;\n byte2 = data[offset++] & 0x7f;\n byte3 = data[offset++] & 0x7f;\n byte4 = data[offset++] & 0x7f;\n tagSize = (byte1 << 21) + (byte2 << 14) + (byte3 << 7) + byte4;\n endPos = offset + tagSize;\n //logger.log(`ID3 tag found, size/end: ${tagSize}/${endPos}`);\n\n // read ID3 tags\n this._parseID3Frames(data, offset,endPos);\n offset = endPos;\n } else if (header === '3DI') {\n // http://id3.org/id3v2.4.0-structure chapter 3.4. ID3v2 footer\n offset += 7;\n logger.log(`3DI footer found, end: ${offset}`);\n } else {\n offset -= 3;\n len = offset;\n if (len) {\n //logger.log(`ID3 len: ${len}`);\n if (!this.hasTimeStamp) {\n logger.warn('ID3 tag found, but no timestamp');\n }\n this._length = len;\n this._payload = data.subarray(0,len);\n }\n return;\n }\n } while (true);\n }\n\n readUTF(data,start,len) {\n\n var result = '',offset = start, end = start + len;\n do {\n result += String.fromCharCode(data[offset++]);\n } while(offset < end);\n return result;\n }\n\n _parseID3Frames(data,offset,endPos) {\n var tagId,tagLen,tagStart,tagFlags,timestamp;\n while(offset + 8 <= endPos) {\n tagId = this.readUTF(data,offset,4);\n offset +=4;\n\n tagLen = data[offset++] << 24 +\n data[offset++] << 16 +\n data[offset++] << 8 +\n data[offset++];\n\n tagFlags = data[offset++] << 8 +\n data[offset++];\n\n tagStart = offset;\n //logger.log(\"ID3 tag id:\" + tagId);\n switch(tagId) {\n case 'PRIV':\n //logger.log('parse frame:' + Hex.hexDump(data.subarray(offset,endPos)));\n // owner should be \"com.apple.streaming.transportStreamTimestamp\"\n if (this.readUTF(data,offset,44) === 'com.apple.streaming.transportStreamTimestamp') {\n offset+=44;\n // smelling even better ! we found the right descriptor\n // skip null character (string end) + 3 first bytes\n offset+= 4;\n\n // timestamp is 33 bit expressed as a big-endian eight-octet number, with the upper 31 bits set to zero.\n var pts33Bit = data[offset++] & 0x1;\n this._hasTimeStamp = true;\n\n timestamp = ((data[offset++] << 23) +\n (data[offset++] << 15) +\n (data[offset++] << 7) +\n data[offset++]) /45;\n\n if (pts33Bit) {\n timestamp += 47721858.84; // 2^32 / 90\n }\n timestamp = Math.round(timestamp);\n logger.trace(`ID3 timestamp found: ${timestamp}`);\n this._timeStamp = timestamp;\n }\n break;\n default:\n break;\n }\n }\n }\n\n get hasTimeStamp() {\n return this._hasTimeStamp;\n }\n\n get timeStamp() {\n return this._timeStamp;\n }\n\n get length() {\n return this._length;\n }\n\n get payload() {\n return this._payload;\n }\n\n}\n\nexport default ID3;\n\n", - "/**\n * highly optimized TS demuxer:\n * parse PAT, PMT\n * extract PES packet from audio and video PIDs\n * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet\n * trigger the remuxer upon parsing completion\n * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource.\n * it also controls the remuxing process :\n * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state.\n*/\n\n import ADTS from './adts';\n import Event from '../events';\n import ExpGolomb from './exp-golomb';\n// import Hex from '../utils/hex';\n import {logger} from '../utils/logger';\n import {ErrorTypes, ErrorDetails} from '../errors';\n\n class TSDemuxer {\n\n constructor(observer,remuxerClass) {\n this.observer = observer;\n this.remuxerClass = remuxerClass;\n this.lastCC = 0;\n this.remuxer = new this.remuxerClass(observer);\n }\n\n static probe(data) {\n // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47\n if (data.length >= 3*188 && data[0] === 0x47 && data[188] === 0x47 && data[2*188] === 0x47) {\n return true;\n } else {\n return false;\n }\n }\n\n switchLevel() {\n this.pmtParsed = false;\n this._pmtId = -1;\n this.lastAacPTS = null;\n this.aacOverFlow = null;\n this._avcTrack = {container : 'video/mp2t', type: 'video', id :-1, sequenceNumber: 0, samples : [], len : 0, nbNalu : 0};\n this._aacTrack = {container : 'video/mp2t', type: 'audio', id :-1, sequenceNumber: 0, samples : [], len : 0};\n this._id3Track = {type: 'id3', id :-1, sequenceNumber: 0, samples : [], len : 0};\n this._txtTrack = {type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0};\n this.remuxer.switchLevel();\n }\n\n insertDiscontinuity() {\n this.switchLevel();\n this.remuxer.insertDiscontinuity();\n }\n\n // feed incoming data to the front of the parsing pipeline\n push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) {\n var avcData, aacData, id3Data,\n start, len = data.length, stt, pid, atf, offset,\n codecsOnly = this.remuxer.passthrough;\n\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this.timeOffset = timeOffset;\n this._duration = duration;\n this.contiguous = false;\n if (cc !== this.lastCC) {\n logger.log('discontinuity detected');\n this.insertDiscontinuity();\n this.lastCC = cc;\n } else if (level !== this.lastLevel) {\n logger.log('level switch detected');\n this.switchLevel();\n this.lastLevel = level;\n } else if (sn === (this.lastSN+1)) {\n this.contiguous = true;\n }\n this.lastSN = sn;\n\n if(!this.contiguous) {\n // flush any partial content\n this.aacOverFlow = null;\n }\n\n var pmtParsed = this.pmtParsed,\n avcId = this._avcTrack.id,\n aacId = this._aacTrack.id,\n id3Id = this._id3Track.id;\n\n // don't parse last TS packet if incomplete\n len -= len % 188;\n // loop through TS packets\n for (start = 0; start < len; start += 188) {\n if (data[start] === 0x47) {\n stt = !!(data[start + 1] & 0x40);\n // pid is a 13-bit field starting at the last bit of TS[1]\n pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2];\n atf = (data[start + 3] & 0x30) >> 4;\n // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n if (atf > 1) {\n offset = start + 5 + data[start + 4];\n // continue if there is only adaptation field\n if (offset === (start + 188)) {\n continue;\n }\n } else {\n offset = start + 4;\n }\n if (pmtParsed) {\n if (pid === avcId) {\n if (stt) {\n if (avcData) {\n this._parseAVCPES(this._parsePES(avcData));\n if (codecsOnly) {\n // if we have video codec info AND\n // if audio PID is undefined OR if we have audio codec info,\n // we have all codec info !\n if (this._avcTrack.codec && (aacId === -1 || this._aacTrack.codec)) {\n this.remux(data);\n return;\n }\n }\n }\n avcData = {data: [], size: 0};\n }\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + 188));\n avcData.size += start + 188 - offset;\n }\n } else if (pid === aacId) {\n if (stt) {\n if (aacData) {\n this._parseAACPES(this._parsePES(aacData));\n if (codecsOnly) {\n // here we now that we have audio codec info\n // if video PID is undefined OR if we have video codec info,\n // we have all codec infos !\n if (this._aacTrack.codec && (avcId === -1 || this._avcTrack.codec)) {\n this.remux(data);\n return;\n }\n }\n }\n aacData = {data: [], size: 0};\n }\n if (aacData) {\n aacData.data.push(data.subarray(offset, start + 188));\n aacData.size += start + 188 - offset;\n }\n } else if (pid === id3Id) {\n if (stt) {\n if (id3Data) {\n this._parseID3PES(this._parsePES(id3Data));\n }\n id3Data = {data: [], size: 0};\n }\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + 188));\n id3Data.size += start + 188 - offset;\n }\n }\n } else {\n if (stt) {\n offset += data[offset] + 1;\n }\n if (pid === 0) {\n this._parsePAT(data, offset);\n } else if (pid === this._pmtId) {\n this._parsePMT(data, offset);\n pmtParsed = this.pmtParsed = true;\n avcId = this._avcTrack.id;\n aacId = this._aacTrack.id;\n id3Id = this._id3Track.id;\n }\n }\n } else {\n this.observer.trigger(Event.ERROR, {type : ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'TS packet did not start with 0x47'});\n }\n }\n // parse last PES packet\n if (avcData) {\n this._parseAVCPES(this._parsePES(avcData));\n }\n if (aacData) {\n this._parseAACPES(this._parsePES(aacData));\n }\n if (id3Data) {\n this._parseID3PES(this._parsePES(id3Data));\n }\n this.remux(null);\n }\n\n remux(data) {\n this.remuxer.remux(this._aacTrack, this._avcTrack, this._id3Track, this._txtTrack, this.timeOffset, this.contiguous, data);\n }\n\n destroy() {\n this.switchLevel();\n this._initPTS = this._initDTS = undefined;\n this._duration = 0;\n }\n\n _parsePAT(data, offset) {\n // skip the PSI header and parse the first PMT entry\n this._pmtId = (data[offset + 10] & 0x1F) << 8 | data[offset + 11];\n //logger.log('PMT PID:' + this._pmtId);\n }\n\n _parsePMT(data, offset) {\n var sectionLength, tableEnd, programInfoLength, pid;\n sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n tableEnd = offset + 3 + sectionLength - 4;\n // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11];\n // advance the offset to the first entry in the mapping table\n offset += 12 + programInfoLength;\n while (offset < tableEnd) {\n pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2];\n switch(data[offset]) {\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n case 0x0f:\n //logger.log('AAC PID:' + pid);\n this._aacTrack.id = pid;\n break;\n // Packetized metadata (ID3)\n case 0x15:\n //logger.log('ID3 PID:' + pid);\n this._id3Track.id = pid;\n break;\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n case 0x1b:\n //logger.log('AVC PID:' + pid);\n this._avcTrack.id = pid;\n break;\n default:\n logger.log('unkown stream type:' + data[offset]);\n break;\n }\n // move to the next table entry\n // skip past the elementary stream descriptors, if present\n offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5;\n }\n }\n\n _parsePES(stream) {\n var i = 0, frag, pesFlags, pesPrefix, pesLen, pesHdrLen, pesData, pesPts, pesDts, payloadStartOffset, data = stream.data;\n //retrieve PTS/DTS from first fragment\n frag = data[0];\n pesPrefix = (frag[0] << 16) + (frag[1] << 8) + frag[2];\n if (pesPrefix === 1) {\n pesLen = (frag[4] << 8) + frag[5];\n pesFlags = frag[7];\n if (pesFlags & 0xC0) {\n /* PES header described here : http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n as PTS / DTS is 33 bit we cannot use bitwise operator in JS,\n as Bitwise operators treat their operands as a sequence of 32 bits */\n pesPts = (frag[9] & 0x0E) * 536870912 +// 1 << 29\n (frag[10] & 0xFF) * 4194304 +// 1 << 22\n (frag[11] & 0xFE) * 16384 +// 1 << 14\n (frag[12] & 0xFF) * 128 +// 1 << 7\n (frag[13] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesPts > 4294967295) {\n // decrement 2^33\n pesPts -= 8589934592;\n }\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0E ) * 536870912 +// 1 << 29\n (frag[15] & 0xFF ) * 4194304 +// 1 << 22\n (frag[16] & 0xFE ) * 16384 +// 1 << 14\n (frag[17] & 0xFF ) * 128 +// 1 << 7\n (frag[18] & 0xFE ) / 2;\n // check if greater than 2^32 -1\n if (pesDts > 4294967295) {\n // decrement 2^33\n pesDts -= 8589934592;\n }\n } else {\n pesDts = pesPts;\n }\n }\n pesHdrLen = frag[8];\n payloadStartOffset = pesHdrLen + 9;\n\n stream.size -= payloadStartOffset;\n //reassemble PES packet\n pesData = new Uint8Array(stream.size);\n while (data.length) {\n frag = data.shift();\n var len = frag.byteLength;\n if (payloadStartOffset) {\n if (payloadStartOffset > len) {\n // trim full frag if PES header bigger than frag\n payloadStartOffset-=len;\n continue;\n } else {\n // trim partial frag if PES header smaller than frag\n frag = frag.subarray(payloadStartOffset);\n len-=payloadStartOffset;\n payloadStartOffset = 0;\n }\n }\n pesData.set(frag, i);\n i+=len;\n }\n return {data: pesData, pts: pesPts, dts: pesDts, len: pesLen};\n } else {\n return null;\n }\n }\n\n _parseAVCPES(pes) {\n var track = this._avcTrack,\n samples = track.samples,\n units = this._parseAVCNALu(pes.data),\n units2 = [],\n debug = false,\n key = false,\n length = 0,\n expGolombDecoder,\n avcSample,\n push,\n i;\n // no NALu found\n if (units.length === 0 && samples.length > 0) {\n // append pes.data to previous NAL unit\n var lastavcSample = samples[samples.length - 1];\n var lastUnit = lastavcSample.units.units[lastavcSample.units.units.length - 1];\n var tmp = new Uint8Array(lastUnit.data.byteLength + pes.data.byteLength);\n tmp.set(lastUnit.data, 0);\n tmp.set(pes.data, lastUnit.data.byteLength);\n lastUnit.data = tmp;\n lastavcSample.units.length += pes.data.byteLength;\n track.len += pes.data.byteLength;\n }\n //free pes.data to save up some memory\n pes.data = null;\n var debugString = '';\n\n units.forEach(unit => {\n switch(unit.type) {\n //NDR\n case 1:\n push = true;\n if(debug) {\n debugString += 'NDR ';\n }\n break;\n //IDR\n case 5:\n push = true;\n if(debug) {\n debugString += 'IDR ';\n }\n key = true;\n break;\n //SEI\n case 6:\n push = true;\n if(debug) {\n debugString += 'SEI ';\n }\n expGolombDecoder = new ExpGolomb(unit.data);\n\n // skip frameType\n expGolombDecoder.readUByte();\n\n var payloadType = expGolombDecoder.readUByte();\n\n // TODO: there can be more than one payload in an SEI packet...\n // TODO: need to read type and size in a while loop to get them all\n if (payloadType === 4)\n {\n var payloadSize = 0;\n\n do {\n payloadSize = expGolombDecoder.readUByte();\n }\n while (payloadSize === 255);\n\n var countryCode = expGolombDecoder.readUByte();\n\n if (countryCode === 181)\n {\n var providerCode = expGolombDecoder.readUShort();\n\n if (providerCode === 49)\n {\n var userStructure = expGolombDecoder.readUInt();\n\n if (userStructure === 0x47413934)\n {\n var userDataType = expGolombDecoder.readUByte();\n\n // Raw CEA-608 bytes wrapped in CEA-708 packet\n if (userDataType === 3)\n {\n var firstByte = expGolombDecoder.readUByte();\n var secondByte = expGolombDecoder.readUByte();\n\n var totalCCs = 31 & firstByte;\n var byteArray = [firstByte, secondByte];\n\n for (i=0; i 1) {\n logger.log(`AAC: align PTS for overlapping frames by ${Math.round((newPTS-pts)/90)}`);\n pts=newPTS;\n }\n }\n\n while ((offset + 5) < len) {\n // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n headerLength = (!!(data[offset + 1] & 0x01) ? 7 : 9);\n // retrieve frame size\n frameLength = ((data[offset + 3] & 0x03) << 11) |\n (data[offset + 4] << 3) |\n ((data[offset + 5] & 0xE0) >>> 5);\n frameLength -= headerLength;\n //stamp = pes.pts;\n\n if ((frameLength > 0) && ((offset + headerLength + frameLength) <= len)) {\n stamp = pts + frameIndex * frameDuration;\n //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n aacSample = {unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp};\n track.samples.push(aacSample);\n track.len += frameLength;\n offset += frameLength + headerLength;\n frameIndex++;\n // look for ADTS header (0xFFFx)\n for ( ; offset < (len - 1); offset++) {\n if ((data[offset] === 0xff) && ((data[offset + 1] & 0xf0) === 0xf0)) {\n break;\n }\n }\n } else {\n break;\n }\n }\n if (offset < len) {\n aacOverFlow = data.subarray(offset, len);\n //logger.log(`AAC: overflow detected:${len-offset}`);\n } else {\n aacOverFlow = null;\n }\n this.aacOverFlow = aacOverFlow;\n this.lastAacPTS = stamp;\n }\n\n _parseID3PES(pes) {\n this._id3Track.samples.push(pes);\n }\n}\n\nexport default TSDemuxer;\n\n", - "export const ErrorTypes = {\n // Identifier for a network error (loading error / timeout ...)\n NETWORK_ERROR: 'networkError',\n // Identifier for a media Error (video/parsing/mediasource error)\n MEDIA_ERROR: 'mediaError',\n // Identifier for all other errors\n OTHER_ERROR: 'otherError'\n};\n\nexport const ErrorDetails = {\n // Identifier for a manifest load error - data: { url : faulty URL, response : XHR response}\n MANIFEST_LOAD_ERROR: 'manifestLoadError',\n // Identifier for a manifest load timeout - data: { url : faulty URL, response : XHR response}\n MANIFEST_LOAD_TIMEOUT: 'manifestLoadTimeOut',\n // Identifier for a manifest parsing error - data: { url : faulty URL, reason : error reason}\n MANIFEST_PARSING_ERROR: 'manifestParsingError',\n // Identifier for a manifest with only incompatible codecs error - data: { url : faulty URL, reason : error reason}\n MANIFEST_INCOMPATIBLE_CODECS_ERROR: 'manifestIncompatibleCodecsError',\n // Identifier for playlist load error - data: { url : faulty URL, response : XHR response}\n LEVEL_LOAD_ERROR: 'levelLoadError',\n // Identifier for playlist load timeout - data: { url : faulty URL, response : XHR response}\n LEVEL_LOAD_TIMEOUT: 'levelLoadTimeOut',\n // Identifier for a level switch error - data: { level : faulty level Id, event : error description}\n LEVEL_SWITCH_ERROR: 'levelSwitchError',\n // Identifier for fragment load error - data: { frag : fragment object, response : XHR response}\n FRAG_LOAD_ERROR: 'fragLoadError',\n // Identifier for fragment loop loading error - data: { frag : fragment object}\n FRAG_LOOP_LOADING_ERROR: 'fragLoopLoadingError',\n // Identifier for fragment load timeout error - data: { frag : fragment object}\n FRAG_LOAD_TIMEOUT: 'fragLoadTimeOut',\n // Identifier for a fragment decryption error event - data: parsing error description\n FRAG_DECRYPT_ERROR: 'fragDecryptError',\n // Identifier for a fragment parsing error event - data: parsing error description\n FRAG_PARSING_ERROR: 'fragParsingError',\n // Identifier for decrypt key load error - data: { frag : fragment object, response : XHR response}\n KEY_LOAD_ERROR: 'keyLoadError',\n // Identifier for decrypt key load timeout error - data: { frag : fragment object}\n KEY_LOAD_TIMEOUT: 'keyLoadTimeOut',\n // Identifier for a buffer append error - data: append error description\n BUFFER_APPEND_ERROR: 'bufferAppendError',\n // Identifier for a buffer appending error event - data: appending error description\n BUFFER_APPENDING_ERROR: 'bufferAppendingError',\n // Identifier for a buffer stalled error event\n BUFFER_STALLED_ERROR: 'bufferStalledError',\n // Identifier for a buffer full event\n BUFFER_FULL_ERROR: 'bufferFullError',\n // Identifier for a buffer seek over hole event\n BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole',\n // Identifier for an internal exception happening inside hls.js while handling an event\n INTERNAL_EXCEPTION: 'internalException'\n};\n", - "/*\n*\n* All objects in the event handling chain should inherit from this class\n*\n*/\n\nimport {logger} from './utils/logger';\nimport {ErrorTypes, ErrorDetails} from './errors';\n\nclass EventHandler {\n\n constructor(hls, ...events) {\n this.hls = hls;\n this.onEvent = this.onEvent.bind(this);\n this.handledEvents = events;\n this.useGenericHandler = true;\n\n this.registerListeners();\n }\n\n destroy() {\n this.unregisterListeners();\n }\n\n isEventHandler() {\n return typeof this.handledEvents === 'object' && this.handledEvents.length && typeof this.onEvent === 'function';\n }\n\n registerListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function(event) {\n if (event === 'hlsEventGeneric') {\n throw new Error('Forbidden event name: ' + event);\n }\n this.hls.on(event, this.onEvent);\n }.bind(this));\n }\n }\n\n unregisterListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function(event) {\n this.hls.off(event, this.onEvent);\n }.bind(this));\n }\n }\n\n /*\n * arguments: event (string), data (any)\n */\n onEvent(event, data) {\n this.onEventGeneric(event, data);\n }\n\n onEventGeneric(event, data) {\n var eventToFunction = function(event, data) {\n var funcName = 'on' + event.replace('hls', '');\n if (typeof this[funcName] !== 'function') {\n throw new Error(`Event ${event} has no generic handler in this ${this.constructor.name} class (tried ${funcName})`);\n }\n return this[funcName].bind(this, data);\n };\n try {\n eventToFunction.call(this, event, data).call();\n } catch (err) {\n logger.error(`internal error happened while processing ${event}:${err.message}`);\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.OTHER_ERROR, details: ErrorDetails.INTERNAL_EXCEPTION, fatal: false, event : event, err : err});\n }\n }\n}\n\nexport default EventHandler;\n", - "module.exports = {\n // fired before MediaSource is attaching to media element - data: { media }\n MEDIA_ATTACHING: 'hlsMediaAttaching',\n // fired when MediaSource has been succesfully attached to media element - data: { }\n MEDIA_ATTACHED: 'hlsMediaAttached',\n // fired before detaching MediaSource from media element - data: { }\n MEDIA_DETACHING: 'hlsMediaDetaching',\n // fired when MediaSource has been detached from media element - data: { }\n MEDIA_DETACHED: 'hlsMediaDetached',\n // fired when we buffer is going to be resetted\n BUFFER_RESET: 'hlsBufferReset',\n // fired when we know about the codecs that we need buffers for to push into - data: {tracks : { container, codec, levelCodec, initSegment, metadata }}\n BUFFER_CODECS: 'hlsBufferCodecs',\n // fired when we append a segment to the buffer - data: { segment: segment object }\n BUFFER_APPENDING: 'hlsBufferAppending',\n // fired when we are done with appending a media segment to the buffer\n BUFFER_APPENDED: 'hlsBufferAppended',\n // fired when the stream is finished and we want to notify the media buffer that there will be no more data\n BUFFER_EOS: 'hlsBufferEos',\n // fired when the media buffer should be flushed - data {startOffset, endOffset}\n BUFFER_FLUSHING: 'hlsBufferFlushing',\n // fired when the media has been flushed\n BUFFER_FLUSHED: 'hlsBufferFlushed',\n // fired to signal that a manifest loading starts - data: { url : manifestURL}\n MANIFEST_LOADING: 'hlsManifestLoading',\n // fired after manifest has been loaded - data: { levels : [available quality levels] , url : manifestURL, stats : { trequest, tfirst, tload, mtime}}\n MANIFEST_LOADED: 'hlsManifestLoaded',\n // fired after manifest has been parsed - data: { levels : [available quality levels] , firstLevel : index of first quality level appearing in Manifest}\n MANIFEST_PARSED: 'hlsManifestParsed',\n // fired when a level playlist loading starts - data: { url : level URL level : id of level being loaded}\n LEVEL_LOADING: 'hlsLevelLoading',\n // fired when a level playlist loading finishes - data: { details : levelDetails object, level : id of loaded level, stats : { trequest, tfirst, tload, mtime} }\n LEVEL_LOADED: 'hlsLevelLoaded',\n // fired when a level's details have been updated based on previous details, after it has been loaded. - data: { details : levelDetails object, level : id of updated level }\n LEVEL_UPDATED: 'hlsLevelUpdated',\n // fired when a level's PTS information has been updated after parsing a fragment - data: { details : levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment }\n LEVEL_PTS_UPDATED: 'hlsLevelPtsUpdated',\n // fired when a level switch is requested - data: { level : id of new level }\n LEVEL_SWITCH: 'hlsLevelSwitch',\n // fired when a fragment loading starts - data: { frag : fragment object}\n FRAG_LOADING: 'hlsFragLoading',\n // fired when a fragment loading is progressing - data: { frag : fragment object, { trequest, tfirst, loaded}}\n FRAG_LOAD_PROGRESS: 'hlsFragLoadProgress',\n // Identifier for fragment load aborting for emergency switch down - data: {frag : fragment object}\n FRAG_LOAD_EMERGENCY_ABORTED: 'hlsFragLoadEmergencyAborted',\n // fired when a fragment loading is completed - data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length}}\n FRAG_LOADED: 'hlsFragLoaded',\n // fired when Init Segment has been extracted from fragment - data: { moov : moov MP4 box, codecs : codecs found while parsing fragment}\n FRAG_PARSING_INIT_SEGMENT: 'hlsFragParsingInitSegment',\n // fired when parsing sei text is completed - data: { samples : [ sei samples pes ] }\n FRAG_PARSING_USERDATA: 'hlsFragParsingUserdata',\n // fired when parsing id3 is completed - data: { samples : [ id3 samples pes ] }\n FRAG_PARSING_METADATA: 'hlsFragParsingMetadata',\n // fired when data have been extracted from fragment - data: { data1 : moof MP4 box or TS fragments, data2 : mdat MP4 box or null}\n FRAG_PARSING_DATA: 'hlsFragParsingData',\n // fired when fragment parsing is completed - data: undefined\n FRAG_PARSED: 'hlsFragParsed',\n // fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - data: { frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length} }\n FRAG_BUFFERED: 'hlsFragBuffered',\n // fired when fragment matching with current media position is changing - data : { frag : fragment object }\n FRAG_CHANGED: 'hlsFragChanged',\n // Identifier for a FPS drop event - data: {curentDropped, currentDecoded, totalDroppedFrames}\n FPS_DROP: 'hlsFpsDrop',\n // Identifier for an error event - data: { type : error type, details : error details, fatal : if true, hls.js cannot/will not try to recover, if false, hls.js will try to recover,other error specific data}\n ERROR: 'hlsError',\n // fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a media to the instance of hls.js to handle mid-rolls for example\n DESTROYING: 'hlsDestroying',\n // fired when a decrypt key loading starts - data: { frag : fragment object}\n KEY_LOADING: 'hlsKeyLoading',\n // fired when a decrypt key loading is completed - data: { frag : fragment object, payload : key payload, stats : { trequest, tfirst, tload, length}}\n KEY_LOADED: 'hlsKeyLoaded',\n};\n", - "/**\n * Buffer Helper class, providing methods dealing buffer length retrieval\n*/\n\n\nclass BufferHelper {\n\n static bufferInfo(media, pos,maxHoleDuration) {\n if (media) {\n var vbuffered = media.buffered, buffered = [],i;\n for (i = 0; i < vbuffered.length; i++) {\n buffered.push({start: vbuffered.start(i), end: vbuffered.end(i)});\n }\n return this.bufferedInfo(buffered,pos,maxHoleDuration);\n } else {\n return {len: 0, start: 0, end: 0, nextStart : undefined} ;\n }\n }\n\n static bufferedInfo(buffered,pos,maxHoleDuration) {\n var buffered2 = [],\n // bufferStart and bufferEnd are buffer boundaries around current video position\n bufferLen,bufferStart, bufferEnd,bufferStartNext,i;\n // sort on buffer.start/smaller end (IE does not always return sorted buffered range)\n buffered.sort(function (a, b) {\n var diff = a.start - b.start;\n if (diff) {\n return diff;\n } else {\n return b.end - a.end;\n }\n });\n // there might be some small holes between buffer time range\n // consider that holes smaller than maxHoleDuration are irrelevant and build another\n // buffer time range representations that discards those holes\n for (i = 0; i < buffered.length; i++) {\n var buf2len = buffered2.length;\n if(buf2len) {\n var buf2end = buffered2[buf2len - 1].end;\n // if small hole (value between 0 or maxHoleDuration ) or overlapping (negative)\n if((buffered[i].start - buf2end) < maxHoleDuration) {\n // merge overlapping time ranges\n // update lastRange.end only if smaller than item.end\n // e.g. [ 1, 15] with [ 2,8] => [ 1,15] (no need to modify lastRange.end)\n // whereas [ 1, 8] with [ 2,15] => [ 1,15] ( lastRange should switch from [1,8] to [1,15])\n if(buffered[i].end > buf2end) {\n buffered2[buf2len - 1].end = buffered[i].end;\n }\n } else {\n // big hole\n buffered2.push(buffered[i]);\n }\n } else {\n // first value\n buffered2.push(buffered[i]);\n }\n }\n for (i = 0, bufferLen = 0, bufferStart = bufferEnd = pos; i < buffered2.length; i++) {\n var start = buffered2[i].start,\n end = buffered2[i].end;\n //logger.log('buf start/end:' + buffered.start(i) + '/' + buffered.end(i));\n if ((pos + maxHoleDuration) >= start && pos < end) {\n // play position is inside this buffer TimeRange, retrieve end of buffer position and buffer length\n bufferStart = start;\n bufferEnd = end;\n bufferLen = bufferEnd - pos;\n } else if ((pos + maxHoleDuration) < start) {\n bufferStartNext = start;\n break;\n }\n }\n return {len: bufferLen, start: bufferStart, end: bufferEnd, nextStart : bufferStartNext};\n }\n\n}\n\nexport default BufferHelper;\n", - "/**\n * Level Helper class, providing methods dealing with playlist sliding and drift\n*/\n\nimport {logger} from '../utils/logger';\n\nclass LevelHelper {\n\n static mergeDetails(oldDetails,newDetails) {\n var start = Math.max(oldDetails.startSN,newDetails.startSN)-newDetails.startSN,\n end = Math.min(oldDetails.endSN,newDetails.endSN)-newDetails.startSN,\n delta = newDetails.startSN - oldDetails.startSN,\n oldfragments = oldDetails.fragments,\n newfragments = newDetails.fragments,\n ccOffset =0,\n PTSFrag;\n\n // check if old/new playlists have fragments in common\n if ( end < start) {\n newDetails.PTSKnown = false;\n return;\n }\n // loop through overlapping SN and update startPTS , cc, and duration if any found\n for(var i = start ; i <= end ; i++) {\n var oldFrag = oldfragments[delta+i],\n newFrag = newfragments[i];\n ccOffset = oldFrag.cc - newFrag.cc;\n if (!isNaN(oldFrag.startPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.duration = oldFrag.duration;\n PTSFrag = newFrag;\n }\n }\n\n if(ccOffset) {\n logger.log(`discontinuity sliding from playlist, take drift into account`);\n for(i = 0 ; i < newfragments.length ; i++) {\n newfragments[i].cc += ccOffset;\n }\n }\n\n // if at least one fragment contains PTS info, recompute PTS information for all fragments\n if(PTSFrag) {\n LevelHelper.updateFragPTS(newDetails,PTSFrag.sn,PTSFrag.startPTS,PTSFrag.endPTS);\n } else {\n // ensure that delta is within oldfragments range\n // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61])\n // in that case we also need to adjust start offset of all fragments\n if (delta >= 0 && delta < oldfragments.length) {\n // adjust start by sliding offset\n var sliding = oldfragments[delta].start;\n for(i = 0 ; i < newfragments.length ; i++) {\n newfragments[i].start += sliding;\n }\n }\n }\n // if we are here, it means we have fragments overlapping between\n // old and new level. reliable PTS info is thus relying on old level\n newDetails.PTSKnown = oldDetails.PTSKnown;\n return;\n }\n\n static updateFragPTS(details,sn,startPTS,endPTS) {\n var fragIdx, fragments, frag, i;\n // exit if sn out of range\n if (sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n fragIdx = sn - details.startSN;\n fragments = details.fragments;\n frag = fragments[fragIdx];\n if(!isNaN(frag.startPTS)) {\n startPTS = Math.min(startPTS,frag.startPTS);\n endPTS = Math.max(endPTS, frag.endPTS);\n }\n\n var drift = startPTS - frag.start;\n\n frag.start = frag.startPTS = startPTS;\n frag.endPTS = endPTS;\n frag.duration = endPTS - startPTS;\n // adjust fragment PTS/duration from seqnum-1 to frag 0\n for(i = fragIdx ; i > 0 ; i--) {\n LevelHelper.updatePTS(fragments,i,i-1);\n }\n\n // adjust fragment PTS/duration from seqnum to last frag\n for(i = fragIdx ; i < fragments.length - 1 ; i++) {\n LevelHelper.updatePTS(fragments,i,i+1);\n }\n details.PTSKnown = true;\n //logger.log(` frag start/end:${startPTS.toFixed(3)}/${endPTS.toFixed(3)}`);\n\n return drift;\n }\n\n static updatePTS(fragments,fromIdx, toIdx) {\n var fragFrom = fragments[fromIdx],fragTo = fragments[toIdx], fragToPTS = fragTo.startPTS;\n // if we know startPTS[toIdx]\n if(!isNaN(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n if (toIdx > fromIdx) {\n fragFrom.duration = fragToPTS-fragFrom.start;\n if(fragFrom.duration < 0) {\n logger.error(`negative duration computed for frag ${fragFrom.sn},level ${fragFrom.level}, there should be some duration drift between playlist and fragment!`);\n }\n } else {\n fragTo.duration = fragFrom.start - fragToPTS;\n if(fragTo.duration < 0) {\n logger.error(`negative duration computed for frag ${fragTo.sn},level ${fragTo.level}, there should be some duration drift between playlist and fragment!`);\n }\n }\n } else {\n // we dont know startPTS[toIdx]\n if (toIdx > fromIdx) {\n fragTo.start = fragFrom.start + fragFrom.duration;\n } else {\n fragTo.start = fragFrom.start - fragTo.duration;\n }\n }\n }\n}\n\nexport default LevelHelper;\n", - "/**\n * HLS interface\n */\n'use strict';\n\nimport Event from './events';\nimport {ErrorTypes, ErrorDetails} from './errors';\nimport PlaylistLoader from './loader/playlist-loader';\nimport FragmentLoader from './loader/fragment-loader';\nimport AbrController from './controller/abr-controller';\nimport BufferController from './controller/buffer-controller';\nimport CapLevelController from './controller/cap-level-controller';\nimport StreamController from './controller/stream-controller';\nimport LevelController from './controller/level-controller';\nimport TimelineController from './controller/timeline-controller';\n//import FPSController from './controller/fps-controller';\nimport {logger, enableLogs} from './utils/logger';\nimport XhrLoader from './utils/xhr-loader';\nimport EventEmitter from 'events';\nimport KeyLoader from './loader/key-loader';\n\nclass Hls {\n\n static isSupported() {\n return (window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"'));\n }\n\n static get Events() {\n return Event;\n }\n\n static get ErrorTypes() {\n return ErrorTypes;\n }\n\n static get ErrorDetails() {\n return ErrorDetails;\n }\n\n static get DefaultConfig() {\n if(!Hls.defaultConfig) {\n Hls.defaultConfig = {\n autoStartLoad: true,\n debug: false,\n capLevelToPlayerSize: false,\n maxBufferLength: 30,\n maxBufferSize: 60 * 1000 * 1000,\n maxBufferHole: 0.5,\n maxSeekHole: 2,\n seekHoleNudgeDuration : 0.01,\n maxFragLookUpTolerance : 0.2,\n liveSyncDurationCount:3,\n liveMaxLatencyDurationCount: Infinity,\n liveSyncDuration: undefined,\n liveMaxLatencyDuration: undefined,\n maxMaxBufferLength: 600,\n enableWorker: true,\n enableSoftwareAES: true,\n manifestLoadingTimeOut: 10000,\n manifestLoadingMaxRetry: 1,\n manifestLoadingRetryDelay: 1000,\n levelLoadingTimeOut: 10000,\n levelLoadingMaxRetry: 4,\n levelLoadingRetryDelay: 1000,\n fragLoadingTimeOut: 20000,\n fragLoadingMaxRetry: 6,\n fragLoadingRetryDelay: 1000,\n fragLoadingLoopThreshold: 3,\n startFragPrefetch : false,\n // fpsDroppedMonitoringPeriod: 5000,\n // fpsDroppedMonitoringThreshold: 0.2,\n appendErrorMaxRetry: 3,\n loader: XhrLoader,\n fLoader: undefined,\n pLoader: undefined,\n abrController : AbrController,\n bufferController : BufferController,\n capLevelController : CapLevelController,\n streamController: StreamController,\n timelineController: TimelineController,\n enableCEA708Captions: true,\n enableMP2TPassThrough : false\n };\n }\n return Hls.defaultConfig;\n }\n\n static set DefaultConfig(defaultConfig) {\n Hls.defaultConfig = defaultConfig;\n }\n\n constructor(config = {}) {\n var defaultConfig = Hls.DefaultConfig;\n\n if ((config.liveSyncDurationCount || config.liveMaxLatencyDurationCount) && (config.liveSyncDuration || config.liveMaxLatencyDuration)) {\n throw new Error('Illegal hls.js config: don\\'t mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration');\n }\n\n for (var prop in defaultConfig) {\n if (prop in config) { continue; }\n config[prop] = defaultConfig[prop];\n }\n\n if (config.liveMaxLatencyDurationCount !== undefined && config.liveMaxLatencyDurationCount <= config.liveSyncDurationCount) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDurationCount\" must be gt \"liveSyncDurationCount\"');\n }\n\n if (config.liveMaxLatencyDuration !== undefined && (config.liveMaxLatencyDuration <= config.liveSyncDuration || config.liveSyncDuration === undefined)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDuration\" must be gt \"liveSyncDuration\"');\n }\n\n enableLogs(config.debug);\n this.config = config;\n // observer setup\n var observer = this.observer = new EventEmitter();\n observer.trigger = function trigger (event, ...data) {\n observer.emit(event, event, ...data);\n };\n\n observer.off = function off (event, ...data) {\n observer.removeListener(event, ...data);\n };\n this.on = observer.on.bind(observer);\n this.off = observer.off.bind(observer);\n this.trigger = observer.trigger.bind(observer);\n this.playlistLoader = new PlaylistLoader(this);\n this.fragmentLoader = new FragmentLoader(this);\n this.levelController = new LevelController(this);\n this.abrController = new config.abrController(this);\n this.bufferController = new config.bufferController(this);\n this.capLevelController = new config.capLevelController(this);\n this.streamController = new config.streamController(this);\n this.timelineController = new config.timelineController(this);\n this.keyLoader = new KeyLoader(this);\n //this.fpsController = new FPSController(this);\n }\n\n destroy() {\n logger.log('destroy');\n this.trigger(Event.DESTROYING);\n this.detachMedia();\n this.playlistLoader.destroy();\n this.fragmentLoader.destroy();\n this.levelController.destroy();\n this.abrController.destroy();\n this.bufferController.destroy();\n this.capLevelController.destroy();\n this.streamController.destroy();\n this.timelineController.destroy();\n this.keyLoader.destroy();\n //this.fpsController.destroy();\n this.url = null;\n this.observer.removeAllListeners();\n }\n\n attachMedia(media) {\n logger.log('attachMedia');\n this.media = media;\n this.trigger(Event.MEDIA_ATTACHING, {media: media});\n }\n\n detachMedia() {\n logger.log('detachMedia');\n this.trigger(Event.MEDIA_DETACHING);\n this.media = null;\n }\n\n loadSource(url) {\n logger.log(`loadSource:${url}`);\n this.url = url;\n // when attaching to a source URL, trigger a playlist load\n this.trigger(Event.MANIFEST_LOADING, {url: url});\n }\n\n startLoad(startPosition=0) {\n logger.log('startLoad');\n this.levelController.startLoad();\n this.streamController.startLoad(startPosition);\n }\n\n stopLoad() {\n logger.log('stopLoad');\n this.levelController.stopLoad();\n this.streamController.stopLoad();\n }\n\n swapAudioCodec() {\n logger.log('swapAudioCodec');\n this.streamController.swapAudioCodec();\n }\n\n recoverMediaError() {\n logger.log('recoverMediaError');\n var media = this.media;\n this.detachMedia();\n this.attachMedia(media);\n }\n\n /** Return all quality levels **/\n get levels() {\n return this.levelController.levels;\n }\n\n /** Return current playback quality level **/\n get currentLevel() {\n return this.streamController.currentLevel;\n }\n\n /* set quality level immediately (-1 for automatic level selection) */\n set currentLevel(newLevel) {\n logger.log(`set currentLevel:${newLevel}`);\n this.loadLevel = newLevel;\n this.streamController.immediateLevelSwitch();\n }\n\n /** Return next playback quality level (quality level of next fragment) **/\n get nextLevel() {\n return this.streamController.nextLevel;\n }\n\n /* set quality level for next fragment (-1 for automatic level selection) */\n set nextLevel(newLevel) {\n logger.log(`set nextLevel:${newLevel}`);\n this.levelController.manualLevel = newLevel;\n this.streamController.nextLevelSwitch();\n }\n\n /** Return the quality level of current/last loaded fragment **/\n get loadLevel() {\n return this.levelController.level;\n }\n\n /* set quality level for current/next loaded fragment (-1 for automatic level selection) */\n set loadLevel(newLevel) {\n logger.log(`set loadLevel:${newLevel}`);\n this.levelController.manualLevel = newLevel;\n }\n\n /** Return the quality level of next loaded fragment **/\n get nextLoadLevel() {\n return this.levelController.nextLoadLevel;\n }\n\n /** set quality level of next loaded fragment **/\n set nextLoadLevel(level) {\n this.levelController.nextLoadLevel = level;\n }\n\n /** Return first level (index of first level referenced in manifest)\n **/\n get firstLevel() {\n return this.levelController.firstLevel;\n }\n\n /** set first level (index of first level referenced in manifest)\n **/\n set firstLevel(newLevel) {\n logger.log(`set firstLevel:${newLevel}`);\n this.levelController.firstLevel = newLevel;\n }\n\n /** Return start level (level of first fragment that will be played back)\n if not overrided by user, first level appearing in manifest will be used as start level\n if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)\n **/\n get startLevel() {\n return this.levelController.startLevel;\n }\n\n /** set start level (level of first fragment that will be played back)\n if not overrided by user, first level appearing in manifest will be used as start level\n if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)\n **/\n set startLevel(newLevel) {\n logger.log(`set startLevel:${newLevel}`);\n this.levelController.startLevel = newLevel;\n }\n\n /** Return the capping/max level value that could be used by automatic level selection algorithm **/\n get autoLevelCapping() {\n return this.abrController.autoLevelCapping;\n }\n\n /** set the capping/max level value that could be used by automatic level selection algorithm **/\n set autoLevelCapping(newLevel) {\n logger.log(`set autoLevelCapping:${newLevel}`);\n this.abrController.autoLevelCapping = newLevel;\n }\n\n /* check if we are in automatic level selection mode */\n get autoLevelEnabled() {\n return (this.levelController.manualLevel === -1);\n }\n\n /* return manual level */\n get manualLevel() {\n return this.levelController.manualLevel;\n }\n}\n\nexport default Hls;\n", - "// This is mostly for support of the es6 module export\n// syntax with the babel compiler, it looks like it doesnt support\n// function exports like we are used to in node/commonjs\nmodule.exports = require('./hls.js').default;\n", - "/*\n * Fragment Loader\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\nclass FragmentLoader extends EventHandler {\n\n constructor(hls) {\n super(hls, Event.FRAG_LOADING);\n }\n\n destroy() {\n if (this.loader) {\n this.loader.destroy();\n this.loader = null;\n }\n EventHandler.prototype.destroy.call(this);\n }\n\n onFragLoading(data) {\n var frag = data.frag;\n this.frag = frag;\n this.frag.loaded = 0;\n var config = this.hls.config;\n frag.loader = this.loader = typeof(config.fLoader) !== 'undefined' ? new config.fLoader(config) : new config.loader(config);\n this.loader.load(frag.url, 'arraybuffer', this.loadsuccess.bind(this), this.loaderror.bind(this), this.loadtimeout.bind(this), config.fragLoadingTimeOut, 1, 0, this.loadprogress.bind(this), frag);\n }\n\n loadsuccess(event, stats) {\n var payload = event.currentTarget.response;\n stats.length = payload.byteLength;\n // detach fragment loader on load success\n this.frag.loader = undefined;\n this.hls.trigger(Event.FRAG_LOADED, {payload: payload, frag: this.frag, stats: stats});\n }\n\n loaderror(event) {\n if (this.loader) {\n this.loader.abort();\n }\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: ErrorDetails.FRAG_LOAD_ERROR, fatal: false, frag: this.frag, response: event});\n }\n\n loadtimeout() {\n if (this.loader) {\n this.loader.abort();\n }\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: ErrorDetails.FRAG_LOAD_TIMEOUT, fatal: false, frag: this.frag});\n }\n\n loadprogress(event, stats) {\n this.frag.loaded = stats.loaded;\n this.hls.trigger(Event.FRAG_LOAD_PROGRESS, {frag: this.frag, stats: stats});\n }\n}\n\nexport default FragmentLoader;\n", - "/*\n * Decrypt key Loader\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\nclass KeyLoader extends EventHandler {\n\n constructor(hls) {\n super(hls, Event.KEY_LOADING);\n this.decryptkey = null;\n this.decrypturl = null;\n }\n\n destroy() {\n if (this.loader) {\n this.loader.destroy();\n this.loader = null;\n }\n EventHandler.prototype.destroy.call(this);\n }\n\n onKeyLoading(data) {\n var frag = this.frag = data.frag,\n decryptdata = frag.decryptdata,\n uri = decryptdata.uri;\n // if uri is different from previous one or if decrypt key not retrieved yet\n if (uri !== this.decrypturl || this.decryptkey === null) {\n var config = this.hls.config;\n frag.loader = this.loader = new config.loader(config);\n this.decrypturl = uri;\n this.decryptkey = null;\n frag.loader.load(uri, 'arraybuffer', this.loadsuccess.bind(this), this.loaderror.bind(this), this.loadtimeout.bind(this), config.fragLoadingTimeOut, config.fragLoadingMaxRetry, config.fragLoadingRetryDelay, this.loadprogress.bind(this), frag);\n } else if (this.decryptkey) {\n // we already loaded this key, return it\n decryptdata.key = this.decryptkey;\n this.hls.trigger(Event.KEY_LOADED, {frag: frag});\n }\n }\n\n loadsuccess(event) {\n var frag = this.frag;\n this.decryptkey = frag.decryptdata.key = new Uint8Array(event.currentTarget.response);\n // detach fragment loader on load success\n frag.loader = undefined;\n this.hls.trigger(Event.KEY_LOADED, {frag: frag});\n }\n\n loaderror(event) {\n if (this.loader) {\n this.loader.abort();\n }\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: ErrorDetails.KEY_LOAD_ERROR, fatal: false, frag: this.frag, response: event});\n }\n\n loadtimeout() {\n if (this.loader) {\n this.loader.abort();\n }\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: ErrorDetails.KEY_LOAD_TIMEOUT, fatal: false, frag: this.frag});\n }\n\n loadprogress() {\n\n }\n}\n\nexport default KeyLoader;\n", - "/**\n * Playlist Loader\n*/\n\nimport Event from '../events';\nimport EventHandler from '../event-handler';\nimport {ErrorTypes, ErrorDetails} from '../errors';\nimport URLHelper from '../utils/url';\nimport AttrList from '../utils/attr-list';\n//import {logger} from '../utils/logger';\n\nclass PlaylistLoader extends EventHandler {\n\n constructor(hls) {\n super(hls,\n Event.MANIFEST_LOADING,\n Event.LEVEL_LOADING);\n }\n\n destroy() {\n if (this.loader) {\n this.loader.destroy();\n this.loader = null;\n }\n this.url = this.id = null;\n EventHandler.prototype.destroy.call(this);\n }\n\n onManifestLoading(data) {\n this.load(data.url, null);\n }\n\n onLevelLoading(data) {\n this.load(data.url, data.level, data.id);\n }\n\n load(url, id1, id2) {\n var config = this.hls.config,\n retry,\n timeout,\n retryDelay;\n this.url = url;\n this.id = id1;\n this.id2 = id2;\n if(this.id === null) {\n retry = config.manifestLoadingMaxRetry;\n timeout = config.manifestLoadingTimeOut;\n retryDelay = config.manifestLoadingRetryDelay;\n } else {\n retry = config.levelLoadingMaxRetry;\n timeout = config.levelLoadingTimeOut;\n retryDelay = config.levelLoadingRetryDelay;\n }\n this.loader = typeof(config.pLoader) !== 'undefined' ? new config.pLoader(config) : new config.loader(config);\n this.loader.load(url, '', this.loadsuccess.bind(this), this.loaderror.bind(this), this.loadtimeout.bind(this), timeout, retry, retryDelay);\n }\n\n resolve(url, baseUrl) {\n return URLHelper.buildAbsoluteURL(baseUrl, url);\n }\n\n parseMasterPlaylist(string, baseurl) {\n let levels = [], result;\n\n // https://regex101.com is your friend\n const re = /#EXT-X-STREAM-INF:([^\\n\\r]*)[\\r\\n]+([^\\r\\n]+)/g;\n while ((result = re.exec(string)) != null){\n const level = {};\n\n var attrs = level.attrs = new AttrList(result[1]);\n level.url = this.resolve(result[2], baseurl);\n\n var resolution = attrs.decimalResolution('RESOLUTION');\n if(resolution) {\n level.width = resolution.width;\n level.height = resolution.height;\n }\n level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH');\n level.name = attrs.NAME;\n\n var codecs = attrs.CODECS;\n if(codecs) {\n codecs = codecs.split(',');\n for (let i = 0; i < codecs.length; i++) {\n const codec = codecs[i];\n if (codec.indexOf('avc1') !== -1) {\n level.videoCodec = this.avc1toavcoti(codec);\n } else {\n level.audioCodec = codec;\n }\n }\n }\n\n levels.push(level);\n }\n return levels;\n }\n\n avc1toavcoti(codec) {\n var result, avcdata = codec.split('.');\n if (avcdata.length > 2) {\n result = avcdata.shift() + '.';\n result += parseInt(avcdata.shift()).toString(16);\n result += ('000' + parseInt(avcdata.shift()).toString(16)).substr(-4);\n } else {\n result = codec;\n }\n return result;\n }\n\n cloneObj(obj) {\n return JSON.parse(JSON.stringify(obj));\n }\n\n parseLevelPlaylist(string, baseurl, id) {\n var currentSN = 0,\n totalduration = 0,\n level = {url: baseurl, fragments: [], live: true, startSN: 0},\n levelkey = {method : null, key : null, iv : null, uri : null},\n cc = 0,\n programDateTime = null,\n frag = null,\n result,\n regexp,\n byteRangeEndOffset,\n byteRangeStartOffset;\n\n regexp = /(?:#EXT-X-(MEDIA-SEQUENCE):(\\d+))|(?:#EXT-X-(TARGETDURATION):(\\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\\d\\.]+)[^\\r\\n]*([\\r\\n]+[^#|\\r\\n]+)?)|(?:#EXT-X-(BYTERANGE):([\\d]+[@[\\d]*)]*[\\r\\n]+([^#|\\r\\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*))/g;\n while ((result = regexp.exec(string)) !== null) {\n result.shift();\n result = result.filter(function(n) { return (n !== undefined); });\n switch (result[0]) {\n case 'MEDIA-SEQUENCE':\n currentSN = level.startSN = parseInt(result[1]);\n break;\n case 'TARGETDURATION':\n level.targetduration = parseFloat(result[1]);\n break;\n case 'ENDLIST':\n level.live = false;\n break;\n case 'DIS':\n cc++;\n break;\n case 'BYTERANGE':\n var params = result[1].split('@');\n if (params.length === 1) {\n byteRangeStartOffset = byteRangeEndOffset;\n } else {\n byteRangeStartOffset = parseInt(params[1]);\n }\n byteRangeEndOffset = parseInt(params[0]) + byteRangeStartOffset;\n if (frag && !frag.url) {\n frag.byteRangeStartOffset = byteRangeStartOffset;\n frag.byteRangeEndOffset = byteRangeEndOffset;\n frag.url = this.resolve(result[2], baseurl);\n }\n break;\n case 'INF':\n var duration = parseFloat(result[1]);\n if (!isNaN(duration)) {\n var fragdecryptdata,\n sn = currentSN++;\n if (levelkey.method && levelkey.uri && !levelkey.iv) {\n fragdecryptdata = this.cloneObj(levelkey);\n var uint8View = new Uint8Array(16);\n for (var i = 12; i < 16; i++) {\n uint8View[i] = (sn >> 8*(15-i)) & 0xff;\n }\n fragdecryptdata.iv = uint8View;\n } else {\n fragdecryptdata = levelkey;\n }\n var url = result[2] ? this.resolve(result[2], baseurl) : null;\n frag = {url: url, duration: duration, start: totalduration, sn: sn, level: id, cc: cc, byteRangeStartOffset: byteRangeStartOffset, byteRangeEndOffset: byteRangeEndOffset, decryptdata : fragdecryptdata, programDateTime: programDateTime};\n level.fragments.push(frag);\n totalduration += duration;\n byteRangeStartOffset = null;\n programDateTime = null;\n }\n break;\n case 'KEY':\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-08#section-3.4.4\n var decryptparams = result[1];\n var keyAttrs = new AttrList(decryptparams);\n var decryptmethod = keyAttrs.enumeratedString('METHOD'),\n decrypturi = keyAttrs.URI,\n decryptiv = keyAttrs.hexadecimalInteger('IV');\n if (decryptmethod) {\n levelkey = { method: null, key: null, iv: null, uri: null };\n if ((decrypturi) && (decryptmethod === 'AES-128')) {\n levelkey.method = decryptmethod;\n // URI to get the key\n levelkey.uri = this.resolve(decrypturi, baseurl);\n levelkey.key = null;\n // Initialization Vector (IV)\n levelkey.iv = decryptiv;\n }\n }\n break;\n case 'PROGRAM-DATE-TIME':\n programDateTime = new Date(Date.parse(result[1]));\n break;\n default:\n break;\n }\n }\n //logger.log('found ' + level.fragments.length + ' fragments');\n if(frag && !frag.url) {\n level.fragments.pop();\n totalduration-=frag.duration;\n }\n level.totalduration = totalduration;\n level.endSN = currentSN - 1;\n return level;\n }\n\n loadsuccess(event, stats) {\n var target = event.currentTarget,\n string = target.responseText,\n url = target.responseURL,\n id = this.id,\n id2 = this.id2,\n hls = this.hls,\n levels;\n // responseURL not supported on some browsers (it is used to detect URL redirection)\n if (url === undefined) {\n // fallback to initial URL\n url = this.url;\n }\n stats.tload = performance.now();\n stats.mtime = new Date(target.getResponseHeader('Last-Modified'));\n if (string.indexOf('#EXTM3U') === 0) {\n if (string.indexOf('#EXTINF:') > 0) {\n // 1 level playlist\n // if first request, fire manifest loaded event, level will be reloaded afterwards\n // (this is to have a uniform logic for 1 level/multilevel playlists)\n if (this.id === null) {\n hls.trigger(Event.MANIFEST_LOADED, {levels: [{url: url}], url: url, stats: stats});\n } else {\n var levelDetails = this.parseLevelPlaylist(string, url, id);\n stats.tparsed = performance.now();\n hls.trigger(Event.LEVEL_LOADED, {details: levelDetails, level: id, id: id2, stats: stats});\n }\n } else {\n levels = this.parseMasterPlaylist(string, url);\n // multi level playlist, parse level info\n if (levels.length) {\n hls.trigger(Event.MANIFEST_LOADED, {levels: levels, url: url, stats: stats});\n } else {\n hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: ErrorDetails.MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'no level found in manifest'});\n }\n }\n } else {\n hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: ErrorDetails.MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'no EXTM3U delimiter'});\n }\n }\n\n loaderror(event) {\n var details, fatal;\n if (this.id === null) {\n details = ErrorDetails.MANIFEST_LOAD_ERROR;\n fatal = true;\n } else {\n details = ErrorDetails.LEVEL_LOAD_ERROR;\n fatal = false;\n }\n if (this.loader) {\n this.loader.abort();\n }\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: details, fatal: fatal, url: this.url, loader: this.loader, response: event.currentTarget, level: this.id, id: this.id2});\n }\n\n loadtimeout() {\n var details, fatal;\n if (this.id === null) {\n details = ErrorDetails.MANIFEST_LOAD_TIMEOUT;\n fatal = true;\n } else {\n details = ErrorDetails.LEVEL_LOAD_TIMEOUT;\n fatal = false;\n }\n if (this.loader) {\n this.loader.abort();\n }\n this.hls.trigger(Event.ERROR, {type: ErrorTypes.NETWORK_ERROR, details: details, fatal: fatal, url: this.url, loader: this.loader, level: this.id, id: this.id2});\n }\n}\n\nexport default PlaylistLoader;\n", - "/**\n * Generate MP4 Box\n*/\n\n//import Hex from '../utils/hex';\nclass MP4 {\n static init() {\n MP4.types = {\n avc1: [], // codingname\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n mvex: [],\n mvhd: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n\n var i;\n for (i in MP4.types) {\n if (MP4.types.hasOwnProperty(i)) {\n MP4.types[i] = [\n i.charCodeAt(0),\n i.charCodeAt(1),\n i.charCodeAt(2),\n i.charCodeAt(3)\n ];\n }\n }\n\n var videoHdlr = new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x56, 0x69, 0x64, 0x65,\n 0x6f, 0x48, 0x61, 0x6e,\n 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n\n var audioHdlr = new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x53, 0x6f, 0x75, 0x6e,\n 0x64, 0x48, 0x61, 0x6e,\n 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'\n ]);\n\n MP4.HDLR_TYPES = {\n 'video': videoHdlr,\n 'audio': audioHdlr\n };\n\n var dref = new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0c, // entry_size\n 0x75, 0x72, 0x6c, 0x20, // 'url' type\n 0x00, // version 0\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n\n var stco = new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n\n MP4.STTS = MP4.STSC = MP4.STCO = stco;\n\n MP4.STSZ = new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00, // sample_count\n ]);\n MP4.VMHD = new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x01, // flags\n 0x00, 0x00, // graphicsmode\n 0x00, 0x00,\n 0x00, 0x00,\n 0x00, 0x00 // opcolor\n ]);\n MP4.SMHD = new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, // balance\n 0x00, 0x00 // reserved\n ]);\n\n MP4.STSD = new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01]);// entry_count\n\n var majorBrand = new Uint8Array([105,115,111,109]); // isom\n var avc1Brand = new Uint8Array([97,118,99,49]); // avc1\n var minorVersion = new Uint8Array([0, 0, 0, 1]);\n\n MP4.FTYP = MP4.box(MP4.types.ftyp, majorBrand, minorVersion, majorBrand, avc1Brand);\n MP4.DINF = MP4.box(MP4.types.dinf, MP4.box(MP4.types.dref, dref));\n }\n\n static box(type) {\n var\n payload = Array.prototype.slice.call(arguments, 1),\n size = 8,\n i = payload.length,\n len = i,\n result;\n // calculate the total size we need to allocate\n while (i--) {\n size += payload[i].byteLength;\n }\n result = new Uint8Array(size);\n result[0] = (size >> 24) & 0xff;\n result[1] = (size >> 16) & 0xff;\n result[2] = (size >> 8) & 0xff;\n result[3] = size & 0xff;\n result.set(type, 4);\n // copy the payload into the result\n for (i = 0, size = 8; i < len; i++) {\n // copy payload[i] array @ offset size\n result.set(payload[i], size);\n size += payload[i].byteLength;\n }\n return result;\n }\n\n static hdlr(type) {\n return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]);\n }\n\n static mdat(data) {\n return MP4.box(MP4.types.mdat, data);\n }\n\n static mdhd(timescale, duration) {\n duration *= timescale;\n return MP4.box(MP4.types.mdhd, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x03, // modification_time\n (timescale >> 24) & 0xFF,\n (timescale >> 16) & 0xFF,\n (timescale >> 8) & 0xFF,\n timescale & 0xFF, // timescale\n (duration >> 24),\n (duration >> 16) & 0xFF,\n (duration >> 8) & 0xFF,\n duration & 0xFF, // duration\n 0x55, 0xc4, // 'und' language (undetermined)\n 0x00, 0x00\n ]));\n }\n\n static mdia(track) {\n return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale, track.duration), MP4.hdlr(track.type), MP4.minf(track));\n }\n\n static mfhd(sequenceNumber) {\n return MP4.box(MP4.types.mfhd, new Uint8Array([\n 0x00,\n 0x00, 0x00, 0x00, // flags\n (sequenceNumber >> 24),\n (sequenceNumber >> 16) & 0xFF,\n (sequenceNumber >> 8) & 0xFF,\n sequenceNumber & 0xFF, // sequence_number\n ]));\n }\n\n static minf(track) {\n if (track.type === 'audio') {\n return MP4.box(MP4.types.minf, MP4.box(MP4.types.smhd, MP4.SMHD), MP4.DINF, MP4.stbl(track));\n } else {\n return MP4.box(MP4.types.minf, MP4.box(MP4.types.vmhd, MP4.VMHD), MP4.DINF, MP4.stbl(track));\n }\n }\n\n static moof(sn, baseMediaDecodeTime, track) {\n return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track,baseMediaDecodeTime));\n }\n/**\n * @param tracks... (optional) {array} the tracks associated with this movie\n */\n static moov(tracks) {\n var\n i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trak(tracks[i]);\n }\n\n return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale, tracks[0].duration)].concat(boxes).concat(MP4.mvex(tracks)));\n }\n\n static mvex(tracks) {\n var\n i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trex(tracks[i]);\n }\n return MP4.box.apply(null, [MP4.types.mvex].concat(boxes));\n }\n\n static mvhd(timescale,duration) {\n duration*=timescale;\n var\n bytes = new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // creation_time\n 0x00, 0x00, 0x00, 0x02, // modification_time\n (timescale >> 24) & 0xFF,\n (timescale >> 16) & 0xFF,\n (timescale >> 8) & 0xFF,\n timescale & 0xFF, // timescale\n (duration >> 24) & 0xFF,\n (duration >> 16) & 0xFF,\n (duration >> 8) & 0xFF,\n duration & 0xFF, // duration\n 0x00, 0x01, 0x00, 0x00, // 1.0 rate\n 0x01, 0x00, // 1.0 volume\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n return MP4.box(MP4.types.mvhd, bytes);\n }\n\n static sdtp(track) {\n var\n samples = track.samples || [],\n bytes = new Uint8Array(4 + samples.length),\n flags,\n i;\n // leave the full box header (4 bytes) all zero\n // write the sample table\n for (i = 0; i < samples.length; i++) {\n flags = samples[i].flags;\n bytes[i + 4] = (flags.dependsOn << 4) |\n (flags.isDependedOn << 2) |\n (flags.hasRedundancy);\n }\n\n return MP4.box(MP4.types.sdtp, bytes);\n }\n\n static stbl(track) {\n return MP4.box(MP4.types.stbl, MP4.stsd(track), MP4.box(MP4.types.stts, MP4.STTS), MP4.box(MP4.types.stsc, MP4.STSC), MP4.box(MP4.types.stsz, MP4.STSZ), MP4.box(MP4.types.stco, MP4.STCO));\n }\n\n static avc1(track) {\n var sps = [], pps = [], i, data, len;\n // assemble the SPSs\n\n for (i = 0; i < track.sps.length; i++) {\n data = track.sps[i];\n len = data.byteLength;\n sps.push((len >>> 8) & 0xFF);\n sps.push((len & 0xFF));\n sps = sps.concat(Array.prototype.slice.call(data)); // SPS\n }\n\n // assemble the PPSs\n for (i = 0; i < track.pps.length; i++) {\n data = track.pps[i];\n len = data.byteLength;\n pps.push((len >>> 8) & 0xFF);\n pps.push((len & 0xFF));\n pps = pps.concat(Array.prototype.slice.call(data));\n }\n\n var avcc = MP4.box(MP4.types.avcC, new Uint8Array([\n 0x01, // version\n sps[3], // profile\n sps[4], // profile compat\n sps[5], // level\n 0xfc | 3, // lengthSizeMinusOne, hard-coded to 4 bytes\n 0xE0 | track.sps.length // 3bit reserved (111) + numOfSequenceParameterSets\n ].concat(sps).concat([\n track.pps.length // numOfPictureParameterSets\n ]).concat(pps))), // \"PPS\"\n width = track.width,\n height = track.height;\n //console.log('avcc:' + Hex.hexDump(avcc));\n return MP4.box(MP4.types.avc1, new Uint8Array([\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n (width >> 8) & 0xFF,\n width & 0xff, // width\n (height >> 8) & 0xFF,\n height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n 0x12,\n 0x64, 0x61, 0x69, 0x6C, //dailymotion/hls.js\n 0x79, 0x6D, 0x6F, 0x74,\n 0x69, 0x6F, 0x6E, 0x2F,\n 0x68, 0x6C, 0x73, 0x2E,\n 0x6A, 0x73, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, // compressorname\n 0x00, 0x18, // depth = 24\n 0x11, 0x11]), // pre_defined = -1\n avcc,\n MP4.box(MP4.types.btrt, new Uint8Array([\n 0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB\n 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate\n 0x00, 0x2d, 0xc6, 0xc0])) // avgBitrate\n );\n }\n\n static esds(track) {\n var configlen = track.config.length;\n return new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n\n 0x03, // descriptor_type\n 0x17+configlen, // length\n 0x00, 0x01, //es_id\n 0x00, // stream_priority\n\n 0x04, // descriptor_type\n 0x0f+configlen, // length\n 0x40, //codec : mpeg4_audio\n 0x15, // stream_type\n 0x00, 0x00, 0x00, // buffer_size\n 0x00, 0x00, 0x00, 0x00, // maxBitrate\n 0x00, 0x00, 0x00, 0x00, // avgBitrate\n\n 0x05 // descriptor_type\n ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor\n }\n\n static mp4a(track) {\n var audiosamplerate = track.audiosamplerate;\n return MP4.box(MP4.types.mp4a, new Uint8Array([\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n (audiosamplerate >> 8) & 0xFF,\n audiosamplerate & 0xff, //\n 0x00, 0x00]),\n MP4.box(MP4.types.esds, MP4.esds(track)));\n }\n\n static stsd(track) {\n if (track.type === 'audio') {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));\n } else {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));\n }\n }\n\n static tkhd(track) {\n var id = track.id,\n duration = track.duration*track.timescale,\n width = track.width,\n height = track.height;\n return MP4.box(MP4.types.tkhd, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x07, // flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (id >> 24) & 0xFF,\n (id >> 16) & 0xFF,\n (id >> 8) & 0xFF,\n id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x00, // reserved\n (duration >> 24),\n (duration >> 16) & 0xFF,\n (duration >> 8) & 0xFF,\n duration & 0xFF, // duration\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, // layer\n 0x00, 0x00, // alternate_group\n 0x00, 0x00, // non-audio track volume\n 0x00, 0x00, // reserved\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix\n (width >> 8) & 0xFF,\n width & 0xFF,\n 0x00, 0x00, // width\n (height >> 8) & 0xFF,\n height & 0xFF,\n 0x00, 0x00 // height\n ]));\n }\n\n static traf(track,baseMediaDecodeTime) {\n var sampleDependencyTable = MP4.sdtp(track),\n id = track.id;\n return MP4.box(MP4.types.traf,\n MP4.box(MP4.types.tfhd, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n (id >> 24),\n (id >> 16) & 0XFF,\n (id >> 8) & 0XFF,\n (id & 0xFF) // track_ID\n ])),\n MP4.box(MP4.types.tfdt, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n (baseMediaDecodeTime >>24),\n (baseMediaDecodeTime >> 16) & 0XFF,\n (baseMediaDecodeTime >> 8) & 0XFF,\n (baseMediaDecodeTime & 0xFF) // baseMediaDecodeTime\n ])),\n MP4.trun(track,\n sampleDependencyTable.length +\n 16 + // tfhd\n 16 + // tfdt\n 8 + // traf header\n 16 + // mfhd\n 8 + // moof header\n 8), // mdat header\n sampleDependencyTable);\n }\n\n /**\n * Generate a track box.\n * @param track {object} a track definition\n * @return {Uint8Array} the track box\n */\n static trak(track) {\n track.duration = track.duration || 0xffffffff;\n return MP4.box(MP4.types.trak, MP4.tkhd(track), MP4.mdia(track));\n }\n\n static trex(track) {\n var id = track.id;\n return MP4.box(MP4.types.trex, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n (id >> 24),\n (id >> 16) & 0XFF,\n (id >> 8) & 0XFF,\n (id & 0xFF), // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]));\n }\n\n static trun(track, offset) {\n var samples= track.samples || [],\n len = samples.length,\n arraylen = 12 + (16 * len),\n array = new Uint8Array(arraylen),\n i,sample,duration,size,flags,cts;\n offset += 8 + arraylen;\n array.set([\n 0x00, // version 0\n 0x00, 0x0f, 0x01, // flags\n (len >>> 24) & 0xFF,\n (len >>> 16) & 0xFF,\n (len >>> 8) & 0xFF,\n len & 0xFF, // sample_count\n (offset >>> 24) & 0xFF,\n (offset >>> 16) & 0xFF,\n (offset >>> 8) & 0xFF,\n offset & 0xFF // data_offset\n ],0);\n for (i = 0; i < len; i++) {\n sample = samples[i];\n duration = sample.duration;\n size = sample.size;\n flags = sample.flags;\n cts = sample.cts;\n array.set([\n (duration >>> 24) & 0xFF,\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n duration & 0xFF, // sample_duration\n (size >>> 24) & 0xFF,\n (size >>> 16) & 0xFF,\n (size >>> 8) & 0xFF,\n size & 0xFF, // sample_size\n (flags.isLeading << 2) | flags.dependsOn,\n (flags.isDependedOn << 6) |\n (flags.hasRedundancy << 4) |\n (flags.paddingValue << 1) |\n flags.isNonSync,\n flags.degradPrio & 0xF0 << 8,\n flags.degradPrio & 0x0F, // sample_flags\n (cts >>> 24) & 0xFF,\n (cts >>> 16) & 0xFF,\n (cts >>> 8) & 0xFF,\n cts & 0xFF // sample_composition_time_offset\n ],12+16*i);\n }\n return MP4.box(MP4.types.trun, array);\n }\n\n static initSegment(tracks) {\n if (!MP4.types) {\n MP4.init();\n }\n var movie = MP4.moov(tracks), result;\n result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength);\n result.set(MP4.FTYP);\n result.set(movie, MP4.FTYP.byteLength);\n return result;\n }\n}\n\nexport default MP4;\n", - "/**\n * fMP4 remuxer\n*/\n\n\nimport Event from '../events';\nimport {logger} from '../utils/logger';\nimport MP4 from '../remux/mp4-generator';\nimport {ErrorTypes, ErrorDetails} from '../errors';\n\nclass MP4Remuxer {\n constructor(observer) {\n this.observer = observer;\n this.ISGenerated = false;\n this.PES2MP4SCALEFACTOR = 4;\n this.PES_TIMESCALE = 90000;\n this.MP4_TIMESCALE = this.PES_TIMESCALE / this.PES2MP4SCALEFACTOR;\n }\n\n get passthrough() {\n return false;\n }\n\n destroy() {\n }\n\n insertDiscontinuity() {\n this._initPTS = this._initDTS = this.nextAacPts = this.nextAvcDts = undefined;\n }\n\n switchLevel() {\n this.ISGenerated = false;\n }\n\n remux(audioTrack,videoTrack,id3Track,textTrack,timeOffset, contiguous) {\n // generate Init Segment if needed\n if (!this.ISGenerated) {\n this.generateIS(audioTrack,videoTrack,timeOffset);\n }\n if (this.ISGenerated) {\n //logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (videoTrack.samples.length) {\n this.remuxVideo(videoTrack,timeOffset,contiguous);\n }\n //logger.log('nb AAC samples:' + audioTrack.samples.length);\n if (audioTrack.samples.length) {\n this.remuxAudio(audioTrack,timeOffset,contiguous);\n }\n }\n //logger.log('nb ID3 samples:' + audioTrack.samples.length);\n if (id3Track.samples.length) {\n this.remuxID3(id3Track,timeOffset);\n }\n //logger.log('nb ID3 samples:' + audioTrack.samples.length);\n if (textTrack.samples.length) {\n this.remuxText(textTrack,timeOffset);\n }\n //notify end of parsing\n this.observer.trigger(Event.FRAG_PARSED);\n }\n\n generateIS(audioTrack,videoTrack,timeOffset) {\n var observer = this.observer,\n audioSamples = audioTrack.samples,\n videoSamples = videoTrack.samples,\n pesTimeScale = this.PES_TIMESCALE,\n tracks = {},\n data = { tracks : tracks, unique : false },\n computePTSDTS = (this._initPTS === undefined),\n initPTS, initDTS;\n\n if (computePTSDTS) {\n initPTS = initDTS = Infinity;\n }\n if (audioTrack.config && audioSamples.length) {\n audioTrack.timescale = audioTrack.audiosamplerate;\n // MP4 duration (track duration in seconds multiplied by timescale) is coded on 32 bits\n // we know that each AAC sample contains 1024 frames....\n // in order to avoid overflowing the 32 bit counter for large duration, we use smaller timescale (timescale/gcd)\n // we just need to ensure that AAC sample duration will still be an integer (will be 1024/gcd)\n if (audioTrack.timescale * audioTrack.duration > Math.pow(2, 32)) {\n let greatestCommonDivisor = function(a, b) {\n if ( ! b) {\n return a;\n }\n return greatestCommonDivisor(b, a % b);\n };\n audioTrack.timescale = audioTrack.audiosamplerate / greatestCommonDivisor(audioTrack.audiosamplerate,1024);\n }\n logger.log ('audio mp4 timescale :'+ audioTrack.timescale);\n tracks.audio = {\n container : 'audio/mp4',\n codec : audioTrack.codec,\n initSegment : MP4.initSegment([audioTrack]),\n metadata : {\n channelCount : audioTrack.channelCount\n }\n };\n if (computePTSDTS) {\n // remember first PTS of this demuxing context. for audio, PTS + DTS ...\n initPTS = initDTS = audioSamples[0].pts - pesTimeScale * timeOffset;\n }\n }\n\n if (videoTrack.sps && videoTrack.pps && videoSamples.length) {\n videoTrack.timescale = this.MP4_TIMESCALE;\n tracks.video = {\n container : 'video/mp4',\n codec : videoTrack.codec,\n initSegment : MP4.initSegment([videoTrack]),\n metadata : {\n width : videoTrack.width,\n height : videoTrack.height\n }\n };\n if (computePTSDTS) {\n initPTS = Math.min(initPTS,videoSamples[0].pts - pesTimeScale * timeOffset);\n initDTS = Math.min(initDTS,videoSamples[0].dts - pesTimeScale * timeOffset);\n }\n }\n\n if(Object.keys(tracks).length) {\n observer.trigger(Event.FRAG_PARSING_INIT_SEGMENT,data);\n this.ISGenerated = true;\n if (computePTSDTS) {\n this._initPTS = initPTS;\n this._initDTS = initDTS;\n }\n } else {\n observer.trigger(Event.ERROR, {type : ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found'});\n }\n }\n\n remuxVideo(track, timeOffset, contiguous) {\n var view,\n offset = 8,\n pesTimeScale = this.PES_TIMESCALE,\n pes2mp4ScaleFactor = this.PES2MP4SCALEFACTOR,\n avcSample,\n mp4Sample,\n mp4SampleLength,\n unit,\n mdat, moof,\n firstPTS, firstDTS, lastDTS,\n pts, dts, ptsnorm, dtsnorm,\n flags,\n samples = [];\n /* concatenate the video data and construct the mdat in place\n (need 8 more bytes to fill length and mpdat type) */\n mdat = new Uint8Array(track.len + (4 * track.nbNalu) + 8);\n view = new DataView(mdat.buffer);\n view.setUint32(0, mdat.byteLength);\n mdat.set(MP4.types.mdat, 4);\n while (track.samples.length) {\n avcSample = track.samples.shift();\n mp4SampleLength = 0;\n // convert NALU bitstream to MP4 format (prepend NALU with size field)\n while (avcSample.units.units.length) {\n unit = avcSample.units.units.shift();\n view.setUint32(offset, unit.data.byteLength);\n offset += 4;\n mdat.set(unit.data, offset);\n offset += unit.data.byteLength;\n mp4SampleLength += 4 + unit.data.byteLength;\n }\n pts = avcSample.pts - this._initDTS;\n dts = avcSample.dts - this._initDTS;\n // ensure DTS is not bigger than PTS\n dts = Math.min(pts,dts);\n //logger.log(`Video/PTS/DTS:${Math.round(pts/90)}/${Math.round(dts/90)}`);\n // if not first AVC sample of video track, normalize PTS/DTS with previous sample value\n // and ensure that sample duration is positive\n if (lastDTS !== undefined) {\n ptsnorm = this._PTSNormalize(pts, lastDTS);\n dtsnorm = this._PTSNormalize(dts, lastDTS);\n var sampleDuration = (dtsnorm - lastDTS) / pes2mp4ScaleFactor;\n if (sampleDuration <= 0) {\n logger.log(`invalid sample duration at PTS/DTS: ${avcSample.pts}/${avcSample.dts}:${sampleDuration}`);\n sampleDuration = 1;\n }\n mp4Sample.duration = sampleDuration;\n } else {\n let nextAvcDts, delta;\n if (contiguous) {\n nextAvcDts = this.nextAvcDts;\n } else {\n nextAvcDts = timeOffset*pesTimeScale;\n }\n // first AVC sample of video track, normalize PTS/DTS\n ptsnorm = this._PTSNormalize(pts, nextAvcDts);\n dtsnorm = this._PTSNormalize(dts, nextAvcDts);\n delta = Math.round((dtsnorm - nextAvcDts) / 90);\n // if fragment are contiguous, or if there is a huge delta (more than 10s) between expected PTS and sample PTS\n if (contiguous || Math.abs(delta) > 10000) {\n if (delta) {\n if (delta > 1) {\n logger.log(`AVC:${delta} ms hole between fragments detected,filling it`);\n } else if (delta < -1) {\n logger.log(`AVC:${(-delta)} ms overlapping between fragments detected`);\n }\n // set DTS to next DTS\n dtsnorm = nextAvcDts;\n // offset PTS as well, ensure that PTS is smaller or equal than new DTS\n ptsnorm = Math.max(ptsnorm - delta, dtsnorm);\n logger.log(`Video/PTS/DTS adjusted: ${ptsnorm}/${dtsnorm},delta:${delta}`);\n }\n }\n // remember first PTS of our avcSamples, ensure value is positive\n firstPTS = Math.max(0, ptsnorm);\n firstDTS = Math.max(0, dtsnorm);\n }\n //console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${this._initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}');\n mp4Sample = {\n size: mp4SampleLength,\n duration: 0,\n cts: (ptsnorm - dtsnorm) / pes2mp4ScaleFactor,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0\n }\n };\n flags = mp4Sample.flags;\n if (avcSample.key === true) {\n // the current sample is a key frame\n flags.dependsOn = 2;\n flags.isNonSync = 0;\n } else {\n flags.dependsOn = 1;\n flags.isNonSync = 1;\n }\n samples.push(mp4Sample);\n lastDTS = dtsnorm;\n }\n var lastSampleDuration = 0;\n if (samples.length >= 2) {\n lastSampleDuration = samples[samples.length - 2].duration;\n mp4Sample.duration = lastSampleDuration;\n }\n // next AVC sample DTS should be equal to last sample DTS + last sample duration\n this.nextAvcDts = dtsnorm + lastSampleDuration * pes2mp4ScaleFactor;\n track.len = 0;\n track.nbNalu = 0;\n if(samples.length && navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n flags = samples[0].flags;\n // chrome workaround, mark first sample as being a Random Access Point to avoid sourcebuffer append issue\n // https://code.google.com/p/chromium/issues/detail?id=229412\n flags.dependsOn = 2;\n flags.isNonSync = 0;\n }\n track.samples = samples;\n moof = MP4.moof(track.sequenceNumber++, firstDTS / pes2mp4ScaleFactor, track);\n track.samples = [];\n this.observer.trigger(Event.FRAG_PARSING_DATA, {\n data1: moof,\n data2: mdat,\n startPTS: firstPTS / pesTimeScale,\n endPTS: (ptsnorm + pes2mp4ScaleFactor * lastSampleDuration) / pesTimeScale,\n startDTS: firstDTS / pesTimeScale,\n endDTS: this.nextAvcDts / pesTimeScale,\n type: 'video',\n nb: samples.length\n });\n }\n\n remuxAudio(track,timeOffset, contiguous) {\n var view,\n offset = 8,\n pesTimeScale = this.PES_TIMESCALE,\n mp4timeScale = track.timescale,\n pes2mp4ScaleFactor = pesTimeScale/mp4timeScale,\n expectedSampleDuration = track.timescale * 1024 / track.audiosamplerate,\n aacSample, mp4Sample,\n unit,\n mdat, moof,\n firstPTS, firstDTS, lastDTS,\n pts, dts, ptsnorm, dtsnorm,\n samples = [],\n samples0 = [];\n\n track.samples.sort(function(a, b) {\n return (a.pts-b.pts);\n });\n samples0 = track.samples;\n\n while (samples0.length) {\n aacSample = samples0.shift();\n unit = aacSample.unit;\n pts = aacSample.pts - this._initDTS;\n dts = aacSample.dts - this._initDTS;\n //logger.log(`Audio/PTS:${Math.round(pts/90)}`);\n // if not first sample\n if (lastDTS !== undefined) {\n ptsnorm = this._PTSNormalize(pts, lastDTS);\n dtsnorm = this._PTSNormalize(dts, lastDTS);\n // let's compute sample duration.\n // sample Duration should be close to expectedSampleDuration\n mp4Sample.duration = (dtsnorm - lastDTS) / pes2mp4ScaleFactor;\n if(Math.abs(mp4Sample.duration - expectedSampleDuration) > expectedSampleDuration/10) {\n // more than 10% diff between sample duration and expectedSampleDuration .... lets log that\n logger.log(`invalid AAC sample duration at PTS ${Math.round(pts/90)},should be 1024,found :${Math.round(mp4Sample.duration*track.audiosamplerate/track.timescale)}`);\n }\n // always adjust sample duration to avoid av sync issue\n mp4Sample.duration = expectedSampleDuration;\n dtsnorm = expectedSampleDuration * pes2mp4ScaleFactor + lastDTS;\n } else {\n let nextAacPts, delta;\n if (contiguous) {\n nextAacPts = this.nextAacPts;\n } else {\n nextAacPts = timeOffset*pesTimeScale;\n }\n ptsnorm = this._PTSNormalize(pts, nextAacPts);\n dtsnorm = this._PTSNormalize(dts, nextAacPts);\n delta = Math.round(1000 * (ptsnorm - nextAacPts) / pesTimeScale);\n // if fragment are contiguous, or if there is a huge delta (more than 10s) between expected PTS and sample PTS\n if (contiguous || Math.abs(delta) > 10000) {\n // log delta\n if (delta) {\n if (delta > 0) {\n logger.log(`${delta} ms hole between AAC samples detected,filling it`);\n // if we have frame overlap, overlapping for more than half a frame duraion\n } else if (delta < -12) {\n // drop overlapping audio frames... browser will deal with it\n logger.log(`${(-delta)} ms overlapping between AAC samples detected, drop frame`);\n track.len -= unit.byteLength;\n continue;\n }\n // set PTS/DTS to next PTS/DTS\n ptsnorm = dtsnorm = nextAacPts;\n }\n }\n // remember first PTS of our aacSamples, ensure value is positive\n firstPTS = Math.max(0, ptsnorm);\n firstDTS = Math.max(0, dtsnorm);\n if(track.len > 0) {\n /* concatenate the audio data and construct the mdat in place\n (need 8 more bytes to fill length and mdat type) */\n mdat = new Uint8Array(track.len + 8);\n view = new DataView(mdat.buffer);\n view.setUint32(0, mdat.byteLength);\n mdat.set(MP4.types.mdat, 4);\n } else {\n // no audio samples\n return;\n }\n }\n mdat.set(unit, offset);\n offset += unit.byteLength;\n //console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${aacSample.pts}/${aacSample.dts}/${this._initDTS}/${ptsnorm}/${dtsnorm}/${(aacSample.pts/4294967296).toFixed(3)}');\n mp4Sample = {\n size: unit.byteLength,\n cts: 0,\n duration:0,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1,\n }\n };\n samples.push(mp4Sample);\n lastDTS = dtsnorm;\n }\n var lastSampleDuration = 0;\n var nbSamples = samples.length;\n //set last sample duration as being identical to previous sample\n if (nbSamples >= 2) {\n lastSampleDuration = samples[nbSamples - 2].duration;\n mp4Sample.duration = lastSampleDuration;\n }\n if (nbSamples) {\n // next aac sample PTS should be equal to last sample PTS + duration\n this.nextAacPts = ptsnorm + pes2mp4ScaleFactor * lastSampleDuration;\n //logger.log('Audio/PTS/PTSend:' + aacSample.pts.toFixed(0) + '/' + this.nextAacDts.toFixed(0));\n track.len = 0;\n track.samples = samples;\n moof = MP4.moof(track.sequenceNumber++, firstDTS / pes2mp4ScaleFactor, track);\n track.samples = [];\n this.observer.trigger(Event.FRAG_PARSING_DATA, {\n data1: moof,\n data2: mdat,\n startPTS: firstPTS / pesTimeScale,\n endPTS: this.nextAacPts / pesTimeScale,\n startDTS: firstDTS / pesTimeScale,\n endDTS: (dtsnorm + pes2mp4ScaleFactor * lastSampleDuration) / pesTimeScale,\n type: 'audio',\n nb: nbSamples\n });\n }\n }\n\n remuxID3(track,timeOffset) {\n var length = track.samples.length, sample;\n // consume samples\n if(length) {\n for(var index = 0; index < length; index++) {\n sample = track.samples[index];\n // setting id3 pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n sample.pts = ((sample.pts - this._initPTS) / this.PES_TIMESCALE);\n sample.dts = ((sample.dts - this._initDTS) / this.PES_TIMESCALE);\n }\n this.observer.trigger(Event.FRAG_PARSING_METADATA, {\n samples:track.samples\n });\n }\n\n track.samples = [];\n timeOffset = timeOffset;\n }\n\n remuxText(track,timeOffset) {\n track.samples.sort(function(a, b) {\n return (a.pts-b.pts);\n });\n\n var length = track.samples.length, sample;\n // consume samples\n if(length) {\n for(var index = 0; index < length; index++) {\n sample = track.samples[index];\n // setting text pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n sample.pts = ((sample.pts - this._initPTS) / this.PES_TIMESCALE);\n }\n this.observer.trigger(Event.FRAG_PARSING_USERDATA, {\n samples:track.samples\n });\n }\n\n track.samples = [];\n timeOffset = timeOffset;\n }\n\n _PTSNormalize(value, reference) {\n var offset;\n if (reference === undefined) {\n return value;\n }\n if (reference < value) {\n // - 2^33\n offset = -8589934592;\n } else {\n // + 2^33\n offset = 8589934592;\n }\n /* PTS is 33bit (from 0 to 2^33 -1)\n if diff between value and reference is bigger than half of the amplitude (2^32) then it means that\n PTS looping occured. fill the gap */\n while (Math.abs(value - reference) > 4294967296) {\n value += offset;\n }\n return value;\n }\n\n}\n\nexport default MP4Remuxer;\n", - "/**\n * passthrough remuxer\n*/\nimport Event from '../events';\n\nclass PassThroughRemuxer {\n constructor(observer) {\n this.observer = observer;\n this.ISGenerated = false;\n }\n\n get passthrough() {\n return true;\n }\n\n destroy() {\n }\n\n insertDiscontinuity() {\n }\n\n switchLevel() {\n this.ISGenerated = false;\n }\n\n remux(audioTrack,videoTrack,id3Track,textTrack,timeOffset,rawData) {\n var observer = this.observer;\n // generate Init Segment if needed\n if (!this.ISGenerated) {\n var tracks = {},\n data = { tracks : tracks, unique : true },\n track = videoTrack,\n codec = track.codec;\n\n if (codec) {\n data.tracks.video = {\n container : track.container,\n codec : codec,\n metadata : {\n width : track.width,\n height : track.height\n }\n };\n }\n\n track = audioTrack;\n codec = track.codec;\n if (codec) {\n data.tracks.audio = {\n container : track.container,\n codec : codec,\n metadata : {\n channelCount : track.channelCount\n }\n };\n }\n this.ISGenerated = true;\n observer.trigger(Event.FRAG_PARSING_INIT_SEGMENT,data);\n }\n observer.trigger(Event.FRAG_PARSING_DATA, {\n data1: rawData,\n startPTS: timeOffset,\n startDTS: timeOffset,\n type: 'audiovideo',\n nb: 1\n });\n }\n}\n\nexport default PassThroughRemuxer;\n", - "\n// adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js\nclass AttrList {\n\n constructor(attrs) {\n if (typeof attrs === 'string') {\n attrs = AttrList.parseAttrList(attrs);\n }\n for(var attr in attrs){\n if(attrs.hasOwnProperty(attr)) {\n this[attr] = attrs[attr];\n }\n }\n }\n\n decimalInteger(attrName) {\n const intValue = parseInt(this[attrName], 10);\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n return intValue;\n }\n\n hexadecimalInteger(attrName) {\n if(this[attrName]) {\n let stringValue = (this[attrName] || '0x').slice(2);\n stringValue = ((stringValue.length & 1) ? '0' : '') + stringValue;\n\n const value = new Uint8Array(stringValue.length / 2);\n for (let i = 0; i < stringValue.length / 2; i++) {\n value[i] = parseInt(stringValue.slice(i * 2, i * 2 + 2), 16);\n }\n return value;\n } else {\n return null;\n }\n }\n\n hexadecimalIntegerAsNumber(attrName) {\n const intValue = parseInt(this[attrName], 16);\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n return intValue;\n }\n\n decimalFloatingPoint(attrName) {\n return parseFloat(this[attrName]);\n }\n\n enumeratedString(attrName) {\n return this[attrName];\n }\n\n decimalResolution(attrName) {\n const res = /^(\\d+)x(\\d+)$/.exec(this[attrName]);\n if (res === null) {\n return undefined;\n }\n return {\n width: parseInt(res[1], 10),\n height: parseInt(res[2], 10)\n };\n }\n\n static parseAttrList(input) {\n const re = /\\s*(.+?)\\s*=((?:\\\".*?\\\")|.*?)(?:,|$)/g;\n var match, attrs = {};\n while ((match = re.exec(input)) !== null) {\n var value = match[2], quote = '\"';\n\n if (value.indexOf(quote) === 0 &&\n value.lastIndexOf(quote) === (value.length-1)) {\n value = value.slice(1, -1);\n }\n attrs[match[1]] = value;\n }\n return attrs;\n }\n\n}\n\nexport default AttrList;\n", - "var BinarySearch = {\n /**\n * Searches for an item in an array which matches a certain condition.\n * This requires the condition to only match one item in the array,\n * and for the array to be ordered.\n *\n * @param {Array} list The array to search.\n * @param {Function} comparisonFunction\n * Called and provided a candidate item as the first argument.\n * Should return:\n * > -1 if the item should be located at a lower index than the provided item.\n * > 1 if the item should be located at a higher index than the provided item.\n * > 0 if the item is the item you're looking for.\n *\n * @return {*} The object if it is found or null otherwise.\n */\n search: function(list, comparisonFunction) {\n var minIndex = 0;\n var maxIndex = list.length - 1;\n var currentIndex = null;\n var currentElement = null;\n \n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = list[currentIndex];\n \n var comparisonResult = comparisonFunction(currentElement);\n if (comparisonResult > 0) {\n minIndex = currentIndex + 1;\n }\n else if (comparisonResult < 0) {\n maxIndex = currentIndex - 1;\n }\n else {\n return currentElement;\n }\n }\n \n return null;\n }\n};\n\nmodule.exports = BinarySearch;\n", - "/*\n * CEA-708 interpreter\n*/\n\nclass CEA708Interpreter {\n\n constructor() {\n }\n\n attach(media) {\n this.media = media;\n this.display = [];\n this.memory = [];\n }\n\n detach()\n {\n this.clear();\n }\n\n destroy() {\n }\n\n _createCue()\n {\n var VTTCue = window.VTTCue || window.TextTrackCue;\n\n var cue = this.cue = new VTTCue(-1, -1, '');\n cue.text = '';\n cue.pauseOnExit = false;\n\n // make sure it doesn't show up before it's ready\n cue.startTime = Number.MAX_VALUE;\n\n // show it 'forever' once we do show it\n // (we'll set the end time once we know it later)\n cue.endTime = Number.MAX_VALUE;\n\n this.memory.push(cue);\n }\n\n clear()\n {\n var textTrack = this._textTrack;\n if (textTrack && textTrack.cues)\n {\n while (textTrack.cues.length > 0)\n {\n textTrack.removeCue(textTrack.cues[0]);\n }\n }\n }\n\n push(timestamp, bytes)\n {\n if (!this.cue)\n {\n this._createCue();\n }\n\n var count = bytes[0] & 31;\n var position = 2;\n var tmpByte, ccbyte1, ccbyte2, ccValid, ccType;\n\n for (var j=0; j= 0x30 && ccbyte2 <= 0x3F)\n {\n // extended chars, e.g. musical note, accents\n switch (ccbyte2)\n {\n case 48:\n this.cue.text += '®';\n break;\n case 49:\n this.cue.text += '°';\n break;\n case 50:\n this.cue.text += '½';\n break;\n case 51:\n this.cue.text += '¿';\n break;\n case 52:\n this.cue.text += '™';\n break;\n case 53:\n this.cue.text += '¢';\n break;\n case 54:\n this.cue.text += '';\n break;\n case 55:\n this.cue.text += '£';\n break;\n case 56:\n this.cue.text += '♪';\n break;\n case 57:\n this.cue.text += ' ';\n break;\n case 58:\n this.cue.text += 'è';\n break;\n case 59:\n this.cue.text += 'â';\n break;\n case 60:\n this.cue.text += 'ê';\n break;\n case 61:\n this.cue.text += 'î';\n break;\n case 62:\n this.cue.text += 'ô';\n break;\n case 63:\n this.cue.text += 'û';\n break;\n }\n }\n if ((ccbyte1 === 0x11 || ccbyte1 === 0x19) && ccbyte2 >= 0x20 && ccbyte2 <= 0x2F)\n {\n // Mid-row codes: color/underline\n switch (ccbyte2)\n {\n case 0x20:\n // White\n break;\n case 0x21:\n // White Underline\n break;\n case 0x22:\n // Green\n break;\n case 0x23:\n // Green Underline\n break;\n case 0x24:\n // Blue\n break;\n case 0x25:\n // Blue Underline\n break;\n case 0x26:\n // Cyan\n break;\n case 0x27:\n // Cyan Underline\n break;\n case 0x28:\n // Red\n break;\n case 0x29:\n // Red Underline\n break;\n case 0x2A:\n // Yellow\n break;\n case 0x2B:\n // Yellow Underline\n break;\n case 0x2C:\n // Magenta\n break;\n case 0x2D:\n // Magenta Underline\n break;\n case 0x2E:\n // Italics\n break;\n case 0x2F:\n // Italics Underline\n break;\n }\n }\n if ((ccbyte1 === 0x14 || ccbyte1 === 0x1C) && ccbyte2 >= 0x20 && ccbyte2 <= 0x2F)\n {\n // Mid-row codes: color/underline\n switch (ccbyte2)\n {\n case 0x20:\n // TODO: shouldn't affect roll-ups...\n this._clearActiveCues(timestamp);\n // RCL: Resume Caption Loading\n // begin pop on\n break;\n case 0x21:\n // BS: Backspace\n this.cue.text = this.cue.text.substr(0, this.cue.text.length-1);\n break;\n case 0x22:\n // AOF: reserved (formerly alarm off)\n break;\n case 0x23:\n // AON: reserved (formerly alarm on)\n break;\n case 0x24:\n // DER: Delete to end of row\n break;\n case 0x25:\n // RU2: roll-up 2 rows\n //this._rollup(2);\n break;\n case 0x26:\n // RU3: roll-up 3 rows\n //this._rollup(3);\n break;\n case 0x27:\n // RU4: roll-up 4 rows\n //this._rollup(4);\n break;\n case 0x28:\n // FON: Flash on\n break;\n case 0x29:\n // RDC: Resume direct captioning\n this._clearActiveCues(timestamp);\n break;\n case 0x2A:\n // TR: Text Restart\n break;\n case 0x2B:\n // RTD: Resume Text Display\n break;\n case 0x2C:\n // EDM: Erase Displayed Memory\n this._clearActiveCues(timestamp);\n break;\n case 0x2D:\n // CR: Carriage Return\n // only affects roll-up\n //this._rollup(1);\n break;\n case 0x2E:\n // ENM: Erase non-displayed memory\n this._text = '';\n break;\n case 0x2F:\n this._flipMemory(timestamp);\n // EOC: End of caption\n // hide any displayed captions and show any hidden one\n break;\n }\n }\n if ((ccbyte1 === 0x17 || ccbyte1 === 0x1F) && ccbyte2 >= 0x21 && ccbyte2 <= 0x23)\n {\n // Mid-row codes: color/underline\n switch (ccbyte2)\n {\n case 0x21:\n // TO1: tab offset 1 column\n break;\n case 0x22:\n // TO1: tab offset 2 column\n break;\n case 0x23:\n // TO1: tab offset 3 column\n break;\n }\n }\n else {\n // Probably a pre-amble address code\n }\n }\n }\n }\n }\n\n _fromCharCode(tmpByte)\n {\n switch (tmpByte)\n {\n case 42:\n return 'á';\n\n case 2:\n return 'á';\n\n case 2:\n return 'é';\n\n case 4:\n return 'í';\n\n case 5:\n return 'ó';\n\n case 6:\n return 'ú';\n\n case 3:\n return 'ç';\n\n case 4:\n return '÷';\n\n case 5:\n return 'Ñ';\n\n case 6:\n return 'ñ';\n\n case 7:\n return '█';\n\n default:\n return String.fromCharCode(tmpByte);\n }\n }\n\n _flipMemory(timestamp)\n {\n this._clearActiveCues(timestamp);\n this._flushCaptions(timestamp);\n }\n\n _flushCaptions(timestamp)\n {\n if (!this._has708)\n {\n this._textTrack = this.media.addTextTrack('captions', 'English', 'en');\n this._has708 = true;\n }\n\n for(let memoryItem of this.memory)\n {\n memoryItem.startTime = timestamp;\n this._textTrack.addCue(memoryItem);\n this.display.push(memoryItem);\n }\n\n this.memory = [];\n this.cue = null;\n }\n\n _clearActiveCues(timestamp)\n {\n for (let displayItem of this.display)\n {\n displayItem.endTime = timestamp;\n }\n\n this.display = [];\n }\n\n/* _rollUp(n)\n {\n // TODO: implement roll-up captions\n }\n*/\n _clearBufferedCues()\n {\n //remove them all...\n }\n\n}\n\nexport default CEA708Interpreter;\n\n", - "'use strict';\n\nfunction noop() {}\n\nconst fakeLogger = {\n trace: noop,\n debug: noop,\n log: noop,\n warn: noop,\n info: noop,\n error: noop\n};\n\nlet exportedLogger = fakeLogger;\n\n//let lastCallTime;\n// function formatMsgWithTimeInfo(type, msg) {\n// const now = Date.now();\n// const diff = lastCallTime ? '+' + (now - lastCallTime) : '0';\n// lastCallTime = now;\n// msg = (new Date(now)).toISOString() + ' | [' + type + '] > ' + msg + ' ( ' + diff + ' ms )';\n// return msg;\n// }\n\nfunction formatMsg(type, msg) {\n msg = '[' + type + '] > ' + msg;\n return msg;\n}\n\nfunction consolePrintFn(type) {\n const func = window.console[type];\n if (func) {\n return function(...args) {\n if(args[0]) {\n args[0] = formatMsg(type, args[0]);\n }\n func.apply(window.console, args);\n };\n }\n return noop;\n}\n\nfunction exportLoggerFunctions(debugConfig, ...functions) {\n functions.forEach(function(type) {\n exportedLogger[type] = debugConfig[type] ? debugConfig[type].bind(debugConfig) : consolePrintFn(type);\n });\n}\n\nexport var enableLogs = function(debugConfig) {\n if (debugConfig === true || typeof debugConfig === 'object') {\n exportLoggerFunctions(debugConfig,\n // Remove out from list here to hard-disable a log-level\n //'trace',\n 'debug',\n 'log',\n 'info',\n 'warn',\n 'error'\n );\n // Some browsers don't allow to use bind on console object anyway\n // fallback to default if needed\n try {\n exportedLogger.log();\n } catch (e) {\n exportedLogger = fakeLogger;\n }\n }\n else {\n exportedLogger = fakeLogger;\n }\n};\n\nexport var logger = exportedLogger;\n", - "var URLHelper = {\n\n // build an absolute URL from a relative one using the provided baseURL\n // if relativeURL is an absolute URL it will be returned as is.\n buildAbsoluteURL: function(baseURL, relativeURL) {\n // remove any remaining space and CRLF\n relativeURL = relativeURL.trim();\n if (/^[a-z]+:/i.test(relativeURL)) {\n // complete url, not relative\n return relativeURL;\n }\n\n var relativeURLQuery = null;\n var relativeURLHash = null;\n\n var relativeURLHashSplit = /^([^#]*)(.*)$/.exec(relativeURL);\n if (relativeURLHashSplit) {\n relativeURLHash = relativeURLHashSplit[2];\n relativeURL = relativeURLHashSplit[1];\n }\n var relativeURLQuerySplit = /^([^\\?]*)(.*)$/.exec(relativeURL);\n if (relativeURLQuerySplit) {\n relativeURLQuery = relativeURLQuerySplit[2];\n relativeURL = relativeURLQuerySplit[1];\n }\n\n var baseURLHashSplit = /^([^#]*)(.*)$/.exec(baseURL);\n if (baseURLHashSplit) {\n baseURL = baseURLHashSplit[1];\n }\n var baseURLQuerySplit = /^([^\\?]*)(.*)$/.exec(baseURL);\n if (baseURLQuerySplit) {\n baseURL = baseURLQuerySplit[1];\n }\n\n var baseURLDomainSplit = /^((([a-z]+):)?\\/\\/[a-z0-9\\.\\-_~]+(:[0-9]+)?\\/)(.*)$/i.exec(baseURL);\n var baseURLProtocol = baseURLDomainSplit[3];\n var baseURLDomain = baseURLDomainSplit[1];\n var baseURLPath = baseURLDomainSplit[5];\n\n var builtURL = null;\n if (/^\\/\\//.test(relativeURL)) {\n builtURL = baseURLProtocol+'://'+URLHelper.buildAbsolutePath('', relativeURL.substring(2));\n }\n else if (/^\\//.test(relativeURL)) {\n builtURL = baseURLDomain+URLHelper.buildAbsolutePath('', relativeURL.substring(1));\n }\n else {\n builtURL = URLHelper.buildAbsolutePath(baseURLDomain+baseURLPath, relativeURL);\n }\n\n // put the query and hash parts back\n if (relativeURLQuery) {\n builtURL += relativeURLQuery;\n }\n if (relativeURLHash) {\n builtURL += relativeURLHash;\n }\n return builtURL;\n },\n\n // build an absolute path using the provided basePath\n // adapted from https://developer.mozilla.org/en-US/docs/Web/API/document/cookie#Using_relative_URLs_in_the_path_parameter\n // this does not handle the case where relativePath is \"/\" or \"//\". These cases should be handled outside this.\n buildAbsolutePath: function(basePath, relativePath) {\n var sRelPath = relativePath;\n var nUpLn, sDir = '', sPath = basePath.replace(/[^\\/]*$/, sRelPath.replace(/(\\/|^)(?:\\.?\\/+)+/g, '$1'));\n for (var nEnd, nStart = 0; nEnd = sPath.indexOf('/../', nStart), nEnd > -1; nStart = nEnd + nUpLn) {\n nUpLn = /^\\/(?:\\.\\.\\/)*/.exec(sPath.slice(nEnd))[0].length;\n sDir = (sDir + sPath.substring(nStart, nEnd)).replace(new RegExp('(?:\\\\\\/+[^\\\\\\/]*){0,' + ((nUpLn - 1) / 3) + '}$'), '/');\n }\n return sDir + sPath.substr(nStart);\n }\n};\n\nmodule.exports = URLHelper;\n", - "/**\n * XHR based logger\n*/\n\nimport {logger} from '../utils/logger';\n\nclass XhrLoader {\n\n constructor(config) {\n if (config && config.xhrSetup) {\n this.xhrSetup = config.xhrSetup;\n }\n }\n\n destroy() {\n this.abort();\n this.loader = null;\n }\n\n abort() {\n var loader = this.loader,\n timeoutHandle = this.timeoutHandle;\n if (loader && loader.readyState !== 4) {\n this.stats.aborted = true;\n loader.abort();\n }\n if (timeoutHandle) {\n window.clearTimeout(timeoutHandle);\n }\n }\n\n load(url, responseType, onSuccess, onError, onTimeout, timeout, maxRetry, retryDelay, onProgress = null, frag = null) {\n this.url = url;\n if (frag && !isNaN(frag.byteRangeStartOffset) && !isNaN(frag.byteRangeEndOffset)) {\n this.byteRange = frag.byteRangeStartOffset + '-' + (frag.byteRangeEndOffset-1);\n }\n this.responseType = responseType;\n this.onSuccess = onSuccess;\n this.onProgress = onProgress;\n this.onTimeout = onTimeout;\n this.onError = onError;\n this.stats = {trequest: performance.now(), retry: 0};\n this.timeout = timeout;\n this.maxRetry = maxRetry;\n this.retryDelay = retryDelay;\n this.loadInternal();\n }\n\n loadInternal() {\n var xhr;\n\n if (typeof XDomainRequest !== 'undefined') {\n xhr = this.loader = new XDomainRequest();\n } else {\n xhr = this.loader = new XMLHttpRequest();\n }\n\n xhr.onloadend = this.loadend.bind(this);\n xhr.onprogress = this.loadprogress.bind(this);\n\n xhr.open('GET', this.url, true);\n if (this.byteRange) {\n xhr.setRequestHeader('Range', 'bytes=' + this.byteRange);\n }\n xhr.responseType = this.responseType;\n this.stats.tfirst = null;\n this.stats.loaded = 0;\n if (this.xhrSetup) {\n this.xhrSetup(xhr, this.url);\n }\n this.timeoutHandle = window.setTimeout(this.loadtimeout.bind(this), this.timeout);\n xhr.send();\n }\n\n loadend(event) {\n var xhr = event.currentTarget,\n status = xhr.status,\n stats = this.stats;\n // don't proceed if xhr has been aborted\n if (!stats.aborted) {\n // http status between 200 to 299 are all successful\n if (status >= 200 && status < 300) {\n window.clearTimeout(this.timeoutHandle);\n stats.tload = performance.now();\n this.onSuccess(event, stats);\n } else {\n // error ...\n if (stats.retry < this.maxRetry) {\n logger.warn(`${status} while loading ${this.url}, retrying in ${this.retryDelay}...`);\n this.destroy();\n window.setTimeout(this.loadInternal.bind(this), this.retryDelay);\n // exponential backoff\n this.retryDelay = Math.min(2 * this.retryDelay, 64000);\n stats.retry++;\n } else {\n window.clearTimeout(this.timeoutHandle);\n logger.error(`${status} while loading ${this.url}` );\n this.onError(event);\n }\n }\n }\n }\n\n loadtimeout(event) {\n logger.warn(`timeout while loading ${this.url}` );\n this.onTimeout(event, this.stats);\n }\n\n loadprogress(event) {\n var stats = this.stats;\n if (stats.tfirst === null) {\n stats.tfirst = performance.now();\n }\n stats.loaded = event.loaded;\n if (this.onProgress) {\n this.onProgress(event, stats);\n }\n }\n}\n\nexport default XhrLoader;\n" - ] -} \ No newline at end of file diff --git a/src/js/lib/hls.min.js b/src/js/lib/hls.min.js index a9fcbf3..8c27e2c 100644 --- a/src/js/lib/hls.min.js +++ b/src/js/lib/hls.min.js @@ -1,4 +1,6 @@ -!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(){return function s(e,t,r){function i(n,d){if(!t[n]){if(!e[n]){var l="function"==typeof require&&require;if(!d&&l)return l(n,!0);if(a)return a(n,!0);var u=new Error("Cannot find module '"+n+"'");throw u.code="MODULE_NOT_FOUND",u}var o=t[n]={exports:{}};e[n][0].call(o.exports,function(t){var r=e[n][1][t];return i(r?r:t)},o,o.exports,s,e,t,r)}return t[n].exports}for(var a="function"==typeof require&&require,n=0;ne||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},e.prototype.emit=function(l){var s,e,u,n,a,o;if(this._events||(this._events={}),"error"===l&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(s=arguments[1],s instanceof Error)throw s;throw TypeError('Uncaught, unspecified "error" event.')}if(e=this._events[l],i(e))return!1;if(t(e))switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),e.apply(this,n)}else if(r(e))for(n=Array.prototype.slice.call(arguments,1),o=e.slice(),u=o.length,a=0;u>a;a++)o[a].apply(this,n);return!0},e.prototype.addListener=function(n,a){var s;if(!t(a))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",n,t(a.listener)?a.listener:a),this._events[n]?r(this._events[n])?this._events[n].push(a):this._events[n]=[this._events[n],a]:this._events[n]=a,r(this._events[n])&&!this._events[n].warned&&(s=i(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[n].length>s&&(this._events[n].warned=!0,"function"==typeof console.trace)),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(i,e){function r(){this.removeListener(i,r),n||(n=!0,e.apply(this,arguments))}if(!t(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(i,r),this},e.prototype.removeListener=function(n,i){var e,s,o,a;if(!t(i))throw TypeError("listener must be a function");if(!this._events||!this._events[n])return this;if(e=this._events[n],o=e.length,s=-1,e===i||t(e.listener)&&e.listener===i)delete this._events[n],this._events.removeListener&&this.emit("removeListener",n,i);else if(r(e)){for(a=o;a-- >0;)if(e[a]===i||e[a].listener&&e[a].listener===i){s=a;break}if(0>s)return this;1===e.length?(e.length=0,delete this._events[n]):e.splice(s,1),this._events.removeListener&&this.emit("removeListener",n,i)}return this},e.prototype.removeAllListeners=function(r){var i,e;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[r]&&delete this._events[r],this;if(0===arguments.length){for(i in this._events)"removeListener"!==i&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[r],t(e))this.removeListener(r,e);else if(e)for(;e.length;)this.removeListener(r,e[e.length-1]);return delete this._events[r],this},e.prototype.listeners=function(e){var r;return r=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(t(e))return 1;if(e)return e.length}return 0},e.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(a,i,s){var n=arguments[3],e=arguments[4],r=arguments[5],t=JSON.stringify;i.exports=function(l){for(var i,s=Object.keys(r),a=0,d=s.length;d>a;a++){var o=s[a],u=r[o].exports;if(u===l||u.default===l){i=o;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},a=0,d=s.length;d>a;a++){var o=s[a];f[o]=o}e[i]=[Function(["require","module","exports"],"("+l+")(self)"),f]}var h=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[i]=i,e[h]=[Function(["require"],"var f = require("+t(i)+");(f.default ? f.default : f)(self);"),c];var v="("+n+")({"+Object.keys(e).map(function(r){return t(r)+":["+e[r][0]+","+t(e[r][1])+"]"}).join(",")+"},{},["+t(h)+"])",g=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(g.createObjectURL(new Blob([v],{type:"text/javascript"})))}},{}],3:[function(e,p,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;t500*e.duration){var d=Math.max(1,1e3*e.loaded/u);e.expectedLens){var o=void 0,r=void 0;for(r=e.level-1;r>=0&&(o=e.duration*n.levels[r].bitrate/(6.4*d),i.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+r+"] :"+l.toFixed(1)+"/"+s.toFixed(1)+"/"+o.toFixed(1)),!(s>o));r--);l>o&&(r=Math.max(0,r),n.nextLoadLevel=r,i.logger.warn("loading too slow, abort fragment loading and switch to level "+r),e.loader.abort(),this.clearTimer(),n.trigger(t.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e}))}}}}},{key:"onFragLoaded",value:function(e){this.clearTimer(),this.lastLoadedFragLevel=e.frag.level,this._nextAutoLevel=-1}},{key:"onError",value:function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var i,e,r,n=this.lastbw,t=this.hls;if(r=-1===this._autoLevelCapping&&t.levels&&t.levels.length?t.levels.length-1:this._autoLevelCapping,-1!==this._nextAutoLevel)return Math.min(this._nextAutoLevel,r);for(e=0;r>=e;e++)if(i=e<=this.lastLoadedFragLevel?.8*n:.7*n,ia.config.appendErrorMaxRetry)return t.logger.log("fail "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),n=[],i.fatal=!0,void a.trigger(e.default.ERROR,i);i.fatal=!1,a.trigger(e.default.ERROR,i)}else n=[],i.details=r.ErrorDetails.BUFFER_FULL_ERROR,a.trigger(e.default.ERROR,i)}}}}},{key:"flushBuffer",value:function(l,s){var e,r,o,a,i,n;if(this.flushBufferCounter.5)return this.flushBufferCounter++,t.logger.log("flush "+u+" ["+i+","+n+"], of ["+o+","+a+"], pos:"+this.media.currentTime),e.remove(i,n),!1}else t.logger.warn("abort flushing too many retries");return t.logger.log("buffer flushed"),!0}}]),i}(s.default);n.default=o},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],5:[function(e,h,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;tthis.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(a){var r=void 0,e=void 0,t=void 0,s=this.mediaWidth,o=this.mediaHeight,i=0,n=0;for(e=0;a>=e&&(t=this.levels[e],r=e,i=t.width,n=t.height,!(i>=s||n>=o));e++);return r}},{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}}]),e}(s.default);t.default=u},{"../event-handler":21,"../events":22}],6:[function(i,v,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;t=0&&i1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var m,l,a,_=this,f=this.hls,o=f.config;switch(this.state){case e.ERROR:case e.PAUSED:break;case e.STARTING:this.startLevel=f.startLevel,-1===this.startLevel&&(this.startLevel=0,this.fragBitrateTest=!0),this.level=f.nextLoadLevel=this.startLevel,this.state=e.WAITING_LEVEL,this.loadedmetadata=!1;break;case e.IDLE:if(!this.media&&(this.startFragRequested||!o.startFragPrefetch))break;m=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition,l=this.startFragRequested===!1?this.startLevel:f.nextLoadLevel;var c,b=s.default.bufferInfo(this.media,m,o.maxBufferHole),k=b.len,u=b.end,v=this.fragPrevious;if(this.levels[l].hasOwnProperty("bitrate")?(c=Math.max(8*o.maxBufferSize/this.levels[l].bitrate,o.maxBufferLength),c=Math.min(c,o.maxMaxBufferLength)):c=o.maxBufferLength,c>k){if(f.nextLoadLevel=l,this.level=l,a=this.levels[l].details,"undefined"==typeof a||a.live&&this.levelLastLoaded!==l){this.state=e.WAITING_LEVEL;break}var d=a.fragments,h=d.length,g=d[0].start,y=d[h-1].start+d[h-1].duration,n=void 0;if(a.live){var T=void 0!==o.liveMaxLatencyDuration?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*a.targetduration;if(uy)break;if(this.startFragRequested&&!a.PTSKnown){if(v){var E=v.sn+1;E>=a.startSN&&E<=a.endSN&&(n=d[E-a.startSN],t.logger.log("live playlist, switching playlist, load frag with next SN: "+n.sn))}n||(n=d[Math.min(h-1,Math.round(h/2))],t.logger.log("live playlist, switching playlist, unknown, load middle frag : "+n.sn))}}else g>u&&(n=d[0]);if(n||!function(){var i=void 0,s=o.maxFragLookUpTolerance;y>u?(u>y-s&&(s=0),i=p.default.search(d,function(e){return e.start+e.duration-s<=u?1:e.start-s>u?-1:0})):i=d[h-1],i&&(n=i,g=i.start,v&&n.level===v.level&&n.sn===v.sn&&(n.sn1&&(n.expectedLen=Math.round(n.duration*this.levels[l].bitrate/8),n.trequest=performance.now()),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,n.loadCounter){n.loadCounter++;var R=o.fragLoadingLoopThreshold;if(n.loadCounter>R&&Math.abs(this.fragLoadIdx-n.loadIdx)=A||O)&&(t.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;case e.STOPPED:case e.FRAG_LOADING:case e.PARSING:case e.PARSED:case e.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(i){var e,t,r=this.bufferRange;if(r)for(e=r.length-1;e>=0;e--)if(t=r[e],i>=t.start&&i<=t.end)return t;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(r){for(var i=this.media,t=i.buffered,e=0;e=t.start(e)&&r<=t.end(e))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var t,e,i=this.media;if(i&&i.seeking===!1&&(e=i.currentTime,e>i.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),this.isBuffered(e)?t=this.getBufferRange(e):this.isBuffered(e+.1)&&(t=this.getBufferRange(e+.1)),t)){var n=t.frag;n!==this.fragPlaying&&(this.fragPlaying=n,this.hls.trigger(r.default.FRAG_CHANGED,{frag:n}))}}},{key:"immediateLevelSwitch",value:function(){t.logger.log("immediateLevelSwitch"),this.immediateSwitch||(this.immediateSwitch=!0,this.previouslyPaused=this.media.paused,this.media.pause());var i=this.fragCurrent;i&&i.loader&&i.loader.abort(),this.fragCurrent=null,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0, -endOffset:Number.POSITIVE_INFINITY}),this.state=e.PAUSED,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.tick()}},{key:"immediateLevelSwitchEnd",value:function(){this.immediateSwitch=!1,this.media.currentTime-=1e-4,this.previouslyPaused||this.media.play()}},{key:"nextLevelSwitch",value:function(){var n,i,t;if(i=this.getBufferRange(this.media.currentTime),i&&i.start>1&&(this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:i.start-1}),this.state=e.PAUSED),this.media.paused)n=0;else{var o=this.hls.nextLoadLevel,l=this.levels[o],s=this.fragLastKbps;n=s&&this.fragCurrent?this.fragCurrent.duration*l.bitrate/(1e3*s)+1:0}if(t=this.getBufferRange(this.media.currentTime+n),t&&(t=this.followingBufferRange(t))){this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:t.start,endOffset:Number.POSITIVE_INFINITY}),this.state=e.PAUSED;var a=this.fragCurrent;a&&a.loader&&a.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold}}},{key:"onMediaAttached",value:function(t){var e=this.media=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("seeked",this.onvseeked),e.addEventListener("ended",this.onvended),this.levels&&this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(t.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var r=this.levels;r&&r.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(){if(this.state===e.FRAG_LOADING){if(0===s.default.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len){t.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load");var r=this.fragCurrent;r&&(r.loader&&r.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.state=e.IDLE}}else this.state===e.ENDED&&(this.state=e.IDLE);this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){this.tick()}},{key:"onMediaEnded",value:function(){t.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){t.logger.log("trigger BUFFER_RESET"),this.hls.trigger(r.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(r){var e,i=!1,n=!1;r.levels.forEach(function(t){e=t.audioCodec,e&&(-1!==e.indexOf("mp4a.40.2")&&(i=!0),-1!==e.indexOf("mp4a.40.5")&&(n=!0))}),this.audioCodecSwitch=i&&n,this.audioCodecSwitch&&t.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startLevelLoaded=!1,this.startFragRequested=!1,this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onLevelLoaded",value:function(s){var i=s.details,n=s.level,o=this.levels[n],l=i.totalduration,a=0;if(t.logger.log("level "+n+" loaded ["+i.startSN+","+i.endSN+"],duration:"+l),this.levelLastLoaded=n,i.live){var d=o.details;d?(u.default.mergeDetails(d,i),a=i.fragments[0].start,i.PTSKnown?t.logger.log("live playlist sliding:"+a.toFixed(3)):t.logger.log("live playlist - outdated PTS, unknown sliding")):(i.PTSKnown=!1,t.logger.log("live playlist - first load, unknown sliding"))}else i.PTSKnown=!1;if(o.details=i,this.hls.trigger(r.default.LEVEL_UPDATED,{details:i,level:n}),this.startFragRequested===!1){if(i.live){var f=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*i.targetduration;this.startPosition=Math.max(0,a+l-f)}this.nextLoadPosition=this.startPosition}this.state===e.WAITING_LEVEL&&(this.state=e.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===e.KEY_LOADING&&(this.state=e.IDLE,this.tick())}},{key:"onFragLoaded",value:function(n){var i=this.fragCurrent;if(this.state===e.FRAG_LOADING&&i&&n.frag.level===i.level&&n.frag.sn===i.sn)if(this.fragBitrateTest===!0)this.state=e.IDLE,this.fragBitrateTest=!1,n.stats.tparsed=n.stats.tbuffered=performance.now(),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:n.stats,frag:i});else{this.state=e.PARSING,this.stats=n.stats;var s=this.levels[this.level],o=s.details,d=o.totalduration,f=i.start,l=i.level,u=i.sn,a=s.audioCodec||this.config.defaultAudioCodec;this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),void 0===a&&(a=this.lastAudioCodec),a&&(a=-1!==a.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,t.logger.log("Demuxing "+u+" of ["+o.startSN+" ,"+o.endSN+"],level "+l),this.demuxer.push(n.payload,a,s.videoCodec,f,i.cc,l,u,d,i.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(l){if(this.state===e.PARSING){var o,i,n=l.tracks;if(i=n.audio){var a=this.levels[this.level].audioCodec,u=navigator.userAgent.toLowerCase();a&&this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),a=-1!==a.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&-1===u.indexOf("firefox")&&(a="mp4a.40.5"),-1!==u.indexOf("android")&&(a="mp4a.40.2",t.logger.log("Android: force audio codec to"+a)),i.levelCodec=a}if(i=n.video,i&&(i.levelCodec=this.levels[this.level].videoCodec),l.unique){var s={codec:"",levelCodec:""};for(o in l.tracks)i=n[o],s.container=i.container,s.codec&&(s.codec+=",",s.levelCodec+=","),i.codec&&(s.codec+=i.codec),i.levelCodec&&(s.levelCodec+=i.levelCodec);n={audiovideo:s}}this.hls.trigger(r.default.BUFFER_CODECS,n);for(o in n){i=n[o],t.logger.log("track:"+o+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var d=i.initSegment;d&&(this.pendingAppending++,this.hls.trigger(r.default.BUFFER_APPENDING,{type:o,data:d}))}this.tick()}}},{key:"onFragParsingData",value:function(i){var o=this;if(this.state===e.PARSING){this.tparse2=Date.now();var n=this.levels[this.level],a=this.fragCurrent;t.logger.log("parsed "+i.type+",PTS:["+i.startPTS.toFixed(3)+","+i.endPTS.toFixed(3)+"],DTS:["+i.startDTS.toFixed(3)+"/"+i.endDTS.toFixed(3)+"],nb:"+i.nb);var l=u.default.updateFragPTS(n.details,a.sn,i.startPTS,i.endPTS),s=this.hls;s.trigger(r.default.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:l}),[i.data1,i.data2].forEach(function(e){e&&(o.pendingAppending++,s.trigger(r.default.BUFFER_APPENDING,{type:i.type,data:e}))}),this.nextLoadPosition=i.endPTS,this.bufferRange.push({type:i.type,start:i.startPTS,end:i.endPTS,frag:a}),this.tick()}else t.logger.warn("not in PARSING state but "+this.state+", ignoring FRAG_PARSING_DATA event")}},{key:"onFragParsed",value:function(){this.state===e.PARSING&&(this.stats.tparsed=performance.now(),this.state=e.PARSED,this._checkAppendedParsed())}},{key:"onBufferAppended",value:function(){switch(this.state){case e.PARSING:case e.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===e.PARSED&&0===this.pendingAppending){var n=this.fragCurrent,i=this.stats;n&&(this.fragPrevious=n,i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.length/(i.tbuffered-i.tfirst)),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:i,frag:n}),t.logger.log("media buffered : "+this.timeRangesToString(this.media.buffered)),this.state=e.IDLE),this.tick()}}},{key:"onError",value:function(n){switch(n.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!n.fatal){var a=this.fragLoadError;if(a?a++:a=1,a<=this.config.fragLoadingMaxRetry){this.fragLoadError=a,n.frag.loadCounter=0;var s=Math.min(Math.pow(2,a-1)*this.config.fragLoadingRetryDelay,64e3);t.logger.warn("mediaController: frag loading failed, retry in "+s+" ms"),this.retryDate=performance.now()+s,this.state=e.FRAG_LOADING_WAITING_RETRY}else t.logger.error("mediaController: "+n.details+" reaches max retry, redispatch as fatal ..."),n.fatal=!0,this.hls.trigger(r.default.ERROR,n),this.state=e.ERROR}break;case i.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case i.ErrorDetails.LEVEL_LOAD_ERROR:case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==e.ERROR&&(this.state=n.fatal?e.ERROR:e.IDLE,t.logger.warn("mediaController: "+n.details+" while loading frag,switch to "+this.state+" state ..."));break;case i.ErrorDetails.BUFFER_FULL_ERROR:this.config.maxMaxBufferLength/=2,t.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError"),this.nextLevelSwitch()}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e){var f=e.readyState;if(f){var n,a,l=this.seekAfterBuffered;if(l)e.duration>=l&&(n=l,this.seekAfterBuffered=void 0);else{a=e.currentTime;var g=this.loadedmetadata;!g&&e.buffered.length&&(this.loadedmetadata=!0,a||a===this.startPosition||(n=this.startPosition))}n&&(a=n,t.logger.log("target seek position:"+n));var u=s.default.bufferInfo(e,a,0),v=!(e.paused||e.ended||e.seeking||2>f),d=.4,h=a>e.playbackRate*this.lastCurrentTime;if(this.stalled&&h&&(this.stalled=!1,t.logger.log("playback not stuck anymore @"+a)),v&&u.len<=d){if(h?(d=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,t.logger.log("playback seems stuck @"+a),this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),u.len<=d){var o=u.nextStart,c=o-a;o&&c0&&!e.seeking&&(t.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+o+" + nudge "+this.seekHoleNudgeDuration),e.currentTime=o+this.seekHoleNudgeDuration,this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1}))}}else n&&e.currentTime!==n&&(t.logger.log("adjust currentTime from "+e.currentTime+" to "+n),e.currentTime=n)}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=e.IDLE,this.tick()}},{key:"onBufferFlushed",value:function(){var t,r,i=[];for(r=0;re;e++)r+="["+t.start(e)+","+t.end(e)+"]";return r}},{key:"currentLevel",get:function(){if(this.media){var e=this.getBufferRange(this.media.currentTime);if(e)return e.frag.level}return-1}},{key:"nextBufferRange",get:function(){return this.media?this.followingBufferRange(this.getBufferRange(this.media.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferRange;return e?e.frag.level:-1}}]),n}(l.default);o.default=f},{"../demux/demuxer":16,"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../helper/level-helper":24,"../utils/binary-search":34,"../utils/logger":36}],8:[function(t,v,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;te;e++)c[(n[e]=e<<1^283*(e>>7))^e]=e;for(i=r=0;!h[i];i^=u||1,r=c[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^255&t^99,h[i]=t,v[t]=i,d=n[f=n[u=n[i]]],l=16843009*d^65537*f^257*u^16843008*i,s=257*n[t]^16843008*t,e=0;4>e;e++)a[e][i]=s=s<<24^s>>>8,o[e][t]=l=l<<24^l>>>8;for(e=0;5>e;e++)a[e]=a[e].slice(0),o[e]=o[e].slice(0)}},{key:"decrypt",value:function(R,p,_,b,E,m){var h,g,v,a,e=this._key[1],t=R^e[0],i=b^e[1],n=_^e[2],r=p^e[3],y=e.length/4-2,s=4,o=this._tables[1],f=o[0],d=o[1],u=o[2],l=o[3],c=o[4];for(a=0;y>a;a++)h=f[t>>>24]^d[i>>16&255]^u[n>>8&255]^l[255&r]^e[s],g=f[i>>>24]^d[n>>16&255]^u[r>>8&255]^l[255&t]^e[s+1],v=f[n>>>24]^d[r>>16&255]^u[t>>8&255]^l[255&i]^e[s+2],r=f[r>>>24]^d[t>>16&255]^u[i>>8&255]^l[255&n]^e[s+3],s+=4,t=h,i=g,n=v;for(a=0;4>a;a++)E[(3&-a)+m]=c[t>>>24]<<24^c[i>>16&255]<<16^c[n>>8&255]<<8^c[255&r]^e[s++],h=t,t=i,i=n,n=r,r=h}}]),e}();e.default=i},{}],10:[function(t,l,e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t>8|e>>>24}},{key:"doDecrypt",value:function(i,g,n){var u,h,o,f,l,c,d,a,e,r=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>2),p=new s.default(Array.prototype.slice.call(g)),v=new Uint8Array(i.byteLength),t=new Int32Array(v.buffer);for(u=~~n[0],h=~~n[1],o=~~n[2],f=~~n[3],e=0;ee&&(255!==t[e]||240!==(240&t[e+1]));e++);for(r.audiosamplerate||(n=o.default.getAudioConfig(this.observer,t,e,p),r.config=n.config,r.audiosamplerate=n.samplerate,r.channelCount=n.channelCount,r.codec=n.codec,r.duration=y,l.logger.log("parsed codec:"+r.codec+",rate:"+n.samplerate+",nb channel:"+n.channelCount)),c=0,g=9216e4/r.audiosamplerate;u>e+5&&(s=1&t[e+1]?7:9,a=(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5,a-=s,a>0&&u>=e+s+a);)for(f=h+c*g,v={unit:t.subarray(e+s,e+s+a),pts:f,dts:f},r.samples.push(v),r.len+=a,e+=a+s,c++;u-1>e&&(255!==t[e]||240!==(240&t[e+1]));e++);this.remuxer.remux(this._aacTrack,{samples:[]},{samples:[{pts:h,dts:h,unit:d.payload}]},{samples:[]},m)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){var e,r,n=new i.default(t);if(n.hasTimeStamp)for(e=n.length,r=t.length;r-1>e;e++)if(255===t[e]&&240===(240&t[e+1]))return!0;return!1}}]),e}();t.default=s},{"../demux/id3":18,"../utils/logger":36,"./adts":13}],13:[function(e,o,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t>>6)+1,e=(60&u[l+2])>>>2,e>d.length-1?void h.trigger(Event.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+e}):(o=(1&u[l+2])<<2,o|=(192&u[l+3])>>>6,a.logger.log("manifest codec:"+n+",ADTS data:type:"+i+",sampleingIndex:"+e+"["+d[e]+"Hz],channelConfig:"+o),-1!==f.indexOf("firefox")?e>=6?(i=5,t=new Array(4),s=e-3):(i=2,t=new Array(2),s=e):-1!==f.indexOf("android")?(i=2,t=new Array(2),s=e):(i=5,t=new Array(4),n&&(-1!==n.indexOf("mp4a.40.29")||-1!==n.indexOf("mp4a.40.5"))||!n&&e>=6?s=e-3:((n&&-1!==n.indexOf("mp4a.40.2")&&e>=6&&1===o||!n&&1===o)&&(i=2,t=new Array(2)),s=e)),t[0]=i<<3,t[0]|=(14&e)>>1,t[1]|=(1&e)<<7,t[1]|=o<<3,5===i&&(t[1]|=(14&s)>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),{config:t,samplerate:d[e],channelCount:o,codec:"mp4a.40."+i})}}]),e}();t.default=s},{"../errors":20,"../utils/logger":36}],14:[function(e,y,i){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t1?r-1:0),e=1;r>e;e++)n[e-1]=arguments[e];t.emit.apply(t,[i,i].concat(n))},t.off=function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),e=1;r>e;e++)i[e-1]=arguments[e];t.removeListener.apply(t,[n].concat(i))},r.addEventListener("message",function(i){var e=i.data;switch(e.cmd){case"init":r.demuxer=new u.default(t,e.typeSupported);break;case"demux":r.demuxer.push(new Uint8Array(e.data),e.audioCodec,e.videoCodec,e.timeOffset,e.cc,e.level,e.sn,e.duration)}}),t.on(e.default.FRAG_PARSING_INIT_SEGMENT,function(t,e){r.postMessage({event:t,tracks:e.tracks,unique:e.unique})}),t.on(e.default.FRAG_PARSING_DATA,function(i,e){var t={event:i,type:e.type,startPTS:e.startPTS,endPTS:e.endPTS,startDTS:e.startDTS,endDTS:e.endDTS,data1:e.data1.buffer,data2:e.data2.buffer,nb:e.nb};r.postMessage(t,[t.data1,t.data2])}),t.on(e.default.FRAG_PARSED,function(e){r.postMessage({event:e})}),t.on(e.default.ERROR,function(e,t){r.postMessage({event:e,data:t})}),t.on(e.default.FRAG_PARSING_METADATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)}),t.on(e.default.FRAG_PARSING_USERDATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)})};i.default=o},{"../demux/demuxer-inline":14,"../events":22,events:1}],16:[function(t,g,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t0&&null!=e&&null!=e.key&&"AES-128"===e.method){null==this.decrypter&&(this.decrypter=new l.default(this.hls));var d=this;this.decrypter.decrypt(t,e.key,e.iv,function(e){d.pushDecrypted(e,r,i,n,a,s,o,u)})}else this.pushDecrypted(t,r,i,n,a,s,o,u)}},{key:"onWorkerMessage",value:function(i){var t=i.data;switch(t.event){case e.default.FRAG_PARSING_INIT_SEGMENT:var r={};r.tracks=t.tracks,r.unique=t.unique,this.hls.trigger(e.default.FRAG_PARSING_INIT_SEGMENT,r);break;case e.default.FRAG_PARSING_DATA:this.hls.trigger(e.default.FRAG_PARSING_DATA,{data1:new Uint8Array(t.data1),data2:new Uint8Array(t.data2),startPTS:t.startPTS,endPTS:t.endPTS,startDTS:t.startDTS,endDTS:t.endDTS,type:t.type,nb:t.nb});break;case e.default.FRAG_PARSING_METADATA:this.hls.trigger(e.default.FRAG_PARSING_METADATA,{samples:t.samples});break;case e.default.FRAG_PARSING_USERDATA:this.hls.trigger(e.default.FRAG_PARSING_USERDATA,{samples:t.samples});break;default:this.hls.trigger(t.event,t.data)}}}]),r}();i.default=o},{"../crypt/decrypter":11,"../demux/demuxer-inline":14,"../demux/demuxer-worker":15,"../events":22,"../utils/logger":36,webworkify:2}],17:[function(t,s,e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function e(i,r){for(var t=0;te?(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(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0?r<>>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(n){var t,i,r=8,e=8;for(t=0;n>t;t++)0!==e&&(i=this.readEG(),e=(r+i+256)%256),r=0===e?r:e}},{key:"readSPS",value:function(){var t,g,p,l,n,a,i,o,r,s=0,d=0,f=0,h=0,c=1;if(this.readUByte(),t=this.readUByte(),g=this.readBits(5),this.skipBits(3),p=this.readUByte(),this.skipUEG(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){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,r=0;o>r;r++)this.readBoolean()&&(6>r?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var u=this.readUEG();if(0===u)this.readUEG();else if(1===u)for(this.skipBits(1),this.skipEG(),this.skipEG(),l=this.readUEG(),r=0;l>r;r++)this.skipEG();if(this.skipUEG(),this.skipBits(1),n=this.readUEG(),a=this.readUEG(),i=this.readBits(1),0===i&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(s=this.readUEG(),d=this.readUEG(),f=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){var e=void 0,y=this.readUByte();switch(y){case 1:e=[1,1];break; -case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}e&&(c=e[0]/e[1])}return{width:Math.ceil((16*(n+1)-2*s-2*d)*c),height:(2-i)*(a+1)*16-(i?2:4)*(f+h)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();e.default=a},{"../utils/logger":36}],18:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;tr);return t}},{key:"_parseID3Frames",value:function(r,t,a){for(var n,s,o,l,i;a>=t+8;)switch(n=this.readUTF(r,t,4),t+=4,s=r[t++]<<24+r[t++]<<16+r[t++]<<8+r[t++],l=r[t++]<<8+r[t++],o=t,n){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(r,t,44)){t+=44,t+=4;var u=1&r[t++];this._hasTimeStamp=!0,i=((r[t++]<<23)+(r[t++]<<15)+(r[t++]<<7)+r[t++])/45,u&&(i+=47721858.84),i=Math.round(i),e.logger.trace("ID3 timestamp found: "+i),this._timeStamp=i}}}},{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}}]),t}();t.default=a},{"../utils/logger":36}],19:[function(t,v,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var f=function(){function e(i,r){for(var t=0;tt;t+=188)if(71===i[t]){if(d=!!(64&i[t+1]),u=((31&i[t+1])<<8)+i[t+2],y=(48&i[t+3])>>4,y>1){if(n=t+5+i[t+4],n===t+188)continue}else n=t+4;if(g)if(u===h){if(d){if(s&&(this._parseAVCPES(this._parsePES(s)),b&&this._avcTrack.codec&&(-1===f||this._aacTrack.codec)))return void this.remux(i);s={data:[],size:0}}s&&(s.data.push(i.subarray(n,t+188)),s.size+=t+188-n)}else if(u===f){if(d){if(o&&(this._parseAACPES(this._parsePES(o)),b&&this._aacTrack.codec&&(-1===h||this._avcTrack.codec)))return void this.remux(i);o={data:[],size:0}}o&&(o.data.push(i.subarray(n,t+188)),o.size+=t+188-n)}else u===v&&(d&&(l&&this._parseID3PES(this._parsePES(l)),l={data:[],size:0}),l&&(l.data.push(i.subarray(n,t+188)),l.size+=t+188-n));else d&&(n+=i[n]+1),0===u?this._parsePAT(i,n):u===this._pmtId&&(this._parsePMT(i,n),g=this.pmtParsed=!0,h=this._avcTrack.id,f=this._aacTrack.id,v=this._id3Track.id)}else this.observer.trigger(a.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s&&this._parseAVCPES(this._parsePES(s)),o&&this._parseAACPES(this._parsePES(o)),l&&this._parseID3PES(this._parsePES(l)),this.remux(null)}},{key:"remux",value:function(e){this.remuxer.remux(this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,e)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){this._pmtId=(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(r,t){var n,a,s,i;for(n=(15&r[t+1])<<8|r[t+2],a=t+3+n-4,s=(15&r[t+10])<<8|r[t+11],t+=12+s;a>t;){switch(i=(31&r[t+1])<<8|r[t+2],r[t]){case 15:this._aacTrack.id=i;break;case 21:this._id3Track.id=i;break;case 27:this._avcTrack.id=i;break;default:e.logger.log("unkown stream type:"+r[t])}t+=((15&r[t+3])<<8|r[t+4])+5}}},{key:"_parsePES",value:function(o){var e,a,h,d,u,l,i,r,t,f=0,s=o.data;if(e=s[0],h=(e[0]<<16)+(e[1]<<8)+e[2],1===h){for(d=(e[4]<<8)+e[5],a=e[7],192&a&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,i>4294967295&&(i-=8589934592),64&a?(r=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r>4294967295&&(r-=8589934592)):r=i),u=e[8],t=u+9,o.size-=t,l=new Uint8Array(o.size);s.length;){e=s.shift();var n=e.byteLength;if(t){if(t>n){t-=n;continue}e=e.subarray(t),n-=t,t=0}l.set(e,f),f+=n}return{data:l,pts:i,dts:r,len:d}}return null}},{key:"_parseAVCPES",value:function(i){var t,p,a,l,y=this,r=this._avcTrack,u=r.samples,m=this._parseAVCNALu(i.data),d=[],o=!1,h=!1,c=0;if(0===m.length&&u.length>0){var v=u[u.length-1],f=v.units.units[v.units.units.length-1],g=new Uint8Array(f.data.byteLength+i.data.byteLength);g.set(f.data,0),g.set(i.data,f.data.byteLength),f.data=g,v.units.length+=i.data.byteLength,r.len+=i.data.byteLength}i.data=null;var n="";m.forEach(function(e){switch(e.type){case 1:a=!0,o&&(n+="NDR ");break;case 5:a=!0,o&&(n+="IDR "),h=!0;break;case 6:a=!0,o&&(n+="SEI "),t=new s.default(e.data),t.readUByte();var E=t.readUByte();if(4===E){var g=0;do g=t.readUByte();while(255===g);var R=t.readUByte();if(181===R){var _=t.readUShort();if(49===_){var A=t.readUInt();if(1195456820===A){var k=t.readUByte();if(3===k){var v=t.readUByte(),b=t.readUByte(),T=31&v,f=[v,b];for(l=0;T>l;l++)f.push(t.readUByte()),f.push(t.readUByte()),f.push(t.readUByte());y._txtTrack.samples.push({type:3,pts:i.pts,bytes:f})}}}}}break;case 7:if(a=!0,o&&(n+="SPS "),!r.sps){t=new s.default(e.data);var p=t.readSPS();r.width=p.width,r.height=p.height,r.sps=[e.data],r.duration=y._duration;var L=e.data.subarray(1,4),m="avc1.";for(l=0;3>l;l++){var u=L[l].toString(16);u.length<2&&(u="0"+u),m+=u}r.codec=m}break;case 8:a=!0,o&&(n+="PPS "),r.pps||(r.pps=[e.data]);break;case 9:a=!1,o&&(n+="AUD ");break;default:a=!1,n+="unknown NAL "+e.type+" "}a&&(d.push(e),c+=e.data.byteLength)}),(o||n.length)&&e.logger.log(n),d.length&&(h===!0||r.sps)&&(p={units:{units:d,length:c},pts:i.pts,dts:i.dts,key:h},u.push(p),r.len+=c,r.nbNalu+=d.length)}},{key:"_parseAVCNALu",value:function(r){for(var a,i,s,p,n,l,t=0,h=r.byteLength,e=0,d=[];h>t;)switch(a=r[t++],e){case 0:0===a&&(e=1);break;case 1:e=0===a?2:0;break;case 2:case 3:if(0===a)e=3;else if(1===a&&h>t){if(p=31&r[t],n)s={data:r.subarray(n,t-e-1),type:l},d.push(s);else if(i=t-e-1){var c=this._avcTrack,f=c.samples;if(f.length){var v=f[f.length-1],g=v.units.units,o=g[g.length-1],u=new Uint8Array(o.data.byteLength+i);u.set(o.data,0),u.set(r.subarray(0,i),o.data.byteLength),o.data=u,v.units.length+=i,c.len+=i}}n=t,l=p,e=0}else e=0}return n&&(s={data:r.subarray(n,h),type:l},d.push(s)),d}},{key:"_parseAACPES",value:function(R){var l,o,p,E,t,d,f,s,_,n=this._aacTrack,i=R.data,v=R.pts,k=0,L=this._duration,A=this.audioCodec,u=this.aacOverFlow,b=this.lastAacPTS;if(u){var m=new Uint8Array(u.byteLength+i.byteLength);m.set(u,0),m.set(i,u.byteLength),i=m}for(t=k,s=i.length;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);if(t){var y,h;if(s-1>t?(y="AAC PES did not start with ADTS header,offset:"+t,h=!1):(y="no ADTS header found in AAC PES",h=!0),this.observer.trigger(a.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:h,reason:y}),h)return}if(n.audiosamplerate||(l=c.default.getAudioConfig(this.observer,i,t,A),n.config=l.config,n.audiosamplerate=l.samplerate,n.channelCount=l.channelCount,n.codec=l.codec,n.duration=L,e.logger.log("parsed codec:"+n.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)),E=0,p=9216e4/n.audiosamplerate,u&&b){var g=b+p;Math.abs(g-v)>1&&(e.logger.log("AAC: align PTS for overlapping frames by "+Math.round((g-v)/90)),v=g)}for(;s>t+5&&(d=1&i[t+1]?7:9,o=(3&i[t+3])<<11|i[t+4]<<3|(224&i[t+5])>>>5,o-=d,o>0&&s>=t+d+o);)for(f=v+E*p,_={unit:i.subarray(t+d,t+d+o),pts:f,dts:f},n.samples.push(_),n.len+=o,t+=o+d,E++;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);u=s>t?i.subarray(t,s):null,this.aacOverFlow=u,this.lastAacPTS=f}},{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]}}]),t}();n.default=o},{"../errors":20,"../events":22,"../utils/logger":36,"./adts":13,"./exp-golomb":17}],20:[function(t,r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},e.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",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_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],21:[function(e,l,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__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?"symbol":typeof e},a=function(){function e(i,r){for(var t=0;t1?r-1:0),t=1;r>t;t++)n[t-1]=arguments[t];this.handledEvents=n,this.useGenericHandler=!0,this.registerListeners()}return a(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 i=function(t,r){var e="on"+t.replace("hls","");if("function"!=typeof this[e])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+e+")");return this[e].bind(this,r)};try{i.call(this,e,t).call()}catch(t){s.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(Event.ERROR,{type:r.ErrorTypes.OTHER_ERROR,details:r.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();t.default=o},{"./errors":20,"./utils/logger":36}],22:[function(t,e,r){"use strict";e.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",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",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",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",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded"}},{}],23:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;td&&(t[u-1].end=r[e].end):t.push(r[e])}else t.push(r[e])}for(e=0,o=0,l=n=i;e=a&&f>i)l=a,n=f,o=n-i;else if(a>i+s){h=a;break}}return{len:o,start:l,end:n,nextStart:h}}}]),e}();e.default=i},{}],24:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;th)return void(i.PTSKnown=!1);for(var r=c;h>=r;r++){var o=f[u+r],n=l[r];d=o.cc-n.cc,isNaN(o.startPTS)||(n.start=n.startPTS=o.startPTS,n.endPTS=o.endPTS,n.duration=o.duration,s=n)}if(d)for(e.logger.log("discontinuity sliding from playlist, take drift into account"),r=0;r=0&&ui.endSN)return 0;o=l-i.startSN,a=i.fragments,r=a[o],isNaN(r.startPTS)||(n=Math.min(n,r.startPTS),s=Math.max(s,r.endPTS));var u=n-r.start;for(r.start=r.startPTS=n,r.endPTS=s,r.duration=s-n,e=o;e>0;e--)t.updatePTS(a,e,e-1);for(e=o;ei?r.start=t.start+t.duration:r.start=t.start-r.duration:n>i?(t.duration=a-t.start,t.duration<0&&e.logger.error("negative duration computed for frag "+t.sn+",level "+t.level+", there should be some duration drift between playlist and fragment!")):(r.duration=t.start-a,r.duration<0&&e.logger.error("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!"))}}]),t}();t.default=a},{"../utils/logger":36}],25:[function(t,I,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t1?t-1:0),e=1;t>e;e++)n[e-1]=arguments[e];i.emit.apply(i,[r,r].concat(n))},i.off=function(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];i.removeListener.apply(i,[n].concat(r))},this.on=i.on.bind(i),this.off=i.off.bind(i),this.trigger=i.trigger.bind(i),this.playlistLoader=new d.default(this),this.fragmentLoader=new h.default(this),this.levelController=new R.default(this),this.abrController=new r.abrController(this),this.bufferController=new r.bufferController(this),this.capLevelController=new r.capLevelController(this),this.streamController=new r.streamController(this),this.timelineController=new r.timelineController(this),this.keyLoader=new p.default(this)}return a(t,null,[{key:"isSupported",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"Events",get:function(){return i.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig||(t.defaultConfig={autoStartLoad:!0,debug:!1,capLevelToPlayerSize:!1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,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,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,abrController:v.default,bufferController:P.default,capLevelController:m.default,streamController:b.default,timelineController:L.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1}),t.defaultConfig},set:function(e){t.defaultConfig=e}}]),a(t,[{key:"destroy",value:function(){e.logger.log("destroy"),this.trigger(i.default.DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.streamController.destroy(),this.timelineController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(t){e.logger.log("attachMedia"),this.media=t,this.trigger(i.default.MEDIA_ATTACHING,{media:t})}},{key:"detachMedia",value:function(){e.logger.log("detachMedia"),this.trigger(i.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(t){e.logger.log("loadSource:"+t),this.url=t,this.trigger(i.default.MANIFEST_LOADING,{url:t})}},{key:"startLoad",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0];e.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(t)}},{key:"stopLoad",value:function(){e.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad()}},{key:"swapAudioCodec",value:function(){e.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){e.logger.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){e.logger.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){e.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){e.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return this.levelController.firstLevel},set:function(t){e.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){e.logger.log("set startLevel:"+t),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(t){e.logger.log("set autoLevelCapping:"+t),this.abrController.autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}}]),t}();n.default=l},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":6,"./controller/stream-controller":7,"./controller/timeline-controller":8,"./errors":20,"./events":22,"./loader/fragment-loader":27,"./loader/key-loader":28,"./loader/playlist-loader":29,"./utils/logger":36,"./utils/xhr-loader":38,events:1}],26:[function(e,t,r){"use strict";t.exports=e("./hls.js").default},{"./hls.js":25}],27:[function(r,c,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t2?(e=t.shift()+".",e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).substr(-4)):e=r,e}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(L,l,A){var e,b,s,a,g=0,o=0,i={url:l,fragments:[],live:!0,startSN:0},r={method:null,key:null,iv:null,uri:null},E=0,f=null,t=null;for(b=/(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*))/g;null!==(e=b.exec(L));)switch(e.shift(),e=e.filter(function(e){return void 0!==e}),e[0]){case"MEDIA-SEQUENCE":g=i.startSN=parseInt(e[1]);break;case"TARGETDURATION":i.targetduration=parseFloat(e[1]);break;case"ENDLIST":i.live=!1;break;case"DIS":E++;break;case"BYTERANGE":var c=e[1].split("@");a=1===c.length?s:parseInt(c[1]),s=parseInt(c[0])+a,t&&!t.url&&(t.byteRangeStartOffset=a,t.byteRangeEndOffset=s,t.url=this.resolve(e[2],l));break;case"INF":var v=parseFloat(e[1]);if(!isNaN(v)){var u,m=g++;if(r.method&&r.uri&&!r.iv){u=this.cloneObj(r);for(var y=new Uint8Array(16),d=12;16>d;d++)y[d]=m>>8*(15-d)&255;u.iv=y}else u=r;var k=e[2]?this.resolve(e[2],l):null;t={url:k,duration:v,start:o,sn:m,level:A,cc:E,byteRangeStartOffset:a,byteRangeEndOffset:s,decryptdata:u,programDateTime:f},i.fragments.push(t),o+=v,a=null,f=null}break;case"KEY":var R=e[1],p=new n.default(R),h=p.enumeratedString("METHOD"),_=p.URI,T=p.hexadecimalInteger("IV");h&&(r={method:null,key:null,iv:null,uri:null},_&&"AES-128"===h&&(r.method=h,r.uri=this.resolve(_,l),r.key=null,r.iv=T));break;case"PROGRAM-DATE-TIME":f=new Date(Date.parse(e[1]))}return t&&!t.url&&(i.fragments.pop(),o-=t.duration),i.totalduration=o,i.endSN=g-1,i}},{key:"loadsuccess",value:function(u,i){var s,o=u.currentTarget,a=o.responseText,r=o.responseURL,l=this.id,d=this.id2,n=this.hls;if(void 0===r&&(r=this.url),i.tload=performance.now(),i.mtime=new Date(o.getResponseHeader("Last-Modified")),0===a.indexOf("#EXTM3U"))if(a.indexOf("#EXTINF:")>0)if(null===this.id)n.trigger(t.default.MANIFEST_LOADED,{levels:[{url:r}],url:r,stats:i});else{var f=this.parseLevelPlaylist(a,r,l);i.tparsed=performance.now(),n.trigger(t.default.LEVEL_LOADED,{details:f,level:l,id:d,stats:i})}else s=this.parseMasterPlaylist(a,r),s.length?n.trigger(t.default.MANIFEST_LOADED,{levels:s,url:r,stats:i}):n.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no level found in manifest"});else n.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(n){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_ERROR,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_ERROR,i=!1),this.loader&&this.loader.abort(),this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,response:n.currentTarget,level:this.id,id:this.id2})}},{key:"loadtimeout",value:function(){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_TIMEOUT,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_TIMEOUT,i=!1),this.loader&&this.loader.abort(),this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,level:this.id,id:this.id2})}}]),r}(a.default);s.default=u},{"../errors":20,"../event-handler":21,"../events":22,"../utils/attr-list":33,"../utils/url":37}],30:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t.set(n,4),r=0,e=8;a>r;r++)t.set(i[r],e),e+=i[r].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(r){for(var t=r.length,i=[];t--;)i[t]=e.trex(r[t]);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(a){var r,t,i=a.samples||[],n=new Uint8Array(4+i.length);for(t=0;t>>8&255),i.push(255&a),i=i.concat(Array.prototype.slice.call(n));for(r=0;r>>8&255),s.push(255&a),s=s.concat(Array.prototype.slice.call(n));var u=e.box(e.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),o=t.width,l=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,o>>8&255,255&o,l>>8&255,255&l,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]),u,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.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:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(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,n=t.width,a=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,n>>8&255,255&n,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(i,t){var n=e.sdtp(i),r=i.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),e.trun(i,n.length+16+16+8+16+8+8),n)}},{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(r){var t=r.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(h,o){var i,n,a,s,t,l,d=h.samples||[],r=d.length,f=12+16*r,u=new Uint8Array(f);for(o+=8+f,u.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o],0),i=0;r>i;i++)n=d[i],a=n.duration,s=n.size,t=n.flags,l=n.cts,u.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,61440&t.degradPrio,15&t.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,u)}},{key:"initSegment",value:function(i){e.types||e.init();var t,r=e.moov(i);return t=new Uint8Array(e.FTYP.byteLength+r.byteLength),t.set(e.FTYP),t.set(r,e.FTYP.byteLength),t}}]),e}();e.default=i},{}],31:[function(i,h,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(i,r){for(var t=0;tMath.pow(2,32)&&!function(){var e=function r(t,e){return e?r(e,t%e):t};i.timescale=i.audiosamplerate/e(i.audiosamplerate,1024)}(),e.logger.log("audio mp4 timescale :"+i.timescale),l.audio={container:"audio/mp4",codec:i.codec,initSegment:r.default.initSegment([i]),metadata:{channelCount:i.channelCount}},u&&(a=o=v[0].pts-f*h)),n.sps&&n.pps&&d.length&&(n.timescale=this.MP4_TIMESCALE,l.video={container:"video/mp4",codec:n.codec,initSegment:r.default.initSegment([n]),metadata:{width:n.width,height:n.height}},u&&(a=Math.min(a,d[0].pts-f*h),o=Math.min(o,d[0].dts-f*h))),Object.keys(l).length?(c.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,g),this.ISGenerated=!0,u&&(this._initPTS=a,this._initDTS=o)):c.trigger(t.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(n,w,S){var L,s,p,A,f,d,T,k,R,v,_,g,o,i,l,E=8,c=this.PES_TIMESCALE,h=this.PES2MP4SCALEFACTOR,u=[];for(d=new Uint8Array(n.len+4*n.nbNalu+8),L=new DataView(d.buffer),L.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4);n.samples.length;){for(s=n.samples.shift(),A=0;s.units.units.length;)f=s.units.units.shift(),L.setUint32(E,f.data.byteLength),E+=4,d.set(f.data,E),E+=f.data.byteLength,A+=4+f.data.byteLength;if(_=s.pts-this._initDTS,g=s.dts-this._initDTS,g=Math.min(_,g),void 0!==v){o=this._PTSNormalize(_,v),i=this._PTSNormalize(g,v);var m=(i-v)/h;0>=m&&(e.logger.log("invalid sample duration at PTS/DTS: "+s.pts+"/"+s.dts+":"+m),m=1),p.duration=m}else{var y=void 0,a=void 0;y=S?this.nextAvcDts:w*c,o=this._PTSNormalize(_,y),i=this._PTSNormalize(g,y),a=Math.round((i-y)/90),(S||Math.abs(a)>1e4)&&a&&(a>1?e.logger.log("AVC:"+a+" ms hole between fragments detected,filling it"):-1>a&&e.logger.log("AVC:"+-a+" ms overlapping between fragments detected"),i=y,o=Math.max(o-a,i),e.logger.log("Video/PTS/DTS adjusted: "+o+"/"+i+",delta:"+a)),k=Math.max(0,o),R=Math.max(0,i)}p={size:A,duration:0,cts:(o-i)/h,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0}},l=p.flags,s.key===!0?(l.dependsOn=2,l.isNonSync=0):(l.dependsOn=1,l.isNonSync=1),u.push(p),v=i}var b=0;u.length>=2&&(b=u[u.length-2].duration,p.duration=b),this.nextAvcDts=i+b*h,n.len=0,n.nbNalu=0,u.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&(l=u[0].flags,l.dependsOn=2,l.isNonSync=0),n.samples=u,T=r.default.moof(n.sequenceNumber++,R/h,n),n.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:T,data2:d,startPTS:k/c,endPTS:(o+h*b)/c,startDTS:R/c,endDTS:this.nextAvcDts/c,type:"video",nb:u.length})}},{key:"remuxAudio",value:function(i,O,S){var T,p,a,h,l,k,L,b,u,g,R,d,n,A=8,s=this.PES_TIMESCALE,w=i.timescale,f=s/w,E=1024*i.timescale/i.audiosamplerate,m=[],_=[];for(i.samples.sort(function(e,t){return e.pts-t.pts}),_=i.samples;_.length;){if(p=_.shift(),h=p.unit,g=p.pts-this._initDTS,R=p.dts-this._initDTS,void 0!==u)d=this._PTSNormalize(g,u),n=this._PTSNormalize(R,u),a.duration=(n-u)/f,Math.abs(a.duration-E)>E/10&&e.logger.log("invalid AAC sample duration at PTS "+Math.round(g/90)+",should be 1024,found :"+Math.round(a.duration*i.audiosamplerate/i.timescale)),a.duration=E,n=E*f+u;else{var c=void 0,o=void 0;if(c=S?this.nextAacPts:O*s,d=this._PTSNormalize(g,c),n=this._PTSNormalize(R,c),o=Math.round(1e3*(d-c)/s),(S||Math.abs(o)>1e4)&&o){if(o>0)e.logger.log(o+" ms hole between AAC samples detected,filling it");else if(-12>o){e.logger.log(-o+" ms overlapping between AAC samples detected, drop frame"),i.len-=h.byteLength;continue}d=n=c}if(L=Math.max(0,d),b=Math.max(0,n),!(i.len>0))return;l=new Uint8Array(i.len+8),T=new DataView(l.buffer),T.setUint32(0,l.byteLength),l.set(r.default.types.mdat,4)}l.set(h,A),A+=h.byteLength,a={size:h.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},m.push(a),u=n}var y=0,v=m.length;v>=2&&(y=m[v-2].duration,a.duration=y),v&&(this.nextAacPts=d+f*y,i.len=0,i.samples=m,k=r.default.moof(i.sequenceNumber++,b/f,i),i.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:k,data2:l,startPTS:L/s,endPTS:this.nextAacPts/s,startDTS:b/s,endDTS:(n+f*y)/s,type:"audio",nb:v}))}},{key:"remuxID3",value:function(r,n){var e,a=r.samples.length;if(a){for(var i=0;a>i;i++)e=r.samples[i],e.pts=(e.pts-this._initPTS)/this.PES_TIMESCALE,e.dts=(e.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_METADATA,{samples:r.samples})}r.samples=[],n=n}},{key:"remuxText",value:function(e,n){e.samples.sort(function(e,t){return e.pts-t.pts});var r,a=e.samples.length;if(a){for(var i=0;a>i;i++)r=e.samples[i],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[],n=n}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=e>t?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),i}();n.default=d},{"../errors":20,"../events":22,"../remux/mp4-generator":30,"../utils/logger":36}],32:[function(r,l,e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(r){if(this[r]){var e=(this[r]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var i=new Uint8Array(e.length/2),t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(t){var e=/^(\d+)x(\d+)$/.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(n){for(var t,a=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(t=a.exec(n));){var e=t[2],i='"';0===e.indexOf(i)&&e.lastIndexOf(i)===e.length-1&&(e=e.slice(1,-1)),r[t[1]]=e}return r}}]),e}();e.default=i},{}],34:[function(r,e,i){"use strict";var t={search:function(n,s){for(var t=0,r=n.length-1,e=null,i=null;r>=t;){e=(t+r)/2|0,i=n[e];var a=s(i);if(a>0)t=e+1;else{if(!(0>a))return i;r=e-1}}return null}};e.exports=t},{}],35:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t0;)e.removeCue(e.cues[0])}},{key:"push",value:function(r,i){this.cue||this._createCue();for(var n,t,e,s,o,u=31&i[0],a=2,l=0;u>l;l++)if(n=i[a++],t=127&i[a++],e=127&i[a++],s=0!==(4&n),o=3&n,(0!==t||0!==e)&&s&&0===o){if(32&t||64&t)this.cue.text+=this._fromCharCode(t)+this._fromCharCode(e);else if((17===t||25===t)&&e>=48&&63>=e)switch(e){case 48:this.cue.text+="®";break;case 49:this.cue.text+="°";break;case 50:this.cue.text+="½";break;case 51:this.cue.text+="¿";break;case 52:this.cue.text+="™";break;case 53:this.cue.text+="¢";break;case 54:this.cue.text+="";break;case 55:this.cue.text+="£";break;case 56:this.cue.text+="♪";break;case 57:this.cue.text+=" ";break;case 58:this.cue.text+="è";break;case 59:this.cue.text+="â";break;case 60:this.cue.text+="ê";break;case 61:this.cue.text+="î";break;case 62:this.cue.text+="ô";break;case 63:this.cue.text+="û"}if((17===t||25===t)&&e>=32&&47>=e)switch(e){case 32:break;case 33:break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:break;case 42:break;case 43:break;case 44:break;case 45:break;case 46:break;case 47:}if((20===t||28===t)&&e>=32&&47>=e)switch(e){case 32:this._clearActiveCues(r);break;case 33:this.cue.text=this.cue.text.substr(0,this.cue.text.length-1);break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:this._clearActiveCues(r);break;case 42:break;case 43:break;case 44:this._clearActiveCues(r);break;case 45:break;case 46:this._text="";break;case 47:this._flipMemory(r)}if((23===t||31===t)&&e>=33&&35>=e)switch(e){case 33:break;case 34:break;case 35:}}}},{key:"_fromCharCode",value:function(e){switch(e){case 42:return"á";case 2:return"á";case 2:return"é";case 4:return"í";case 5:return"ó";case 6:return"ú";case 3:return"ç";case 4:return"÷";case 5:return"Ñ";case 6:return"ñ";case 7:return"█";default:return String.fromCharCode(e)}}},{key:"_flipMemory",value:function(e){this._clearActiveCues(e),this._flushCaptions(e)}},{key:"_flushCaptions",value:function(s){this._has708||(this._textTrack=this.media.addTextTrack("captions","English","en"),this._has708=!0);var e=!0,i=!1,n=void 0;try{for(var a,t=this.memory[Symbol.iterator]();!(e=(a=t.next()).done);e=!0){var r=a.value;r.startTime=s,this._textTrack.addCue(r),this.display.push(r)}}catch(e){i=!0,n=e}finally{try{!e&&t.return&&t.return()}finally{if(i)throw n}}this.memory=[],this.cue=null}},{key:"_clearActiveCues",value:function(a){var e=!0,r=!1,i=void 0;try{for(var n,t=this.display[Symbol.iterator]();!(e=(n=t.next()).done);e=!0){var s=n.value;s.endTime=a}}catch(e){r=!0,i=e}finally{try{!e&&t.return&&t.return()}finally{if(r)throw i}}this.display=[]}},{key:"_clearBufferedCues",value:function(){}}]),e}();e.default=i},{}],36:[function(l,u,r){"use strict";function e(){}function n(t,e){return e="["+t+"] > "+e}function a(t){var r=window.console[t];return r?function(){for(var a=arguments.length,e=Array(a),i=0;a>i;i++)e[i]=arguments[i];e[0]&&(e[0]=n(t,e[0])),r.apply(window.console,e)}:e}function s(r){for(var i=arguments.length,n=Array(i>1?i-1:0),e=1;i>e;e++)n[e-1]=arguments[e];n.forEach(function(e){t[e]=r[e]?r[e].bind(r):a(e)})}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?"symbol":typeof e},i={trace:e,debug:e,log:e,warn:e,info:e,error:e},t=i;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{t.log()}catch(e){t=i}}else t=i},r.logger=t},{}],37:[function(r,t,i){"use strict";var e={buildAbsoluteURL:function(r,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var o=null,n=null,a=/^([^#]*)(.*)$/.exec(t);a&&(n=a[2],t=a[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(o=s[2],t=s[1]);var f=/^([^#]*)(.*)$/.exec(r);f&&(r=f[1]);var u=/^([^\?]*)(.*)$/.exec(r);u&&(r=u[1]);var l=/^((([a-z]+):)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?\/)(.*)$/i.exec(r),h=l[3],d=l[1],c=l[5],i=null;return i=/^\/\//.test(t)?h+"://"+e.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?d+e.buildAbsolutePath("",t.substring(1)):e.buildAbsolutePath(d+c,t),o&&(i+=o),n&&(i+=n),i},buildAbsolutePath:function(a,s){for(var i,e,o=s,n="",t=a.replace(/[^\/]*$/,o.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),r=0;e=t.indexOf("/../",r),e>-1;r=e+i)i=/^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length,n=(n+t.substring(r,e)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");return n+t.substr(r)}};t.exports=e},{}],38:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t=200&&300>r?(window.clearTimeout(this.timeoutHandle),t.tload=performance.now(),this.onSuccess(i,t)):t.retrye||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},e.prototype.emit=function(l){var s,e,u,a,n,o;if(this._events||(this._events={}),"error"===l&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(s=arguments[1],s instanceof Error)throw s;throw TypeError('Uncaught, unspecified "error" event.')}if(e=this._events[l],i(e))return!1;if(t(e))switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),e.apply(this,a)}else if(r(e))for(a=Array.prototype.slice.call(arguments,1),o=e.slice(),u=o.length,n=0;u>n;n++)o[n].apply(this,a);return!0},e.prototype.addListener=function(a,n){var s;if(!t(n))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,t(n.listener)?n.listener:n),this._events[a]?r(this._events[a])?this._events[a].push(n):this._events[a]=[this._events[a],n]:this._events[a]=n,r(this._events[a])&&!this._events[a].warned&&(s=i(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[a].length>s&&(this._events[a].warned=!0,"function"==typeof console.trace)),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(i,e){function r(){this.removeListener(i,r),a||(a=!0,e.apply(this,arguments))}if(!t(e))throw TypeError("listener must be a function");var a=!1;return r.listener=e,this.on(i,r),this},e.prototype.removeListener=function(a,i){var e,s,o,n;if(!t(i))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(e=this._events[a],o=e.length,s=-1,e===i||t(e.listener)&&e.listener===i)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,i);else if(r(e)){for(n=o;n-- >0;)if(e[n]===i||e[n].listener&&e[n].listener===i){s=n;break}if(0>s)return this;1===e.length?(e.length=0,delete this._events[a]):e.splice(s,1),this._events.removeListener&&this.emit("removeListener",a,i)}return this},e.prototype.removeAllListeners=function(r){var i,e;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[r]&&delete this._events[r],this;if(0===arguments.length){for(i in this._events)"removeListener"!==i&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[r],t(e))this.removeListener(r,e);else if(e)for(;e.length;)this.removeListener(r,e[e.length-1]);return delete this._events[r],this},e.prototype.listeners=function(e){var r;return r=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(t(e))return 1;if(e)return e.length}return 0},e.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(n,i,s){var a=arguments[3],e=arguments[4],r=arguments[5],t=JSON.stringify;i.exports=function(l){for(var i,s=Object.keys(r),n=0,d=s.length;d>n;n++){var o=s[n],u=r[o].exports;if(u===l||u.default===l){i=o;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var h={},n=0,d=s.length;d>n;n++){var o=s[n];h[o]=o}e[i]=[Function(["require","module","exports"],"("+l+")(self)"),h]}var f=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[i]=i,e[f]=[Function(["require"],"var f = require("+t(i)+");(f.default ? f.default : f)(self);"),c];var g="("+a+")({"+Object.keys(e).map(function(r){return t(r)+":["+e[r][0]+","+t(e[r][1])+"]"}).join(",")+"},{},["+t(f)+"])",v=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(v.createObjectURL(new Blob([g],{type:"text/javascript"})))}},{}],3:[function(e,m,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function g(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(i,r){for(var t=0;t500*e.duration/u){var f=n.levels,g=Math.max(1,1e3*e.loaded/d),v=Math.max(e.loaded,Math.round(e.duration*f[e.level].bitrate/8)),c=a.currentTime,h=(v-e.loaded)/g,s=(o.default.bufferInfo(a,c,n.config.maxBufferHole).end-c)/u;if(s<2*e.duration/u&&h>s){var l=void 0,r=void 0;for(r=e.level-1;r>=0&&(l=e.duration*f[r].bitrate/(6.4*g),i.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+r+"] :"+h.toFixed(1)+"/"+s.toFixed(1)+"/"+l.toFixed(1)),!(s>l));r--);h>l&&(r=Math.max(0,r),n.nextLoadLevel=r,this.bwEstimator.sample(d,e.loaded),i.logger.warn("loading too slow, abort fragment loading and switch to level "+r),e.loader.abort(),this.clearTimer(),n.trigger(t.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e}))}}}}},{key:"onFragLoaded",value:function(r){var e=r.frag;if("main"===e.type){var t=r.stats;void 0===t.aborted&&1===e.loadCounter&&this.bwEstimator.sample(performance.now()-t.trequest,t.loaded),this.clearTimer(),this.lastLoadedFragLevel=e.level,this._nextAutoLevel=-1}}},{key:"onError",value:function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var r=this.hls,i=r.config,t=r.levels,a=r.media,e=void 0,n=void 0;if(n=-1===this._autoLevelCapping&&t&&t.length?t.length-1:this._autoLevelCapping,-1!==this._nextAutoLevel)return Math.min(this._nextAutoLevel,n);var s=a&&0!==a.playbackRate?Math.abs(a.playbackRate):1,o=this.bwEstimator?this.bwEstimator.getEstimate()/s:i.abrEwmaDefaultEstimate/s,l=void 0;for(e=0;n>=e;e++)if(l=e<=this.lastLoadedFragLevel?i.abrBandWidthFactor*o:i.abrBandWidthUpFactor*o,l1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var g,p,n,T=this,d=this.hls,l=d.config;switch(this.state){case e.ERROR:case e.PAUSED:break;case e.STARTING:this.state=e.WAITING_TRACK,this.loadedmetadata=!1;break;case e.IDLE:if(!this.media&&(this.startFragRequested||!l.startFragPrefetch))break;g=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition;var f=this.mediaBuffer?this.mediaBuffer:this.media,y=h.default.bufferInfo(f,g,l.maxBufferHole),k=y.len,o=y.end,c=this.fragPrevious,R=l.maxMaxBufferLength;if(R>k&&this.trackIdo?i=s[0]:!function(){var t=void 0,a=l.maxFragLookUpTolerance;E>o?(o>E-a&&(a=0),t=u.default.search(s,function(e){return e.start+e.duration-a<=o?1:e.start-a>o?-1:0})):t=s[v-1],t&&(i=t,m=t.start,c&&i.level===c.level&&i.sn===c.sn&&(i.snb&&Math.abs(this.fragLoadIdx-i.loadIdx)=_||S)&&(r.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;case e.STOPPED:case e.FRAG_LOADING:case e.PARSING:case e.PARSED:case e.ENDED:}}},{key:"onMediaAttached",value:function(r){var e=this.media=this.mediaBuffer=r.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("ended",this.onvended);var t=this.config;this.tracks&&t.autoStartLoad&&this.startLoad(t.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(r.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===e.ENDED&&(this.state=e.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){r.logger.log("audio tracks updated"),this.tracks=e.audioTracks}},{key:"onAudioTrackSwitch",value:function(r){this.trackId=r.id,this.state=e.IDLE,this.fragCurrent=null,this.state=e.PAUSED,"main"===r.type&&this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.hls.trigger(t.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),this.tick()}},{key:"onAudioTrackLoaded",value:function(a){var t=a.details,n=a.id,s=this.tracks[n],o=t.totalduration;if(r.logger.log("track "+n+" loaded ["+t.startSN+","+t.endSN+"],duration:"+o),t.PTSKnown=!1,s.details=t,!this.startFragRequested){if(-1===this.startPosition){var i=t.startTimeOffset;isNaN(i)?this.startPosition=0:(r.logger.log("start time offset found in playlist, adjust startPosition to "+i),this.startPosition=i)}this.nextLoadPosition=this.startPosition}this.state===e.WAITING_TRACK&&(this.state=e.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===e.KEY_LOADING&&(this.state=e.IDLE,this.tick())}},{key:"onFragLoaded",value:function(i){var t=this.fragCurrent;if(this.state===e.FRAG_LOADING&&t&&"audio"===i.frag.type&&i.frag.level===t.level&&i.frag.sn===t.sn){this.state=e.PARSING,this.stats=i.stats;var n=this.tracks[this.trackId],a=n.details,l=a.totalduration,u=t.start,s=t.level,o=t.sn,d=this.config.defaultAudioCodec||n.audioCodec;this.pendingAppending=0,this.demuxer||(this.demuxer=new T.default(this.hls,"audio")),r.logger.log("Demuxing "+o+" of ["+a.startSN+" ,"+a.endSN+"],track "+s),this.demuxer.push(i.payload,d,null,u,t.cc,s,o,l,t.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(a){var n=this.fragCurrent;if(n&&"audio"===a.id&&a.sn===n.sn&&a.level===n.level&&this.state===e.PARSING){var s=a.tracks,i=void 0;if(i=s.audio){i.levelCodec="mp4a.40.2",i.id=a.id,this.hls.trigger(t.default.BUFFER_CODECS,s),r.logger.log("track:audio,container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var o=i.initSegment;o&&(this.pendingAppending++,this.hls.trigger(t.default.BUFFER_APPENDING,{type:"audio",data:o,parent:"audio"})),this.tick()}}}},{key:"onFragParsingData",value:function(i){var n=this,a=this.fragCurrent;if(a&&"audio"===i.id&&i.sn===a.sn&&i.level===a.level&&this.state===e.PARSING){var s=this.tracks[this.trackId],o=this.fragCurrent;r.logger.log("parsed "+i.type+",PTS:["+i.startPTS.toFixed(3)+","+i.endPTS.toFixed(3)+"],DTS:["+i.startDTS.toFixed(3)+"/"+i.endDTS.toFixed(3)+"],nb:"+i.nb),E.default.updateFragPTSDTS(s.details,o.sn,i.startPTS,i.endPTS),[i.data1,i.data2].forEach(function(e){e&&(n.pendingAppending++,n.hls.trigger(t.default.BUFFER_APPENDING,{type:i.type,data:e,parent:"audio"}))}),this.nextLoadPosition=i.endPTS,this.tick()}}},{key:"onFragParsed",value:function(t){var r=this.fragCurrent;r&&"audio"===t.id&&t.sn===r.sn&&t.level===r.level&&this.state===e.PARSING&&(this.stats.tparsed=performance.now(),this.state=e.PARSED,this._checkAppendedParsed())}},{key:"onBufferCreated",value:function(t){var e=t.tracks.audio;e&&(this.mediaBuffer=e.buffer,this.loadedmetadata=!0)}},{key:"onBufferAppended",value:function(t){if("audio"===t.parent)switch(this.state){case e.PARSING:case e.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===e.PARSED&&0===this.pendingAppending){var a=this.fragCurrent,i=this.stats;if(a){this.fragPrevious=a,i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.length/(i.tbuffered-i.tfirst)),this.hls.trigger(t.default.FRAG_BUFFERED,{stats:i,frag:a,id:"audio"});var n=this.mediaBuffer?this.mediaBuffer:this.media;r.logger.log("audio buffered : "+_.default.toString(n.buffered)),this.state=e.IDLE}this.tick()}}},{key:"onError",value:function(i){var s=i.frag;if(!s||"audio"===s.type)switch(i.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!i.fatal){var n=this.fragLoadError;if(n?n++:n=1,n<=this.config.fragLoadingMaxRetry){this.fragLoadError=n,s.loadCounter=0;var o=Math.min(Math.pow(2,n-1)*this.config.fragLoadingRetryDelay,64e3);r.logger.warn("audioStreamController: frag loading failed, retry in "+o+" ms"),this.retryDate=performance.now()+o,this.state=e.FRAG_LOADING_WAITING_RETRY}else r.logger.error("audioStreamController: "+i.details+" reaches max retry, redispatch as fatal ..."),i.fatal=!0,this.hls.trigger(t.default.ERROR,i),this.state=e.ERROR}break;case a.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==e.ERROR&&(this.state=i.fatal?e.ERROR:e.IDLE,r.logger.warn("audioStreamController: "+i.details+" while loading frag,switch to "+this.state+" state ..."))}}},{key:"onBufferFlushed",value:function(){this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=e.IDLE,this.fragPrevious=null,this.tick()}}]),i}(o.default);s.default=c},{"../demux/demuxer":20,"../errors":24,"../event-handler":25,"../events":26,"../helper/buffer-helper":28,"../helper/level-helper":29,"../utils/binary-search":39,"../utils/logger":43,"../utils/timeRanges":45}],5:[function(r,c,i){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var f=function(){function e(i,r){for(var t=0;t=0&&rthis._msDuration&&(e.logger.log("Updating mediasource duration to "+this._levelDuration),t.duration=this._levelDuration,this._msDuration=this._levelDuration)}}}},{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 r=0,i=this.sourceBuffer;for(var a in i)r+=i[a].buffered.length;this.appended=r,this.hls.trigger(t.default.BUFFER_FLUSHED)}}},{key:"doAppending",value:function(){var a=this.hls,o=this.sourceBuffer,n=this.segments;if(Object.keys(o).length){if(this.media.error)return this.segments=[],void e.logger.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(n&&n.length){var s=n.shift();try{o[s.type]?(this.parent=s.parent,o[s.type].appendBuffer(s.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(o){e.logger.error("error while trying to append buffer:"+o.message),n.unshift(s);var i={type:r.ErrorTypes.MEDIA_ERROR};if(22===o.code)return this.segments=[],i.details=r.ErrorDetails.BUFFER_FULL_ERROR,void a.trigger(t.default.ERROR,i);if(this.appendError?this.appendError++:this.appendError=1,i.details=r.ErrorDetails.BUFFER_APPEND_ERROR,i.frag=this.fragCurrent,this.appendError>a.config.appendErrorMaxRetry)return e.logger.log("fail "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),n=[],i.fatal=!0,void a.trigger(t.default.ERROR,i);i.fatal=!1,a.trigger(t.default.ERROR,i)}}}}},{key:"flushBuffer",value:function(l,n,h){var t,r,o,s,i,a,u=this.sourceBuffer;if(Object.keys(u).length){ +if(e.logger.log("flushBuffer,pos/start/end: "+this.media.currentTime+"/"+l+"/"+n),this.flushBufferCounter.5)return this.flushBufferCounter++,e.logger.log("flush "+d+" ["+i+","+a+"], of ["+o+","+s+"], pos:"+this.media.currentTime),t.remove(i,a),!1}}else e.logger.warn("abort flushing too many retries");e.logger.log("buffer flushed")}return!0}}]),i}(s.default);a.default=o},{"../errors":24,"../event-handler":25,"../events":26,"../utils/logger":43}],7:[function(t,f,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(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;tthis.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(n){var r=0,e=void 0,t=void 0,s=this.mediaWidth,o=this.mediaHeight,i=0,a=0;for(e=0;n>=e&&(t=this.levels[e],!this.isLevelRestricted(e))&&(r=e,i=t.width,a=t.height,!(i>=s||a>=o));e++);return r}},{key:"isLevelRestricted",value:function(e){return!(!this.restrictedLevels||-1===this.restrictedLevels.indexOf(e))}},{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}(s.default);r.default=u},{"../event-handler":25,"../events":26}],8:[function(r,l,e){"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(e,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t0&&a>this.hls.config.fpsDroppedMonitoringThreshold*s){var e=this.hls.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===this.hls.autoLevelCapping||this.hls.autoLevelCapping>=e)&&(e-=1,this.hls.trigger(t.default.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:this.hls.currentLevel}),this.hls.autoLevelCapping=e,this.hls.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=r}}},{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)}}]),e}(h.default);r.default=u},{"../event-handler":25,"../events":26,"../utils/logger":43}],10:[function(i,g,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(a,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;t=0&&ie&&(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),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){return void 0===this._startLevel?this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this._manualLevel?this._manualLevel:this.hls.abrController.nextAutoLevel},set:function(e){this.level=e,-1===this._manualLevel&&(this.hls.abrController.nextAutoLevel=e)}}]),i}(h.default);a.default=o},{"../errors":24,"../event-handler":25,"../events":26,"../utils/logger":43}],11:[function(a,A,d){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function R(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(d,"__esModule",{value:!0});var E=function(){function e(i,r){for(var t=0;t0?(t.logger.log("configure startPosition @"+i),this.lastPaused||(t.logger.log("resuming video"),r.play()),this.state=e.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:a,this.state=e.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else t.logger.warn("cannot start loading as manifest not parsed yet"),this.state=e.STOPPED}},{key:"stopLoad",value:function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=e.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 e.STARTING:var i=this.hls,r=i.startLevel;-1===r&&(r=0,this.fragBitrateTest=!0),this.level=i.nextLoadLevel=r,this.state=e.WAITING_LEVEL,this.loadedmetadata=!1;break;case e.IDLE:if(!this._doTickIdle())return;break;case e.WAITING_LEVEL:var a=this.levels[this.level];a&&a.details&&(this.state=e.IDLE);break;case e.FRAG_LOADING_WAITING_RETRY:var s=performance.now(),n=this.retryDate;(!n||s>=n||this.media&&this.media.seeking)&&(t.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;case e.ERROR:case e.PAUSED:case e.STOPPED:case e.FRAG_LOADING:case e.PARSING:case e.PARSED:case e.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"_doTickIdle",value:function(){var n=this.hls,r=n.config,o=this.media;if(!o&&(this.startFragRequested||!r.startFragPrefetch))return!0;var l=void 0;l=this.loadedmetadata?o.currentTime:this.nextLoadPosition;var i=n.nextLoadLevel,a=void 0;this.levels[i].hasOwnProperty("bitrate")?(a=Math.max(8*r.maxBufferSize/this.levels[i].bitrate,r.maxBufferLength),a=Math.min(a,r.maxMaxBufferLength)):a=r.maxBufferLength;var d=s.default.bufferInfo(this.mediaBuffer?this.mediaBuffer:o,l,r.maxBufferHole),h=d.len;if(h>=a)return!0;t.logger.trace("buffer length of "+h.toFixed(3)+" is below max of "+a.toFixed(3)+". checking for more payload ..."),n.nextLoadLevel=i,this.level=i;var u=this.levels[i].details;return"undefined"==typeof u||u.live&&this.levelLastLoaded!==i?(this.state=e.WAITING_LEVEL,!0):this._fetchPayloadOrEos({pos:l,bufferInfo:d,levelDetails:u})}},{key:"_fetchPayloadOrEos",value:function(s){var h=s.pos,u=s.bufferInfo,r=s.levelDetails,o=this.fragPrevious,d=this.level,e=r.fragments,i=e.length,n=e[0].start,l=e[i-1].start+e[i-1].duration,a=u.end,t=void 0;if(r.live){if(t=this._ensureFragmentAtLivePoint({levelDetails:r,bufferEnd:a,start:n,end:l,fragPrevious:o,fragments:e,fragLen:i}),null===t)return!1}else n>a&&(t=e[0]);return t||(t=this._findFragment({start:n,fragPrevious:o,fragLen:i,fragments:e,bufferEnd:a,end:l,levelDetails:r})),t?this._loadFragmentOrKey({frag:t,level:d,levelDetails:r,pos:h,bufferEnd:a}):!0}},{key:"_ensureFragmentAtLivePoint",value:function(r){var e=r.levelDetails,n=r.bufferEnd,f=r.start,h=r.end,d=r.fragPrevious,u=r.fragments,c=r.fragLen,a=this.hls.config,i=void 0,g=void 0!==a.liveMaxLatencyDuration?a.liveMaxLatencyDuration:a.liveMaxLatencyDurationCount*e.targetduration;if(no&&(s.currentTime=o)}if(e.PTSKnown&&n>h)return null;if(this.startFragRequested&&!e.PTSKnown){if(d){var l=d.sn+1;l>=e.startSN&&l<=e.endSN&&(i=u[l-e.startSN],t.logger.log("live playlist, switching playlist, load frag with next SN: "+i.sn))}i||(i=u[Math.min(c-1,Math.round(c/2))],t.logger.log("live playlist, switching playlist, unknown, load middle frag : "+i.sn))}return i}},{key:"_findFragment",value:function(a){var p=a.start,n=a.fragPrevious,y=a.fragLen,l=a.fragments,u=a.bufferEnd,c=a.end,h=a.levelDetails,f=this.hls.config,i=void 0,s=void 0,o=f.maxFragLookUpTolerance;if(c>u?(u>c-o&&(o=0),s=v.default.search(l,function(e){return e.start+e.duration-o<=u?1:e.start-o>u&&e.start?-1:0})):s=l[y-1],s&&(i=s,p=s.start,n&&i.level===n.level&&i.sn===n.sn))if(i.snf.maxBufferHole&&n.dropped&&d?(i=l[d-1],t.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"),n.loadCounter--):(i=l[d+1],t.logger.log("SN just loaded, load next one: "+i.sn))}else h.live||(this.hls.trigger(r.default.BUFFER_EOS),this.media.seeking||(this.state=e.ENDED)),i=null;return i}},{key:"_loadFragmentOrKey",value:function(n){var a=n.frag,l=n.level,o=n.levelDetails,d=n.pos,h=n.bufferEnd,s=this.hls,f=s.config;if(null==a.decryptdata.uri||null!=a.decryptdata.key){if(t.logger.log("Loading "+a.sn+" of ["+o.startSN+" ,"+o.endSN+"],level "+l+", currentTime:"+d+",bufferEnd:"+h.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,a.loadCounter){a.loadCounter++;var u=f.fragLoadingLoopThreshold;if(a.loadCounter>u&&Math.abs(this.fragLoadIdx-a.loadIdx)=0;e--)if(t=r[e],i>=t.start&&i<=t.end)return t;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(r){var i=this.media;if(i)for(var t=i.buffered,e=0;e=t.start(e)&&r<=t.end(e))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var t,e,i=this.media;if(i&&i.seeking===!1&&(e=i.currentTime,e>i.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),this.isBuffered(e)?t=this.getBufferRange(e):this.isBuffered(e+.1)&&(t=this.getBufferRange(e+.1)),t)){var a=t.frag;a!==this.fragPlaying&&(this.fragPlaying=a,this.hls.trigger(r.default.FRAG_CHANGED,{frag:a}))}}},{key:"immediateLevelSwitch",value:function(){if(t.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var i=this.media,a=void 0;i?(a=i.paused,i.pause()):a=!0,this.previouslyPaused=a}var n=this.fragCurrent;n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})}},{key:"immediateLevelSwitchEnd",value:function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,this.isBuffered(e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var t=this.media;if(t&&t.readyState){var n=void 0,a=void 0,i=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,a=this.getBufferRange(t.currentTime),a&&a.start>1&&(this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:a.start-1})),t.paused)n=0;else{var l=this.hls.nextLoadLevel,u=this.levels[l],o=this.fragLastKbps;n=o&&this.fragCurrent?this.fragCurrent.duration*u.bitrate/(1e3*o)+1:0}if(i=this.getBufferRange(t.currentTime+n),i&&(i=this.followingBufferRange(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:i.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(r){var e=this.media=this.mediaBuffer=r.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("seeked",this.onvseeked),e.addEventListener("ended",this.onvended);var t=this.config;this.levels&&t.autoStartLoad&&this.hls.startLoad(t.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(t.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var r=this.levels;r&&r.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 a=this.media,i=a?a.currentTime:void 0;if(t.logger.log("media seeking to "+i),this.state===e.FRAG_LOADING){var o=s.default.bufferInfo(a,i,this.config.maxBufferHole),r=this.fragCurrent;if(0===o.len&&r){var n=this.config.maxFragLookUpTolerance,l=r.start-n,u=r.start+r.duration+n;l>i||i>u?(r.loader&&(t.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),r.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=e.IDLE):t.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===e.ENDED&&(this.state=e.IDLE);a&&(this.lastCurrentTime=i),this.state!==e.FRAG_LOADING&&void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){t.logger.log("media seeked to "+this.media.currentTime),this.tick()}},{key:"onMediaEnded",value:function(){t.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){t.logger.log("trigger BUFFER_RESET"),this.hls.trigger(r.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(r){var e,i=!1,a=!1;r.levels.forEach(function(t){e=t.audioCodec,e&&(-1!==e.indexOf("mp4a.40.2")&&(i=!0),-1!==e.indexOf("mp4a.40.5")&&(a=!0))}),this.audioCodecSwitch=i&&a,this.audioCodecSwitch&&t.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startLevelLoaded=!1,this.startFragRequested=!1;var n=this.config;n.autoStartLoad&&this.hls.startLoad(n.startPosition)}},{key:"onLevelLoaded",value:function(u){var i=u.details,n=u.level,d=this.levels[n],l=i.totalduration,s=0;if(t.logger.log("level "+n+" loaded ["+i.startSN+","+i.endSN+"],duration:"+l),this.levelLastLoaded=n,i.live){var h=d.details;h?(o.default.mergeDetails(h,i),s=i.fragments[0].start,i.PTSKnown?t.logger.log("live playlist sliding:"+s.toFixed(3)):t.logger.log("live playlist - outdated PTS, unknown sliding")):(i.PTSKnown=!1,t.logger.log("live playlist - first load, unknown sliding"))}else i.PTSKnown=!1;if(d.details=i,this.hls.trigger(r.default.LEVEL_UPDATED,{details:i,level:n}),this.startFragRequested===!1){if(-1===this.startPosition){var a=i.startTimeOffset;if(isNaN(a))if(i.live){var f=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*i.targetduration;this.startPosition=Math.max(0,s+l-f),t.logger.log("configure startPosition to "+this.startPosition)}else this.startPosition=0;else 0>a&&(t.logger.log("negative start time offset "+a+", count from end of last fragment"),a=s+l+a),t.logger.log("start time offset found in playlist, adjust startPosition to "+a),this.startPosition=a}this.nextLoadPosition=this.startPosition}this.state===e.WAITING_LEVEL&&(this.state=e.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===e.KEY_LOADING&&(this.state=e.IDLE,this.tick())}},{key:"onFragLoaded",value:function(a){var i=this.fragCurrent;if(this.state===e.FRAG_LOADING&&i&&"main"===a.frag.type&&a.frag.level===i.level&&a.frag.sn===i.sn)if(t.logger.log("Loaded "+i.sn+" of level "+i.level),this.fragBitrateTest===!0)this.state=e.IDLE,this.fragBitrateTest=!1,this.startFragRequested=!1,a.stats.tparsed=a.stats.tbuffered=performance.now(),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:a.stats,frag:i,id:"main"});else{this.state=e.PARSING,this.stats=a.stats;var s=this.levels[this.level],o=s.details,f=o.totalduration,c=void 0!==i.startDTS?i.startDTS:i.start,d=i.level,h=i.sn,n=this.config.defaultAudioCodec||s.audioCodec;this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),void 0===n&&(n=this.lastAudioCodec),n&&(n=-1!==n.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,t.logger.log("Demuxing "+h+" of ["+o.startSN+" ,"+o.endSN+"],level "+d+", cc "+i.cc);var l=this.demuxer;l||(l=this.demuxer=new u.default(this.hls,"main")),l.push(a.payload,n,s.videoCodec,c,i.cc,d,h,f,i.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(a){var u=this.fragCurrent;if(u&&"main"===a.id&&a.sn===u.sn&&a.level===u.level&&this.state===e.PARSING){var l,i,n=a.tracks;if(i=n.audio){var s=this.levels[this.level].audioCodec,d=navigator.userAgent.toLowerCase();s&&this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),s=-1!==s.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&-1===d.indexOf("firefox")&&(s="mp4a.40.5"),-1!==d.indexOf("android")&&(s="mp4a.40.2",t.logger.log("Android: force audio codec to"+s)),i.levelCodec=s,i.id=a.id}if(i=n.video,i&&(i.levelCodec=this.levels[this.level].videoCodec,i.id=a.id),a.unique){var o={codec:"",levelCodec:""};for(l in a.tracks)i=n[l],o.container=i.container,o.codec&&(o.codec+=",",o.levelCodec+=","),i.codec&&(o.codec+=i.codec),i.levelCodec&&(o.levelCodec+=i.levelCodec);n={audiovideo:o}}this.hls.trigger(r.default.BUFFER_CODECS,n);for(l in n){i=n[l],t.logger.log("track:"+l+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var h=i.initSegment;h&&(this.pendingAppending++,this.hls.trigger(r.default.BUFFER_APPENDING,{type:l,data:h,parent:"main"}))}this.tick()}}},{key:"onFragParsingData",value:function(i){var u=this,a=this.fragCurrent;if(a&&"main"===i.id&&i.sn===a.sn&&i.level===a.level&&("audio"!==i.type||"AUDIO"!==this.audioTrackType)&&this.state===e.PARSING){var s=this.levels[this.level],n=this.fragCurrent;t.logger.log("parsed "+i.type+",PTS:["+i.startPTS.toFixed(3)+","+i.endPTS.toFixed(3)+"],DTS:["+i.startDTS.toFixed(3)+"/"+i.endDTS.toFixed(3)+"],nb:"+i.nb+",dropped:"+(i.dropped||0));var d=o.default.updateFragPTSDTS(s.details,n.sn,i.startPTS,i.endPTS,i.startDTS,i.endDTS),l=this.hls;l.trigger(r.default.LEVEL_PTS_UPDATED,{details:s.details,level:this.level,drift:d}),"video"===i.type&&(n.dropped=i.dropped),[i.data1,i.data2].forEach(function(e){e&&(u.pendingAppending++,l.trigger(r.default.BUFFER_APPENDING,{type:i.type,data:e,parent:"main"}))}),this.nextLoadPosition=i.endPTS,this.bufferRange.push({type:i.type,start:i.startPTS,end:i.endPTS,frag:n}),this.tick()}}},{key:"onFragParsed",value:function(t){var r=this.fragCurrent;r&&"main"===t.id&&t.sn===r.sn&&t.level===r.level&&this.state===e.PARSING&&(this.stats.tparsed=performance.now(),this.state=e.PARSED,this._checkAppendedParsed())}},{key:"onAudioTrackSwitch",value:function(a){var r=a.type;if("main"===r){if(this.mediaBuffer!==this.media){t.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i.loader&&(t.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=e.IDLE}}else this.videoBuffer&&this.mediaBuffer!==this.videoBuffer&&(t.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"), +this.mediaBuffer=this.videoBuffer);this.audioTrackType=r}},{key:"onBufferCreated",value:function(o){var r=o.tracks,i=void 0,a=void 0,n=!1;for(var e in r){var s=r[e];"main"===s.id?(a=e,i=s,"video"===e&&(this.videoBuffer=r[e].buffer)):n=!0}n&&i?(t.logger.log("alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}},{key:"onBufferAppended",value:function(t){if("main"===t.parent)switch(this.state){case e.PARSING:case e.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===e.PARSED&&0===this.pendingAppending){var a=this.fragCurrent,i=this.stats;if(a){this.fragPrevious=a,i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.length/(i.tbuffered-i.tfirst)),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:i,frag:a,id:"main"});var n=this.mediaBuffer?this.mediaBuffer:this.media;t.logger.log("main buffered : "+_.default.toString(n.buffered)),this.state=e.IDLE}this.tick()}}},{key:"onError",value:function(a){var s=a.frag;if(!s||"main"===s.type)switch(a.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!a.fatal){var n=this.fragLoadError;if(n?n++:n=1,n<=this.config.fragLoadingMaxRetry||this.media&&this.isBuffered(this.media.currentTime)){this.fragLoadError=n,s.loadCounter=0;var o=Math.min(Math.pow(2,n-1)*this.config.fragLoadingRetryDelay,64e3);t.logger.warn("mediaController: frag loading failed, retry in "+o+" ms"),this.retryDate=performance.now()+o,this.state=e.FRAG_LOADING_WAITING_RETRY}else t.logger.error("mediaController: "+a.details+" reaches max retry, redispatch as fatal ..."),a.fatal=!0,this.hls.trigger(r.default.ERROR,a),this.state=e.ERROR}break;case i.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case i.ErrorDetails.LEVEL_LOAD_ERROR:case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==e.ERROR&&(this.state=a.fatal?e.ERROR:e.IDLE,t.logger.warn("mediaController: "+a.details+" while loading frag,switch to "+this.state+" state ..."));break;case i.ErrorDetails.BUFFER_FULL_ERROR:this.state!==e.PARSING&&this.state!==e.PARSED||(this.config.maxMaxBufferLength/=2,t.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and switch to IDLE state"),this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=e.IDLE)}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e&&e.readyState){var n=e.currentTime,d=e.buffered;if(!this.loadedmetadata&&d.length){this.loadedmetadata=!0;var a=this.startPosition,h=this.isBuffered(a);n===a&&h||(t.logger.log("target start position:"+a),h||(a=d.start(0),t.logger.log("target start position not buffered, seek to buffered.start(0) "+a)),t.logger.log("adjust currentTime from "+n+" to "+a),e.currentTime=a)}else if(this.immediateSwitch)this.immediateLevelSwitchEnd();else{var l=s.default.bufferInfo(e,n,0),v=!(e.paused||e.ended||0===e.buffered.length),u=.4,f=n>e.playbackRate*this.lastCurrentTime;if(this.stalled&&f&&(this.stalled=!1,t.logger.log("playback not stuck anymore @"+n)),v&&l.len<=u&&(f?(u=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,t.logger.log("playback seems stuck @"+n),this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),l.len<=u)){var o=l.nextStart,c=o-n;if(o&&c0){t.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+o+" + nudge "+this.seekHoleNudgeDuration);var g=o+this.seekHoleNudgeDuration-e.currentTime;e.currentTime=o+this.seekHoleNudgeDuration,this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:g})}}}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=e.IDLE,this.tick()}},{key:"onBufferFlushed",value:function(){var t,r,i=[];for(r=0;r0;)e.removeCue(e.cues[0])}},{key:"createTextTrack",value:function(e,t,r){return this.media?this.media.addTextTrack(e,t,r):void 0}},{key:"destroy",value:function(){n.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(t){if(this.enabled)for(var e=0;el;l++)t=e[a++],r=127&e[a++],i=127&e[a++],s=0!==(4&t),o=3&t,0===r&&0===i||s&&0===o&&(n.push(r),n.push(i));return n}}]),t}(n.default);i.default=l},{"../event-handler":25,"../events":26,"../utils/cea-608-parser":40,"../utils/cues":41}],13:[function(a,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;te;e++)c[(a[e]=e<<1^283*(e>>7))^e]=e;for(i=r=0;!f[i];i^=u||1,r=c[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^255&t^99,f[i]=t,g[t]=i,d=a[h=a[u=a[i]]],l=16843009*d^65537*h^257*u^16843008*i,s=257*a[t]^16843008*t,e=0;4>e;e++)n[e][i]=s=s<<24^s>>>8,o[e][t]=l=l<<24^l>>>8;for(e=0;5>e;e++)n[e]=n[e].slice(0),o[e]=o[e].slice(0)}},{key:"decrypt",value:function(R,p,_,b,E,m){var f,v,g,n,e=this._key[1],t=R^e[0],i=b^e[1],a=_^e[2],r=p^e[3],y=e.length/4-2,s=4,o=this._tables[1],h=o[0],d=o[1],u=o[2],l=o[3],c=o[4];for(n=0;y>n;n++)f=h[t>>>24]^d[i>>16&255]^u[a>>8&255]^l[255&r]^e[s],v=h[i>>>24]^d[a>>16&255]^u[r>>8&255]^l[255&t]^e[s+1],g=h[a>>>24]^d[r>>16&255]^u[t>>8&255]^l[255&i]^e[s+2],r=h[r>>>24]^d[t>>16&255]^u[i>>8&255]^l[255&a]^e[s+3],s+=4,t=f,i=v,a=g;for(n=0;4>n;n++)E[(3&-n)+m]=c[t>>>24]<<24^c[i>>16&255]<<16^c[a>>8&255]<<8^c[255&r]^e[s++],f=t,t=i,i=a,a=r,r=f}}]),e}();e.default=i},{}],14:[function(t,l,e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t>8|e>>>24}},{key:"doDecrypt",value:function(i,v,a){var u,f,o,h,l,c,d,n,e,r=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>2),p=new s.default(Array.prototype.slice.call(v)),g=new Uint8Array(i.byteLength),t=new Int32Array(g.buffer);for(u=~~a[0],f=~~a[1],o=~~a[2],h=~~a[3],e=0;ee&&(255!==r[e]||240!==(240&r[e+1]));e++);for(i.audiosamplerate||(n=o.default.getAudioConfig(this.observer,r,e,b),i.config=n.config,i.audiosamplerate=n.samplerate,i.channelCount=n.channelCount,i.codec=n.codec,i.duration=R,t.logger.log("parsed codec:"+i.codec+",rate:"+n.samplerate+",nb channel:"+n.channelCount)),c=0,m=9216e4/i.audiosamplerate;u>e+5&&(l=1&r[e+1]?7:9,s=(3&r[e+3])<<11|r[e+4]<<3|(224&r[e+5])>>>5,s-=l,s>0&&u>=e+l+s);)for(v=h+c*m,y={unit:r.subarray(e+l,e+l+s),pts:v,dts:v},i.samples.push(y),i.len+=s,e+=s+l,c++;u-1>e&&(255!==r[e]||240!==(240&r[e+1]));e++);this.remuxer.remux(d,g,this._aacTrack,{samples:[]},{samples:[{pts:h,dts:h,unit:f.payload}]},{samples:[]},_,p)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){var e,r,i=new a.default(t);if(i.hasTimeStamp)for(e=i.length,r=t.length;r-1>e;e++)if(255===t[e]&&240===(240&t[e+1]))return!0;return!1}}]),e}();r.default=s},{"../demux/id3":22,"../utils/logger":43,"./adts":17}],17:[function(e,o,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t>>6)+1,e=(60&u[l+2])>>>2,e>d.length-1?void f.trigger(Event.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+e}):(o=(1&u[l+2])<<2,o|=(192&u[l+3])>>>6,n.logger.log("manifest codec:"+a+",ADTS data:type:"+i+",sampleingIndex:"+e+"["+d[e]+"Hz],channelConfig:"+o),-1!==h.indexOf("firefox")?e>=6?(i=5,t=new Array(4),s=e-3):(i=2,t=new Array(2),s=e):-1!==h.indexOf("android")?(i=2,t=new Array(2),s=e):(i=5,t=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&e>=6?s=e-3:((a&&-1!==a.indexOf("mp4a.40.2")&&e>=6&&1===o||!a&&1===o)&&(i=2,t=new Array(2)),s=e)),t[0]=i<<3,t[0]|=(14&e)>>1,t[1]|=(1&e)<<7,t[1]|=o<<3,5===i&&(t[1]|=(14&s)>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),{config:t,samplerate:d[e],channelCount:o,codec:"mp4a.40."+i})}}]),e}();t.default=s},{"../errors":24,"../utils/logger":43}],18:[function(e,y,i){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var f=function(){function e(i,r){for(var t=0;t1?r-1:0),e=1;r>e;e++)a[e-1]=arguments[e];t.emit.apply(t,[i,i].concat(a))},t.off=function(a){for(var r=arguments.length,i=Array(r>1?r-1:0),e=1;r>e;e++)i[e-1]=arguments[e];t.removeListener.apply(t,[a].concat(i))},r.addEventListener("message",function(i){var e=i.data;switch(e.cmd){case"init":r.demuxer=new u.default(t,e.id,e.typeSupported,JSON.parse(e.config));break;case"demux":r.demuxer.push(new Uint8Array(e.data),e.audioCodec,e.videoCodec,e.timeOffset,e.cc,e.level,e.sn,e.duration)}});var i=function(e,t){r.postMessage({event:e,data:t})};t.on(e.default.FRAG_PARSING_INIT_SEGMENT,i),t.on(e.default.FRAG_PARSED,i),t.on(e.default.ERROR,i),t.on(e.default.FRAG_PARSING_METADATA,i),t.on(e.default.FRAG_PARSING_USERDATA,i),t.on(e.default.FRAG_PARSING_DATA,function(a,e){var t=e.data1.buffer,i=e.data2.buffer;delete e.data1,delete e.data2,r.postMessage({event:a,data:e,data1:t,data2:i},[t,i])})};i.default=o},{"../demux/demuxer-inline":18,"../events":26,events:1}],20:[function(e,p,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var u=function(){function e(i,r){for(var t=0;t0&&null!=e&&null!=e.key&&"AES-128"===e.method){null==this.decrypter&&(this.decrypter=new g.default(this.hls));var u=this;this.decrypter.decrypt(t,e.key,e.iv,function(e){u.pushDecrypted(e,r,i,a,n,s,o,l)})}else this.pushDecrypted(t,r,i,a,n,s,o,l)}},{key:"onWorkerMessage",value:function(t){var e=t.data,r=this.hls;switch(e.event){case i.default.FRAG_PARSING_DATA:e.data.data1=new Uint8Array(e.data1),e.data.data2=new Uint8Array(e.data2);default:r.trigger(e.event,e.data)}}}]),t}();r.default=o},{"../crypt/decrypter":15,"../demux/demuxer-inline":18,"../demux/demuxer-worker":19,"../errors":24,"../events":26,"../utils/logger":43,webworkify:2}],21:[function(t,s,e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function e(i,r){for(var t=0;te?(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(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&a.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0?r<>>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(a){var t,i,r=8,e=8;for(t=0;a>t;t++)0!==e&&(i=this.readEG(),e=(r+i+256)%256),r=0===e?r:e}},{key:"readSPS",value:function(){var t,v,p,l,a,n,i,o,r,s=0,d=0,h=0,f=0,c=1;if(this.readUByte(),t=this.readUByte(),v=this.readBits(5),this.skipBits(3),p=this.readUByte(),this.skipUEG(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){var g=this.readUEG();if(3===g&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==g?8:12,r=0;o>r;r++)this.readBoolean()&&(6>r?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var u=this.readUEG();if(0===u)this.readUEG();else if(1===u)for(this.skipBits(1),this.skipEG(),this.skipEG(),l=this.readUEG(),r=0;l>r;r++)this.skipEG();if(this.skipUEG(),this.skipBits(1),a=this.readUEG(),n=this.readUEG(),i=this.readBits(1),0===i&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(s=this.readUEG(),d=this.readUEG(),h=this.readUEG(),f=this.readUEG()),this.readBoolean()&&this.readBoolean()){var e=void 0,y=this.readUByte();switch(y){case 1:e=[1,1];break;case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}e&&(c=e[0]/e[1])}return{width:Math.ceil((16*(a+1)-2*s-2*d)*c),height:(2-i)*(n+1)*16-(i?2:4)*(h+f)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();e.default=n},{"../utils/logger":43}],22:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;tr);return t}},{key:"_parseID3Frames",value:function(r,t,n){for(var a,s,o,l,i;n>=t+8;)switch(a=this.readUTF(r,t,4),t+=4,s=r[t++]<<24+r[t++]<<16+r[t++]<<8+r[t++],l=r[t++]<<8+r[t++],o=t,a){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(r,t,44)){t+=44,t+=4;var u=1&r[t++];this._hasTimeStamp=!0,i=((r[t++]<<23)+(r[t++]<<15)+(r[t++]<<7)+r[t++])/45,u&&(i+=47721858.84),i=Math.round(i),e.logger.trace("ID3 timestamp found: "+i),this._timeStamp=i}}}},{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}}]),t}();t.default=n},{"../utils/logger":43}],23:[function(t,g,a){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;tt;t+=188)if(71===i[t]){if(u=!!(64&i[t+1]),T=((31&i[t+1])<<8)+i[t+2],L=(48&i[t+3])>>4,L>1){if(a=t+5+i[t+4],a===t+188)continue}else a=t+4;switch(T){case v:if(u){if(o&&(m(d(o)),E&&this._avcTrack.codec&&(-1===p||this._aacTrack.codec)))return void this.remux(f,h,i);o={data:[],size:0}}o&&(o.data.push(i.subarray(a,t+188)),o.size+=t+188-a);break;case p:if(u){if(l&&(_(d(l)),E&&this._aacTrack.codec&&(-1===v||this._avcTrack.codec)))return void this.remux(f,h,i);l={data:[],size:0}}l&&(l.data.push(i.subarray(a,t+188)),l.size+=t+188-a);break;case A:u&&(s&&k(d(s)),s={data:[],size:0}),s&&(s.data.push(i.subarray(a,t+188)),s.size+=t+188-a);break;case 0:u&&(a+=i[a]+1),S=this._pmtId=w(i,a);break;case S:u&&(a+=i[a]+1);var y=D(i,a); +v=this._avcTrack.id=y.avc,p=this._aacTrack.id=y.aac,A=this._id3Track.id=y.id3,g&&!R&&(e.logger.log("reparse from beginning"),g=!1,t=-188),R=this.pmtParsed=!0;break;case 17:case 8191:break;default:g=!0}}else this.observer.trigger(n.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,id:this.id,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});o&&m(d(o)),l&&_(d(l)),s&&k(d(s)),this.remux(f,h,null)}},{key:"remux",value:function(e,t,r){this.remuxer.remux(e,t,this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,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(r,t){var n,s,o,a,i={aac:-1,avc:-1,id3:-1};for(n=(15&r[t+1])<<8|r[t+2],s=t+3+n-4,o=(15&r[t+10])<<8|r[t+11],t+=12+o;s>t;){switch(a=(31&r[t+1])<<8|r[t+2],r[t]){case 15:-1===i.aac&&(i.aac=a);break;case 21:-1===i.id3&&(i.id3=a);break;case 27:-1===i.avc&&(i.avc=a);break;case 36:e.logger.warn("HEVC stream type found, not supported for now");break;default:e.logger.log("unkown stream type:"+r[t])}t+=((15&r[t+3])<<8|r[t+4])+5}return i}},{key:"_parsePES",value:function(o){var e,n,f,d,u,l,i,r,t,h=0,s=o.data;if(e=s[0],f=(e[0]<<16)+(e[1]<<8)+e[2],1===f){for(d=(e[4]<<8)+e[5],n=e[7],192&n&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,i>4294967295&&(i-=8589934592),64&n?(r=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r>4294967295&&(r-=8589934592)):r=i),u=e[8],t=u+9,o.size-=t,l=new Uint8Array(o.size);s.length;){e=s.shift();var a=e.byteLength;if(t){if(t>a){t-=a;continue}e=e.subarray(t),a-=t,t=0}l.set(e,h),h+=a}return{data:l,pts:i,dts:r,len:d}}return null}},{key:"_parseAVCPES",value:function(a){var t,m,o,i,h=this,r=this._avcTrack,u=r.samples,y=this._parseAVCNALu(a.data),d=[],l=!1,g=!1,f=0;if(0===y.length&&u.length>0){var v=u[u.length-1],c=v.units.units[v.units.units.length-1],p=new Uint8Array(c.data.byteLength+a.data.byteLength);p.set(c.data,0),p.set(a.data,c.data.byteLength),c.data=p,v.units.length+=a.data.byteLength,r.len+=a.data.byteLength}a.data=null;var n="",E=function(){d.length&&(!this.config.forceKeyFrameOnDiscontinuity||g===!0||r.sps&&(u.length||this.contiguous)?(m={units:{units:d,length:f},pts:a.pts,dts:a.dts,key:g},u.push(m),r.len+=f,r.nbNalu+=d.length):r.dropped++,d=[],f=0)}.bind(this);y.forEach(function(e){switch(e.type){case 1:o=!0,l&&(n+="NDR ");break;case 5:o=!0,l&&(n+="IDR "),g=!0;break;case 6:o=!0,l&&(n+="SEI "),e.data=h.discardEPB(e.data),t=new s.default(e.data),t.readUByte();for(var y=0,c=0,b=!1,u=0;!b&&t.bytesAvailable>1;){y=0;do u=t.readUByte(),y+=u;while(255===u);c=0;do u=t.readUByte(),c+=u;while(255===u);if(4===y&&0!==t.bytesAvailable){b=!0;var A=t.readUByte();if(181===A){var T=t.readUShort();if(49===T){var S=t.readUInt();if(1195456820===S){var w=t.readUByte();if(3===w){var m=t.readUByte(),D=t.readUByte(),k=31&m,v=[m,D];for(i=0;k>i;i++)v.push(t.readUByte()),v.push(t.readUByte()),v.push(t.readUByte());h._insertSampleInOrder(h._txtTrack.samples,{type:3,pts:a.pts,bytes:v})}}}}}else if(ci;i++)t.readUByte()}break;case 7:if(o=!0,l&&(n+="SPS "),!r.sps){t=new s.default(e.data);var _=t.readSPS();r.width=_.width,r.height=_.height,r.sps=[e.data],r.duration=h._duration;var L=e.data.subarray(1,4),R="avc1.";for(i=0;3>i;i++){var p=L[i].toString(16);p.length<2&&(p="0"+p),R+=p}r.codec=R}break;case 8:o=!0,l&&(n+="PPS "),r.pps||(r.pps=[e.data]);break;case 9:o=!1,l&&(n+="AUD "),E();break;default:o=!1,n+="unknown NAL "+e.type+" "}o&&(d.push(e),f+=e.data.byteLength)}),(l||n.length)&&e.logger.log(n),E()}},{key:"_insertSampleInOrder",value:function(e,t){var i=e.length;if(i>0){if(t.pts>=e[i-1].pts)e.push(t);else for(var r=i-1;r>=0;r--)if(t.ptst;)switch(s=r[t++],e){case 0:0===s&&(e=1);break;case 1:e=0===s?2:0;break;case 2:case 3:if(0===s)e=3;else if(1===s&&v>t){if(_=31&r[t],n)l={data:r.subarray(n,t-e-1),type:d},g.push(l);else{var a=this.avcNaluState;if(a&&4-a>=t){var m=this._avcTrack,c=m.samples;if(c.length){var p=c[c.length-1],R=p.units.units,u=R[R.length-1];u.state&&(u.data=u.data.subarray(0,u.data.byteLength-a),p.units.length-=a,m.len-=a)}}if(i=t-e-1,i>0){var y=this._avcTrack,f=y.samples;if(f.length){var E=f[f.length-1],b=E.units.units,o=b[b.length-1],h=new Uint8Array(o.data.byteLength+i);h.set(o.data,0),h.set(r.subarray(0,i),o.data.byteLength),o.data=h,E.units.length+=i,y.len+=i}}}n=t,d=_,e=0}else e=0}return n&&(l={data:r.subarray(n,v),type:d,state:e},g.push(l),this.avcNaluState=e),g}},{key:"discardEPB",value:function(t){for(var a,n,s=t.byteLength,r=[],e=1;s-2>e;)0===t[e]&&0===t[e+1]&&3===t[e+2]?(r.push(e+2),e+=2):e++;if(0===r.length)return t;a=s-r.length,n=new Uint8Array(a);var i=0;for(e=0;a>e;i++,e++)i===r[0]&&(i++,r.shift()),n[e]=t[i];return n}},{key:"_parseAACPES",value:function(R){var l,o,p,E,t,d,h,s,_,a=this._aacTrack,i=R.data,g=R.pts,A=0,T=this._duration,k=this.audioCodec,u=this.aacOverFlow,b=this.aacLastPTS;if(u){var m=new Uint8Array(u.byteLength+i.byteLength);m.set(u,0),m.set(i,u.byteLength),i=m}for(t=A,s=i.length;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);if(t){var y,f;if(s-1>t?(y="AAC PES did not start with ADTS header,offset:"+t,f=!1):(y="no ADTS header found in AAC PES",f=!0),this.observer.trigger(n.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,id:this.id,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:f,reason:y}),f)return}if(a.audiosamplerate||(l=c.default.getAudioConfig(this.observer,i,t,k),a.config=l.config,a.audiosamplerate=l.samplerate,a.channelCount=l.channelCount,a.codec=l.codec,a.duration=T,e.logger.log("parsed codec:"+a.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)),E=0,p=9216e4/a.audiosamplerate,u&&b){var v=b+p;Math.abs(v-g)>1&&(e.logger.log("AAC: align PTS for overlapping frames by "+Math.round((v-g)/90)),g=v)}for(;s>t+5&&(d=1&i[t+1]?7:9,o=(3&i[t+3])<<11|i[t+4]<<3|(224&i[t+5])>>>5,o-=d,o>0&&s>=t+d+o);)for(h=g+E*p,_={unit:i.subarray(t+d,t+d+o),pts:h,dts:h},a.samples.push(_),a.len+=o,t+=o+d,E++;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);u=s>t?i.subarray(t,s):null,this.aacOverFlow=u,this.aacLastPTS=h}},{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]}}]),t}();a.default=o},{"../errors":24,"../events":26,"../utils/logger":43,"./adts":17,"./exp-golomb":21}],24:[function(t,r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},e.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"}},{}],25:[function(e,h,t){"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(t,"__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?"symbol":typeof e},d=function(){function e(i,r){for(var t=0;t1?r-1:0),t=1;r>t;t++)i[t-1]=arguments[t];this.handledEvents=i,this.useGenericHandler=!0,this.registerListeners()}return d(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 i=function(t,r){var e="on"+t.replace("hls","");if("function"!=typeof this[e])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+e+")");return this[e].bind(this,r)};try{i.call(this,e,t).call()}catch(t){o.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(s.default.ERROR,{type:r.ErrorTypes.OTHER_ERROR,details:r.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();t.default=l},{"./errors":24,"./events":26,"./utils/logger":43}],26:[function(t,e,r){"use strict";e.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_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"}},{}],27:[function(a,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;td&&(t[u-1].end=r[e].end):t.push(r[e])}else t.push(r[e])}for(e=0,o=0,l=a=i;e=n&&h>i)l=n,a=h,o=a-i;else if(n>i+s){f=n;break}}return{len:o,start:l,end:a,nextStart:f}}}]),e}();e.default=i},{}],29:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;tf)return void(i.PTSKnown=!1);for(var r=c;f>=r;r++){var s=h[u+r],n=l[r];n&&s&&(d=s.cc-n.cc,isNaN(s.startPTS)||(n.start=n.startPTS=s.startPTS,n.endPTS=s.endPTS,n.duration=s.duration,a=n))}if(d)for(e.logger.log("discontinuity sliding from playlist, take drift into account"),r=0;r=0&&ua.endSN)return 0;if(o=l-a.startSN,n=a.fragments,e=n[o],!isNaN(e.startPTS)){var h=Math.abs(e.startPTS-i);isNaN(e.deltaPTS)?e.deltaPTS=h:e.deltaPTS=Math.max(h,e.deltaPTS),i=Math.min(i,e.startPTS),s=Math.max(s,e.endPTS),d=Math.min(d,e.startDTS),u=Math.max(u,e.endDTS)}var f=i-e.start;for(e.start=e.startPTS=i,e.endPTS=s,e.startDTS=d,e.endDTS=u,e.duration=s-i,r=o;r>0;r--)t.updatePTS(n,r,r-1);for(r=o;ri?r.start=t.start+t.duration:r.start=t.start-r.duration:a>i?(t.duration=n-t.start,t.duration<0&&e.logger.error("negative duration computed for frag "+t.sn+",level "+t.level+", there should be some duration drift between playlist and fragment!")):(r.duration=t.start-n,r.duration<0&&e.logger.error("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!"))}}]),t}();t.default=n},{"../utils/logger":43}],30:[function(e,B,a){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t1?t-1:0),e=1;t>e;e++)a[e-1]=arguments[e];i.emit.apply(i,[r,r].concat(a))},i.off=function(a){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];i.removeListener.apply(i,[a].concat(r))},this.on=i.on.bind(i),this.off=i.off.bind(i),this.trigger=i.trigger.bind(i),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 F.default(this)}return n(e,null,[{key:"isSupported",value:function(){return 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.2-4"}},{key:"Events",get:function(){return i.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return e.defaultConfig||(e.defaultConfig={autoStartLoad:!0,startPosition:-1,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!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,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:C.default,fLoader:void 0,pLoader:void 0,abrController:g.default,bufferController:p.default,capLevelController:m.default,fpsController:D.default,streamController:R.default,audioStreamController:G.default,timelineController:S.default,cueHandler:b.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1,stretchShortVideoTrack:!1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:5,abrEwmaSlowLive:9,abrEwmaFastVoD:4,abrEwmaSlowVoD:15,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.8,abrBandWidthUpFactor:.7}),e.defaultConfig},set:function(t){e.defaultConfig=t}}]),n(e,[{key:"destroy",value:function(){r.logger.log("destroy"),this.trigger(i.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){r.logger.log("attachMedia"),this.media=e,this.trigger(i.default.MEDIA_ATTACHING,{media:e})}},{key:"detachMedia",value:function(){r.logger.log("detachMedia"),this.trigger(i.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(e){r.logger.log("loadSource:"+e),this.url=e,this.trigger(i.default.MANIFEST_LOADING,{url:e})}},{key:"startLoad",value:function(){var e=arguments.length<=0||void 0===arguments[0]?-1:arguments[0];r.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(e),this.audioStreamController.startLoad(e)}},{key:"stopLoad",value:function(){r.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad(),this.audioStreamController.stopLoad()}},{key:"swapAudioCodec",value:function(){r.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){r.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){r.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){r.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){r.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 this.levelController.firstLevel},set:function(e){r.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){r.logger.log("set startLevel:"+e),this.levelController.startLevel=e}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(e){r.logger.log("set autoLevelCapping:"+e),this.abrController.autoLevelCapping=e}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{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}}]),e}();a.default=l},{"./controller/abr-controller":3,"./controller/audio-stream-controller":4,"./controller/audio-track-controller":5,"./controller/buffer-controller":6,"./controller/cap-level-controller":7,"./controller/fps-controller":9,"./controller/level-controller":10,"./controller/stream-controller":11,"./controller/timeline-controller":12,"./errors":24,"./events":26,"./loader/fragment-loader":32,"./loader/key-loader":33,"./loader/playlist-loader":34,"./utils/cues":41,"./utils/logger":43,"./utils/xhr-loader":47,events:1}],31:[function(e,t,r){"use strict";t.exports=e("./hls.js").default},{"./hls.js":30}],32:[function(t,g,i){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;te;e++)t[e]=r>>8*(15-e)&255;return t}},{key:"fragmentDecryptdataFromLevelkey",value:function(e,r){var t=e;return e&&e.method&&e.uri&&!e.iv&&(t=this.cloneObj(e),t.iv=this.createInitializationVector(r)),t}},{key:"avc1toavcoti",value:function(r){var e,t=r.split(".");return t.length>2?(e=t.shift()+".",e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).substr(-4)):e=r,e}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(P,f,L,S){var b,e,k,h=0,o=0,t={type:null,version:null,url:f,fragments:[],live:!0,startSN:0},i={method:null,key:null,iv:null,uri:null},m=0,v=null,r=null,l=null,g=null,c=null,u=null,s=[];for(k=/(?:(?:#(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-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g;null!==(e=k.exec(P));)switch(e.shift(),e=e.filter(function(e){return void 0!==e}),e[0]){case"PLAYLIST-TYPE":t.type=e[1].toUpperCase();break;case"MEDIA-SEQUENCE":h=t.startSN=parseInt(e[1]);break;case"TARGETDURATION":t.targetduration=parseFloat(e[1]);break;case"VERSION":t.version=parseInt(e[1]);break;case"EXTM3U":break;case"ENDLIST":t.live=!1;break;case"DIS":m++,s.push(e);break;case"BYTERANGE":var p=e[1].split("@");u=1===p.length?c:parseInt(p[1]),c=parseInt(p[0])+u;break;case"INF":l=parseFloat(e[1]),g=e[2]?e[2]:null,s.push(e);break;case"":if(!isNaN(l)){var R=h++;b=this.fragmentDecryptdataFromLevelkey(i,R);var A=e[1]?this.resolve(e[1],f):null;r={url:A,type:S,duration:l,title:g,start:o,sn:R,level:L,cc:m,decryptdata:b,programDateTime:v,tagList:s},null!==u&&(r.byteRangeStartOffset=u,r.byteRangeEndOffset=c),t.fragments.push(r),o+=l,l=null,g=null,u=null,v=null,s=[]}break;case"KEY":var T=e[1],y=new a.default(T),d=y.enumeratedString("METHOD"),_=y.URI,D=y.hexadecimalInteger("IV");d&&(i={method:null,key:null,iv:null,uri:null},_&&"AES-128"===d&&(i.method=d,i.uri=this.resolve(_,f),i.key=null,i.iv=D));break;case"START":var w=e[1],O=new a.default(w),E=O.decimalFloatingPoint("TIME-OFFSET");E&&(t.startTimeOffset=E);break;case"PROGRAM-DATE-TIME":v=new Date(Date.parse(e[1])),s.push(e);break;case"#":e.shift(),s.push(e);break;default:n.logger.warn("line parsed but not handled: "+e)}return r&&!r.url&&(t.fragments.pop(),o-=r.duration),t.totalduration=o,t.averagetargetduration=o/t.fragments.length,t.endSN=h-1,t}},{key:"loadsuccess",value:function(v,i,s){var h=v.currentTarget,n=h.responseText,r=h.responseURL,l=s.type,o=s.id,g=s.level,a=this.hls;if(this.loaders[l]=void 0,void 0!==r&&0!==r.indexOf("data:")||(r=s.url),i.tload=performance.now(),i.mtime=new Date(h.getResponseHeader("Last-Modified")),0===n.indexOf("#EXTM3U"))if(n.indexOf("#EXTINF:")>0){var c="audioTrack"!==l,f=this.parseLevelPlaylist(n,r,g||o||0,c?"main":"audio");"manifest"===l?a.trigger(t.default.MANIFEST_LOADED,{levels:[{url:r,details:f}],url:r,stats:i}):(i.tparsed=performance.now(),c?a.trigger(t.default.LEVEL_LOADED,{details:f,level:g,id:o,stats:i}):a.trigger(t.default.AUDIO_TRACK_LOADED,{details:f,id:o,stats:i}))}else{var d=this.parseMasterPlaylist(n,r),u=[];d[0].audioCodec&&u.push({id:0,type:"main",name:"main"}),this.parseMasterPlaylistMedia(u,n,r,"AUDIO"),d.length?a.trigger(t.default.MANIFEST_LOADED,{levels:d,audioTracks:u,url:r,stats:i}):a.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no level found in manifest"})}else a.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(s,r){var i,a,n=r.loader;switch(r.type){case"manifest":i=e.ErrorDetails.MANIFEST_LOAD_ERROR,a=!0;break;case"level":i=e.ErrorDetails.LEVEL_LOAD_ERROR,a=!1;break;case"audioTrack":i=e.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,a=!1}n&&(n.abort(),this.loaders[r.type]=void 0),this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:i,fatal:a,url:n.url,loader:n,response:s.currentTarget,context:r})}},{key:"loadtimeout",value:function(s,o,r){var i,a,n=r.loader;switch(r.type){case"manifest":i=e.ErrorDetails.MANIFEST_LOAD_TIMEOUT,a=!0;break;case"level":i=e.ErrorDetails.LEVEL_LOAD_TIMEOUT,a=!1;break;case"audioTrack":i=e.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT,a=!1}n&&(n.abort(),this.loaders[r.type]=void 0),this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:i,fatal:a,url:n.url,loader:n,context:r})}}]),r}(s.default);o.default=y},{"../errors":24,"../event-handler":25,"../events":26,"../utils/attr-list":38,"../utils/logger":43,"../utils/url":46}],35:[function(a,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t.set(a,4),r=0,e=8;n>r;r++)t.set(i[r],e),e+=i[r].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(r){for(var t=r.length,i=[];t--;)i[t]=e.trex(r[t]);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(n){var r,t,i=n.samples||[],a=new Uint8Array(4+i.length);for(t=0;t>>8&255),i.push(255&n),i=i.concat(Array.prototype.slice.call(a));for(r=0;r>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(a));var u=e.box(e.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),o=t.width,l=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,o>>8&255,255&o,l>>8&255,255&l,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]),u,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.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:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(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(i,t){var a=e.sdtp(i),r=i.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),e.trun(i,a.length+16+16+8+16+8+8),a)}},{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(r){var t=r.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(f,o){var i,a,n,s,t,l,d=f.samples||[],r=d.length,h=12+16*r,u=new Uint8Array(h);for(o+=8+h,u.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o],0),i=0;r>i;i++)a=d[i],n=a.duration,s=a.size,t=a.flags,l=a.cts,u.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,61440&t.degradPrio,15&t.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,u)}},{key:"initSegment",value:function(i){e.types||e.init();var t,r=e.moov(i);return t=new Uint8Array(e.FTYP.byteLength+r.byteLength),t.set(e.FTYP),t.set(r,e.FTYP.byteLength),t}}]),e}();e.default=i},{}],36:[function(r,g,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;tMath.pow(2,32)&&!function(){var e=function r(t,e){return e?r(e,t%e):t};r.timescale=r.audiosamplerate/e(r.audiosamplerate,1024)}(),e.logger.log("audio mp4 timescale :"+r.timescale),l.audio={container:"audio/mp4",codec:r.codec,initSegment:i.default.initSegment([r]),metadata:{channelCount:r.channelCount}},u&&(n=s=g[0].pts-h*f)),a.sps&&a.pps&&d.length&&(a.timescale=this.MP4_TIMESCALE,l.video={container:"video/mp4",codec:a.codec,initSegment:i.default.initSegment([a]),metadata:{width:a.width,height:a.height}},u&&(n=Math.min(n,d[0].pts-h*f),s=Math.min(s,d[0].dts-h*f))),Object.keys(l).length?(c.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,v),this.ISGenerated=!0,u&&(this._initPTS=n,this._initDTS=s)):c.trigger(t.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,id:this.id,details:o.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(s,B,O,N){var r,v,C,g,l,H,_,R,E=8,f=this.PES_TIMESCALE,n=this.PES2MP4SCALEFACTOR,a=s.samples,p=[],u=void 0;u=O?this.nextAvcDts:B*f;var y=a[0];l=Math.max(this._PTSNormalize(y.dts,u)-this._initDTS,0),g=Math.max(this._PTSNormalize(y.pts,u)-this._initDTS,0);var c=Math.round((l-u)/90);O&&c&&(c>1?e.logger.log("AVC:"+c+" ms hole between fragments detected,filling it"):-1>c&&e.logger.log("AVC:"+-c+" ms overlapping between fragments detected"),l=u,a[0].dts=l+this._initDTS,g=Math.max(g-c,u),a[0].pts=g+this._initDTS,e.logger.log("Video/PTS/DTS adjusted: "+g+"/"+l+",delta:"+c)),H=l,y=a[a.length-1],R=Math.max(this._PTSNormalize(y.dts,u)-this._initDTS,0),_=Math.max(this._PTSNormalize(y.pts,u)-this._initDTS,0),_=Math.max(_,R);var x=navigator.vendor,I=navigator.userAgent,L=x&&x.indexOf("Apple")>-1&&I&&!I.match("CriOS");L&&(r=Math.round((R-l)/(n*(a.length-1))));for(var b=0;b0?h-1:h].dts;if(S.stretchShortVideoTrack){var F=S.maxBufferHole,U=S.maxSeekHole,G=Math.floor(Math.min(F,U)*f),A=(N?g+N*f:this.nextAacPts)-o.pts;A>G?(r=A-k,0>r&&(r=k),e.logger.log("It is approximately "+A/90+" ms to the next segment; using duration "+r/90+" ms for the last video frame.")):r=k}else r=k}r/=n,T=Math.round((o.pts-o.dts)/n)}p.push({size:P,duration:r,cts:T,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:o.key?2:1,isNonSync:o.key?0:1}})}this.nextAvcDts=R+r*n;var j=s.dropped;if(s.len=0,s.nbNalu=0,s.dropped=0,p.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var w=p[0].flags;w.dependsOn=2,w.isNonSync=0}s.samples=p,C=i.default.moof(s.sequenceNumber++,l/n,s),s.samples=[];var M={id:this.id,level:this.level,sn:this.sn,data1:C,data2:v,startPTS:g/f,endPTS:(_+n*r)/f,startDTS:l/f,endDTS:this.nextAvcDts/f,type:"video",nb:p.length,dropped:j};return this.observer.trigger(t.default.FRAG_PARSING_DATA,M),M}},{key:"remuxAudio",value:function(r,B,P){var I,_,S,v,h,N,M,D,g,O,w,f,l,u=this.PES_TIMESCALE,j=r.timescale,y=u/j,H=1024*r.timescale/r.audiosamplerate,U=8,E=[],n=[];r.samples.sort(function(e,t){return e.pts-t.pts}),n=r.samples;for(var c=P?this.nextAacPts:B*u,G=this._PTSNormalize(n[0].pts-this._initPTS,c),a=H*y,T=G+a,o=1;od)e.logger.log("Dropping frame due to "+Math.abs(d/90)+" ms overlap."),n.splice(o,1),r.len-=m.unit.length;else if(d>.5*a){var k=Math.round(d/a);e.logger.log("Injecting "+k+" frame"+(k>1?"s":"")+" of missing audio due to "+Math.round(d/90)+" ms gap.");for(var x=0;k>x;x++){var F=n[o-1].pts+a,b=s.default.getSilentFrame(r.channelCount);b||(e.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),b=m.unit.slice(0)),n.splice(o,0,{unit:b,pts:F,dts:F}),r.len+=b.length,o+=1}T+=(k+1)*a,m.pts=n[o-1].pts+a,o+=1}else Math.abs(d)>.1*a&&e.logger.log("Invalid frame delta "+(L-T+a)+" at PTS "+Math.round(L/90)+" (should be "+a+")."),T+=a,m.pts=n[o-1].pts+a,o+=1}for(;n.length;){if(_=n.shift(),v=_.unit,O=_.pts-this._initDTS,w=_.dts-this._initDTS,void 0!==g)f=this._PTSNormalize(O,g),l=this._PTSNormalize(w,g),S.duration=(l-g)/y;else{f=this._PTSNormalize(O,c),l=this._PTSNormalize(w,c);var p=Math.round(1e3*(f-c)/u);if(P&&p){if(p>0)e.logger.log(p+" ms hole between AAC samples detected,filling it");else if(-12>p){e.logger.log(-p+" ms overlapping between AAC samples detected, drop frame"),r.len-=v.byteLength;continue}f=l=c}if(M=Math.max(0,f),D=Math.max(0,l),!(r.len>0))return;h=new Uint8Array(r.len+8),I=new DataView(h.buffer),I.setUint32(0,h.byteLength),h.set(i.default.types.mdat,4)}h.set(v,U),U+=v.byteLength,S={size:v.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},E.push(S),g=l}var A=0,R=E.length;if(R>=2&&(A=E[R-2].duration,S.duration=A),R){this.nextAacPts=f+y*A,r.len=0,r.samples=E,N=i.default.moof(r.sequenceNumber++,D/y,r),r.samples=[];var C={id:this.id,level:this.level,sn:this.sn,data1:N,data2:h,startPTS:M/u,endPTS:this.nextAacPts/u,startDTS:D/u,endDTS:(l+y*A)/u,type:"audio",nb:R};return this.observer.trigger(t.default.FRAG_PARSING_DATA,C),C}return null}},{key:"remuxEmptyAudio",value:function(t,f,p,l){var i=this.PES_TIMESCALE,v=t.timescale?t.timescale:t.audiosamplerate,g=i/v,u=l.startDTS*i+this._initDTS,y=l.endDTS*i+this._initDTS,h=1024,d=g*h,c=Math.ceil((y-u)/d),a=s.default.getSilentFrame(t.channelCount);if(!a)return void e.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var o=[],r=0;c>r;r++){var n=u+r*d;o.push({unit:a.slice(0),pts:n,dts:n}),t.len+=a.length}t.samples=o,this.remuxAudio(t,f,p)}},{key:"remuxID3",value:function(r,a){var e,n=r.samples.length;if(n){for(var i=0;n>i;i++)e=r.samples[i],e.pts=(e.pts-this._initPTS)/this.PES_TIMESCALE,e.dts=(e.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_METADATA,{id:this.id,level:this.level,sn:this.sn,samples:r.samples})}r.samples=[],a=a}},{key:"remuxText",value:function(e,a){e.samples.sort(function(e,t){return e.pts-t.pts});var r,n=e.samples.length;if(n){for(var i=0;n>i;i++)r=e.samples[i],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_USERDATA,{id:this.id,level:this.level,sn:this.sn,samples:e.samples})}e.samples=[],a=a}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=e>t?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),r}();n.default=c},{"../errors":24,"../events":26,"../helper/aac":27,"../remux/mp4-generator":35,"../utils/logger":43,"../utils/polyfill":44}],37:[function(r,l,e){"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(e,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(r){if(this[r]){var e=(this[r]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var i=new Uint8Array(e.length/2),t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(t){var e=/^(\d+)x(\d+)$/.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(a){for(var t,n=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(t=n.exec(a));){var e=t[2],i='"';0===e.indexOf(i)&&e.lastIndexOf(i)===e.length-1&&(e=e.slice(1,-1)),r[t[1]]=e}return r}}]),e}();e.default=i},{}],39:[function(r,e,i){"use strict";var t={search:function(a,s){for(var t=0,r=a.length-1,e=null,i=null;r>=t;){e=(t+r)/2|0,i=a[e];var n=s(i);if(n>0)t=e+1;else{if(!(0>n))return i;r=e-1}}return null}};e.exports=t},{}],40:[function(_,b,o){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(o,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t=t}},i=function(t){for(var r=[],e=0;ee;e++)this.chars.push(new y);this.pos=0,this.currPenState=new h}return n(t,[{key:"equals",value:function(i){for(var t=!0,e=0;r>e;e++)if(!this.chars[e].equals(i.chars[e])){t=!1;break}return t}},{key:"copy",value:function(t){for(var e=0;r>e;e++)this.chars[e].copy(t.chars[e])}},{key:"isEmpty",value:function(){for(var t=!0,e=0;r>e;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t}},{key:"setCursor",value:function(t){this.pos!==t&&(this.pos=t),this.pos<0?(e.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>r&&(e.log("ERROR","Too large cursor position "+this.pos),this.pos=r)}},{key:"moveCursor",value:function(t){var r=this.pos+t;if(t>1)for(var e=this.pos+1;r+1>e;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(r)}},{key:"backSpace",value:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}},{key:"insertChar",value:function(t){t>=144&&this.backSpace();var i=u(t);return this.pos>=r?void e.log("ERROR","Cannot insert "+t.toString(16)+" ("+i+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(i,this.currPenState),void this.moveCursor(1))}},{key:"clearFromPos",value:function(t){var e;for(e=t;r>e;e++)this.chars[e].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 t=[],i=!0,e=0;r>e;e++){var a=this.chars[e].uchar;" "!==a&&(i=!1),t.push(a)}return i?"":t.join("")}},{key:"setPenStyles",value:function(e){this.currPenState.setStyles(e);var t=this.chars[this.pos];t.setPenState(this.currPenState)}}]),t}(),s=function(){function r(){a(this,r),this.rows=[];for(var e=0;t>e;e++)this.rows.push(new m);this.currRow=t-1,this.nrRollUpRows=null,this.reset()}return n(r,[{key:"reset",value:function(){for(var e=0;t>e;e++)this.rows[e].clear();this.currRow=t-1}},{key:"equals",value:function(i){for(var r=!0,e=0;t>e;e++)if(!this.rows[e].equals(i.rows[e])){r=!1;break}return r}},{key:"copy",value:function(r){for(var e=0;t>e;e++)this.rows[e].copy(r.rows[e])}},{key:"isEmpty",value:function(){for(var r=!0,e=0;t>e;e++)if(!this.rows[e].isEmpty()){r=!1;break}return r}},{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(t){e.log("INFO","setCursor: "+t);var r=this.rows[this.currRow];r.setCursor(t)}},{key:"setPAC",value:function(t){e.log("INFO","pacData = "+JSON.stringify(t));var r=t.row-1;this.nrRollUpRows&&ri;i++){var a=this.rows[i].getTextString();a&&(s=i+1,r?e.push("Row "+s+": '"+a+"'"):e.push(a.trim()))}return e.length>0&&(n=r?"["+e.join(" | ")+"]":e.join("\n")),n}},{key:"getTextAndFormat",value:function(){return this.rows}}]),r}(),l=function(){function r(e,i){a(this,r),this.chNr=e,this.outputFilter=i,this.mode=null,this.verbose=0,this.displayedMemory=new s,this.nonDisplayedMemory=new s,this.lastOutputScreen=new s,this.currRollUpRow=this.displayedMemory.rows[t-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}return n(r,[{key:"reset",value:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[t-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(t){t!==this.mode&&(this.mode=t,e.log("INFO","MODE="+t),"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=t)}},{key:"insertChars",value:function(r){for(var t=0;t=46,t.italics)t.foreground="white";else{var i=Math.floor(r/2)-16,a=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=a[i]}e.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}},{key:"outputDataUpdate",value:function(){var t=e.time;null!==t&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(t,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,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))}}]),r}(),p=function(){function t(i,e,r){a(this,t),this.field=i||1,this.outputs=[e,r],this.channels=[new l(1,e),new l(2,r)],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 n(t,[{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(l,s){var t,r,a,o=!1;this.lastTime=l,e.setTime(l);for(var n=0;n ("+i([r,a])+")"),t=this.parseCmd(r,a),t||(t=this.parseMidrow(r,a)),t||(t=this.parsePAC(r,a)),t||(t=this.parseBackgroundAttributes(r,a)),!t&&(o=this.parseChars(r,a)))if(this.currChNr&&this.currChNr>=0){var u=this.channels[this.currChNr-1];u.insertChars(o)}else e.log("WARNING","No channel found yet. TEXT-MODE?");t?this.dataCounters.cmd+=2:o?this.dataCounters.char+=2:(this.dataCounters.other+=2,e.log("WARNING","Couldn't parse cleaned data "+i([r,a])+" orig: "+i([s[n],s[n+1]])))}else this.dataCounters.padding+=2}},{key:"parseCmd",value:function(a,t){var n=null,s=(20===a||28===a)&&t>=32&&47>=t,o=(23===a||31===a)&&t>=33&&35>=t;if(!s&&!o)return!1;if(a===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,e.log("DEBUG","Repeated command ("+i([a,t])+") is dropped"),!0;n=20===a||23===a?1:2;var r=this.channels[n-1];return 20===a||28===a?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),this.lastCmdA=a,this.lastCmdB=t,this.currChNr=n,!0}},{key:"parseMidrow",value:function(t,r){var a=null;if((17===t||25===t)&&r>=32&&47>=r){if(a=17===t?1:2,a!==this.currChNr)return e.log("ERROR","Mismatch channel in midrow parsing"),!1;var n=this.channels[a-1];return n.ccMIDROW(r),e.log("DEBUG","MIDROW ("+i([t,r])+")"),!0}return!1}},{key:"parsePAC",value:function(e,t){var r=null,i=null,a=(e>=17&&23>=e||e>=25&&31>=e)&&t>=64&&127>=t,n=(16===e||24===e)&&t>=64&&95>=t;if(!a&&!n)return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;r=23>=e?1:2,i=t>=64&&95>=t?1===r?g[e]:f[e]:1===r?v[e]:E[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(i,r){var e=r,t={color:null,italics:!1,indent:null,underline:!1,row:i};return e=r>95?r-96:r-64,t.underline=1===(1&e),13>=e?t.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(e/2)]:15>=e?(t.italics=!0,t.color="white"):t.indent=4*Math.floor((e-16)/2),t}},{key:"parseChars",value:function(t,r){var s=null,n=null,a=null;if(t>=25?(s=2,a=t-8):(s=1,a=t),a>=17&&19>=a){var o=r;o=17===a?r+80:18===a?r+112:r+144,e.log("INFO","Special char '"+u(o)+"' in channel "+s),n=[o]}else t>=32&&127>=t&&(n=0===r?[t]:[t,r]);if(n){var l=i(n);e.log("DEBUG","Char codes = "+l.join(",")),this.lastCmdA=null,this.lastCmdB=null}return n}},{key:"parseBackgroundAttributes",value:function(r,e){var t,i,a,n,s=(16===r||24===r)&&e>=32&&47>=e,o=(23===r||31===r)&&e>=45&&47>=e;return s||o?(t={},16===r||24===r?(i=Math.floor((e-32)/2),t.background=c[i],e%2===1&&(t.background=t.background+"_semi")):45===e?t.background="transparent":(t.foreground="black",47===e&&(t.underline=!0)),a=24>r?1:2,n=this.channels[a-1],n.setBkgData(t),this.lastCmdA=null,this.lastCmdB=null,!0):!1}},{key:"reset",value:function(){for(var e=0;e=16?r--:r++,navigator.userAgent.match(/Firefox\//)?t.line=e+1:t.line=e>7?e-2:e+1,t.align="left",t.position=100*(r/32)+(navigator.userAgent.match(/Firefox\//)?50:0),h.addCue(t)}}};e.exports=t},{}],42:[function(a,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t "+e}function n(t){var r=window.console[t];return r?function(){for(var n=arguments.length,e=Array(n),i=0;n>i;i++)e[i]=arguments[i];e[0]&&(e[0]=a(t,e[0])),r.apply(window.console,e)}:e}function s(r){for(var i=arguments.length,a=Array(i>1?i-1:0),e=1;i>e;e++)a[e-1]=arguments[e];a.forEach(function(e){t[e]=r[e]?r[e].bind(r):n(e)})}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?"symbol":typeof e},i={trace:e,debug:e,log:e,warn:e,info:e,error:e},t=i;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{t.log()}catch(e){t=i}}else t=i},r.logger=t},{}],44:[function(e,t,r){"use strict";"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=function(r,t){var i=new Uint8Array(this);void 0===t&&(t=i.length);for(var a=new ArrayBuffer(t-r),n=new Uint8Array(a),e=0;ee;e++)r+="["+t.start(e)+","+t.end(e)+"]";return r}}]),e}();e.default=i},{}],46:[function(r,t,i){"use strict";var e={buildAbsoluteURL:function(r,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var l=null,o=null,n=/^([^#]*)(.*)$/.exec(t);n&&(o=n[2],t=n[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(l=s[2],t=s[1]);var h=/^([^#]*)(.*)$/.exec(r);h&&(r=h[1]);var u=/^([^\?]*)(.*)$/.exec(r);u&&(r=u[1]);var i=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(r);if(!i)throw new Error("Error trying to parse base URL.");var f=i[2]||"",d=i[1]||"",c=i[4],a=null;return a=/^\/\//.test(t)?f+"//"+e.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?d+"/"+e.buildAbsolutePath("",t.substring(1)):e.buildAbsolutePath(d+c,t),l&&(a+=l),o&&(a+=o),a},buildAbsolutePath:function(n,s){for(var i,e,o=s,a="",t=n.replace(/[^\/]*$/,o.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),r=0;e=t.indexOf("/../",r),e>-1;r=e+i)i=/^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length,a=(a+t.substring(r,e)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");return a+t.substr(r)}};t.exports=e},{}],47:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t=200&&300>r?(t.tload=Math.max(t.tfirst,performance.now()),this.onSuccess(i,t,a)):t.retryi;i++)g[i]=d[i].style.cssText,d[i].style.setProperty?d[i].style.setProperty("display","block","important"):d[i].style.cssText+=";display: block !important",d[i].style.height="0",d[i].style.overflow="hidden",d[i].style.visibility="hidden",c(d[i]);h=a[b];for(var j=0;e>j;j++)d[j].style.cssText=g[j],c(d[j])}return h}function h(a,b){var c=parseFloat(a);return Number.isNaN(c)?b:c}function i(a){return a.charAt(0).toUpperCase()+a.substr(1)}function j(b,e){if(this.$window=a(window),this.$document=a(document),this.$element=a(b),this.options=a.extend({},n,e),this.polyfill=this.options.polyfill,this.orientation=this.$element[0].getAttribute("data-orientation")||this.options.orientation,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.DIMENSION=o.orientation[this.orientation].dimension,this.DIRECTION=o.orientation[this.orientation].direction,this.DIRECTION_STYLE=o.orientation[this.orientation].directionStyle,this.COORDINATE=o.orientation[this.orientation].coordinate,this.polyfill&&m)return!1;this.identifier="js-"+k+"-"+l++,this.startEvent=this.options.startEvent.join("."+this.identifier+" ")+"."+this.identifier,this.moveEvent=this.options.moveEvent.join("."+this.identifier+" ")+"."+this.identifier,this.endEvent=this.options.endEvent.join("."+this.identifier+" ")+"."+this.identifier,this.toFixed=(this.step+"").replace(".","").length-1,this.$fill=a('
'),this.$handle=a('
'),this.$range=a('
').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var f=this;this.$window.on("resize."+this.identifier,d(function(){c(function(){f.update(!1,!1)},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+this.identifier,function(a,b){if(!b||b.origin!==f.identifier){var c=a.target.value,d=f.getPositionFromValue(c);f.setPosition(d)}})}Number.isNaN=Number.isNaN||function(a){return"number"==typeof a&&a!==a};var k="rangeslider",l=0,m=b(),n={polyfill:!0,orientation:"horizontal",rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",horizontalClass:"rangeslider--horizontal",verticalClass:"rangeslider--vertical",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]},o={orientation:{horizontal:{dimension:"width",direction:"left",directionStyle:"left",coordinate:"x"},vertical:{dimension:"height",direction:"top",directionStyle:"bottom",coordinate:"y"}}};return j.prototype.init=function(){this.update(!0,!1),this.onInit&&"function"==typeof this.onInit&&this.onInit()},j.prototype.update=function(a,b){a=a||!1,a&&(this.min=h(this.$element[0].getAttribute("min"),0),this.max=h(this.$element[0].getAttribute("max"),100),this.value=h(this.$element[0].value,Math.round(this.min+(this.max-this.min)/2)),this.step=h(this.$element[0].getAttribute("step"),1)),this.handleDimension=g(this.$handle[0],"offset"+i(this.DIMENSION)),this.rangeDimension=g(this.$range[0],"offset"+i(this.DIMENSION)),this.maxHandlePos=this.rangeDimension-this.handleDimension,this.grabPos=this.handleDimension/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position,b)},j.prototype.handleDown=function(a){if(this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+a.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var b=this.getRelativePosition(a),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=this.getPositionFromNode(this.$handle[0])-c,e="vertical"===this.orientation?this.maxHandlePos-(b-this.grabPos):b-this.grabPos;this.setPosition(e),b>=d&&ba?b:a>c?c:a},j.prototype.setPosition=function(a,b){var c,d;void 0===b&&(b=!0),c=this.getValueFromPosition(this.cap(a,0,this.maxHandlePos)),d=this.getPositionFromValue(c),this.$fill[0].style[this.DIMENSION]=d+this.grabPos+"px",this.$handle[0].style[this.DIRECTION_STYLE]=d+"px",this.setValue(c),this.position=d,this.value=c,b&&this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(d,c)},j.prototype.getPositionFromNode=function(a){for(var b=0;null!==a;)b+=a.offsetLeft,a=a.offsetParent;return b},j.prototype.getRelativePosition=function(a){var b=i(this.COORDINATE),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=0;return"undefined"!=typeof a["page"+b]?d=a["client"+b]:"undefined"!=typeof a.originalEvent["client"+b]?d=a.originalEvent["client"+b]:a.originalEvent.touches&&a.originalEvent.touches[0]&&"undefined"!=typeof a.originalEvent.touches[0]["client"+b]?d=a.originalEvent.touches[0]["client"+b]:a.currentPoint&&"undefined"!=typeof a.currentPoint[this.COORDINATE]&&(d=a.currentPoint[this.COORDINATE]),d-c},j.prototype.getPositionFromValue=function(a){var b,c;return b=(a-this.min)/(this.max-this.min),c=Number.isNaN(b)?0:b*this.maxHandlePos},j.prototype.getValueFromPosition=function(a){var b,c;return b=a/(this.maxHandlePos||1),c=this.step*Math.round(b*(this.max-this.min)/this.step)+this.min,Number(c.toFixed(this.toFixed))},j.prototype.setValue=function(a){(a!==this.value||""===this.$element[0].value)&&this.$element.val(a).trigger("input",{origin:this.identifier})},j.prototype.destroy=function(){this.$document.off("."+this.identifier),this.$window.off("."+this.identifier),this.$element.off("."+this.identifier).removeAttr("style").removeData("plugin_"+k),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0])},a.fn[k]=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),e=d.data("plugin_"+k);e||d.data("plugin_"+k,e=new j(this,b)),"string"==typeof b&&e[b].apply(e,c)})},"rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);"}); \ No newline at end of file +/*! rangeslider.js - v2.2.1 | (c) 2016 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */ +!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";function b(){var a=document.createElement("input");return a.setAttribute("type","range"),"text"!==a.type}function c(a,b){var c=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)}function d(a,b){return b=b||100,function(){if(!a.debouncing){var c=Array.prototype.slice.apply(arguments);a.lastReturnVal=a.apply(window,c),a.debouncing=!0}return clearTimeout(a.debounceTimeout),a.debounceTimeout=setTimeout(function(){a.debouncing=!1},b),a.lastReturnVal}}function e(a){return a&&(0===a.offsetWidth||0===a.offsetHeight||a.open===!1)}function f(a){for(var b=[],c=a.parentNode;e(c);)b.push(c),c=c.parentNode;return b}function g(a,b){function c(a){"undefined"!=typeof a.open&&(a.open=!a.open)}var d=f(a),e=d.length,g=[],h=a[b];if(e){for(var i=0;e>i;i++)g[i]=d[i].style.cssText,d[i].style.setProperty?d[i].style.setProperty("display","block","important"):d[i].style.cssText+=";display: block !important",d[i].style.height="0",d[i].style.overflow="hidden",d[i].style.visibility="hidden",c(d[i]);h=a[b];for(var j=0;e>j;j++)d[j].style.cssText=g[j],c(d[j])}return h}function h(a,b){var c=parseFloat(a);return Number.isNaN(c)?b:c}function i(a){return a.charAt(0).toUpperCase()+a.substr(1)}function j(b,e){if(this.$window=a(window),this.$document=a(document),this.$element=a(b),this.options=a.extend({},n,e),this.polyfill=this.options.polyfill,this.orientation=this.$element[0].getAttribute("data-orientation")||this.options.orientation,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.DIMENSION=o.orientation[this.orientation].dimension,this.DIRECTION=o.orientation[this.orientation].direction,this.DIRECTION_STYLE=o.orientation[this.orientation].directionStyle,this.COORDINATE=o.orientation[this.orientation].coordinate,this.polyfill&&m)return!1;this.identifier="js-"+k+"-"+l++,this.startEvent=this.options.startEvent.join("."+this.identifier+" ")+"."+this.identifier,this.moveEvent=this.options.moveEvent.join("."+this.identifier+" ")+"."+this.identifier,this.endEvent=this.options.endEvent.join("."+this.identifier+" ")+"."+this.identifier,this.toFixed=(this.step+"").replace(".","").length-1,this.$fill=a('
'),this.$handle=a('
'),this.$range=a('
').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var f=this;this.$window.on("resize."+this.identifier,d(function(){c(function(){f.update(!1,!1)},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+this.identifier,function(a,b){if(!b||b.origin!==f.identifier){var c=a.target.value,d=f.getPositionFromValue(c);f.setPosition(d)}})}Number.isNaN=Number.isNaN||function(a){return"number"==typeof a&&a!==a};var k="rangeslider",l=0,m=b(),n={polyfill:!0,orientation:"horizontal",rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",horizontalClass:"rangeslider--horizontal",verticalClass:"rangeslider--vertical",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]},o={orientation:{horizontal:{dimension:"width",direction:"left",directionStyle:"left",coordinate:"x"},vertical:{dimension:"height",direction:"top",directionStyle:"bottom",coordinate:"y"}}};return j.prototype.init=function(){this.update(!0,!1),this.onInit&&"function"==typeof this.onInit&&this.onInit()},j.prototype.update=function(a,b){a=a||!1,a&&(this.min=h(this.$element[0].getAttribute("min"),0),this.max=h(this.$element[0].getAttribute("max"),100),this.value=h(this.$element[0].value,Math.round(this.min+(this.max-this.min)/2)),this.step=h(this.$element[0].getAttribute("step"),1)),this.handleDimension=g(this.$handle[0],"offset"+i(this.DIMENSION)),this.rangeDimension=g(this.$range[0],"offset"+i(this.DIMENSION)),this.maxHandlePos=this.rangeDimension-this.handleDimension,this.grabPos=this.handleDimension/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position,b)},j.prototype.handleDown=function(a){if(this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+a.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var b=this.getRelativePosition(a),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=this.getPositionFromNode(this.$handle[0])-c,e="vertical"===this.orientation?this.maxHandlePos-(b-this.grabPos):b-this.grabPos;this.setPosition(e),b>=d&&ba?b:a>c?c:a},j.prototype.setPosition=function(a,b){var c,d;void 0===b&&(b=!0),c=this.getValueFromPosition(this.cap(a,0,this.maxHandlePos)),d=this.getPositionFromValue(c),this.$fill[0].style[this.DIMENSION]=d+this.grabPos+"px",this.$handle[0].style[this.DIRECTION_STYLE]=d+"px",this.setValue(c),this.position=d,this.value=c,b&&this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(d,c)},j.prototype.getPositionFromNode=function(a){for(var b=0;null!==a;)b+=a.offsetLeft,a=a.offsetParent;return b},j.prototype.getRelativePosition=function(a){var b=i(this.COORDINATE),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=0;return"undefined"!=typeof a["page"+b]?d=a["page"+b]:"undefined"!=typeof a.originalEvent["client"+b]?d=a.originalEvent["client"+b]:a.originalEvent.touches&&a.originalEvent.touches[0]&&"undefined"!=typeof a.originalEvent.touches[0]["page"+b]?d=a.originalEvent.touches[0]["page"+b]:a.currentPoint&&"undefined"!=typeof a.currentPoint[this.COORDINATE]&&(d=a.currentPoint[this.COORDINATE]),d-c},j.prototype.getPositionFromValue=function(a){var b,c;return b=(a-this.min)/(this.max-this.min),c=Number.isNaN(b)?0:b*this.maxHandlePos},j.prototype.getValueFromPosition=function(a){var b,c;return b=a/(this.maxHandlePos||1),c=this.step*Math.round(b*(this.max-this.min)/this.step)+this.min,Number(c.toFixed(this.toFixed))},j.prototype.setValue=function(a){a===this.value&&""!==this.$element[0].value||this.$element.val(a).trigger("input",{origin:this.identifier})},j.prototype.destroy=function(){this.$document.off("."+this.identifier),this.$window.off("."+this.identifier),this.$element.off("."+this.identifier).removeAttr("style").removeData("plugin_"+k),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0])},a.fn[k]=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),e=d.data("plugin_"+k);e||d.data("plugin_"+k,e=new j(this,b)),"string"==typeof b&&e[b].apply(e,c)})},"rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);"}); \ No newline at end of file diff --git a/src/scss/julia-icons.css b/src/scss/julia-icons.css new file mode 100644 index 0000000..c542e10 --- /dev/null +++ b/src/scss/julia-icons.css @@ -0,0 +1,40 @@ +@font-face { + font-family: "Julia"; + src: url("../fonts/Julia.eot"); + src: url("../fonts/Julia.eot?#iefix") format("embedded-opentype"), + url("../fonts/Julia.woff") format("woff"), + url("../fonts/Julia.ttf") format("truetype"), + url("../fonts/Julia.svg#Julia") format("svg"); + font-weight: normal; + font-style: normal; +} + +@media screen and (-webkit-min-device-pixel-ratio:0) { + @font-face { + font-family: "Julia"; + src: url("../fonts/Julia.svg#Julia") format("svg"); + } +} + +.julia-icon { + font-family: "Julia"; + font-style: normal; + display: inline; +} + +.julia-refresh:before { content: "\f100"; } +.julia-close:before { content: "\f101"; } +.julia-download:before { content: "\f102"; } +.julia-fullscreen-exit:before { content: "\f103"; } +.julia-subtitles:before { content: "\f104"; } +.julia-menu:before { content: "\f105"; } +.julia-fullscreen:before { content: "\f106"; } +.julia-dot-menu:before { content: "\f107"; } +.julia-play-circle:before { content: "\f108"; } +.julia-play-circle-inverse:before { content: "\f109"; } +.julia-play:before { content: "\f10a"; } +.julia-pause:before { content: "\f10b"; } +.julia-sound-off:before { content: "\f10c"; } +.julia-sound-on:before { content: "\f10d"; } +.julia-sound-min:before { content: "\f10e"; } +.julia-list:before { content: "\f10f"; } diff --git a/src/scss/julia-icons.html b/src/scss/julia-icons.html new file mode 100644 index 0000000..735b7cd --- /dev/null +++ b/src/scss/julia-icons.html @@ -0,0 +1,129 @@ + + + + Julia WebFont + + + + + + +

Julia webfont demo

+ +
+
+ +
.julia-play
+
+ +
+ +
.julia-pause
+
+ +
+ +
.julia-play-circle
+
+ +
+ +
.julia-play-circle-inverse
+
+ +
+ +
.julia-sound-on
+
+ +
+ +
.julia-sound-off
+
+ +
+ +
.julia-sound-min
+
+ +
+ +
.julia-subtitles
+
+ +
+ +
.julia-fullscreen
+
+ +
+ +
.julia-fullscreen-exit
+
+ +
+ +
.julia-refresh
+
+ +
+ +
.julia-close
+
+ +
+ +
.julia-download
+
+ +
+ +
.julia-menu
+
+ +
+ +
.julia-dot-menu
+
+ +
+ +
.julia-list
+
+
+ + diff --git a/src/scss/julia-icons.scss b/src/scss/julia-icons.scss new file mode 100644 index 0000000..6081eb0 --- /dev/null +++ b/src/scss/julia-icons.scss @@ -0,0 +1,40 @@ +@font-face { + font-family: "Julia"; + src: url("../fonts/Julia.eot"); + src: url("../fonts/Julia.eot?#iefix") format("embedded-opentype"), + url("../fonts/Julia.woff") format("woff"), + url("../fonts/Julia.ttf") format("truetype"), + url("../fonts/Julia.svg#Julia") format("svg"); + font-weight: normal; + font-style: normal; +} + +@media screen and (-webkit-min-device-pixel-ratio:0) { + @font-face { + font-family: "Julia"; + src: url("../fonts/Julia.svg#Julia") format("svg"); + } +} + +.julia-icon { + font-family: "Julia"; + font-style: normal; + display: inline; +} + +.julia-refresh:before { content: "\f100"; } +.julia-close:before { content: "\f101"; } +.julia-download:before { content: "\f102"; } +.julia-fullscreen-exit:before { content: "\f103"; } +.julia-subtitles:before { content: "\f104"; } +.julia-menu:before { content: "\f105"; } +.julia-fullscreen:before { content: "\f106"; } +.julia-dot-menu:before { content: "\f107"; } +.julia-play-circle:before { content: "\f108"; } +.julia-play-circle-inverse:before { content: "\f109"; } +.julia-play:before { content: "\f10a"; } +.julia-pause:before { content: "\f10b"; } +.julia-sound-off:before { content: "\f10c"; } +.julia-sound-on:before { content: "\f10d"; } +.julia-sound-min:before { content: "\f10e"; } +.julia-list:before { content: "\f10f"; } diff --git a/src/scss/julia-player.scss b/src/scss/julia-player.scss new file mode 100644 index 0000000..d3bbe34 --- /dev/null +++ b/src/scss/julia-player.scss @@ -0,0 +1,567 @@ +@import "julia-icons.scss"; + + + + + + +/* ***************************** +* FIX! +* Hide default controls +* in fullscreen mode +***************************** */ +video::-webkit-media-controls { + display:none !important; +} + + + + + + +/* ***************************** +* FIX! +* 4/5px gap bellow resizable +* inline media elements +***************************** */ +video, audio, canvas { + vertical-align: top; +} + + + + + + +/* ***************************** +* === PRELOADER EFFECT === +* change to CSS loader +***************************** */ +@keyframes julia-preload-spin { + 100%{ transform: rotate(360deg); transform: rotate(360deg); } +} + +@-o-keyframes julia-preload-spin { + 100%{ -o-transform: rotate(360deg); transform: rotate(360deg); } +} + +@-ms-keyframes julia-preload-spin { + 100%{ -ms-transform: rotate(360deg); transform: rotate(360deg); } +} + +@-webkit-keyframes julia-preload-spin { + 100%{ -webkit-transform: rotate(360deg); transform: rotate(360deg); } +} + +@-moz-keyframes julia-preload-spin { + 100%{ -moz-transform: rotate(360deg); transform: rotate(360deg); } +} + + + + + +/* ***************************** +* Julia player style +* === CONTAINER === +***************************** */ +div.julia-player { + padding: 0; + margin: 0; + position: relative; + display: inline-block; + background: rgba(0,0,0,1); + box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.9); + + + /* ***************************** + * Julia player style + * Keep UI unselectable + ***************************** */ + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + div, video, canvas { + padding: 0; + margin: 0; + } + + + + + /* ***************************** + * === VIDEO ELEMENT === + ****************************** */ + video { + min-width: 100%; + height: auto; + min-height: 100%; + } + + + + + /* ***************************** + * === FULLSCREEN MODE === + ****************************** */ + &.julia-fullscreen-on { + position: relative; + min-width: 100%; + min-height: 100%; + width: 100vw; + height: 100vh; + background: #000; + display: block; + + video { + width: auto; + height: 100%; + } + } + + + + + /* ***************************** + * === SHIELD === + ***************************** */ + >div.julia-shield { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0,0,0,0); + z-index: 73; + + >img { + z-index: 75; + } + + + + + /* ***************************** + * === PRELOADER === + ***************************** */ + >div.julia-preloader { + display: none; + width: 100%; + height: 100%; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + padding: 0; + margin: 0; + background-color: rgba(0,0,0,.7); + z-index: 79; + + &.on { + display: block; + } + + >div.julia-preloader-run { + width: 64px; + height: 64px; + line-height: 64px; + border: 2px solid #777; + padding: 0; + margin: 0; + display: block; + font-size: 1px; + position: absolute; + bottom: 50%; + left: 50%; + border-radius: 50%; + border-left-color: transparent; + border-right-color: transparent; + animation: julia-preload-spin 800ms infinite linear; + -o-animation: julia-preload-spin 800ms infinite linear; + -ms-animation: julia-preload-spin 800ms infinite linear; + -webkit-animation: julia-preload-spin 800ms infinite linear; + -moz-animation: julia-preload-spin 800ms infinite linear; + margin-left: -32px; + margin-bottom: -32px; + z-index: 80; + } + } + } + + + + + + + /* ***************************** + * === SUGGEST === + ***************************** */ + >div.julia-suggest { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0,0,0,1); + z-index: 77; + display: none; + + &.on { + display: block; + } + + + + + /* ***************************** + * Julia player style + * === SUGGEST ITEMS === + ***************************** */ + >div.julia-suggest-item { + width: 42.5%; + height: 50%; + min-height: 80px; + font-size: 1.2em; + border: 1px solid #444; + color: #ABABAB; + background: rgba(0,0,0,1); + float: left; + margin: 5% 0 0 5%; + padding: 2%; + cursor: pointer; + position: relative; + overflow: hidden; + + >img { + position: absolute; + top: 0; + left: 0; + } + + &:hover { + border: 1px solid #FFCC00; + } + + >div.julia-suggest-item-title { + position: absolute; + top: 0; + left: 0; + right: 0; + background: rgba(0,0,0,.8); + padding: 10px; + text-align: left; + } + } + } + + + + + + + /* ***************************** + * === BASE TOOLBAR === + ***************************** */ + >div.julia-toolbar { + background: rgba(0,0,0,.7); + height: 44px; + position: absolute; + bottom: 0; + left: 0; + right: 0; + z-index: 70; + opacity: .0; + + + + + /* ***************************** + * === PANELS === + ***************************** */ + div.julia-panel { + display: inline-block; + border: 0; + outline: 0; + height: 20px; + font-size: 12px; + color: #DDD; + position: absolute; + bottom: 6px; + font-family: sans-serif; + + &.julia-currentTime { + width: 60px; + left: 40px; + text-align: right; + } + + &.julia-live-indicator { + left: 50px; + text-align: left; + display: none; + font-weight: bold; + text-transform: uppercase; + } + + &.julia-duration { + left: 105px; + } + + } + + + + + /* ***************************** + * === BARS === + ***************************** */ + div.julia-progress { + height: 12px; + position: absolute; + left: 0; + right: 0; + top: 0; + } + + div.julia-volume { + width: 80px; + border: 0; + outline: 0; + height: 16px; + position: absolute; + right: 50px; + bottom: 5px; + } + + + + + &.live { + height: 38px; + + div.julia-progress { + display: none; + } + + div.julia-currentTime, + div.julia-duration { + display: none; + } + + div.julia-live-indicator { + display: inline-block; + } + } + + + + + /* ***************************** + * === TOOLBAR VISIBLE MODE === + ***************************** */ + &.julia-toolbar-visible { + opacity: 1; + z-index: 80; + } + + + + + /* ***************************** + * Rangeslider polyfill styles + * Progress bars + ******************************* */ + div.julia-progress, + div.julia-volume { + + .julia-rangeslider { + display: block; + background: #777; + position: relative; + + .julia-rangeslider__fill { + display: block; + background: #FFCC00; + position: absolute; + } + + .julia-rangeslider__handle { + background-color: #F9F9F9; + cursor: pointer; + display: inline-block; + width: 8px; + height: 8px; + position: absolute; + -moz-border-radius:0; + -webkit-border-radius: 0; + border-radius: 0; + + &:after { + content: ""; + display: block; + width: 8px; + height: 8px; + margin: auto; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; + } + + &:active { + background-color: #FFCC00; + } + } + } + + >.julia-rangeslider--horizontal { + height: 6px; + width: 100%; + cursor: pointer; + + >.julia-rangeslider__fill { + top: 0; + height: 100%; + } + + >.julia-rangeslider__handle { + top: -1px; + touch-action: pan-y; + -ms-touch-action: pan-y; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; + } + + &:hover { + .julia-rangeslider__handle { + + &:after { + width: 16px; + height: 16px; + background-color: inherit; + } + } + } + } + + .julia-rangeslider--disabled { + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); + opacity: 0.4; + } + + } + } + + + + + + + /* ***************************** + * === BUTTONS === + ***************************** */ + button.julia-btn { + color: #F9F9F9; + background: transparent; + border: 0; + outline: 0; + font-size: 20px; + width: 30px; + height: 25px; + line-height: 25px; + position: absolute; + bottom: 7px; + padding: 0; + margin: 0; + + &:hover { + color: #FFCC00; + } + + &.julia-playback { + left: 5px; + } + + &.julia-sound { + right: 140px; + } + + &.julia-fullscreen-toggle { + right: 5px; + } + + &.julia-big-play { + width: 72px; + height: 72px; + line-height: 72px; + text-align: center; + bottom: 50%; + left: 50%; + font-size: 72px; + margin-left: -36px; + margin-bottom: -36px; + z-index: 74; + } + } +} + + + + + + +@media (max-width: 480px) { + div.julia-player { + div.julia-suggest { + div.julia-suggest-item { + font-size: 12px; + } + } + } +} + + + + + + +/* ***************************** +* === TRANSITIONS === +****************************** */ +div.julia-player, +div.julia-player>div.julia-toolbar, +div.julia-player>div.julia-shield>button.julia-btn.julia-big-play, +div.julia-player>div.julia-suggest>div.julia-suggest-item, +.julia-rangeslider__handle:after +{ + -webkit-transition: all 250ms; + -moz-transition: all 250ms; + -o-transition: all 250ms; + transition: all 250ms; +} + + + + + + +/* ***************************** +* === BACKDROP === +****************************** */ +::backdrop { + background-color: #000; +} + +::-ms-backdrop { + background-color: #000; +} diff --git a/src/css/themes/aqua/julia.css b/src/scss/themes/aqua/julia.css similarity index 94% rename from src/css/themes/aqua/julia.css rename to src/scss/themes/aqua/julia.css index 64fd155..958c0d8 100644 --- a/src/css/themes/aqua/julia.css +++ b/src/scss/themes/aqua/julia.css @@ -179,7 +179,7 @@ div.julia-player.julia-theme-aqua button.julia-btn { background: transparent; border: 0; outline: 0; - font-size: 25px; + font-size: 23px; width: 30px; height: 25px; position: absolute; @@ -310,12 +310,12 @@ div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item { padding: 2%; cursor: pointer; position: relative; - overflow: hidden; + overflow: hidden; } div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; } @@ -324,8 +324,8 @@ div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item:hover } div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; right: 0; background: rgba(0,0,0,.8); @@ -336,7 +336,7 @@ div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item>div.j @media (max-width: 480px) { div.julia-player.julia-theme-aqua>div.julia-suggest>div.julia-suggest-item { font-size: 12px; - } + } } /* ***************************** @@ -369,6 +369,11 @@ div.julia-player.julia-theme-aqua>video { min-height: 100%; } +div.julia-player.julia-theme-default.julia-fullscreen-on>video { + width: auto; + height: 100%; +} + /* ***************************** * === TRANSITIONS === ****************************** */ diff --git a/src/css/themes/aquamarine/julia.css b/src/scss/themes/aquamarine/julia.css similarity index 94% rename from src/css/themes/aquamarine/julia.css rename to src/scss/themes/aquamarine/julia.css index 1cc98de..25cf5ef 100644 --- a/src/css/themes/aquamarine/julia.css +++ b/src/scss/themes/aquamarine/julia.css @@ -179,7 +179,7 @@ div.julia-player.julia-theme-aquamarine button.julia-btn { background: transparent; border: 0; outline: 0; - font-size: 25px; + font-size: 23px; width: 30px; height: 25px; position: absolute; @@ -310,12 +310,12 @@ div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item padding: 2%; cursor: pointer; position: relative; - overflow: hidden; + overflow: hidden; } div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; } @@ -324,8 +324,8 @@ div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item } div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; right: 0; background: rgba(0,0,0,.8); @@ -336,7 +336,7 @@ div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item @media (max-width: 480px) { div.julia-player.julia-theme-aquamarine>div.julia-suggest>div.julia-suggest-item { font-size: 12px; - } + } } @@ -370,6 +370,11 @@ div.julia-player.julia-theme-aquamarine>video { min-height: 100%; } +div.julia-player.julia-theme-default.julia-fullscreen-on>video { + width: auto; + height: 100%; +} + /* ***************************** * === TRANSITIONS === ****************************** */ diff --git a/src/css/themes/crimson/julia.css b/src/scss/themes/crimson/julia.css similarity index 94% rename from src/css/themes/crimson/julia.css rename to src/scss/themes/crimson/julia.css index 30f140c..6bdb60e 100644 --- a/src/css/themes/crimson/julia.css +++ b/src/scss/themes/crimson/julia.css @@ -179,7 +179,7 @@ div.julia-player.julia-theme-crimson button.julia-btn { background: transparent; border: 0; outline: 0; - font-size: 25px; + font-size: 23px; width: 30px; height: 25px; position: absolute; @@ -314,8 +314,8 @@ div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item { } div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; } @@ -324,8 +324,8 @@ div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item:ho } div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; right: 0; background: rgba(0,0,0,.8); @@ -336,8 +336,8 @@ div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item>di @media (max-width: 480px) { div.julia-player.julia-theme-crimson>div.julia-suggest>div.julia-suggest-item { font-size: 12px; - } -} + } +} /* ***************************** @@ -370,6 +370,11 @@ div.julia-player.julia-theme-crimson>video { min-height: 100%; } +div.julia-player.julia-theme-default.julia-fullscreen-on>video { + width: auto; + height: 100%; +} + /* ***************************** * === TRANSITIONS === ****************************** */ diff --git a/src/css/themes/deeppink/julia.css b/src/scss/themes/deeppink/julia.css similarity index 94% rename from src/css/themes/deeppink/julia.css rename to src/scss/themes/deeppink/julia.css index 8fa03ba..5168bf1 100644 --- a/src/css/themes/deeppink/julia.css +++ b/src/scss/themes/deeppink/julia.css @@ -179,7 +179,7 @@ div.julia-player.julia-theme-deeppink button.julia-btn { background: transparent; border: 0; outline: 0; - font-size: 25px; + font-size: 23px; width: 30px; height: 25px; position: absolute; @@ -310,12 +310,12 @@ div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item { padding: 2%; cursor: pointer; position: relative; - overflow: hidden; + overflow: hidden; } div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; } @@ -324,8 +324,8 @@ div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item:h } div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; right: 0; background: rgba(0,0,0,.8); @@ -336,7 +336,7 @@ div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item>d @media (max-width: 480px) { div.julia-player.julia-theme-deeppink>div.julia-suggest>div.julia-suggest-item { font-size: 12px; - } + } } @@ -370,6 +370,11 @@ div.julia-player.julia-theme-deeppink>video { min-height: 100%; } +div.julia-player.julia-theme-default.julia-fullscreen-on>video { + width: auto; + height: 100%; +} + /* ***************************** * === TRANSITIONS === ****************************** */ diff --git a/src/css/themes/default/julia.css b/src/scss/themes/default/julia.css similarity index 94% rename from src/css/themes/default/julia.css rename to src/scss/themes/default/julia.css index 3706c84..4caacc7 100644 --- a/src/css/themes/default/julia.css +++ b/src/scss/themes/default/julia.css @@ -179,7 +179,7 @@ div.julia-player.julia-theme-default button.julia-btn { background: transparent; border: 0; outline: 0; - font-size: 25px; + font-size: 23px; width: 30px; height: 25px; position: absolute; @@ -310,12 +310,12 @@ div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item { padding: 2%; cursor: pointer; position: relative; - overflow: hidden; + overflow: hidden; } div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; } @@ -324,8 +324,8 @@ div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item:ho } div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; right: 0; background: rgba(0,0,0,.8); @@ -336,8 +336,8 @@ div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item>di @media (max-width: 480px) { div.julia-player.julia-theme-default>div.julia-suggest>div.julia-suggest-item { font-size: 12px; - } -} + } +} /* ***************************** @@ -370,6 +370,11 @@ div.julia-player.julia-theme-default>video { min-height: 100%; } +div.julia-player.julia-theme-default.julia-fullscreen-on>video { + width: auto; + height: 100%; +} + /* ***************************** * === TRANSITIONS === ****************************** */ diff --git a/src/css/themes/lime/julia.css b/src/scss/themes/lime/julia.css similarity index 94% rename from src/css/themes/lime/julia.css rename to src/scss/themes/lime/julia.css index f79798d..3a7536d 100644 --- a/src/css/themes/lime/julia.css +++ b/src/scss/themes/lime/julia.css @@ -179,7 +179,7 @@ div.julia-player.julia-theme-lime button.julia-btn { background: transparent; border: 0; outline: 0; - font-size: 25px; + font-size: 23px; width: 30px; height: 25px; position: absolute; @@ -310,12 +310,12 @@ div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item { padding: 2%; cursor: pointer; position: relative; - overflow: hidden; + overflow: hidden; } div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; } @@ -324,8 +324,8 @@ div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item:hover } div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; right: 0; background: rgba(0,0,0,.8); @@ -336,7 +336,7 @@ div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item>div.j @media (max-width: 480px) { div.julia-player.julia-theme-lime>div.julia-suggest>div.julia-suggest-item { font-size: 12px; - } + } } @@ -370,6 +370,11 @@ div.julia-player.julia-theme-lime>video { min-height: 100%; } +div.julia-player.julia-theme-default.julia-fullscreen-on>video { + width: auto; + height: 100%; +} + /* ***************************** * === TRANSITIONS === ****************************** */ diff --git a/src/css/themes/mediumspringgreen/julia.css b/src/scss/themes/mediumspringgreen/julia.css similarity index 94% rename from src/css/themes/mediumspringgreen/julia.css rename to src/scss/themes/mediumspringgreen/julia.css index c9c3370..cf57c8b 100644 --- a/src/css/themes/mediumspringgreen/julia.css +++ b/src/scss/themes/mediumspringgreen/julia.css @@ -179,7 +179,7 @@ div.julia-player.julia-theme-mediumspringgreen button.julia-btn { background: transparent; border: 0; outline: 0; - font-size: 25px; + font-size: 23px; width: 30px; height: 25px; position: absolute; @@ -310,12 +310,12 @@ div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-sugge padding: 2%; cursor: pointer; position: relative; - overflow: hidden; + overflow: hidden; } div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item>img { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; } @@ -324,8 +324,8 @@ div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-sugge } div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item>div.julia-suggest-item-title { - position: absolute; - top: 0; + position: absolute; + top: 0; left: 0; right: 0; background: rgba(0,0,0,.8); @@ -336,7 +336,7 @@ div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-sugge @media (max-width: 480px) { div.julia-player.julia-theme-mediumspringgreen>div.julia-suggest>div.julia-suggest-item { font-size: 12px; - } + } } @@ -370,6 +370,11 @@ div.julia-player.julia-theme-mediumspringgreen>video { min-height: 100%; } +div.julia-player.julia-theme-default.julia-fullscreen-on>video { + width: auto; + height: 100%; +} + /* ***************************** * === TRANSITIONS === ****************************** */ diff --git a/src/swf/flashlsChromeless.swf b/src/swf/flashlsChromeless.swf deleted file mode 100644 index 0efa6eb..0000000 Binary files a/src/swf/flashlsChromeless.swf and /dev/null differ