Source: main/webapp/modules/VideoPlayer.js

  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. var Guacamole = Guacamole || {};
  20. /**
  21. * Abstract video player which accepts, queues and plays back arbitrary video
  22. * data. It is up to implementations of this class to provide some means of
  23. * handling a provided Guacamole.InputStream and rendering the received data to
  24. * the provided Guacamole.Display.VisibleLayer. Data received along the
  25. * provided stream is to be played back immediately.
  26. *
  27. * @constructor
  28. */
  29. Guacamole.VideoPlayer = function VideoPlayer() {
  30. /**
  31. * Notifies this Guacamole.VideoPlayer that all video up to the current
  32. * point in time has been given via the underlying stream, and that any
  33. * difference in time between queued video data and the current time can be
  34. * considered latency.
  35. */
  36. this.sync = function sync() {
  37. // Default implementation - do nothing
  38. };
  39. };
  40. /**
  41. * Determines whether the given mimetype is supported by any built-in
  42. * implementation of Guacamole.VideoPlayer, and thus will be properly handled
  43. * by Guacamole.VideoPlayer.getInstance().
  44. *
  45. * @param {!string} mimetype
  46. * The mimetype to check.
  47. *
  48. * @returns {!boolean}
  49. * true if the given mimetype is supported by any built-in
  50. * Guacamole.VideoPlayer, false otherwise.
  51. */
  52. Guacamole.VideoPlayer.isSupportedType = function isSupportedType(mimetype) {
  53. // There are currently no built-in video players (and therefore no
  54. // supported types)
  55. return false;
  56. };
  57. /**
  58. * Returns a list of all mimetypes supported by any built-in
  59. * Guacamole.VideoPlayer, in rough order of priority. Beware that only the core
  60. * mimetypes themselves will be listed. Any mimetype parameters, even required
  61. * ones, will not be included in the list.
  62. *
  63. * @returns {!string[]}
  64. * A list of all mimetypes supported by any built-in Guacamole.VideoPlayer,
  65. * excluding any parameters.
  66. */
  67. Guacamole.VideoPlayer.getSupportedTypes = function getSupportedTypes() {
  68. // There are currently no built-in video players (and therefore no
  69. // supported types)
  70. return [];
  71. };
  72. /**
  73. * Returns an instance of Guacamole.VideoPlayer providing support for the given
  74. * video format. If support for the given video format is not available, null
  75. * is returned.
  76. *
  77. * @param {!Guacamole.InputStream} stream
  78. * The Guacamole.InputStream to read video data from.
  79. *
  80. * @param {!Guacamole.Display.VisibleLayer} layer
  81. * The destination layer in which this Guacamole.VideoPlayer should play
  82. * the received video data.
  83. *
  84. * @param {!string} mimetype
  85. * The mimetype of the video data in the provided stream.
  86. *
  87. * @return {Guacamole.VideoPlayer}
  88. * A Guacamole.VideoPlayer instance supporting the given mimetype and
  89. * reading from the given stream, or null if support for the given mimetype
  90. * is absent.
  91. */
  92. Guacamole.VideoPlayer.getInstance = function getInstance(stream, layer, mimetype) {
  93. // There are currently no built-in video players
  94. return null;
  95. };