modified lib-jitsi-meet dev repo
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.

RTCUIHelper.js 2.3KB

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: function () {
  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: function (containerElement) {
  21. var videoElemName = RTCUIHelper.getVideoElementName();
  22. if (!RTCBrowserType.isTemasysPluginUsed()) {
  23. return $(containerElement).find(videoElemName)[0];
  24. } else {
  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. }
  36. return undefined;
  37. },
  38. /**
  39. * Sets 'volume' property of given HTML element displaying RTC audio or
  40. * video stream.
  41. * @param streamElement HTML element to which the RTC stream is attached to.
  42. * @param volume the volume value to be set.
  43. */
  44. setVolume: function (streamElement, volume) {
  45. if (!RTCBrowserType.isIExplorer()) {
  46. streamElement.volume = volume;
  47. }
  48. },
  49. /**
  50. * Sets 'autoplay' property of given HTML element displaying RTC audio or
  51. * video stream.
  52. * @param streamElement HTML element to which the RTC stream is attached to.
  53. * @param autoPlay 'true' or 'false'
  54. */
  55. setAutoPlay: function (streamElement, autoPlay) {
  56. if (!RTCBrowserType.isIExplorer()) {
  57. streamElement.autoplay = autoPlay;
  58. }
  59. }
  60. };
  61. module.exports = RTCUIHelper;