render: function renderVideo()

in seriously.js [5726:5774]


				render: function renderVideo(gl) {
					var source,
						error;

					lastRenderTime = video.currentTime;

					if (!video.videoHeight || !video.videoWidth) {
						return false;
					}

					if (noVideoTextureSupport) {
						if (!ctx2d) {
							ctx2d = document.createElement('canvas').getContext('2d');
							canvas = ctx2d.canvas;
							canvas.width = me.width;
							canvas.height = me.height;
						}
						source = canvas;
						ctx2d.drawImage(video, 0, 0, me.width, me.height);
					} else {
						source = video;
					}

					gl.bindTexture(gl.TEXTURE_2D, me.texture);
					gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, me.flip);
					gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
					try {
						gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);

						//workaround for lack of video texture support in IE
						if (noVideoTextureSupport === undefined) {
							error = gl.getError();
							if (error === gl.INVALID_VALUE) {
								noVideoTextureSupport = true;
								return renderVideo(gl);
							}
							noVideoTextureSupport = false;
						}
						return true;
					} catch (securityError) {
						if (securityError.code === window.DOMException.SECURITY_ERR) {
							me.allowRefresh = false;
							Seriously.logger.error('Unable to access cross-domain image');
						} else {
							Seriously.logger.error('Error rendering video source', securityError);
						}
					}
					return false;
				},