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

RTCUIHelper.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* global $ */
  2. var logger = require('jitsi-meet-logger').getLogger(__filename);
  3. var RTCBrowserType = require('./RTCBrowserType');
  4. var RTCUIHelper = {
  5. /**
  6. * Returns the name of 'video' element depending on the browser that we're
  7. * currently using.
  8. * @returns {string} 'video' or 'object' string name of WebRTC video element
  9. */
  10. getVideoElementName() {
  11. return RTCBrowserType.isTemasysPluginUsed() ? 'object' : 'video';
  12. },
  13. /**
  14. * Finds video element inside of the given container.
  15. * @param containerElement HTML element node instance which is supposed to
  16. * contain the video element.
  17. * @returns {HTMLElement} video HTML element instance if found inside of the
  18. * container or undefined otherwise.
  19. */
  20. findVideoElement(containerElement) {
  21. var videoElemName = RTCUIHelper.getVideoElementName();
  22. if (!RTCBrowserType.isTemasysPluginUsed()) {
  23. return $(containerElement).find(videoElemName)[0];
  24. }
  25. var matching = $(containerElement).find(
  26. ' ' + videoElemName + '>param[value="video"]');
  27. if (matching.length) {
  28. if (matching.length > 1) {
  29. logger.warn(
  30. 'Container with more than one video elements: ',
  31. containerElement);
  32. }
  33. return matching.parent()[0];
  34. }
  35. return undefined;
  36. },
  37. /**
  38. * Sets 'volume' property of given HTML element displaying RTC audio or
  39. * video stream.
  40. * @param streamElement HTML element to which the RTC stream is attached to.
  41. * @param volume the volume value to be set.
  42. */
  43. setVolume(streamElement, volume) {
  44. if (!RTCBrowserType.isIExplorer()) {
  45. streamElement.volume = volume;
  46. }
  47. },
  48. /**
  49. * Sets 'autoplay' property of given HTML element displaying RTC audio or
  50. * video stream.
  51. * @param streamElement HTML element to which the RTC stream is attached to.
  52. * @param autoPlay 'true' or 'false'
  53. */
  54. setAutoPlay(streamElement, autoPlay) {
  55. if (!RTCBrowserType.isIExplorer()) {
  56. streamElement.autoplay = autoPlay;
  57. }
  58. }
  59. };
  60. module.exports = RTCUIHelper;