/*
* Copyright (C) 2015 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var Guacamole = Guacamole || {};
/**
* Abstract video player which accepts, queues and plays back arbitrary video
* data. It is up to implementations of this class to provide some means of
* handling a provided Guacamole.InputStream and rendering the received data to
* the provided Guacamole.Display.VisibleLayer. Data received along the
* provided stream is to be played back immediately.
*
* @constructor
*/
Guacamole.VideoPlayer = function VideoPlayer() {
/**
* Notifies this Guacamole.VideoPlayer that all video up to the current
* point in time has been given via the underlying stream, and that any
* difference in time between queued video data and the current time can be
* considered latency.
*/
this.sync = function sync() {
// Default implementation - do nothing
};
};
/**
* Determines whether the given mimetype is supported by any built-in
* implementation of Guacamole.VideoPlayer, and thus will be properly handled
* by Guacamole.VideoPlayer.getInstance().
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by any built-in
* Guacamole.VideoPlayer, false otherwise.
*/
Guacamole.VideoPlayer.isSupportedType = function isSupportedType(mimetype) {
// There are currently no built-in video players (and therefore no
// supported types)
return false;
};
/**
* Returns a list of all mimetypes supported by any built-in
* Guacamole.VideoPlayer, in rough order of priority. Beware that only the core
* mimetypes themselves will be listed. Any mimetype parameters, even required
* ones, will not be included in the list.
*
* @returns {String[]}
* A list of all mimetypes supported by any built-in Guacamole.VideoPlayer,
* excluding any parameters.
*/
Guacamole.VideoPlayer.getSupportedTypes = function getSupportedTypes() {
// There are currently no built-in video players (and therefore no
// supported types)
return [];
};
/**
* Returns an instance of Guacamole.VideoPlayer providing support for the given
* video format. If support for the given video format is not available, null
* is returned.
*
* @param {Guacamole.InputStream} stream
* The Guacamole.InputStream to read video data from.
*
* @param {Guacamole.Display.VisibleLayer} layer
* The destination layer in which this Guacamole.VideoPlayer should play
* the received video data.
*
* @param {String} mimetype
* The mimetype of the video data in the provided stream.
*
* @return {Guacamole.VideoPlayer}
* A Guacamole.VideoPlayer instance supporting the given mimetype and
* reading from the given stream, or null if support for the given mimetype
* is absent.
*/
Guacamole.VideoPlayer.getInstance = function getInstance(stream, layer, mimetype) {
// There are currently no built-in video players
return null;
};