fjplayer
Version:
A Javascript video player for dash and mp4 videos, support multi subs tracks , overlays ads or information, injection mp4 video ads in preroll, modroll or after roll.
1,947 lines (1,781 loc) • 744 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("fjplayer", [], factory);
else if(typeof exports === 'object')
exports["fjplayer"] = factory();
else
root["fjplayer"] = factory();
})(self, function() {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/Version.js":
/*!************************!*\
!*** ./src/Version.js ***!
\************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var pjson = __webpack_require__(/*! ../package.json */ "./package.json");
/**
*
*/
var Version = /*#__PURE__*/function () {
/**
*
*/
function Version() {
_classCallCheck(this, Version);
this.version = pjson.version;
}
/**
* Get Player Version
* @returns the current verision of teh package
*/
_createClass(Version, [{
key: "getVersion",
value: function getVersion() {
return this.version;
}
}]);
return Version;
}();
module.exports = Version;
/***/ }),
/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/**
* The entry point for the library FJplayer.JS
*/
var Playlist = __webpack_require__(/*! ./js/player/playlist */ "./src/js/player/playlist.js");
var Player = __webpack_require__(/*! ./js/player/player */ "./src/js/player/player.js");
var Version = __webpack_require__(/*! ./Version */ "./src/Version.js");
var _require = __webpack_require__(/*! ./js/defs/constants */ "./src/js/defs/constants.js"),
PlayerEvents = _require.PlayerEvents,
AdsEvents = _require.AdsEvents,
OverlayEvents = _require.OverlayEvents; // Shove both of these into the global scope
var context = typeof window !== 'undefined' && window || __webpack_require__.g;
var fjplayer = context.fjplayer;
if (!fjplayer) {
fjplayer = {};
context.fjplayer = {};
}
fjplayer.Playlist = Playlist;
fjplayer.Player = Player;
fjplayer.Version = Version;
fjplayer.PlayerEvents = PlayerEvents;
fjplayer.AdsEvents = AdsEvents;
fjplayer.OverlayEvents = OverlayEvents;
module.exports = {
fjplayer: fjplayer,
Playlist: Playlist,
Player: Player,
Version: Version,
PlayerEvents: PlayerEvents,
AdsEvents: AdsEvents,
OverlayEvents: OverlayEvents
};
/*
Next version like this + playlist must be detached
class fjplayer {
constructor() {
this.Playlist = new Playlist();
this.Player = null;
this.Version = new Version();
this.PlayerEvents = PlayerEvents;
this.AdsEvents = AdsEvents;
this.OverlayEvents = OverlayEvents;
}
get playlist() {
return this.Playlist;
}
get player() {
return this.Player;
}
setPlayer(id, videoContainerId) {
this.Player = new Player(id, videoContainerId);
}
get version() {
return this.Version.getVersion();
}
get playerEvents() {
return this.PlayerEvents;
}
get adsEvents() {
return this.AdsEvents;
}
get overlayEvents() {
return this.OverlayEvents;
}
}
module.exports = fjplayer;
s
*/
/***/ }),
/***/ "./src/js/defs/constants.js":
/*!**********************************!*\
!*** ./src/js/defs/constants.js ***!
\**********************************/
/***/ ((module) => {
/**
* @module Constants
*/
var FJCONFIG_CLASS = 'FJClass';
var FJCONFIG_TYPE = 'FJType';
var FJCONFIG_TITLE = 'FJTitle';
var FJCONFIG_SRC = 'FJSrc';
var FJCONFIG_POSTER = 'FJPoster';
var FJCONFIG_ADS_LINK_URL = 'FJAdsLinkUrl';
var FJCONFIG_CAN_ESCAPE = 'FJCanEscape';
var FJCONFIG_THUMBS = 'FJThumbs';
var FJCONFIG_SUBTITLES = 'FJSubtitles';
var FJCONFIG_ADS = 'FJAds';
var FJCONFIG_AUDIOS = 'FJAudios';
var FJCONFIG_OVERLAYS = 'FJOverlays';
var FJCONFIG_DRM = 'FJDrm';
var FJCONFIG_LABEL = 'FJLabel';
var FJCONFIG_LANG = 'FJLang';
var FJCONFIG_DATA = 'FJData';
var FJCONFIG_URL = 'FJUrl';
var FJCONFIG_DURATION = 'FJDuration';
var FJCONFIG_SHOW_AT = 'FJShowAt';
var FJCONFIG_DRM_LICENSE_SERVER = 'FJLicenseServer';
var FJCONFIG_DRM_SCHEME = 'FJDrmScheme';
var FJCONFIG_DRM_SCHEME_FORJA = 'forja';
var FJCONFIG_SHOW_UP_TITLE = 'FJUpTitle';
var FJCONFIG_DOWNLOAD = 'FJDownload';
var FJCONFIG_SHARE = 'FJShare';
var FJCONFIG_BACK = 'FJBack';
var FJCONFIG_TRUE = 'true';
var FJCONFIG_FALSE = 'false';
var FJCONFIG_BOOLEAN = {
FJCONFIG_TRUE: FJCONFIG_TRUE,
FJCONFIG_FALSE: FJCONFIG_FALSE
};
var FJCONFIG_CLASS_VOD = 'vod';
var FJCONFIG_CLASS_LIVE = 'live';
var FJCONFIG_CLASSES = [FJCONFIG_CLASS_LIVE, FJCONFIG_CLASS_VOD];
var FJCONFIG_TYPE_MP4 = 'video/mp4';
var FJCONFIG_TYPE_DASH = 'dash';
var FJCONFIG_TYPES = [FJCONFIG_TYPE_MP4, FJCONFIG_TYPE_DASH];
var FJCONFIG_ADS_CLASS_PRE_ROLL = 'pre-roll';
var FJCONFIG_ADS_CLASS_MID_ROLL = 'mid-roll';
var FJCONFIG_ADS_CLASS_POST_ROLL = 'post-roll';
var FJCONFIG_ADS_CLASSES = [FJCONFIG_ADS_CLASS_PRE_ROLL, FJCONFIG_ADS_CLASS_MID_ROLL, FJCONFIG_ADS_CLASS_POST_ROLL];
var AdsEnum = {
ADS_PRE_ROLL: 'ADS_PRE_ROLL',
ADS_MID_ROLL: 'ADS_MID_ROLL',
ADS_POST_ROLL: 'ADS_POST_ROLL'
};
var PlayerEvents = {
STREAM_LOADED: 'STREAM_LOADED',
TRACKS_ADDED: 'TRACKS_ADDED',
PLAYBACK_ERROR: 'PLAYBACK_ERROR',
PLAYBACK_STARTED: 'PLAYBACK_STARTED',
PLAYBACK_PAUSED: 'PLAYBACK_PAUSED',
PLAYBACK_SEEKING: 'PLAYBACK_SEEKING',
PLAYBACK_SEEKED: 'PLAYBACK_SEEKED',
PLAYBACK_ENDED: 'PLAYBACK_ENDED',
PLAYBACK_TIME_UPDATE: 'PLAYBACK_TIME_UPDATE'
};
var AdsEvents = {
ADS_USER_CLICKED: 'ADS_USER_CLICKED',
ADS_PLAYBACK_STARTED: 'ADS_PLAYBACK_STARTED',
ADS_PLAYBACK_ENDED: 'ADS_PLAYBACK_ENDED',
ADS_PLAYBACK_ERROR: 'ADS_PLAYBACK_ERROR'
};
var OverlayEvents = {
OVERLAY_USER_CLICKED: 'OVERLAY_USER_CLICKED',
OVERLAY_STARTED: 'OVERLAY_STARTED',
OVERLAY_ENDED: 'OVERLAY_ENDED',
OVERLAY_ERROR: 'OVERLAY_ERROR',
OVERLAY_SKIPPED: 'OVERLAY_SKIPPED'
};
module.exports = {
FJCONFIG_CLASS: FJCONFIG_CLASS,
FJCONFIG_TYPE: FJCONFIG_TYPE,
FJCONFIG_TITLE: FJCONFIG_TITLE,
FJCONFIG_SRC: FJCONFIG_SRC,
FJCONFIG_POSTER: FJCONFIG_POSTER,
FJCONFIG_ADS_LINK_URL: FJCONFIG_ADS_LINK_URL,
FJCONFIG_CAN_ESCAPE: FJCONFIG_CAN_ESCAPE,
FJCONFIG_THUMBS: FJCONFIG_THUMBS,
FJCONFIG_SUBTITLES: FJCONFIG_SUBTITLES,
FJCONFIG_ADS: FJCONFIG_ADS,
FJCONFIG_AUDIOS: FJCONFIG_AUDIOS,
FJCONFIG_OVERLAYS: FJCONFIG_OVERLAYS,
FJCONFIG_DRM: FJCONFIG_DRM,
FJCONFIG_LABEL: FJCONFIG_LABEL,
FJCONFIG_LANG: FJCONFIG_LANG,
FJCONFIG_DATA: FJCONFIG_DATA,
FJCONFIG_URL: FJCONFIG_URL,
FJCONFIG_DURATION: FJCONFIG_DURATION,
FJCONFIG_SHOW_AT: FJCONFIG_SHOW_AT,
FJCONFIG_DRM_LICENSE_SERVER: FJCONFIG_DRM_LICENSE_SERVER,
FJCONFIG_DRM_SCHEME: FJCONFIG_DRM_SCHEME,
FJCONFIG_DRM_SCHEME_FORJA: FJCONFIG_DRM_SCHEME_FORJA,
FJCONFIG_SHOW_UP_TITLE: FJCONFIG_SHOW_UP_TITLE,
FJCONFIG_DOWNLOAD: FJCONFIG_DOWNLOAD,
FJCONFIG_SHARE: FJCONFIG_SHARE,
FJCONFIG_BACK: FJCONFIG_BACK,
FJCONFIG_TRUE: FJCONFIG_TRUE,
FJCONFIG_FALSE: FJCONFIG_FALSE,
FJCONFIG_BOOLEAN: FJCONFIG_BOOLEAN,
FJCONFIG_CLASS_VOD: FJCONFIG_CLASS_VOD,
FJCONFIG_CLASS_LIVE: FJCONFIG_CLASS_LIVE,
FJCONFIG_CLASSES: FJCONFIG_CLASSES,
FJCONFIG_TYPE_MP4: FJCONFIG_TYPE_MP4,
FJCONFIG_TYPE_DASH: FJCONFIG_TYPE_DASH,
FJCONFIG_TYPES: FJCONFIG_TYPES,
FJCONFIG_ADS_CLASS_PRE_ROLL: FJCONFIG_ADS_CLASS_PRE_ROLL,
FJCONFIG_ADS_CLASS_MID_ROLL: FJCONFIG_ADS_CLASS_MID_ROLL,
FJCONFIG_ADS_CLASS_POST_ROLL: FJCONFIG_ADS_CLASS_POST_ROLL,
FJCONFIG_ADS_CLASSES: FJCONFIG_ADS_CLASSES,
AdsEnum: AdsEnum,
PlayerEvents: PlayerEvents,
AdsEvents: AdsEvents,
OverlayEvents: OverlayEvents
};
/***/ }),
/***/ "./src/js/defs/isoLangs.js":
/*!*********************************!*\
!*** ./src/js/defs/isoLangs.js ***!
\*********************************/
/***/ ((module) => {
/**
* @author Phil Teare
* using wikipedia data
*/
var IsoLangs = {
ab: {
name: 'Abkhaz',
nativeName: 'аҧсуа'
},
aa: {
name: 'Afar',
nativeName: 'Afaraf'
},
af: {
name: 'Afrikaans',
nativeName: 'Afrikaans'
},
ak: {
name: 'Akan',
nativeName: 'Akan'
},
sq: {
name: 'Albanian',
nativeName: 'Shqip'
},
am: {
name: 'Amharic',
nativeName: 'አማርኛ'
},
ar: {
name: 'Arabic',
nativeName: 'العربية'
},
an: {
name: 'Aragonese',
nativeName: 'Aragonés'
},
hy: {
name: 'Armenian',
nativeName: 'Հայերեն'
},
as: {
name: 'Assamese',
nativeName: 'অসমীয়া'
},
av: {
name: 'Avaric',
nativeName: 'авар мацӀ, магӀарул мацӀ'
},
ae: {
name: 'Avestan',
nativeName: 'avesta'
},
ay: {
name: 'Aymara',
nativeName: 'aymar aru'
},
az: {
name: 'Azerbaijani',
nativeName: 'azərbaycan dili'
},
bm: {
name: 'Bambara',
nativeName: 'bamanankan'
},
ba: {
name: 'Bashkir',
nativeName: 'башҡорт теле'
},
eu: {
name: 'Basque',
nativeName: 'euskara, euskera'
},
be: {
name: 'Belarusian',
nativeName: 'Беларуская'
},
bn: {
name: 'Bengali',
nativeName: 'বাংলা'
},
bh: {
name: 'Bihari',
nativeName: 'भोजपुरी'
},
bi: {
name: 'Bislama',
nativeName: 'Bislama'
},
bs: {
name: 'Bosnian',
nativeName: 'bosanski jezik'
},
br: {
name: 'Breton',
nativeName: 'brezhoneg'
},
bg: {
name: 'Bulgarian',
nativeName: 'български език'
},
my: {
name: 'Burmese',
nativeName: 'ဗမာစာ'
},
ca: {
name: 'Catalan; Valencian',
nativeName: 'Català'
},
ch: {
name: 'Chamorro',
nativeName: 'Chamoru'
},
ce: {
name: 'Chechen',
nativeName: 'нохчийн мотт'
},
ny: {
name: 'Chichewa; Chewa; Nyanja',
nativeName: 'chiCheŵa, chinyanja'
},
zh: {
name: 'Chinese',
nativeName: '中文 (Zhōngwén), 汉语, 漢語'
},
cv: {
name: 'Chuvash',
nativeName: 'чӑваш чӗлхи'
},
kw: {
name: 'Cornish',
nativeName: 'Kernewek'
},
co: {
name: 'Corsican',
nativeName: 'corsu, lingua corsa'
},
cr: {
name: 'Cree',
nativeName: 'ᓀᐦᐃᔭᐍᐏᐣ'
},
hr: {
name: 'Croatian',
nativeName: 'hrvatski'
},
cs: {
name: 'Czech',
nativeName: 'česky, čeština'
},
da: {
name: 'Danish',
nativeName: 'dansk'
},
dv: {
name: 'Divehi; Dhivehi; Maldivian;',
nativeName: 'ދިވެހި'
},
nl: {
name: 'Dutch',
nativeName: 'Nederlands, Vlaams'
},
en: {
name: 'English',
nativeName: 'English'
},
eo: {
name: 'Esperanto',
nativeName: 'Esperanto'
},
et: {
name: 'Estonian',
nativeName: 'eesti, eesti keel'
},
ee: {
name: 'Ewe',
nativeName: 'Eʋegbe'
},
fo: {
name: 'Faroese',
nativeName: 'føroyskt'
},
fj: {
name: 'Fijian',
nativeName: 'vosa Vakaviti'
},
fi: {
name: 'Finnish',
nativeName: 'suomi, suomen kieli'
},
fr: {
name: 'French',
nativeName: 'français, langue française'
},
ff: {
name: 'Fula; Fulah; Pulaar; Pular',
nativeName: 'Fulfulde, Pulaar, Pular'
},
gl: {
name: 'Galician',
nativeName: 'Galego'
},
ka: {
name: 'Georgian',
nativeName: 'ქართული'
},
de: {
name: 'German',
nativeName: 'Deutsch'
},
el: {
name: 'Greek, Modern',
nativeName: 'Ελληνικά'
},
gn: {
name: 'Guaraní',
nativeName: 'Avañeẽ'
},
gu: {
name: 'Gujarati',
nativeName: 'ગુજરાતી'
},
ht: {
name: 'Haitian; Haitian Creole',
nativeName: 'Kreyòl ayisyen'
},
ha: {
name: 'Hausa',
nativeName: 'Hausa, هَوُسَ'
},
he: {
name: 'Hebrew (modern)',
nativeName: 'עברית'
},
hz: {
name: 'Herero',
nativeName: 'Otjiherero'
},
hi: {
name: 'Hindi',
nativeName: 'हिन्दी, हिंदी'
},
ho: {
name: 'Hiri Motu',
nativeName: 'Hiri Motu'
},
hu: {
name: 'Hungarian',
nativeName: 'Magyar'
},
ia: {
name: 'Interlingua',
nativeName: 'Interlingua'
},
id: {
name: 'Indonesian',
nativeName: 'Bahasa Indonesia'
},
ie: {
name: 'Interlingue',
nativeName: 'Originally called Occidental; then Interlingue after WWII'
},
ga: {
name: 'Irish',
nativeName: 'Gaeilge'
},
ig: {
name: 'Igbo',
nativeName: 'Asụsụ Igbo'
},
ik: {
name: 'Inupiaq',
nativeName: 'Iñupiaq, Iñupiatun'
},
io: {
name: 'Ido',
nativeName: 'Ido'
},
is: {
name: 'Icelandic',
nativeName: 'Íslenska'
},
it: {
name: 'Italian',
nativeName: 'Italiano'
},
iu: {
name: 'Inuktitut',
nativeName: 'ᐃᓄᒃᑎᑐᑦ'
},
ja: {
name: 'Japanese',
nativeName: '日本語 (にほんご/にっぽんご)'
},
jv: {
name: 'Javanese',
nativeName: 'basa Jawa'
},
kl: {
name: 'Kalaallisut, Greenlandic',
nativeName: 'kalaallisut, kalaallit oqaasii'
},
kn: {
name: 'Kannada',
nativeName: 'ಕನ್ನಡ'
},
kr: {
name: 'Kanuri',
nativeName: 'Kanuri'
},
ks: {
name: 'Kashmiri',
nativeName: 'कश्मीरी, كشميري'
},
kk: {
name: 'Kazakh',
nativeName: 'Қазақ тілі'
},
km: {
name: 'Khmer',
nativeName: 'ភាសាខ្មែរ'
},
ki: {
name: 'Kikuyu, Gikuyu',
nativeName: 'Gĩkũyũ'
},
rw: {
name: 'Kinyarwanda',
nativeName: 'Ikinyarwanda'
},
ky: {
name: 'Kirghiz, Kyrgyz',
nativeName: 'кыргыз тили'
},
kv: {
name: 'Komi',
nativeName: 'коми кыв'
},
kg: {
name: 'Kongo',
nativeName: 'KiKongo'
},
ko: {
name: 'Korean',
nativeName: '한국어 (韓國語), 조선말 (朝鮮語)'
},
ku: {
name: 'Kurdish',
nativeName: 'Kurdî, كوردی'
},
kj: {
name: 'Kwanyama, Kuanyama',
nativeName: 'Kuanyama'
},
la: {
name: 'Latin',
nativeName: 'latine, lingua latina'
},
lb: {
name: 'Luxembourgish, Letzeburgesch',
nativeName: 'Lëtzebuergesch'
},
lg: {
name: 'Luganda',
nativeName: 'Luganda'
},
li: {
name: 'Limburgish, Limburgan, Limburger',
nativeName: 'Limburgs'
},
ln: {
name: 'Lingala',
nativeName: 'Lingála'
},
lo: {
name: 'Lao',
nativeName: 'ພາສາລາວ'
},
lt: {
name: 'Lithuanian',
nativeName: 'lietuvių kalba'
},
lu: {
name: 'Luba-Katanga',
nativeName: ''
},
lv: {
name: 'Latvian',
nativeName: 'latviešu valoda'
},
gv: {
name: 'Manx',
nativeName: 'Gaelg, Gailck'
},
mk: {
name: 'Macedonian',
nativeName: 'македонски јазик'
},
mg: {
name: 'Malagasy',
nativeName: 'Malagasy fiteny'
},
ms: {
name: 'Malay',
nativeName: 'bahasa Melayu, بهاس ملايو'
},
ml: {
name: 'Malayalam',
nativeName: 'മലയാളം'
},
mt: {
name: 'Maltese',
nativeName: 'Malti'
},
mi: {
name: 'Māori',
nativeName: 'te reo Māori'
},
mr: {
name: 'Marathi (Marāṭhī)',
nativeName: 'मराठी'
},
mh: {
name: 'Marshallese',
nativeName: 'Kajin M̧ajeļ'
},
mn: {
name: 'Mongolian',
nativeName: 'монгол'
},
na: {
name: 'Nauru',
nativeName: 'Ekakairũ Naoero'
},
nv: {
name: 'Navajo, Navaho',
nativeName: 'Diné bizaad, Dinékʼehǰí'
},
nb: {
name: 'Norwegian Bokmål',
nativeName: 'Norsk bokmål'
},
nd: {
name: 'North Ndebele',
nativeName: 'isiNdebele'
},
ne: {
name: 'Nepali',
nativeName: 'नेपाली'
},
ng: {
name: 'Ndonga',
nativeName: 'Owambo'
},
nn: {
name: 'Norwegian Nynorsk',
nativeName: 'Norsk nynorsk'
},
no: {
name: 'Norwegian',
nativeName: 'Norsk'
},
ii: {
name: 'Nuosu',
nativeName: 'ꆈꌠ꒿ Nuosuhxop'
},
nr: {
name: 'South Ndebele',
nativeName: 'isiNdebele'
},
oc: {
name: 'Occitan',
nativeName: 'Occitan'
},
oj: {
name: 'Ojibwe, Ojibwa',
nativeName: 'ᐊᓂᔑᓈᐯᒧᐎᓐ'
},
cu: {
name: 'Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic',
nativeName: 'ѩзыкъ словѣньскъ'
},
om: {
name: 'Oromo',
nativeName: 'Afaan Oromoo'
},
or: {
name: 'Oriya',
nativeName: 'ଓଡ଼ିଆ'
},
os: {
name: 'Ossetian, Ossetic',
nativeName: 'ирон æвзаг'
},
pa: {
name: 'Panjabi, Punjabi',
nativeName: 'ਪੰਜਾਬੀ, پنجابی'
},
pi: {
name: 'Pāli',
nativeName: 'पाऴि'
},
fa: {
name: 'Persian',
nativeName: 'فارسی'
},
pl: {
name: 'Polish',
nativeName: 'polski'
},
ps: {
name: 'Pashto, Pushto',
nativeName: 'پښتو'
},
pt: {
name: 'Portuguese',
nativeName: 'Português'
},
qu: {
name: 'Quechua',
nativeName: 'Runa Simi, Kichwa'
},
rm: {
name: 'Romansh',
nativeName: 'rumantsch grischun'
},
rn: {
name: 'Kirundi',
nativeName: 'kiRundi'
},
ro: {
name: 'Romanian, Moldavian, Moldovan',
nativeName: 'română'
},
ru: {
name: 'Russian',
nativeName: 'русский язык'
},
sa: {
name: 'Sanskrit (Saṁskṛta)',
nativeName: 'संस्कृतम्'
},
sc: {
name: 'Sardinian',
nativeName: 'sardu'
},
sd: {
name: 'Sindhi',
nativeName: 'सिन्धी, سنڌي، سندھی'
},
se: {
name: 'Northern Sami',
nativeName: 'Davvisámegiella'
},
sm: {
name: 'Samoan',
nativeName: 'gagana faa Samoa'
},
sg: {
name: 'Sango',
nativeName: 'yângâ tî sängö'
},
sr: {
name: 'Serbian',
nativeName: 'српски језик'
},
gd: {
name: 'Scottish Gaelic; Gaelic',
nativeName: 'Gàidhlig'
},
sn: {
name: 'Shona',
nativeName: 'chiShona'
},
si: {
name: 'Sinhala, Sinhalese',
nativeName: 'සිංහල'
},
sk: {
name: 'Slovak',
nativeName: 'slovenčina'
},
sl: {
name: 'Slovene',
nativeName: 'slovenščina'
},
so: {
name: 'Somali',
nativeName: 'Soomaaliga, af Soomaali'
},
st: {
name: 'Southern Sotho',
nativeName: 'Sesotho'
},
es: {
name: 'Spanish; Castilian',
nativeName: 'español, castellano'
},
su: {
name: 'Sundanese',
nativeName: 'Basa Sunda'
},
sw: {
name: 'Swahili',
nativeName: 'Kiswahili'
},
ss: {
name: 'Swati',
nativeName: 'SiSwati'
},
sv: {
name: 'Swedish',
nativeName: 'svenska'
},
ta: {
name: 'Tamil',
nativeName: 'தமிழ்'
},
te: {
name: 'Telugu',
nativeName: 'తెలుగు'
},
tg: {
name: 'Tajik',
nativeName: 'тоҷикӣ, toğikī, تاجیکی'
},
th: {
name: 'Thai',
nativeName: 'ไทย'
},
ti: {
name: 'Tigrinya',
nativeName: 'ትግርኛ'
},
bo: {
name: 'Tibetan Standard, Tibetan, Central',
nativeName: 'བོད་ཡིག'
},
tk: {
name: 'Turkmen',
nativeName: 'Türkmen, Түркмен'
},
tl: {
name: 'Tagalog',
nativeName: 'Wikang Tagalog, ᜏᜒᜃᜅ᜔ ᜆᜄᜎᜓᜄ᜔'
},
tn: {
name: 'Tswana',
nativeName: 'Setswana'
},
to: {
name: 'Tonga (Tonga Islands)',
nativeName: 'faka Tonga'
},
tr: {
name: 'Turkish',
nativeName: 'Türkçe'
},
ts: {
name: 'Tsonga',
nativeName: 'Xitsonga'
},
tt: {
name: 'Tatar',
nativeName: 'татарча, tatarça, تاتارچا'
},
tw: {
name: 'Twi',
nativeName: 'Twi'
},
ty: {
name: 'Tahitian',
nativeName: 'Reo Tahiti'
},
ug: {
name: 'Uighur, Uyghur',
nativeName: 'Uyƣurqə, ئۇيغۇرچە'
},
uk: {
name: 'Ukrainian',
nativeName: 'українська'
},
ur: {
name: 'Urdu',
nativeName: 'اردو'
},
uz: {
name: 'Uzbek',
nativeName: 'zbek, Ўзбек, أۇزبېك'
},
ve: {
name: 'Venda',
nativeName: 'Tshivenḓa'
},
vi: {
name: 'Vietnamese',
nativeName: 'Tiếng Việt'
},
vo: {
name: 'Volapük',
nativeName: 'Volapük'
},
wa: {
name: 'Walloon',
nativeName: 'Walon'
},
cy: {
name: 'Welsh',
nativeName: 'Cymraeg'
},
wo: {
name: 'Wolof',
nativeName: 'Wollof'
},
fy: {
name: 'Western Frisian',
nativeName: 'Frysk'
},
xh: {
name: 'Xhosa',
nativeName: 'isiXhosa'
},
yi: {
name: 'Yiddish',
nativeName: 'ייִדיש'
},
yo: {
name: 'Yoruba',
nativeName: 'Yorùbá'
},
za: {
name: 'Zhuang, Chuang',
nativeName: 'Saɯ cueŋƅ, Saw cuengh'
}
};
module.exports = IsoLangs;
/***/ }),
/***/ "./src/js/player/PlayerMedia.js":
/*!**************************************!*\
!*** ./src/js/player/PlayerMedia.js ***!
\**************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var shaka = __webpack_require__(/*! shaka-player */ "./node_modules/shaka-player/dist/shaka-player.compiled.js");
var Logger = __webpack_require__(/*! ../utils/Logger */ "./src/js/utils/Logger.js");
var Eventing = __webpack_require__(/*! ../utils/Eventing */ "./src/js/utils/Eventing.js");
var Const = __webpack_require__(/*! ../defs/constants */ "./src/js/defs/constants.js");
var IsoLangs = __webpack_require__(/*! ../defs/isoLangs */ "./src/js/defs/isoLangs.js");
/**
* @module PlayerMedia
* @description The PlayerMedia is the html video/dash/drm Media player
*
*/
var PlayerMedia = /*#__PURE__*/function () {
function PlayerMedia(fjPlayerId) {
_classCallCheck(this, PlayerMedia);
this.video = null;
this.FjPlayerId = fjPlayerId;
this.FjSessionToken = 'notSettled';
this.initialized = false;
this.startingCount = 0;
this.thumbsTrackUrl = null;
this.thumbsTrackIndex = -1;
this.CurrentUrl = false;
this.CurrentUrl = null;
this.CurrentProtection = null;
this.CurrentStreamType = PlayerMedia.UNKNOWN;
this.DashPlayer = null;
this.logger = new Logger(this);
this.events = new Eventing();
this.StreamTypes = {
UNKNOWN: 0,
MP4_CLEAR: 1,
DASH_CLEAR: 2,
DASH_ENCRYPTED: 3,
properties: {
0: {
name: 'UNKNOWN',
value: 0,
code: 'U'
},
1: {
name: 'MP4_CLEAR',
value: 1,
code: 'M'
},
2: {
name: 'DASH_CLEAR',
value: 2,
code: 'D'
},
3: {
name: 'DASH_ENCRYPTED',
value: 3,
code: 'E'
}
}
};
}
/**
*
*/
_createClass(PlayerMedia, [{
key: "initialize",
value: function initialize(playerUiVideo) {
// Install built-in polyfills to patch browser incompatibilities.
shaka.polyfill.installAll(); // Debug logs, when the default of INFO isn't enough:
// shaka.log.setLevel(shaka.log.Level.DEBUG);
// Check to see if the browser supports the basic APIs Shaka needs.
if (!shaka.Player.isBrowserSupported()) {
// This browser does not have the minimum set of APIs we need.
this.logger.error('Browser not supported !');
return false;
}
this.video = playerUiVideo;
if (!this.video) {
throw new Error('Please call initialize with a valid Player UI having a this.videohtml 5 element ');
} // this.DashPlayer= new shaka.Player(video);
// done
this.initialized = true;
this.logger.debug(' Media player just this.initializedwith playerUiVideo');
return true;
}
/**
*
*/
}, {
key: "on",
value: function on(name, handler) {
return this.events.on(name, handler);
}
/**
*
*/
}, {
key: "off",
value: function off(name, handler) {
return this.events.off(name, handler);
}
/**
*
*/
}, {
key: "play",
value: function play() {
if (this.initialized === true) {
this.video.play();
} else {
this.logger.warn(' No Media Loaded , nothing to play ');
}
}
/**
*
*/
}, {
key: "time",
value: function time() {
if (this.initialized === true) {
return this.video.currentTime;
}
this.logger.warn(' No Media Loaded ! ');
return null;
}
/**
*
*/
}, {
key: "isPaused",
value: function isPaused() {
if (this.initialized === true) {
return this.video.paused;
}
this.logger.warn(' No Media Loaded ! ');
return true;
}
/**
*
*/
}, {
key: "isEnded",
value: function isEnded() {
if (this.initialized === true) {
return this.video.ended;
}
this.logger.warn(' No Media Loaded ! ');
return true;
}
/**
*
*/
}, {
key: "isMuted",
value: function isMuted() {
if (this.initialized === true) {
return this.video.muted;
}
this.logger.warn(' No Media Loaded ! ');
return true;
}
/**
*
*/
}, {
key: "setVolume",
value: function setVolume(volume) {
if (this.initialized === true) {
this.video.volume = volume;
} else {
this.logger.warn(' No Media Loaded ! ');
}
}
/**
*
*/
}, {
key: "getDuration",
value: function getDuration() {
if (this.initialized === true) {
return this.video.duration;
}
this.logger.warn(' No Media Loaded ! ');
return null;
}
/**
*
*/
}, {
key: "getVolume",
value: function getVolume() {
if (this.initialized === true) {
return this.video.volume;
}
this.logger.warn(' No Media Loaded ! ');
return null;
}
}, {
key: "setThumbsUrl",
value: function setThumbsUrl(url) {
if (url !== null && url !== undefined && url !== '') {
this.thumbsTrackUrl = url;
this.logger.debug(' Setting url for thumbs @', url);
} else {
this.thumbsTrackUrl = null;
this.logger.debug(' No Setting url for thumbs ');
}
}
/* ********************************************************************** */
/* TXT TRACKS */
/* ********************************************************************** */
}, {
key: "setTextTrack",
value: function setTextTrack(textTrackIndex) {
this.logger.warn(' Setting text track to index : ', textTrackIndex);
var index = parseInt(textTrackIndex, 10);
this.logger.warn(' Setting text track to index : ', index);
if (this.initialized === true) {
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
for (var i = 0; i < this.video.textTracks.length; i += 1) {
if (this.video.textTracks[i].kind === 'captions' || this.video.textTracks[i].kind === 'subtitles' || this.video.textTracks[i].kind === 'subtitle') {
if (index === i) {
this.video.textTracks[i].mode = 'showing';
} else {
this.video.textTracks[i].mode = 'hidden';
}
}
}
} else {
this.DashPlayer.selectTextTrack(this.DashPlayer.getTextTracks()[index]);
}
}
}
}, {
key: "getTextTracks",
value: function getTextTracks() {
if (this.initialized === true) {
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
return this.video.textTracks;
}
return this.DashPlayer.getTextTracks();
}
this.logger.warn(' No Media Loaded ! ');
return [];
}
}, {
key: "isTextTrackEnabled",
value: function isTextTrackEnabled(textTrackIndex) {
if (this.initialized === true) {
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
return this.video.textTracks[textTrackIndex].enabled === true;
}
return this.DashPlayer.getTextTracks()[textTrackIndex].active === true;
}
this.logger.warn(' No Media Loaded ! ');
return false;
}
}, {
key: "getTextTrackLabel",
value: function getTextTrackLabel(textTrackIndex) {
if (this.initialized === true) {
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
return this.video.textTracks[textTrackIndex].label;
}
return this.DashPlayer.getTextTracks()[textTrackIndex].language;
}
this.logger.warn(' No Media Loaded ! ');
return 'NaN';
}
/* ********************************************************************** */
/* AUD LANGS */
/* ********************************************************************** */
}, {
key: "setAudioLang",
value: function setAudioLang(AudLangIndex) {
var index = parseInt(AudLangIndex);
this.logger.warn(' Setting text track to index : ', index);
if (this.initialized === true) {
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
for (var i = 0; i < this.video.textTracks.length; i += 1) {
if (index === i) {
this.video.audioTracks[i].enabled = true;
} else {
this.video.audioTracks[i].enabled = false;
}
}
} else {
this.DashPlayer.selectAudioLanguage(this.DashPlayer.getAudioLanguages()[index]);
}
}
}
}, {
key: "getAudioLanguages",
value: function getAudioLanguages() {
if (this.initialized === true) {
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
return this.video.audioTracks;
}
return this.DashPlayer.getAudioLanguages();
}
this.logger.warn(' No Media Loaded ! ');
return [];
}
}, {
key: "isAudioLangEnabled",
value: function isAudioLangEnabled(AudLangIndex) {
var index = parseInt(AudLangIndex);
if (this.initialized === true) {
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
return this.video.audioTracks[index].enabled === true;
}
return this.DashPlayer.getAudioLanguages()[index].enabled === true;
}
this.logger.warn(' No Media Loaded ! ');
return false;
}
}, {
key: "getAudioLangLabel",
value: function getAudioLangLabel(AudLangIndex) {
var index = parseInt(AudLangIndex);
if (this.initialized === true) {
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
return this.video.audioTracks[index].label;
}
return this.DashPlayer.getAudioLanguages()[index].label;
}
this.logger.warn(' No Media Loaded ! ');
return 'NaN';
}
/**
*
*/
}, {
key: "setMute",
value: function setMute(mute) {
if (this.initialized === true) {
this.video.muted = mute;
} else {
this.logger.warn(' No Media Loaded ! ');
}
}
/**
*
*/
}, {
key: "pause",
value: function pause() {
if (this.initialized === true) {
this.video.pause();
} else {
this.logger.warn(' No Media Loaded , nothing to pause ');
}
}
/**
*
*/
}, {
key: "seek",
value: function seek(position) {
if (this.initialized === true) {
this.video.currentTime = parseFloat(position);
} else {
this.logger.warn(' No Media Loaded , nothing to seek ');
}
}
/**
* Callbacks
*/
}, {
key: "onShakaError",
value: function onShakaError(e) {
this.onShError(e.detail);
}
}, {
key: "onShakaEvent",
value: function onShakaEvent(event) {
this.logger.warn('Eventing [', event.type, ']:', event);
}
}, {
key: "onShError",
value: function onShError(error) {
this.logger.error('Error code', error.code, 'object', error);
}
}, {
key: "onPlayStart",
value: function onPlayStart() {
this.startingCount += 1;
this.events.fireEvent(Const.PlayerEvents.PLAYBACK_STARTED, this.startingCount);
}
}, {
key: "onPlaybackPaused",
value: function onPlaybackPaused() {
this.events.fireEvent(Const.PlayerEvents.PLAYBACK_PAUSED);
}
}, {
key: "onPlaybackEnded",
value: function onPlaybackEnded() {
this.getEndedEvent = true;
this.events.fireEvent(Const.PlayerEvents.PLAYBACK_ENDED);
}
}, {
key: "onPlayTimeUpdate",
value: function onPlayTimeUpdate() {
var time = 0;
if (this.initialized === true) {
time = this.video.currentTime;
} else {
this.logger.warn(' Internal error !');
return;
}
this.events.fireEvent(Const.PlayerEvents.PLAYBACK_TIME_UPDATE, time);
}
}, {
key: "onSeeked",
value: function onSeeked() {
this.events.fireEvent(Const.PlayerEvents.PLAYBACK_SEEKED);
}
}, {
key: "onSeeking",
value: function onSeeking() {
this.events.fireEvent(Const.PlayerEvents.PLAYBACK_SEEKING);
}
}, {
key: "onError",
value: function onError(e) {
var msg = e.event.message;
if (e.event.message === undefined) {
msg = e.event;
}
var args = {
type: e.type,
code: e.error,
message: msg
};
this.logger.error('>>>>>>>>>>>>>>> ERROR !!:', e);
this.events.fireEvent(Const.PlayerEvents.PLAYBACK_ERROR, args);
}
}, {
key: "onStreamInitialized",
value: function onStreamInitialized() {
this.thumbsTrackIndex = -1;
if (this.thumbsTrackUrl !== null) {
for (var i = 0; i < this.video.textTracks.length; i += 1) {
if (this.video.textTracks[i].kind === 'metadata') {
this.thumbsTrackIndex = i;
this.video.textTracks[i].mode = 'hidden'; // thanks Firefox
this.logger.warn('find metadata tumbs @ ', this.thumbsTrackIndex, '/', this.video.textTracks.length, ' >>> and this.videoduration ;;; ', this.getDuration());
} else if (this.video.textTracks[i].kind === 'captions' || this.video.textTracks[i].kind === 'subtitles') {
// SubsTrackIndex = i;
this.logger.warn('find soustitres @ ', this.thumbsTrackIndex, '/', this.video.textTracks.length, ' >>> ', this.video.textTracks[i]);
break;
}
}
}
this.logger.info('Stream is completly loaded.');
if (this.thumbsTrackIndex !== -1 && this.thumbsTrackUrl !== -1) {
this.events.fireEvent(Const.PlayerEvents.STREAM_LOADED, this.thumbsTrackIndex);
} else {
this.events.fireEvent(Const.PlayerEvents.STREAM_LOADED, null);
}
}
}, {
key: "SetManuallysubs",
value: function SetManuallysubs(subs, video) {
var track = null;
var item = null;
var tmp = null;
var label = null;
var i = 0;
var n = 0; // set subs
if (subs !== null && subs !== undefined) {
for (i = 0; i < subs.length; i += 1) {
item = subs[i];
track = document.createElement('track');
track.kind = 'subtitles';
track.src = item[Const.FJCONFIG_SRC];
track.srclang = item[Const.FJCONFIG_LANG];
tmp = IsoLangs[item[Const.FJCONFIG_LANG]];
this.logger.log(' Appending track substitles with Label', tmp.name);
n = tmp.name.indexOf(',');
if (n === -1) {
n = tmp.name.indexOf(';');
}
if (n === -1) {
label = tmp.name;
} else {
label = tmp.name.substr(0, n);
}
track.label = label;
video.appendChild(track);
}
} else {
this.logger.debug('no vtt Subs are found in config.');
}
}
}, {
key: "doesTimeMarchesOn",
value: function doesTimeMarchesOn() {
var version;
var REQUIRED_VERSION = 49.0;
if (typeof navigator !== 'undefined') {
if (!navigator.userAgent.match(/Firefox/)) {
return true;
}
version = this.parseFloat(navigator.userAgent.match(/rv:([0-9.]+)/)[1]);
if (!Number.isNaN(version) && version >= REQUIRED_VERSION) {
return true;
}
}
return false;
}
/**
* Used to Clean loaded data video
*/
}, {
key: "Unload",
value: function Unload() {
var el = this.video;
var elClone = null;
if (this.initialized !== true) {
this.logger.warn('not yet this.initialized!');
return;
} // remove all this.videochild
elClone = el.cloneNode(true);
el.parentNode.replaceChild(elClone, el);
this.video = elClone; // hide the overlay , empty the div
while (this.video.hasChildNodes()) {
this.video.removeChild(this.video.firstChild);
} // unset attr
this.video.removeAttribute('poster');
if (this.CurrentStreamType === this.StreamTypes.MP4_CLEAR) {
this.video.removeEventListener('loadedmetadata', this.onStreamInitialized);
this.video.removeEventListener('play', this.onPlayStart);
this.video.removeEventListener('pause', this.onPlaybackPaused);
this.video.removeEventListener('ended', this.onPlaybackEnded);
this.video.removeEventListener('timeupdate', this.onPlayTimeUpdate);
this.video.removeEventListener('seeking', this.onSeeking);
this.video.removeEventListener('seeked', this.onSeeked);
this.video.removeEventListener('error', this.onError);
} else {
// Unsetting Callbacks
this.DashPlayer.removeEventListener('error', this.onShakaError);
this.DashPlayer.removeEventListener('adaptation', this.onShakaEvent);
this.DashPlayer.removeEventListener('buffering', this.onShakaEvent);
this.DashPlayer.removeEventListener('emsg', this.onShakaEvent);
this.DashPlayer.removeEventListener('expirationupdated', this.onShakaEvent);
this.DashPlayer.removeEventListener('largegap', this.onShakaEvent);
this.DashPlayer.removeEventListener('loading', this.onShakaEvent);
this.DashPlayer.removeEventListener('texttrackvisibility', this.onShakaEvent);
this.DashPlayer.removeEventListener('timelineregionadded', this.onShakaEvent);
this.DashPlayer.removeEventListener('timelineregionenter', this.onShakaEvent);
this.DashPlayer.removeEventListener('timelineregionexit', this.onShakaEvent);
this.DashPlayer.removeEventListener('trackschanged', this.onShakaEvent);
this.DashPlayer.removeEventListener('unloading', this.onShakaEvent);
this.DashPlayer.destroy();
this.DashPlayer = null;
}
this.CurrentStreamType = PlayerMedia.UNKNOWN;
}
/**
* Used for clear video/mp4
*/
}, {
key: "load",
value: function load(url, type, poster, subs, autoplay) {
var _this = this;
var track = null;
var source = document.createElement('source');
source.type = type;
source.src = url;
this.video.preload = true;
this.video.controls = false;
this.video.autoplay = autoplay;
this.video.appendChild(source);
if (poster !== null && poster !== undefined && poster !== '') {
this.video.setAttribute('poster', poster);
}
this.CurrentStreamType = this.StreamTypes.MP4_CLEAR; // set thumbs
if (this.thumbsTrackUrl !== null && this.thumbsTrackUrl !== undefined) {
track = document.createElement('track');
track.kind = 'metadata';
track.src = this.thumbsTrackUrl;
this.logger.log(' Appending source thumbs to video', track);
this.video.appendChild(track);
} else {
this.logger.warn(' Thumbs was not found .');
} // set subs
this.SetManuallysubs(subs, this.video); // Setting Callbacks
this.video.addEventListener('loadedmetadata', function () {
return _this.onStreamInitialized();
}, false);
this.video.addEventListener('play', function () {
return _this.onPlayStart();
}, false);
this.video.addEventListener('pause', function () {
return _this.onPlaybackPaused();
}, false);
this.video.addEventListener('ended', function () {
return _this.onPlaybackEnded();
}, false);
this.video.addEventListener('timeupdate', function () {
return _this.onPlayTimeUpdate();
}, false);
this.video.addEventListener('seeked', function () {
return _this.onSeeked();
}, false);
this.video.addEventListener('seeking', function () {
return _this.onSeeking();
}, false);
this.video.addEventListener('error', function (e) {
return _this.onError(e);
}, false);
this.logger.info(' Clear MP4 stream is loaded @ ', url);
}
}, {
key: "responsefilerCbx",
value: function responsefilerCbx(type, response) {
if (type === shaka.net.NetworkingEngine.RequestType.MANIFEST) {
this.FjSessionToken = response.headers['session-token'];
this.logger.warn(' UPDATING Session Token : ', this.FjSessionToken);
}
}
/**
* Used for loading mpeg Dash
*/
}, {
key: "loadDash",
value: function loadDash(url, poster, subs, videoCaption, autoplay, drm) {
var _this2 = this;
var track = null;
if (poster !== null && poster !== undefined && poster !== '') {
this.video.setAttribute('poster', poster);
}
this.video.preload = true;
this.video.controls = false;
this.video.autoplay = autoplay;
if (this.DashPlayer === null) {
this.DashPlayer = new shaka.Player(this.video);
} // Setting Callbacks
this.video.addEventListener('loadedmetadata', function () {
return _this2.onStreamInitialized();
}, false);
this.video.addEventListener('play', function () {
return _this2.onPlayStart();
}, false);
this.video.addEventListener('pause', function () {
return _this2.onPlaybackPaused();
}, false);
this.video.addEventListener('ended', function () {
return _this2.onPlaybackEnded();
}, false);
this.video.addEventListener('timeupdate', function () {
return _this2.onPlayTimeUpdate();
}, false);
this.video.addEventListener('seeked', function () {
return _this2.onSeeked();
}, false);
this.video.addEventListener('seeking', function () {
return _this2.onSeeking();
}, false);
this.video.addEventListener('error', function (e) {
return _this2.onError(e);
}, false); // Setting Callbacks
this.DashPlayer.addEventListener('error', function (e) {
return _this2.onShakaError(e);
});
this.DashPlayer.addEventListener('adaptation', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('buffering', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('emsg', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('expirationupdated', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('largegap', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('loading', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('texttrackvisibility', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('timelineregionadded', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('timelineregionenter', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('timelineregionexit', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('trackschanged', function (e) {
return _this2.onShakaEvent(e);
});
this.DashPlayer.addEventListener('unloading', function (e) {
return _this2.onShakaEvent(e);
});
this.CurrentUrl = url;
if (drm === undefined || drm === null) {
this.CurrentStreamType = this.StreamTypes.DASH_CLEAR;
this.CurrentProtection = null;
this.logger.info(' Loading CLEAR Dash @', this.CurrentUrl);
} else {
this.CurrentStreamType = this.StreamTypes.DASH_ENCRYPTED;
this.CurrentProtection = drm;
this.logger.info(' drm are ::: ', drm);
this.DashPlayer.configure({
drm: {
servers: {
'org.w3.clearkey': drm[Const.FJCONFIG_DRM_LICENSE_SERVER]
}
}
});
this.logger.debug(' To Encrypt : using Forja System Key !.');
this.logger.info(' Loading ENCRYPTED Dash @', this.CurrentUrl);
}
this.DashPlayer.getNetworkingEngine().registerRequestFilter(function (type, request) {
if (type === shaka.net.NetworkingEngine.RequestType.MANIFEST || type === shaka.net.NetworkingEngine.RequestType.LICENSE) {
request.headers['Player-Key'] = _this2.FjPlayerId;
request.headers['Access-Control-Allow-Origin'] = '*';
}
if (type === shaka.net.NetworkingEngine.RequestType.SEGMENT) {
request.headers['Player-Key'] = _this2.FjPlayerId;
request.headers['Session-Token'] = _this2.FjSessionToken;
}
});
this.DashPlayer.getNetworkingEngine().registerResponseFilter(this.responsefilerCbx); // set thumbs
if (this.thumbsTrackUrl !== null && this.thumbsTrackUrl !== undefined) {
track = document.createElement('track');
track.kind = 'metadata';
track.src = this.thumbsTrackUrl;
this.logger.log(' Appending source thumbs to video', track);
this.video.appendChild(track);
} else {
this.logger.debug(' Thumbs was not found .');
} // set subs
this.SetManuallysubs(subs, this.video); // Try to load a manifest.
// This is an asynchronous process.
this.DashPlayer.load(url).then(function () {
// This runs if the asynchronous load is successful.
_this2.logger.log('The this.videohas now been loaded!');
})["catch"](this.onShError); // onError is executed if the asynchronous load fails.
this.logger.info(' DASH stream is loaded @ ', url);
}
}]);
return PlayerMedia;
}();
module.exports = PlayerMedia;
/***/ }),
/***/ "./src/js/player/player.js":
/*!*********************************!*\
!*** ./src/js/player/player.js ***!
\*********************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var Logger = __webpack_require__(/*! ../utils/Logger */ "./src/js/utils/Logger.js");
var Overlays = __webpack_require__(/*! ../ui/Overlays */ "./src/js/ui/Overlays.js");
var Eventing = __webpack_require__(/*! ../utils/Eventing */ "./src/js/utils/Eventing.js");
var Const = __webpack_require__(/*! ../defs/constants */ "./src/js/defs/constants.js");
var PlayerMedia = __webpack_require__(/*! ./PlayerMedia */ "./src/js/player/PlayerMedia.js");
var PlayerUi = __webpack_require__(/*! ../ui/PlayerUi */ "./src/js/ui/PlayerUi.js");
var AdsManager = __webpack_require__(/*! ../ui/AdsManager */ "./src/js/ui/AdsManager.js");
var FjError = __webpack_require__(/*! ../utils/FjError */ "./src/js/utils/FjError.js");
/**
* Class player in whinch the player is implemented
*/
var Player = /*#__PURE__*/function () {
function Player(fjID, vidContainerId) {
_classCallCheck(this, Player);
this.logger = new Logger(this);
this.playerPlaylist = null;
this.playingList = false;
this.loopingList = false;
this.currentPlaying = -1;
this.isPlaying = false;
this.currentIsDash = false;
this.playlistLoaded = false;
this.playingAds = false; // default values
this.videoWidth = '100%';
this.videoHeight = '';
this.events = new Eventing();
this.videoContainerId = vidContainerId;
this.fjPlayerId = fjID;
this.OverlaysMgr = new Overlays();
this.AdsMgr = new AdsManager();
this.supportsVideo = !!document.createElement('video').c