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

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