您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LargeVideo.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  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. It respects the
  162. * VIDEO_LAYOUT_FIT config, to fit the video to the screen, by hiding some parts
  163. * of it, or to fit it to the height or width.
  164. *
  165. * @param videoWidth the original video width
  166. * @param videoHeight the original video height
  167. * @param videoSpaceWidth the width of the video space
  168. * @param videoSpaceHeight the height of the video space
  169. * @return an array with 2 elements, the video width and the video height
  170. */
  171. function getCameraVideoSize(videoWidth,
  172. videoHeight,
  173. videoSpaceWidth,
  174. videoSpaceHeight) {
  175. if (!videoWidth)
  176. videoWidth = currentVideoWidth;
  177. if (!videoHeight)
  178. videoHeight = currentVideoHeight;
  179. var aspectRatio = videoWidth / videoHeight;
  180. var availableWidth = videoWidth;
  181. var availableHeight = videoHeight;
  182. if (interfaceConfig.VIDEO_LAYOUT_FIT == 'height') {
  183. availableHeight = videoSpaceHeight;
  184. availableWidth = availableHeight*aspectRatio;
  185. }
  186. else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'width') {
  187. availableWidth = videoSpaceWidth;
  188. availableHeight = availableWidth/aspectRatio;
  189. }
  190. else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'both') {
  191. availableWidth = Math.max(videoWidth, videoSpaceWidth);
  192. availableHeight = Math.max(videoHeight, videoSpaceHeight);
  193. if (availableWidth / aspectRatio < videoSpaceHeight) {
  194. availableHeight = videoSpaceHeight;
  195. availableWidth = availableHeight * aspectRatio;
  196. }
  197. if (availableHeight * aspectRatio < videoSpaceWidth) {
  198. availableWidth = videoSpaceWidth;
  199. availableHeight = availableWidth / aspectRatio;
  200. }
  201. }
  202. return [availableWidth, availableHeight];
  203. }
  204. /**
  205. * Updates the src of the active speaker avatar
  206. * @param jid of the current active speaker
  207. */
  208. function updateActiveSpeakerAvatarSrc() {
  209. var avatar = $("#activeSpeakerAvatar")[0];
  210. var jid = currentSmallVideo.peerJid;
  211. var url = Avatar.getActiveSpeakerUrl(jid);
  212. if (avatar.src === url)
  213. return;
  214. if (jid) {
  215. avatar.src = url;
  216. currentSmallVideo.showAvatar();
  217. }
  218. }
  219. /**
  220. * Change the video source of the large video.
  221. * @param isVisible
  222. */
  223. function changeVideo(isVisible) {
  224. if (!currentSmallVideo) {
  225. console.error("Unable to change large video - no 'currentSmallVideo'");
  226. return;
  227. }
  228. updateActiveSpeakerAvatarSrc();
  229. var largeVideoElement = $('#largeVideo')[0];
  230. APP.RTC.setVideoSrc(largeVideoElement, currentSmallVideo.getSrc());
  231. var flipX = currentSmallVideo.flipX;
  232. largeVideoElement.style.transform = flipX ? "scaleX(-1)" : "none";
  233. var isDesktop = currentSmallVideo.getVideoType() === 'screen';
  234. // Change the way we'll be measuring and positioning large video
  235. getVideoSize = isDesktop ? getDesktopVideoSize : getCameraVideoSize;
  236. getVideoPosition = isDesktop ? getDesktopVideoPosition :
  237. getCameraVideoPosition;
  238. // Only if the large video is currently visible.
  239. if (isVisible) {
  240. LargeVideo.VideoLayout.largeVideoUpdated(currentSmallVideo);
  241. $('#largeVideoWrapper').fadeTo(300, 1);
  242. }
  243. }
  244. /**
  245. * Creates the html elements for the large video.
  246. */
  247. function createLargeVideoHTML()
  248. {
  249. var html = '<div id="largeVideoContainer" class="videocontainer">';
  250. html += '<div id="presentation"></div>' +
  251. '<div id="etherpad"></div>' +
  252. '<a target="_new"><div class="watermark leftwatermark"></div></a>' +
  253. '<a target="_new"><div class="watermark rightwatermark"></div></a>' +
  254. '<a class="poweredby" href="http://jitsi.org" target="_new" >' +
  255. '<span data-i18n="poweredby"></span> jitsi.org' +
  256. '</a>'+
  257. '<div id="activeSpeaker">' +
  258. '<img id="activeSpeakerAvatar" src=""/>' +
  259. '<canvas id="activeSpeakerAudioLevel"></canvas>' +
  260. '</div>' +
  261. '<div id="largeVideoWrapper">' +
  262. '<video id="largeVideo" muted="true"' +
  263. 'autoplay oncontextmenu="return false;"></video>' +
  264. '</div id="largeVideoWrapper">' +
  265. '<span id="videoConnectionMessage"></span>';
  266. html += '</div>';
  267. $(html).prependTo("#videospace");
  268. if (interfaceConfig.SHOW_JITSI_WATERMARK) {
  269. var leftWatermarkDiv
  270. = $("#largeVideoContainer div[class='watermark leftwatermark']");
  271. leftWatermarkDiv.css({display: 'block'});
  272. leftWatermarkDiv.parent().get(0).href
  273. = interfaceConfig.JITSI_WATERMARK_LINK;
  274. }
  275. if (interfaceConfig.SHOW_BRAND_WATERMARK) {
  276. var rightWatermarkDiv
  277. = $("#largeVideoContainer div[class='watermark rightwatermark']");
  278. rightWatermarkDiv.css({display: 'block'});
  279. rightWatermarkDiv.parent().get(0).href
  280. = interfaceConfig.BRAND_WATERMARK_LINK;
  281. rightWatermarkDiv.get(0).style.backgroundImage
  282. = "url(images/rightwatermark.png)";
  283. }
  284. if (interfaceConfig.SHOW_POWERED_BY) {
  285. $("#largeVideoContainer>a[class='poweredby']").css({display: 'block'});
  286. }
  287. if (!RTCBrowserType.isIExplorer()) {
  288. $('#largeVideo').volume = 0;
  289. }
  290. }
  291. var LargeVideo = {
  292. init: function (VideoLayout, emitter) {
  293. if(!isEnabled)
  294. return;
  295. createLargeVideoHTML();
  296. this.VideoLayout = VideoLayout;
  297. this.eventEmitter = emitter;
  298. this.eventEmitter.emit(UIEvents.LARGEVIDEO_INIT);
  299. var self = this;
  300. // Listen for large video size updates
  301. var largeVideo = $('#largeVideo')[0];
  302. var onplaying = function (arg1, arg2, arg3) {
  303. // re-select
  304. if (RTCBrowserType.isTemasysPluginUsed())
  305. largeVideo = $('#largeVideo')[0];
  306. currentVideoWidth = largeVideo.videoWidth;
  307. currentVideoHeight = largeVideo.videoHeight;
  308. self.position(currentVideoWidth, currentVideoHeight);
  309. };
  310. largeVideo.onplaying = onplaying;
  311. },
  312. /**
  313. * Indicates if the large video is currently visible.
  314. *
  315. * @return <tt>true</tt> if visible, <tt>false</tt> - otherwise
  316. */
  317. isLargeVideoVisible: function() {
  318. return $('#largeVideoWrapper').is(':visible');
  319. },
  320. /**
  321. * Returns <tt>true</tt> if the user is currently displayed on large video.
  322. */
  323. isCurrentlyOnLarge: function (resourceJid) {
  324. return currentSmallVideo && resourceJid &&
  325. currentSmallVideo.getResourceJid() === resourceJid;
  326. },
  327. /**
  328. * Updates the large video with the given new video source.
  329. */
  330. updateLargeVideo: function (resourceJid, forceUpdate) {
  331. if(!isEnabled)
  332. return;
  333. var newSmallVideo = this.VideoLayout.getSmallVideo(resourceJid);
  334. console.info('hover in ' + resourceJid + ', video: ', newSmallVideo);
  335. if (!newSmallVideo) {
  336. console.error("Small video not found for: " + resourceJid);
  337. return;
  338. }
  339. if (!LargeVideo.isCurrentlyOnLarge(resourceJid) || forceUpdate) {
  340. $('#activeSpeaker').css('visibility', 'hidden');
  341. var oldSmallVideo = null;
  342. if (currentSmallVideo) {
  343. oldSmallVideo = currentSmallVideo;
  344. }
  345. currentSmallVideo = newSmallVideo;
  346. var oldJid = null;
  347. if (oldSmallVideo)
  348. oldJid = oldSmallVideo.peerJid;
  349. if (oldJid !== resourceJid) {
  350. // we want the notification to trigger even if userJid is undefined,
  351. // or null.
  352. this.eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, resourceJid);
  353. }
  354. // We are doing fadeOut/fadeIn animations on parent div which wraps
  355. // largeVideo, because when Temasys plugin is in use it replaces
  356. // <video> elements with plugin <object> tag. In Safari jQuery is
  357. // unable to store values on this plugin object which breaks all
  358. // animation effects performed on it directly.
  359. //
  360. // If for any reason large video was hidden before calling fadeOut
  361. // changeVideo will never be called, so we call show() in chain just
  362. // to be sure
  363. $('#largeVideoWrapper').show().fadeTo(300, 0,
  364. changeVideo.bind($('#largeVideo'), this.isLargeVideoVisible()));
  365. } else {
  366. if (currentSmallVideo) {
  367. currentSmallVideo.showAvatar();
  368. }
  369. }
  370. },
  371. /**
  372. * Shows/hides the large video.
  373. */
  374. setLargeVideoVisible: function(isVisible) {
  375. if(!isEnabled)
  376. return;
  377. if (isVisible) {
  378. $('#largeVideoWrapper').css({visibility: 'visible'});
  379. $('.watermark').css({visibility: 'visible'});
  380. if(currentSmallVideo)
  381. currentSmallVideo.enableDominantSpeaker(true);
  382. }
  383. else {
  384. $('#largeVideoWrapper').css({visibility: 'hidden'});
  385. $('#activeSpeaker').css('visibility', 'hidden');
  386. $('.watermark').css({visibility: 'hidden'});
  387. if(currentSmallVideo)
  388. currentSmallVideo.enableDominantSpeaker(false);
  389. }
  390. },
  391. onVideoTypeChanged: function (resourceJid, newVideoType) {
  392. if (!isEnabled)
  393. return;
  394. if (LargeVideo.isCurrentlyOnLarge(resourceJid))
  395. {
  396. var isDesktop = newVideoType === 'screen';
  397. getVideoSize = isDesktop ? getDesktopVideoSize : getCameraVideoSize;
  398. getVideoPosition = isDesktop ? getDesktopVideoPosition
  399. : getCameraVideoPosition;
  400. this.position(null, null, null, null, true);
  401. }
  402. },
  403. /**
  404. * Positions the large video.
  405. *
  406. * @param videoWidth the stream video width
  407. * @param videoHeight the stream video height
  408. */
  409. position: function (videoWidth, videoHeight,
  410. videoSpaceWidth, videoSpaceHeight, animate) {
  411. if(!isEnabled)
  412. return;
  413. if(!videoSpaceWidth)
  414. videoSpaceWidth = $('#videospace').width();
  415. if(!videoSpaceHeight)
  416. videoSpaceHeight = window.innerHeight;
  417. var videoSize = getVideoSize(videoWidth,
  418. videoHeight,
  419. videoSpaceWidth,
  420. videoSpaceHeight);
  421. var largeVideoWidth = videoSize[0];
  422. var largeVideoHeight = videoSize[1];
  423. var videoPosition = getVideoPosition(largeVideoWidth,
  424. largeVideoHeight,
  425. videoSpaceWidth,
  426. videoSpaceHeight);
  427. var horizontalIndent = videoPosition[0];
  428. var verticalIndent = videoPosition[1];
  429. positionVideo($('#largeVideoWrapper'),
  430. largeVideoWidth,
  431. largeVideoHeight,
  432. horizontalIndent, verticalIndent, animate);
  433. },
  434. /**
  435. * Resizes the large html elements.
  436. * @param animate boolean property that indicates whether the resize should be animated or not.
  437. * @param isChatVisible boolean property that indicates whether the chat area is displayed or not.
  438. * If that parameter is null the method will check the chat pannel visibility.
  439. * @param completeFunction a function to be called when the video space is resized
  440. * @returns {*[]} array with the current width and height values of the largeVideo html element.
  441. */
  442. resize: function (animate, isVisible, completeFunction) {
  443. if(!isEnabled)
  444. return;
  445. var availableHeight = window.innerHeight;
  446. var availableWidth = UIUtil.getAvailableVideoWidth(isVisible);
  447. if (availableWidth < 0 || availableHeight < 0) return;
  448. var avatarSize = interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE;
  449. var top = availableHeight / 2 - avatarSize / 4 * 3;
  450. $('#activeSpeaker').css('top', top);
  451. this.VideoLayout.resizeVideoSpace(animate, isVisible, completeFunction);
  452. if(animate) {
  453. $('#largeVideoContainer').animate({
  454. width: availableWidth,
  455. height: availableHeight
  456. },
  457. {
  458. queue: false,
  459. duration: 500
  460. });
  461. } else {
  462. $('#largeVideoContainer').width(availableWidth);
  463. $('#largeVideoContainer').height(availableHeight);
  464. }
  465. return [availableWidth, availableHeight];
  466. },
  467. resizeVideoAreaAnimated: function (isVisible, completeFunction) {
  468. if(!isEnabled)
  469. return;
  470. var size = this.resize(true, isVisible, completeFunction);
  471. this.position(null, null, size[0], size[1], true);
  472. },
  473. getResourceJid: function () {
  474. return currentSmallVideo ? currentSmallVideo.getResourceJid() : null;
  475. },
  476. updateAvatar: function (resourceJid) {
  477. if(!isEnabled)
  478. return;
  479. if (resourceJid === this.getResourceJid()) {
  480. updateActiveSpeakerAvatarSrc();
  481. }
  482. },
  483. showAvatar: function (resourceJid, show) {
  484. if (!isEnabled)
  485. return;
  486. if (this.getResourceJid() === resourceJid && state === "video") {
  487. $("#largeVideoWrapper")
  488. .css("visibility", show ? "hidden" : "visible");
  489. $('#activeSpeaker').css("visibility", show ? "visible" : "hidden");
  490. return true;
  491. }
  492. return false;
  493. },
  494. /**
  495. * Disables the large video
  496. */
  497. disable: function () {
  498. isEnabled = false;
  499. },
  500. /**
  501. * Enables the large video
  502. */
  503. enable: function () {
  504. isEnabled = true;
  505. },
  506. /**
  507. * Returns true if the video is enabled.
  508. */
  509. isEnabled: function () {
  510. return isEnabled;
  511. },
  512. /**
  513. * Creates the iframe used by the etherpad
  514. * @param src the value for src attribute
  515. * @param onloadHandler handler executed when the iframe loads it content
  516. * @returns {HTMLElement} the iframe
  517. */
  518. createEtherpadIframe: function (src, onloadHandler) {
  519. if(!isEnabled)
  520. return;
  521. var etherpadIFrame = document.createElement('iframe');
  522. etherpadIFrame.src = src;
  523. etherpadIFrame.frameBorder = 0;
  524. etherpadIFrame.scrolling = "no";
  525. etherpadIFrame.width = $('#largeVideoContainer').width() || 640;
  526. etherpadIFrame.height = $('#largeVideoContainer').height() || 480;
  527. etherpadIFrame.setAttribute('style', 'visibility: hidden;');
  528. document.getElementById('etherpad').appendChild(etherpadIFrame);
  529. etherpadIFrame.onload = onloadHandler;
  530. return etherpadIFrame;
  531. },
  532. /**
  533. * Changes the state of the large video.
  534. * Possible values - video, prezi, etherpad.
  535. * @param newState - the new state
  536. */
  537. setState: function (newState) {
  538. if(state === newState)
  539. return;
  540. var currentContainer = getContainerByState(state);
  541. if(!currentContainer)
  542. return;
  543. var self = this;
  544. var oldState = state;
  545. switch (newState)
  546. {
  547. case "etherpad":
  548. $('#activeSpeaker').css('visibility', 'hidden');
  549. currentContainer.fadeOut(300, function () {
  550. if (oldState === "prezi") {
  551. currentContainer.css({opacity: '0'});
  552. $('#reloadPresentation').css({display: 'none'});
  553. }
  554. else {
  555. self.setLargeVideoVisible(false);
  556. }
  557. });
  558. $('#etherpad>iframe').fadeIn(300, function () {
  559. document.body.style.background = '#eeeeee';
  560. $('#etherpad>iframe').css({visibility: 'visible'});
  561. $('#etherpad').css({zIndex: 2});
  562. });
  563. break;
  564. case "prezi":
  565. var prezi = $('#presentation>iframe');
  566. currentContainer.fadeOut(300, function() {
  567. document.body.style.background = 'black';
  568. });
  569. prezi.fadeIn(300, function() {
  570. prezi.css({opacity:'1'});
  571. ToolbarToggler.dockToolbar(true);//fix that
  572. self.setLargeVideoVisible(false);
  573. $('#etherpad>iframe').css({visibility: 'hidden'});
  574. $('#etherpad').css({zIndex: 0});
  575. });
  576. $('#activeSpeaker').css('visibility', 'hidden');
  577. break;
  578. case "video":
  579. currentContainer.fadeOut(300, function () {
  580. $('#presentation>iframe').css({opacity:'0'});
  581. $('#reloadPresentation').css({display:'none'});
  582. $('#etherpad>iframe').css({visibility: 'hidden'});
  583. $('#etherpad').css({zIndex: 0});
  584. document.body.style.background = 'black';
  585. ToolbarToggler.dockToolbar(false);//fix that
  586. });
  587. $('#largeVideoWrapper').fadeIn(300, function () {
  588. self.setLargeVideoVisible(true);
  589. });
  590. break;
  591. }
  592. state = newState;
  593. },
  594. /**
  595. * Returns the current state of the large video.
  596. * @returns {string} the current state - video, prezi or etherpad.
  597. */
  598. getState: function () {
  599. return state;
  600. },
  601. /**
  602. * Sets hover handlers for the large video container div.
  603. *
  604. * @param inHandler
  605. * @param outHandler
  606. */
  607. setHover: function(inHandler, outHandler)
  608. {
  609. $('#largeVideoContainer').hover(inHandler, outHandler);
  610. },
  611. /**
  612. * Enables/disables the filter indicating a video problem to the user.
  613. *
  614. * @param enable <tt>true</tt> to enable, <tt>false</tt> to disable
  615. */
  616. enableVideoProblemFilter: function (enable) {
  617. $("#largeVideo").toggleClass("videoProblemFilter", enable);
  618. }
  619. };
  620. module.exports = LargeVideo;