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

LargeVideo.js 23KB

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