You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LargeVideo.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. /* global $, APP, interfaceConfig */
  2. /* jshint -W101 */
  3. import Avatar from "../avatar/Avatar";
  4. import ToolbarToggler from "../toolbars/ToolbarToggler";
  5. import UIUtil from "../util/UIUtil";
  6. import UIEvents from "../../../service/UI/UIEvents";
  7. var RTCBrowserType = require("../../RTC/RTCBrowserType");
  8. // FIXME: With Temasys we have to re-select everytime
  9. //var video = $('#largeVideo');
  10. var currentVideoWidth = null;
  11. var currentVideoHeight = null;
  12. // By default we use camera
  13. var getVideoSize = getCameraVideoSize;
  14. var getVideoPosition = getCameraVideoPosition;
  15. /**
  16. * The small video instance that is displayed in the large video
  17. * @type {SmallVideo}
  18. */
  19. var currentSmallVideo = null;
  20. /**
  21. * Indicates whether the large video is enabled.
  22. * @type {boolean}
  23. */
  24. var isEnabled = true;
  25. /**
  26. * Current large video state.
  27. * Possible values - video, prezi or etherpad.
  28. * @type {string}
  29. */
  30. var state = "video";
  31. /**
  32. * Returns the html element associated with the passed state of large video
  33. * @param state the state.
  34. * @returns {JQuery|*|jQuery|HTMLElement} the container.
  35. */
  36. function getContainerByState(state) {
  37. var selector = null;
  38. switch (state) {
  39. case "video":
  40. selector = "#largeVideoWrapper";
  41. break;
  42. case "etherpad":
  43. selector = "#etherpad>iframe";
  44. break;
  45. case "prezi":
  46. selector = "#presentation>iframe";
  47. break;
  48. default:
  49. return null;
  50. }
  51. return $(selector);
  52. }
  53. /**
  54. * Sets the size and position of the given video element.
  55. *
  56. * @param video the video element to position
  57. * @param width the desired video width
  58. * @param height the desired video height
  59. * @param horizontalIndent the left and right indent
  60. * @param verticalIndent the top and bottom indent
  61. */
  62. function positionVideo(video,
  63. width,
  64. height,
  65. horizontalIndent,
  66. verticalIndent,
  67. animate) {
  68. if (animate) {
  69. video.animate({
  70. width: width,
  71. height: height,
  72. top: verticalIndent,
  73. bottom: verticalIndent,
  74. left: horizontalIndent,
  75. right: horizontalIndent
  76. }, {
  77. queue: false,
  78. duration: 500
  79. });
  80. } else {
  81. video.width(width);
  82. video.height(height);
  83. video.css({
  84. top: verticalIndent,
  85. bottom: verticalIndent,
  86. left: horizontalIndent,
  87. right: horizontalIndent
  88. });
  89. }
  90. }
  91. /**
  92. * Returns an array of the video dimensions, so that it keeps it's aspect
  93. * ratio and fits available area with it's larger dimension. This method
  94. * ensures that whole video will be visible and can leave empty areas.
  95. *
  96. * @return an array with 2 elements, the video width and the video height
  97. */
  98. function getDesktopVideoSize(videoWidth,
  99. videoHeight,
  100. videoSpaceWidth,
  101. videoSpaceHeight) {
  102. if (!videoWidth)
  103. videoWidth = currentVideoWidth;
  104. if (!videoHeight)
  105. videoHeight = currentVideoHeight;
  106. var aspectRatio = videoWidth / videoHeight;
  107. var availableWidth = Math.max(videoWidth, videoSpaceWidth);
  108. var availableHeight = Math.max(videoHeight, videoSpaceHeight);
  109. var filmstrip = $("#remoteVideos");
  110. if (!filmstrip.hasClass("hidden"))
  111. videoSpaceHeight -= filmstrip.outerHeight();
  112. if (availableWidth / aspectRatio >= videoSpaceHeight)
  113. {
  114. availableHeight = videoSpaceHeight;
  115. availableWidth = availableHeight * aspectRatio;
  116. }
  117. if (availableHeight * aspectRatio >= videoSpaceWidth)
  118. {
  119. availableWidth = videoSpaceWidth;
  120. availableHeight = availableWidth / aspectRatio;
  121. }
  122. return [availableWidth, availableHeight];
  123. }
  124. /**
  125. * Returns an array of the video horizontal and vertical indents,
  126. * so that if fits its parent.
  127. *
  128. * @return an array with 2 elements, the horizontal indent and the vertical
  129. * indent
  130. */
  131. function getCameraVideoPosition(videoWidth,
  132. videoHeight,
  133. videoSpaceWidth,
  134. videoSpaceHeight) {
  135. // Parent height isn't completely calculated when we position the video in
  136. // full screen mode and this is why we use the screen height in this case.
  137. // Need to think it further at some point and implement it properly.
  138. var isFullScreen = document.fullScreen ||
  139. document.mozFullScreen ||
  140. document.webkitIsFullScreen;
  141. if (isFullScreen)
  142. videoSpaceHeight = window.innerHeight;
  143. var horizontalIndent = (videoSpaceWidth - videoWidth) / 2;
  144. var verticalIndent = (videoSpaceHeight - videoHeight) / 2;
  145. return [horizontalIndent, verticalIndent];
  146. }
  147. /**
  148. * Returns an array of the video horizontal and vertical indents.
  149. * Centers horizontally and top aligns vertically.
  150. *
  151. * @return an array with 2 elements, the horizontal indent and the vertical
  152. * indent
  153. */
  154. function getDesktopVideoPosition(videoWidth,
  155. videoHeight,
  156. videoSpaceWidth,
  157. videoSpaceHeight) {
  158. var horizontalIndent = (videoSpaceWidth - videoWidth) / 2;
  159. var verticalIndent = 0;// Top aligned
  160. return [horizontalIndent, verticalIndent];
  161. }
  162. /**
  163. * Returns an array of the video dimensions. It respects the
  164. * VIDEO_LAYOUT_FIT config, to fit the video to the screen, by hiding some parts
  165. * of it, or to fit it to the height or width.
  166. *
  167. * @param videoWidth the original video width
  168. * @param videoHeight the original video height
  169. * @param videoSpaceWidth the width of the video space
  170. * @param videoSpaceHeight the height of the video space
  171. * @return an array with 2 elements, the video width and the video height
  172. */
  173. function getCameraVideoSize(videoWidth,
  174. videoHeight,
  175. videoSpaceWidth,
  176. videoSpaceHeight) {
  177. if (!videoWidth)
  178. videoWidth = currentVideoWidth;
  179. if (!videoHeight)
  180. videoHeight = currentVideoHeight;
  181. var aspectRatio = videoWidth / videoHeight;
  182. var availableWidth = videoWidth;
  183. var availableHeight = videoHeight;
  184. if (interfaceConfig.VIDEO_LAYOUT_FIT == 'height') {
  185. availableHeight = videoSpaceHeight;
  186. availableWidth = availableHeight*aspectRatio;
  187. }
  188. else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'width') {
  189. availableWidth = videoSpaceWidth;
  190. availableHeight = availableWidth/aspectRatio;
  191. }
  192. else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'both') {
  193. availableWidth = Math.max(videoWidth, videoSpaceWidth);
  194. availableHeight = Math.max(videoHeight, videoSpaceHeight);
  195. if (availableWidth / aspectRatio < videoSpaceHeight) {
  196. availableHeight = videoSpaceHeight;
  197. availableWidth = availableHeight * aspectRatio;
  198. }
  199. if (availableHeight * aspectRatio < videoSpaceWidth) {
  200. availableWidth = videoSpaceWidth;
  201. availableHeight = availableWidth / aspectRatio;
  202. }
  203. }
  204. return [availableWidth, availableHeight];
  205. }
  206. /**
  207. * Updates the src of the active speaker avatar
  208. */
  209. function updateActiveSpeakerAvatarSrc() {
  210. let avatar = $("#activeSpeakerAvatar");
  211. let id = currentSmallVideo.id;
  212. let url = Avatar.getActiveSpeakerUrl(id);
  213. if (id && avatar.attr('src') !== url) {
  214. avatar.attr('src', url);
  215. currentSmallVideo.showAvatar();
  216. }
  217. }
  218. /**
  219. * Change the video source of the large video.
  220. * @param isVisible
  221. */
  222. function changeVideo(isVisible) {
  223. if (!currentSmallVideo) {
  224. console.error("Unable to change large video - no 'currentSmallVideo'");
  225. return;
  226. }
  227. updateActiveSpeakerAvatarSrc();
  228. let largeVideoElement = $('#largeVideo');
  229. currentSmallVideo.stream.attach(largeVideoElement);
  230. let flipX = currentSmallVideo.flipX;
  231. largeVideoElement.css({
  232. transform: flipX ? "scaleX(-1)" : "none"
  233. });
  234. LargeVideo.updateVideoSizeAndPosition(currentSmallVideo.getVideoType());
  235. // Only if the large video is currently visible.
  236. if (isVisible) {
  237. LargeVideo.VideoLayout.largeVideoUpdated(currentSmallVideo);
  238. $('#largeVideoWrapper').fadeTo(300, 1);
  239. }
  240. }
  241. /**
  242. * Creates the html elements for the large video.
  243. */
  244. function createLargeVideoHTML()
  245. {
  246. var html = '<div id="largeVideoContainer" class="videocontainer">';
  247. html += '<div id="presentation"></div>' +
  248. '<div id="etherpad"></div>' +
  249. '<a target="_new"><div class="watermark leftwatermark"></div></a>' +
  250. '<a target="_new"><div class="watermark rightwatermark"></div></a>' +
  251. '<a class="poweredby" href="http://jitsi.org" target="_new" >' +
  252. '<span data-i18n="poweredby"></span> jitsi.org' +
  253. '</a>'+
  254. '<div id="activeSpeaker">' +
  255. '<img id="activeSpeakerAvatar" src=""/>' +
  256. '<canvas id="activeSpeakerAudioLevel"></canvas>' +
  257. '</div>' +
  258. '<div id="largeVideoWrapper">' +
  259. '<video id="largeVideo" muted="true"' +
  260. 'autoplay oncontextmenu="return false;"></video>' +
  261. '</div id="largeVideoWrapper">' +
  262. '<span id="videoConnectionMessage"></span>';
  263. html += '</div>';
  264. $(html).prependTo("#videospace");
  265. if (interfaceConfig.SHOW_JITSI_WATERMARK) {
  266. var leftWatermarkDiv
  267. = $("#largeVideoContainer div[class='watermark leftwatermark']");
  268. leftWatermarkDiv.css({display: 'block'});
  269. leftWatermarkDiv.parent().get(0).href
  270. = interfaceConfig.JITSI_WATERMARK_LINK;
  271. }
  272. if (interfaceConfig.SHOW_BRAND_WATERMARK) {
  273. var rightWatermarkDiv
  274. = $("#largeVideoContainer div[class='watermark rightwatermark']");
  275. rightWatermarkDiv.css({display: 'block'});
  276. rightWatermarkDiv.parent().get(0).href
  277. = interfaceConfig.BRAND_WATERMARK_LINK;
  278. rightWatermarkDiv.get(0).style.backgroundImage
  279. = "url(images/rightwatermark.png)";
  280. }
  281. if (interfaceConfig.SHOW_POWERED_BY) {
  282. $("#largeVideoContainer>a[class='poweredby']").css({display: 'block'});
  283. }
  284. if (!RTCBrowserType.isIExplorer()) {
  285. $('#largeVideo').volume = 0;
  286. }
  287. }
  288. var LargeVideo = {
  289. init: function (VideoLayout, emitter) {
  290. if(!isEnabled)
  291. return;
  292. createLargeVideoHTML();
  293. this.VideoLayout = VideoLayout;
  294. this.eventEmitter = emitter;
  295. this.eventEmitter.emit(UIEvents.LARGEVIDEO_INIT);
  296. var self = this;
  297. // Listen for large video size updates
  298. var largeVideo = $('#largeVideo')[0];
  299. var onplaying = function (arg1, arg2, arg3) {
  300. // re-select
  301. if (RTCBrowserType.isTemasysPluginUsed())
  302. largeVideo = $('#largeVideo')[0];
  303. currentVideoWidth = largeVideo.videoWidth;
  304. currentVideoHeight = largeVideo.videoHeight;
  305. self.position(currentVideoWidth, currentVideoHeight);
  306. };
  307. largeVideo.onplaying = onplaying;
  308. },
  309. /**
  310. * Indicates if the large video is currently visible.
  311. *
  312. * @return <tt>true</tt> if visible, <tt>false</tt> - otherwise
  313. */
  314. isLargeVideoVisible: function() {
  315. return $('#largeVideoWrapper').is(':visible');
  316. },
  317. /**
  318. * Returns <tt>true</tt> if the user is currently displayed on large video.
  319. */
  320. isCurrentlyOnLarge: function (id) {
  321. return id && id === this.getId();
  322. },
  323. /**
  324. * Updates the large video with the given new video source.
  325. */
  326. updateLargeVideo: function (id, forceUpdate) {
  327. if(!isEnabled) {
  328. return;
  329. }
  330. let newSmallVideo = this.VideoLayout.getSmallVideo(id);
  331. console.info(`hover in ${id} , video: `, newSmallVideo);
  332. if (!newSmallVideo) {
  333. console.error("Small video not found for: " + id);
  334. return;
  335. }
  336. if (!LargeVideo.isCurrentlyOnLarge(id) || forceUpdate) {
  337. $('#activeSpeaker').css('visibility', 'hidden');
  338. let oldId = this.getId();
  339. currentSmallVideo = newSmallVideo;
  340. if (oldId !== id) {
  341. // we want the notification to trigger even if id is undefined,
  342. // or null.
  343. this.eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, id);
  344. }
  345. // We are doing fadeOut/fadeIn animations on parent div which wraps
  346. // largeVideo, because when Temasys plugin is in use it replaces
  347. // <video> elements with plugin <object> tag. In Safari jQuery is
  348. // unable to store values on this plugin object which breaks all
  349. // animation effects performed on it directly.
  350. //
  351. // If for any reason large video was hidden before calling fadeOut
  352. // changeVideo will never be called, so we call show() in chain just
  353. // to be sure
  354. $('#largeVideoWrapper').show().fadeTo(300, 0,
  355. changeVideo.bind($('#largeVideo'), this.isLargeVideoVisible()));
  356. } else {
  357. if (currentSmallVideo) {
  358. currentSmallVideo.showAvatar();
  359. }
  360. }
  361. },
  362. /**
  363. * Shows/hides the large video.
  364. */
  365. setLargeVideoVisible: function(isVisible) {
  366. if(!isEnabled)
  367. return;
  368. if (isVisible) {
  369. $('#largeVideoWrapper').css({visibility: 'visible'});
  370. $('.watermark').css({visibility: 'visible'});
  371. if(currentSmallVideo)
  372. currentSmallVideo.enableDominantSpeaker(true);
  373. }
  374. else {
  375. $('#largeVideoWrapper').css({visibility: 'hidden'});
  376. $('#activeSpeaker').css('visibility', 'hidden');
  377. $('.watermark').css({visibility: 'hidden'});
  378. if(currentSmallVideo)
  379. currentSmallVideo.enableDominantSpeaker(false);
  380. }
  381. },
  382. onVideoTypeChanged: function (id, newVideoType) {
  383. if (!isEnabled)
  384. return;
  385. if (LargeVideo.isCurrentlyOnLarge(id)) {
  386. LargeVideo.updateVideoSizeAndPosition(newVideoType);
  387. this.position(null, null, null, null, true);
  388. }
  389. },
  390. /**
  391. * Positions the large video.
  392. *
  393. * @param videoWidth the stream video width
  394. * @param videoHeight the stream video height
  395. */
  396. position: function (videoWidth, videoHeight,
  397. videoSpaceWidth, videoSpaceHeight, animate) {
  398. if(!isEnabled)
  399. return;
  400. if(!videoSpaceWidth)
  401. videoSpaceWidth = $('#videospace').width();
  402. if(!videoSpaceHeight)
  403. videoSpaceHeight = window.innerHeight;
  404. var videoSize = getVideoSize(videoWidth,
  405. videoHeight,
  406. videoSpaceWidth,
  407. videoSpaceHeight);
  408. var largeVideoWidth = videoSize[0];
  409. var largeVideoHeight = videoSize[1];
  410. var videoPosition = getVideoPosition(largeVideoWidth,
  411. largeVideoHeight,
  412. videoSpaceWidth,
  413. videoSpaceHeight);
  414. var horizontalIndent = videoPosition[0];
  415. var verticalIndent = videoPosition[1];
  416. positionVideo($('#largeVideoWrapper'),
  417. largeVideoWidth,
  418. largeVideoHeight,
  419. horizontalIndent, verticalIndent, animate);
  420. },
  421. /**
  422. * Resizes the large html elements.
  423. *
  424. * @param animate boolean property that indicates whether the resize should
  425. * be animated or not.
  426. * @param isSideBarVisible boolean property that indicates whether the chat
  427. * area is displayed or not.
  428. * If that parameter is null the method will check the chat panel
  429. * visibility.
  430. * @param completeFunction a function to be called when the video space is
  431. * resized
  432. * @returns {*[]} array with the current width and height values of the
  433. * largeVideo html element.
  434. */
  435. resize: function (animate, isSideBarVisible, completeFunction) {
  436. if(!isEnabled)
  437. return;
  438. var availableHeight = window.innerHeight;
  439. var availableWidth = UIUtil.getAvailableVideoWidth(isSideBarVisible);
  440. if (availableWidth < 0 || availableHeight < 0) return;
  441. var avatarSize = interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE;
  442. var top = availableHeight / 2 - avatarSize / 4 * 3;
  443. $('#activeSpeaker').css('top', top);
  444. this.VideoLayout
  445. .resizeVideoSpace(animate, isSideBarVisible, completeFunction);
  446. if(animate) {
  447. $('#largeVideoContainer').animate({
  448. width: availableWidth,
  449. height: availableHeight
  450. },
  451. {
  452. queue: false,
  453. duration: 500
  454. });
  455. } else {
  456. $('#largeVideoContainer').width(availableWidth);
  457. $('#largeVideoContainer').height(availableHeight);
  458. }
  459. return [availableWidth, availableHeight];
  460. },
  461. /**
  462. * Resizes the large video.
  463. *
  464. * @param isSideBarVisible indicating if the side bar is visible
  465. * @param completeFunction the callback function to be executed after the
  466. * resize
  467. */
  468. resizeVideoAreaAnimated: function (isSideBarVisible, completeFunction) {
  469. if(!isEnabled)
  470. return;
  471. var size = this.resize(true, isSideBarVisible, completeFunction);
  472. this.position(null, null, size[0], size[1], true);
  473. },
  474. /**
  475. * Updates the video size and position.
  476. *
  477. * @param videoType the video type indicating if the stream is of type
  478. * desktop or web cam
  479. */
  480. updateVideoSizeAndPosition: function (videoType) {
  481. if (!videoType)
  482. videoType = currentSmallVideo.getVideoType();
  483. var isDesktop = videoType === 'screen';
  484. // Change the way we'll be measuring and positioning large video
  485. getVideoSize = isDesktop ? getDesktopVideoSize : getCameraVideoSize;
  486. getVideoPosition = isDesktop ? getDesktopVideoPosition :
  487. getCameraVideoPosition;
  488. },
  489. getId: function () {
  490. return currentSmallVideo ? currentSmallVideo.id : null;
  491. },
  492. updateAvatar: function (id) {
  493. if (!isEnabled) {
  494. return;
  495. }
  496. if (id === this.getId()) {
  497. updateActiveSpeakerAvatarSrc();
  498. }
  499. },
  500. showAvatar: function (id, show) {
  501. if (!isEnabled) {
  502. return;
  503. }
  504. if (this.getId() === id && state === "video") {
  505. $("#largeVideoWrapper").css("visibility", show ? "hidden" : "visible");
  506. $('#activeSpeaker').css("visibility", show ? "visible" : "hidden");
  507. return true;
  508. }
  509. return false;
  510. },
  511. /**
  512. * Disables the large video
  513. */
  514. disable: function () {
  515. isEnabled = false;
  516. },
  517. /**
  518. * Enables the large video
  519. */
  520. enable: function () {
  521. isEnabled = true;
  522. },
  523. /**
  524. * Returns true if the video is enabled.
  525. */
  526. isEnabled: function () {
  527. return isEnabled;
  528. },
  529. /**
  530. * Creates the iframe used by the etherpad
  531. * @param src the value for src attribute
  532. * @param onloadHandler handler executed when the iframe loads it content
  533. * @returns {HTMLElement} the iframe
  534. */
  535. createEtherpadIframe: function (src, onloadHandler) {
  536. if(!isEnabled)
  537. return;
  538. var etherpadIFrame = document.createElement('iframe');
  539. etherpadIFrame.src = src;
  540. etherpadIFrame.frameBorder = 0;
  541. etherpadIFrame.scrolling = "no";
  542. etherpadIFrame.width = $('#largeVideoContainer').width() || 640;
  543. etherpadIFrame.height = $('#largeVideoContainer').height() || 480;
  544. etherpadIFrame.setAttribute('style', 'visibility: hidden;');
  545. document.getElementById('etherpad').appendChild(etherpadIFrame);
  546. etherpadIFrame.onload = onloadHandler;
  547. return etherpadIFrame;
  548. },
  549. /**
  550. * Changes the state of the large video.
  551. * Possible values - video, prezi, etherpad.
  552. * @param newState - the new state
  553. */
  554. setState: function (newState) {
  555. if(state === newState)
  556. return;
  557. var currentContainer = getContainerByState(state);
  558. if(!currentContainer)
  559. return;
  560. var self = this;
  561. var oldState = state;
  562. switch (newState)
  563. {
  564. case "etherpad":
  565. $('#activeSpeaker').css('visibility', 'hidden');
  566. currentContainer.fadeOut(300, function () {
  567. if (oldState === "prezi") {
  568. currentContainer.css({opacity: '0'});
  569. $('#reloadPresentation').css({display: 'none'});
  570. }
  571. else {
  572. self.setLargeVideoVisible(false);
  573. }
  574. });
  575. $('#etherpad>iframe').fadeIn(300, function () {
  576. document.body.style.background = '#eeeeee';
  577. $('#etherpad>iframe').css({visibility: 'visible'});
  578. $('#etherpad').css({zIndex: 2});
  579. });
  580. break;
  581. case "prezi":
  582. var prezi = $('#presentation>iframe');
  583. currentContainer.fadeOut(300, function() {
  584. document.body.style.background = 'black';
  585. });
  586. prezi.fadeIn(300, function() {
  587. prezi.css({opacity:'1'});
  588. ToolbarToggler.dockToolbar(true);//fix that
  589. self.setLargeVideoVisible(false);
  590. $('#etherpad>iframe').css({visibility: 'hidden'});
  591. $('#etherpad').css({zIndex: 0});
  592. });
  593. $('#activeSpeaker').css('visibility', 'hidden');
  594. break;
  595. case "video":
  596. currentContainer.fadeOut(300, function () {
  597. $('#presentation>iframe').css({opacity:'0'});
  598. $('#reloadPresentation').css({display:'none'});
  599. $('#etherpad>iframe').css({visibility: 'hidden'});
  600. $('#etherpad').css({zIndex: 0});
  601. document.body.style.background = 'black';
  602. ToolbarToggler.dockToolbar(false);//fix that
  603. });
  604. $('#largeVideoWrapper').fadeIn(300, function () {
  605. self.setLargeVideoVisible(true);
  606. });
  607. break;
  608. }
  609. state = newState;
  610. },
  611. /**
  612. * Returns the current state of the large video.
  613. * @returns {string} the current state - video, prezi or etherpad.
  614. */
  615. getState: function () {
  616. return state;
  617. },
  618. /**
  619. * Sets hover handlers for the large video container div.
  620. *
  621. * @param inHandler
  622. * @param outHandler
  623. */
  624. setHover: function(inHandler, outHandler)
  625. {
  626. $('#largeVideoContainer').hover(inHandler, outHandler);
  627. },
  628. /**
  629. * Enables/disables the filter indicating a video problem to the user.
  630. *
  631. * @param enable <tt>true</tt> to enable, <tt>false</tt> to disable
  632. */
  633. enableVideoProblemFilter: function (enable) {
  634. $("#largeVideo").toggleClass("videoProblemFilter", enable);
  635. }
  636. };
  637. export default LargeVideo;