Build HTML5 video player element
@param media Media metadata
@return Media element
186251
protected Video getVideoPlayerElement(@NotNull Media media) {
    Dimension dimension = MediaMarkupBuilderUtil.getMediaformatDimension(media);

    Video video = new Video();
    video.setWidth((int)dimension.getWidth());
    video.setHeight((int)dimension.getHeight());
    video.setControls(true);

    // add video sources for each video profile
    addSources(video, media);

    // add flash player as fallback
    video.addContent(getFlashPlayerElement(media, dimension));

    return video;
  }
1331735
public function build()
    {
        if (empty($this->attribute['source'])) {
            Throw new ElementException('No mediasource set.');
        }

        if (empty($this->attribute['type'])) {
            Throw new ElementException('No media type set.');
        }

        return parent::build();
    }
621682
public function build(): SetEmulatedMediaRequest
	{
		$instance = new SetEmulatedMediaRequest();
		if ($this->media === null) {
			throw new BuilderException('Property [media] is required.');
		}
		$instance->media = $this->media;
		return $instance;
	}
35058
function() {
		var api_url,
			self = this;

		// Create Dom element
		this._el.content_item	= TL.Dom.create("div", "tl-media-item tl-media-iframe tl-media-vimeo tl-media-shadow", this._el.content);

		// Get Media ID
		this.media_id = this.data.url.split(/video\/|\/\/vimeo\.com\//)[1].split(/[?&]/)[0];
		var start_time = null;

		// Get start time
		if (this.data.url.match(/#t=([^&]+).*/)) {
			start_time = this.data.url.match(/#t=([^&]+).*/)[1];
		}

		// API URL
		api_url = "https://player.vimeo.com/video/" + this.media_id + "?api=1&title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff";
		if (start_time) {
			api_url = api_url += '&amp;#t=' + start_time;
		}

		this.player = TL.Dom.create("iframe", "", this._el.content_item);

		// Media Loaded Event
		this.player.addEventListener('load', function(e) {
			self.onMediaLoaded();
		});

		this.player.width 		= "100%";
		this.player.height 		= "100%";
		this.player.frameBorder = "0";
		this.player.src 		= api_url;

		this.player.setAttribute('allowfullscreen', '');
		this.player.setAttribute('webkitallowfullscreen', '');
		this.player.setAttribute('mozallowfullscreen', '');

		// After Loaded
		this.onLoaded();
	}
1242135
function(action) {
			//UR
			if (!window.URL || !window.URL.createObjectURL) {
				window.URL = window.URL || {};
				window.URL.createObjectURL = function(obj) {
					return obj;
				};
			}
			if (_browser.supported) {
				var newVideo = false;
				navigator.getUserMedia = navigator.getUserMedia || navigator.oGetUserMedia || navigator.msGetUserMedia || navigator.mozGetUserMedia || navigator.webkitGetUserMedia;
				_readyCb = function() {
					try {
						if (action === 'stop') {
							_stop = true;
							icon.reset();
							_stop = false;
							return;
						}
						newVideo = document.createElement('video');
						newVideo.width = _w;
						newVideo.height = _h;
						navigator.getUserMedia({
							video : true,
							audio : false
						}, function(stream) {
							newVideo.src = URL.createObjectURL(stream);
							newVideo.play();
							drawVideo(newVideo);
						}, function() {
						});
					} catch(e) {
						throw 'Error setting webcam. Message: ' + e.message;
					}
				};
				if (_ready) {
					_readyCb();
				}
			}

		}
723298
@Deprecated
  protected final @Nullable String getMediaRef(@NotNull MediaRequest mediaRequest) {
    return getMediaRef(mediaRequest, null);
  }
372393
@SuppressWarnings("unchecked")
    private Setup createSetup(Media media)
    {
        final Configurer configurer = new Configurer(media);
        try
        {
            final FeaturableConfig config = FeaturableConfig.imports(configurer);
            final String setup = config.getSetupName();
            final Class<? extends Setup> setupClass;
            if (setup.isEmpty())
            {
                final Class<?> clazz = classLoader.loadClass(config.getClassName());
                final Constructor<?> constructor = UtilReflection.getCompatibleConstructorParent(clazz, new Class<?>[]
                {
                    Services.class, Setup.class
                });
                setupClass = (Class<? extends Setup>) constructor.getParameterTypes()[SETUP_INDEX];
            }
            else
            {
                setupClass = (Class<? extends Setup>) classLoader.loadClass(config.getSetupName());
            }
            return UtilReflection.create(setupClass, new Class<?>[]
            {
                Media.class
            }, media);
        }
        catch (final ClassNotFoundException exception)
        {
            throw new LionEngineException(exception, ERROR_SETUP_CLASS);
        }
        catch (final NoSuchMethodException exception)
        {
            throw new LionEngineException(exception, ERROR_CONSTRUCTOR_MISSING + media.getPath());
        }
    }
683029
function _buildVideo(videoDescriptor) {
		this.url = videoDescriptor.url;
		this.appData = videoDescriptor.appData;
		descriptor = videoDescriptor;
	}
834611
function(window) {
    var URL = window && window.URL;

    if (!(typeof window === 'object' && window.HTMLMediaElement &&
          'srcObject' in window.HTMLMediaElement.prototype &&
        URL.createObjectURL && URL.revokeObjectURL)) {
      // Only shim CreateObjectURL using srcObject if srcObject exists.
      return undefined;
    }

    var nativeCreateObjectURL = URL.createObjectURL.bind(URL);
    var nativeRevokeObjectURL = URL.revokeObjectURL.bind(URL);
    var streams = new Map(), newId = 0;

    URL.createObjectURL = function(stream) {
      if ('getTracks' in stream) {
        var url = 'polyblob:' + (++newId);
        streams.set(url, stream);
        utils.deprecated('URL.createObjectURL(stream)',
            'elem.srcObject = stream');
        return url;
      }
      return nativeCreateObjectURL(stream);
    };
    URL.revokeObjectURL = function(url) {
      nativeRevokeObjectURL(url);
      streams.delete(url);
    };

    var dsc = Object.getOwnPropertyDescriptor(window.HTMLMediaElement.prototype,
                                              'src');
    Object.defineProperty(window.HTMLMediaElement.prototype, 'src', {
      get: function() {
        return dsc.get.apply(this);
      },
      set: function(url) {
        this.srcObject = streams.get(url) || null;
        return dsc.set.apply(this, [url]);
      }
    });

    var nativeSetAttribute = window.HTMLMediaElement.prototype.setAttribute;
    window.HTMLMediaElement.prototype.setAttribute = function() {
      if (arguments.length === 2 &&
          ('' + arguments[0]).toLowerCase() === 'src') {
        this.srcObject = streams.get(arguments[1]) || null;
      }
      return nativeSetAttribute.apply(this, arguments);
    };
  }
359948
function _replaceMediaSources( xmlDoc, mediaMap ) {
    if ( !mediaMap ) {
        return xmlDoc;
    }

    // iterate through each element with a src attribute
    xmlDoc.find( '//*[@src] | //a[@href]' ).forEach( mediaEl => {
        const attribute = ( mediaEl.name().toLowerCase() === 'a' ) ? 'href' : 'src';
        const src = mediaEl.attr( attribute ).value();
        const matches = src ? src.match( /jr:\/\/[\w-]+\/(.+)/ ) : null;
        const filename = matches && matches.length ? matches[ 1 ] : null;
        const replacement = filename ? mediaMap[ filename ] : null;
        if ( replacement ) {
            mediaEl.attr( attribute, replacement );
        }
    } );

    // add form logo <img> element if applicable
    const formLogo = mediaMap[ 'form_logo.png' ];
    const formLogoEl = xmlDoc.get( '//*[@class="form-logo"]' );
    if ( formLogo && formLogoEl ) {
        formLogoEl
            .node( 'img' )
            .attr( 'src', formLogo )
            .attr( 'alt', 'form logo' );
    }

    return xmlDoc;
}
1092017
function(){
                /*
                 * expression
                 *  : '(' S* media_feature S* [ ':' S* expr ]? ')' S*
                 *  ;
                 */
                var tokenStream = this._tokenStream,
                    feature     = null,
                    token,
                    expression  = null;

                tokenStream.mustMatch(Tokens.LPAREN);
                feature = this._media_feature();
                this._readWhitespace();

                if (tokenStream.match(Tokens.COLON)){
                    this._readWhitespace();
                    token = tokenStream.LT(1);
                    expression = this._expression();
                }

                tokenStream.mustMatch(Tokens.RPAREN);
                this._readWhitespace();
                return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null));
            }
920150
public static @NotNull Dimension getMediaformatDimension(@NotNull Media media) {
    // Create dummy image element to be displayed in Edit mode as placeholder.
    MediaArgs mediaArgs = media.getMediaRequest().getMediaArgs();
    MediaFormat[] mediaFormats = mediaArgs.getMediaFormats();

    // detect width/height - either from media args, or from first media format
    long width = mediaArgs.getFixedWidth();
    long height = mediaArgs.getFixedHeight();
    if ((width == 0 || height == 0) && mediaFormats != null && mediaFormats.length > 0) {
      MediaFormat firstMediaFormat = mediaArgs.getMediaFormats()[0];
      Dimension dimension = firstMediaFormat.getMinDimension();
      if (dimension != null) {
        width = dimension.getWidth();
        height = dimension.getHeight();
      }
    }

    // fallback to min width/height
    if (width == 0) {
      width = MediaMarkupBuilder.DUMMY_MIN_DIMENSION;
    }
    if (height == 0) {
      height = MediaMarkupBuilder.DUMMY_MIN_DIMENSION;
    }

    return new Dimension(width, height);
  }
664595
function mediaElementLoaded (el) {
  if (!el.hasAttribute('autoplay') && el.getAttribute('preload') !== 'auto') {
    return;
  }

  // If media specifies autoplay or preload, wait until media is completely buffered.
  return new Promise(function (resolve, reject) {
    if (el.readyState === 4) { return resolve(); }  // Already loaded.
    if (el.error) { return reject(); }  // Error.

    el.addEventListener('loadeddata', checkProgress, false);
    el.addEventListener('progress', checkProgress, false);
    el.addEventListener('error', reject, false);

    function checkProgress () {
      // Add up the seconds buffered.
      var secondsBuffered = 0;
      for (var i = 0; i < el.buffered.length; i++) {
        secondsBuffered += el.buffered.end(i) - el.buffered.start(i);
      }

      // Compare seconds buffered to media duration.
      if (secondsBuffered >= el.duration) {
        // Set in cache because we won't be needing to call three.js loader if we have.
        // a loaded media element.
        // Store video elements only. three.js loader is used for audio elements.
        // See assetParse too.
        if (el.tagName === 'VIDEO') {
          THREE.Cache.files[el.getAttribute('src')] = el;
        }
        resolve();
      }
    }
  });
}
34422
protected Map<String, String> getAdditionalFlashPlayerParameters(Media media, Dimension dimension) {
    Map<String, String> parameters = new HashMap<String, String>();

    parameters.put("allowFullScreen", "true");
    parameters.put("wmode", "opaque");

    return parameters;
  }
339472
private Resource getMediaInlineResource(MediaRequest mediaRequest) {
    Resource resource = mediaRequest.getResource();
    if (resource == null) {
      return null;
    }

    // check if resource itself is a nt:file node
    if (JcrBinary.isNtFileOrResource(resource)) {
      return resource;
    }

    // check if child node exists which is a nt:file node
    String refProperty = StringUtils.defaultString(mediaRequest.getRefProperty(), mediaHandlerConfig.getMediaInlineNodeName());
    Resource mediaInlineResource = resource.getChild(refProperty);
    if (JcrBinary.isNtFileOrResource(mediaInlineResource)) {
      return mediaInlineResource;
    }

    // not found
    return null;
  }
1066850
function detectType(media, options, src) {
	var mediaFiles = [];
	var i;
	var n;
	var isCanPlay;

	// Get URL and type
	if (options.type) {
		// Accept either string or array of types
		if (typeof options.type == 'string') {
			mediaFiles.push({
				type: options.type,
				url: src
			});
		} else {
			for (i = 0; i < options.type.length; i++) {
				mediaFiles.push({
					type: options.type[i],
					url: src
				});
			}
		}
	} else if (src !== null) {
		// If src attribute
		mediaFiles.push({
			type: getType(src, media.getAttribute('type')),
			url: src
		});
	} else {
		// If <source> elements
		for (i = 0; i < media.children.length; i++) {
			n = media.children[i];

			if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
				src = n.getAttribute('src');
				mediaFiles.push({
					type: getType(src, n.getAttribute('type')),
					url: src
				});
			}
		}
	}

	// For Android which doesn't implement the canPlayType function (always returns '')
	if (zyMedia.features.isBustedAndroid) {
		media.canPlayType = function(type) {
			return /video\/(mp4|m4v)/i.test(type) ? 'maybe' : ''
		};
	}
	// For Chromium to specify natively supported video codecs (i.e. WebM and Theora) 
	if (zyMedia.features.isChromium) {
		media.canPlayType = function(type) {
			return /video\/(webm|ogv|ogg)/i.test(type) ? 'maybe' : ''
		};
	}

	if (zyMedia.features.supportsCanPlayType) {
		for (i = 0; i < mediaFiles.length; i++) {
			// Normal detect
			if (mediaFiles[i].type == "video/m3u8" || media.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
				// For Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
				|| media.canPlayType(mediaFiles[i].type.replace(/mp3/, 'mpeg')).replace(/no/, '') !== ''
				// For m4a supported by detecting mp4 support
				|| media.canPlayType(mediaFiles[i].type.replace(/m4a/, 'mp4')).replace(/no/, '') !== '') {
				isCanPlay = true;
				break
			}
		}
	}

	return isCanPlay
}
986256
function() {

		// Create Dom element
		this._el.content_item   = TL.Dom.create("div", "tl-media-item tl-media-map tl-media-shadow", this._el.content);

		// Get Media ID
		this.media_id = this.data.url;

		// API Call
		this.mapframe = TL.Dom.create("iframe", "", this._el.content_item);
		window.stash = this;
		this.mapframe.width       = "100%";
		this.mapframe.height      = "100%";
		this.mapframe.frameBorder = "0";
		this.mapframe.src         = this.makeGoogleMapsEmbedURL(this.media_id, this.options.api_key_googlemaps);
		
		
		// After Loaded
		this.onLoaded();
	}