mpvVideoPlayer.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  1. /* eslint-disable indent */
  2. function getMediaStreamAudioTracks(mediaSource) {
  3. return mediaSource.MediaStreams.filter(function (s) {
  4. return s.Type === 'Audio';
  5. });
  6. }
  7. class mpvVideoPlayer {
  8. constructor({ events, loading, appRouter, globalize, appHost, appSettings, confirm, dashboard }) {
  9. this.events = events;
  10. this.loading = loading;
  11. this.appRouter = appRouter;
  12. this.globalize = globalize;
  13. this.appHost = appHost;
  14. this.appSettings = appSettings;
  15. // this can be removed after 10.9
  16. this.setTransparency = (dashboard && dashboard.setBackdropTransparency)
  17. ? dashboard.setBackdropTransparency.bind(dashboard)
  18. : appRouter.setTransparency.bind(appRouter);
  19. /**
  20. * @type {string}
  21. */
  22. this.name = 'MPV Video Player';
  23. /**
  24. * @type {string}
  25. */
  26. this.type = 'mediaplayer';
  27. /**
  28. * @type {string}
  29. */
  30. this.id = 'mpvvideoplayer';
  31. this.syncPlayWrapAs = 'htmlvideoplayer';
  32. this.priority = -1;
  33. this.useFullSubtitleUrls = true;
  34. /**
  35. * @type {boolean}
  36. */
  37. this.isFetching = false;
  38. /**
  39. * @type {HTMLDivElement | null | undefined}
  40. */
  41. this._videoDialog = undefined;
  42. /**
  43. * @type {number | undefined}
  44. */
  45. this._subtitleTrackIndexToSetOnPlaying = undefined;
  46. /**
  47. * @type {number | null}
  48. */
  49. this._audioTrackIndexToSetOnPlaying = undefined;
  50. /**
  51. * @type {boolean | undefined}
  52. */
  53. this._showTrackOffset = undefined;
  54. /**
  55. * @type {number | undefined}
  56. */
  57. this._currentTrackOffset = undefined;
  58. /**
  59. * @type {string[] | undefined}
  60. */
  61. this._supportedFeatures = undefined;
  62. /**
  63. * @type {string | undefined}
  64. */
  65. this._currentSrc = undefined;
  66. /**
  67. * @type {boolean | undefined}
  68. */
  69. this._started = undefined;
  70. /**
  71. * @type {boolean | undefined}
  72. */
  73. this._timeUpdated = undefined;
  74. /**
  75. * @type {number | null | undefined}
  76. */
  77. this._currentTime = undefined;
  78. /**
  79. * @private (used in other files)
  80. * @type {any | undefined}
  81. */
  82. this._currentPlayOptions = undefined;
  83. /**
  84. * @type {any | undefined}
  85. */
  86. this._lastProfile = undefined;
  87. /**
  88. * @type {number | undefined}
  89. */
  90. this._duration = undefined;
  91. /**
  92. * @type {boolean}
  93. */
  94. this._paused = false;
  95. /**
  96. * @type {int}
  97. */
  98. this._volume = 100;
  99. /**
  100. * @type {boolean}
  101. */
  102. this._muted = false;
  103. /**
  104. * @type {float}
  105. */
  106. this._playRate = 1;
  107. /**
  108. * @type {boolean}
  109. */
  110. this._hasConnection = false;
  111. /**
  112. * @private
  113. */
  114. this.onEnded = () => {
  115. this.onEndedInternal();
  116. };
  117. /**
  118. * @private
  119. */
  120. this.onTimeUpdate = (time) => {
  121. if (time && !this._timeUpdated) {
  122. this._timeUpdated = true;
  123. }
  124. this._currentTime = time;
  125. this.events.trigger(this, 'timeupdate');
  126. };
  127. /**
  128. * @private
  129. */
  130. this.onNavigatedToOsd = () => {
  131. const dlg = this._videoDialog;
  132. if (dlg) {
  133. dlg.style.zIndex = 'unset';
  134. }
  135. };
  136. /**
  137. * @private
  138. */
  139. this.onPlaying = () => {
  140. if (!this._started) {
  141. this._started = true;
  142. this.loading.hide();
  143. const volume = this.getSavedVolume() * 100;
  144. this.setVolume(volume, false);
  145. this.setPlaybackRate(this.getPlaybackRate());
  146. if (this._currentPlayOptions.fullscreen) {
  147. this.appRouter.showVideoOsd().then(this.onNavigatedToOsd);
  148. } else {
  149. this.setTransparency('backdrop');
  150. this._videoDialog.dlg.style.zIndex = 'unset';
  151. }
  152. // Need to override default style.
  153. this._videoDialog.style.setProperty('background', 'transparent', 'important');
  154. }
  155. if (this._paused) {
  156. this._paused = false;
  157. this.events.trigger(this, 'unpause');
  158. }
  159. this.events.trigger(this, 'playing');
  160. };
  161. /**
  162. * @private
  163. */
  164. this.onPause = () => {
  165. this._paused = true;
  166. // For Syncplay ready notification
  167. this.events.trigger(this, 'pause');
  168. };
  169. this.onWaiting = () => {
  170. this.events.trigger(this, 'waiting');
  171. };
  172. /**
  173. * @private
  174. * @param e {Event} The event received from the `<video>` element
  175. */
  176. this.onError = async (error) => {
  177. this.removeMediaDialog();
  178. console.error(`media error: ${error}`);
  179. const errorData = {
  180. type: 'mediadecodeerror'
  181. };
  182. try {
  183. await confirm({
  184. title: "Playback Failed",
  185. text: `Playback failed with error "${error}". Retry with transcode? (Note this may hang the player.)`,
  186. cancelText: "Cancel",
  187. confirmText: "Retry"
  188. });
  189. } catch (ex) {
  190. // User declined retry
  191. errorData.streamInfo = {
  192. // Prevent jellyfin-web retrying with transcode
  193. // which crashes the player
  194. mediaSource: {
  195. SupportsTranscoding: false
  196. }
  197. };
  198. }
  199. this.events.trigger(this, 'error', [errorData]);
  200. };
  201. this.onDuration = (duration) => {
  202. this._duration = duration;
  203. };
  204. }
  205. currentSrc() {
  206. return this._currentSrc;
  207. }
  208. async play(options) {
  209. this._started = false;
  210. this._timeUpdated = false;
  211. this._currentTime = null;
  212. this.resetSubtitleOffset();
  213. this.loading.show();
  214. window.api.power.setScreensaverEnabled(false);
  215. const elem = await this.createMediaElement(options);
  216. return await this.setCurrentSrc(elem, options);
  217. }
  218. getSavedVolume() {
  219. return this.appSettings.get('volume') || 1;
  220. }
  221. /**
  222. * @private
  223. */
  224. getRelativeIndexByType(mediaStreams, jellyIndex, streamType) {
  225. let relIndex = 1;
  226. for (const source of mediaStreams) {
  227. if (source.Type != streamType || source.IsExternal) {
  228. continue;
  229. }
  230. if (source.Index == jellyIndex) {
  231. return relIndex;
  232. }
  233. relIndex += 1;
  234. }
  235. return null;
  236. }
  237. /**
  238. * @private
  239. */
  240. getStreamByIndex(mediaStreams, jellyIndex) {
  241. for (const source of mediaStreams) {
  242. if (source.Index == jellyIndex) {
  243. return source;
  244. }
  245. }
  246. return null;
  247. }
  248. /**
  249. * @private
  250. */
  251. getSubtitleParam() {
  252. const options = this._currentPlayOptions;
  253. if (this._subtitleTrackIndexToSetOnPlaying != null && this._subtitleTrackIndexToSetOnPlaying >= 0) {
  254. const initialSubtitleStream = this.getStreamByIndex(options.mediaSource.MediaStreams, this._subtitleTrackIndexToSetOnPlaying);
  255. if (!initialSubtitleStream || initialSubtitleStream.DeliveryMethod === 'Encode') {
  256. this._subtitleTrackIndexToSetOnPlaying = -1;
  257. } else if (initialSubtitleStream.DeliveryMethod === 'External') {
  258. return '#,' + initialSubtitleStream.DeliveryUrl;
  259. }
  260. }
  261. if (this._subtitleTrackIndexToSetOnPlaying == -1 || this._subtitleTrackIndexToSetOnPlaying == null) {
  262. return '';
  263. }
  264. const subtitleRelIndex = this.getRelativeIndexByType(
  265. options.mediaSource.MediaStreams,
  266. this._subtitleTrackIndexToSetOnPlaying,
  267. 'Subtitle'
  268. );
  269. return subtitleRelIndex != null
  270. ? '#' + subtitleRelIndex
  271. : '';
  272. }
  273. /**
  274. * @private
  275. */
  276. getAudioParam() {
  277. const options = this._currentPlayOptions;
  278. if (this._audioTrackIndexToSetOnPlaying != null && this._audioTrackIndexToSetOnPlaying >= 0) {
  279. const initialAudioStream = this.getStreamByIndex(options.mediaSource.MediaStreams, this._audioTrackIndexToSetOnPlaying);
  280. if (!initialAudioStream) {
  281. return '#1';
  282. }
  283. }
  284. if (this._audioTrackIndexToSetOnPlaying == -1 || this._audioTrackIndexToSetOnPlaying == null) {
  285. return '#1';
  286. }
  287. const audioRelIndex = this.getRelativeIndexByType(
  288. options.mediaSource.MediaStreams,
  289. this._audioTrackIndexToSetOnPlaying,
  290. 'Audio'
  291. );
  292. return audioRelIndex != null
  293. ? '#' + audioRelIndex
  294. : '#1';
  295. }
  296. tryGetFramerate(options) {
  297. if (options.mediaSource && options.mediaSource.MediaStreams) {
  298. for (let stream of options.mediaSource.MediaStreams) {
  299. if (stream.Type == "Video") {
  300. return stream.RealFrameRate || stream.AverageFrameRate || null;
  301. }
  302. }
  303. }
  304. }
  305. /**
  306. * @private
  307. */
  308. setCurrentSrc(elem, options) {
  309. return new Promise((resolve) => {
  310. const val = options.url;
  311. this._currentSrc = val;
  312. console.debug(`playing url: ${val}`);
  313. // Convert to seconds
  314. const ms = (options.playerStartPositionTicks || 0) / 10000;
  315. this._currentPlayOptions = options;
  316. this._subtitleTrackIndexToSetOnPlaying = options.mediaSource.DefaultSubtitleStreamIndex == null ? -1 : options.mediaSource.DefaultSubtitleStreamIndex;
  317. this._audioTrackIndexToSetOnPlaying = options.playMethod === 'Transcode' ? null : options.mediaSource.DefaultAudioStreamIndex;
  318. const streamdata = {type: 'video', headers: {'User-Agent': 'JellyfinMediaPlayer'}, metadata: options.item, media: {}};
  319. const fps = this.tryGetFramerate(options);
  320. if (fps) {
  321. streamdata.frameRate = fps;
  322. }
  323. const player = window.api.player;
  324. player.load(val,
  325. { startMilliseconds: ms, autoplay: true },
  326. streamdata,
  327. this.getAudioParam(),
  328. this.getSubtitleParam(),
  329. resolve);
  330. });
  331. }
  332. setSubtitleStreamIndex(index) {
  333. this._subtitleTrackIndexToSetOnPlaying = index;
  334. window.api.player.setSubtitleStream(this.getSubtitleParam());
  335. }
  336. resetSubtitleOffset() {
  337. this._currentTrackOffset = 0;
  338. this._showTrackOffset = false;
  339. window.api.player.setSubtitleDelay(0);
  340. }
  341. enableShowingSubtitleOffset() {
  342. this._showTrackOffset = true;
  343. }
  344. disableShowingSubtitleOffset() {
  345. this._showTrackOffset = false;
  346. }
  347. isShowingSubtitleOffsetEnabled() {
  348. return this._showTrackOffset;
  349. }
  350. setSubtitleOffset(offset) {
  351. const offsetValue = parseFloat(offset);
  352. this._currentTrackOffset = offsetValue;
  353. window.api.player.setSubtitleDelay(Math.round(offsetValue * 1000));
  354. }
  355. getSubtitleOffset() {
  356. return this._currentTrackOffset;
  357. }
  358. /**
  359. * @private
  360. */
  361. isAudioStreamSupported() {
  362. return true;
  363. }
  364. /**
  365. * @private
  366. */
  367. getSupportedAudioStreams() {
  368. const profile = this._lastProfile;
  369. return getMediaStreamAudioTracks(this._currentPlayOptions.mediaSource).filter((stream) => {
  370. return this.isAudioStreamSupported(stream, profile);
  371. });
  372. }
  373. setAudioStreamIndex(index) {
  374. this._audioTrackIndexToSetOnPlaying = index;
  375. const streams = this.getSupportedAudioStreams();
  376. if (streams.length < 2) {
  377. // If there's only one supported stream then trust that the player will handle it on it's own
  378. return;
  379. }
  380. window.api.player.setAudioStream(this.getAudioParam());
  381. }
  382. onEndedInternal() {
  383. const stopInfo = {
  384. src: this._currentSrc
  385. };
  386. this.events.trigger(this, 'stopped', [stopInfo]);
  387. this._currentTime = null;
  388. this._currentSrc = null;
  389. this._currentPlayOptions = null;
  390. }
  391. stop(destroyPlayer) {
  392. window.api.player.stop();
  393. window.api.power.setScreensaverEnabled(true);
  394. this.onEndedInternal();
  395. if (destroyPlayer) {
  396. this.destroy();
  397. }
  398. return Promise.resolve();
  399. }
  400. removeMediaDialog() {
  401. this.loading.hide();
  402. window.api.player.stop();
  403. window.api.power.setScreensaverEnabled(true);
  404. this.setTransparency('none');
  405. document.body.classList.remove('hide-scroll');
  406. const dlg = this._videoDialog;
  407. if (dlg) {
  408. this._videoDialog = null;
  409. dlg.parentNode.removeChild(dlg);
  410. }
  411. // Only supporting QtWebEngine here
  412. if (document.webkitIsFullScreen && document.webkitExitFullscreen) {
  413. document.webkitExitFullscreen();
  414. }
  415. }
  416. destroy() {
  417. this.removeMediaDialog();
  418. const player = window.api.player;
  419. this._hasConnection = false;
  420. player.playing.disconnect(this.onPlaying);
  421. player.positionUpdate.disconnect(this.onTimeUpdate);
  422. player.finished.disconnect(this.onEnded);
  423. this._duration = undefined;
  424. player.updateDuration.disconnect(this.onDuration);
  425. player.error.disconnect(this.onError);
  426. player.paused.disconnect(this.onPause);
  427. }
  428. /**
  429. * @private
  430. */
  431. createMediaElement(options) {
  432. const dlg = document.querySelector('.videoPlayerContainer');
  433. if (!dlg) {
  434. this.loading.show();
  435. const dlg = document.createElement('div');
  436. dlg.classList.add('videoPlayerContainer');
  437. dlg.style.position = 'fixed';
  438. dlg.style.top = 0;
  439. dlg.style.bottom = 0;
  440. dlg.style.left = 0;
  441. dlg.style.right = 0;
  442. dlg.style.display = 'flex';
  443. dlg.style.alignItems = 'center';
  444. if (options.fullscreen) {
  445. dlg.style.zIndex = 1000;
  446. }
  447. const html = '';
  448. dlg.innerHTML = html;
  449. document.body.insertBefore(dlg, document.body.firstChild);
  450. this._videoDialog = dlg;
  451. const player = window.api.player;
  452. if (!this._hasConnection) {
  453. this._hasConnection = true;
  454. player.playing.connect(this.onPlaying);
  455. player.positionUpdate.connect(this.onTimeUpdate);
  456. player.finished.connect(this.onEnded);
  457. player.updateDuration.connect(this.onDuration);
  458. player.error.connect(this.onError);
  459. player.paused.connect(this.onPause);
  460. }
  461. if (options.fullscreen) {
  462. // At this point, we must hide the scrollbar placeholder, so it's not being displayed while the item is being loaded
  463. document.body.classList.add('hide-scroll');
  464. }
  465. return Promise.resolve();
  466. } else {
  467. // we need to hide scrollbar when starting playback from page with animated background
  468. if (options.fullscreen) {
  469. document.body.classList.add('hide-scroll');
  470. }
  471. return Promise.resolve();
  472. }
  473. }
  474. /**
  475. * @private
  476. */
  477. canPlayMediaType(mediaType) {
  478. return (mediaType || '').toLowerCase() === 'video';
  479. }
  480. /**
  481. * @private
  482. */
  483. supportsPlayMethod() {
  484. return true;
  485. }
  486. /**
  487. * @private
  488. */
  489. getDeviceProfile(item, options) {
  490. if (this.appHost.getDeviceProfile) {
  491. return this.appHost.getDeviceProfile(item, options);
  492. }
  493. return Promise.resolve({});
  494. }
  495. /**
  496. * @private
  497. */
  498. static getSupportedFeatures() {
  499. return ['PlaybackRate', 'SetAspectRatio'];
  500. }
  501. supports(feature) {
  502. if (!this._supportedFeatures) {
  503. this._supportedFeatures = mpvVideoPlayer.getSupportedFeatures();
  504. }
  505. return this._supportedFeatures.includes(feature);
  506. }
  507. // Save this for when playback stops, because querying the time at that point might return 0
  508. currentTime(val) {
  509. if (val != null) {
  510. window.api.player.seekTo(val);
  511. return;
  512. }
  513. return this._currentTime;
  514. }
  515. currentTimeAsync() {
  516. return new Promise((resolve) => {
  517. window.api.player.getPosition(resolve);
  518. });
  519. }
  520. duration() {
  521. if (this._duration) {
  522. return this._duration;
  523. }
  524. return null;
  525. }
  526. canSetAudioStreamIndex() {
  527. return true;
  528. }
  529. static onPictureInPictureError(err) {
  530. console.error(`Picture in picture error: ${err}`);
  531. }
  532. setPictureInPictureEnabled() {}
  533. isPictureInPictureEnabled() {
  534. return false;
  535. }
  536. isAirPlayEnabled() {
  537. return false;
  538. }
  539. setAirPlayEnabled() {}
  540. setBrightness() {}
  541. getBrightness() {
  542. return 100;
  543. }
  544. seekable() {
  545. return Boolean(this._duration);
  546. }
  547. pause() {
  548. window.api.player.pause();
  549. window.api.power.setScreensaverEnabled(true);
  550. }
  551. // This is a retry after error
  552. resume() {
  553. this._paused = false;
  554. window.api.player.play();
  555. }
  556. unpause() {
  557. window.api.player.play();
  558. window.api.power.setScreensaverEnabled(false);
  559. }
  560. paused() {
  561. return this._paused;
  562. }
  563. setPlaybackRate(value) {
  564. let playSpeed = +value; //this comes as a string from player force int for now
  565. this._playRate = playSpeed;
  566. window.api.player.setPlaybackRate(playSpeed * 1000);
  567. }
  568. getPlaybackRate() {
  569. return this._playRate;
  570. }
  571. getSupportedPlaybackRates() {
  572. return [{
  573. name: '0.5x',
  574. id: 0.5
  575. }, {
  576. name: '0.75x',
  577. id: 0.75
  578. }, {
  579. name: '1x',
  580. id: 1.0
  581. }, {
  582. name: '1.25x',
  583. id: 1.25
  584. }, {
  585. name: '1.5x',
  586. id: 1.5
  587. }, {
  588. name: '1.75x',
  589. id: 1.75
  590. }, {
  591. name: '2x',
  592. id: 2.0
  593. }];
  594. }
  595. saveVolume(value) {
  596. if (value) {
  597. this.appSettings.set('volume', value);
  598. }
  599. }
  600. setVolume(val, save = true) {
  601. this._volume = val;
  602. if (save) {
  603. this.saveVolume((val || 100) / 100);
  604. this.events.trigger(this, 'volumechange');
  605. }
  606. window.api.player.setVolume(val);
  607. }
  608. getVolume() {
  609. return this._volume;
  610. }
  611. volumeUp() {
  612. this.setVolume(Math.min(this.getVolume() + 2, 100));
  613. }
  614. volumeDown() {
  615. this.setVolume(Math.max(this.getVolume() - 2, 0));
  616. }
  617. setMute(mute, triggerEvent = true) {
  618. this._muted = mute;
  619. window.api.player.setMuted(mute);
  620. if (triggerEvent) {
  621. this.events.trigger(this, 'volumechange');
  622. }
  623. }
  624. isMuted() {
  625. return this._muted;
  626. }
  627. togglePictureInPicture() {
  628. }
  629. toggleAirPlay() {
  630. }
  631. getBufferedRanges() {
  632. return [];
  633. }
  634. getStats() {
  635. const playOptions = this._currentPlayOptions || [];
  636. const categories = [];
  637. if (!this._currentPlayOptions) {
  638. return Promise.resolve({
  639. categories: categories
  640. });
  641. }
  642. const mediaCategory = {
  643. stats: [],
  644. type: 'media'
  645. };
  646. categories.push(mediaCategory);
  647. if (playOptions.url) {
  648. // create an anchor element (note: no need to append this element to the document)
  649. let link = document.createElement('a');
  650. // set href to any path
  651. link.setAttribute('href', playOptions.url);
  652. const protocol = (link.protocol || '').replace(':', '');
  653. if (protocol) {
  654. mediaCategory.stats.push({
  655. label: this.globalize.translate('LabelProtocol'),
  656. value: protocol
  657. });
  658. }
  659. link = null;
  660. }
  661. mediaCategory.stats.push({
  662. label: this.globalize.translate('LabelStreamType'),
  663. value: 'Video'
  664. });
  665. const videoCategory = {
  666. stats: [],
  667. type: 'video'
  668. };
  669. categories.push(videoCategory);
  670. const audioCategory = {
  671. stats: [],
  672. type: 'audio'
  673. };
  674. categories.push(audioCategory);
  675. return Promise.resolve({
  676. categories: categories
  677. });
  678. }
  679. getSupportedAspectRatios() {
  680. const options = window.jmpInfo.settingsDescriptions.video.find(x => x.key == 'aspect').options;
  681. const current = window.jmpInfo.settings.video.aspect;
  682. const getOptionName = (option) => {
  683. const canTranslate = {
  684. 'normal': 'Auto',
  685. 'zoom': 'AspectRatioCover',
  686. 'stretch': 'AspectRatioFill',
  687. }
  688. const name = option.replace('video.aspect.', '');
  689. return canTranslate[name]
  690. ? this.globalize.translate(canTranslate[name])
  691. : name;
  692. }
  693. return options.map(x => ({
  694. id: x.value,
  695. name: getOptionName(x.title),
  696. selected: x.value == current
  697. }));
  698. }
  699. getAspectRatio() {
  700. return window.jmpInfo.settings.video.aspect;
  701. }
  702. setAspectRatio(value) {
  703. window.jmpInfo.settings.video.aspect = value;
  704. }
  705. }
  706. /* eslint-enable indent */
  707. window._mpvVideoPlayer = mpvVideoPlayer;