奇点
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.
 
 
 
 

437 lines
14 KiB

import {
require_window,
video_es_default
} from "./chunk-2C77MW7E.js";
import {
__toESM,
init_define_process_env_UNI_STAT_TITLE_JSON,
init_define_process_env_UNI_STAT_UNI_CLOUD
} from "./chunk-UMUGEEWL.js";
// dep:videojs-flash
init_define_process_env_UNI_STAT_TITLE_JSON();
init_define_process_env_UNI_STAT_UNI_CLOUD();
// F:/DigitalArt/node_modules/videojs-flash/dist/videojs-flash.es.js
init_define_process_env_UNI_STAT_TITLE_JSON();
init_define_process_env_UNI_STAT_UNI_CLOUD();
// F:/DigitalArt/node_modules/videojs-swf/package.json
var version = "5.4.2";
// F:/DigitalArt/node_modules/videojs-flash/dist/videojs-flash.es.js
var import_window = __toESM(require_window());
var version$1 = "2.2.1";
function FlashRtmpDecorator(Flash2) {
Flash2.streamingFormats = {
"rtmp/mp4": "MP4",
"rtmp/flv": "FLV"
};
Flash2.streamFromParts = function(connection, stream) {
return connection + "&" + stream;
};
Flash2.streamToParts = function(src) {
var parts = {
connection: "",
stream: ""
};
if (!src) {
return parts;
}
var connEnd = src.search(/&(?![\w-]+=)/);
var streamBegin = void 0;
if (connEnd !== -1) {
streamBegin = connEnd + 1;
} else {
connEnd = streamBegin = src.lastIndexOf("/") + 1;
if (connEnd === 0) {
connEnd = streamBegin = src.length;
}
}
parts.connection = src.substring(0, connEnd);
parts.stream = src.substring(streamBegin, src.length);
return parts;
};
Flash2.isStreamingType = function(srcType) {
return srcType in Flash2.streamingFormats;
};
Flash2.RTMP_RE = /^rtmp[set]?:\/\//i;
Flash2.isStreamingSrc = function(src) {
return Flash2.RTMP_RE.test(src);
};
Flash2.rtmpSourceHandler = {};
Flash2.rtmpSourceHandler.canPlayType = function(type) {
if (Flash2.isStreamingType(type)) {
return "maybe";
}
return "";
};
Flash2.rtmpSourceHandler.canHandleSource = function(source, options) {
var can = Flash2.rtmpSourceHandler.canPlayType(source.type);
if (can) {
return can;
}
if (Flash2.isStreamingSrc(source.src)) {
return "maybe";
}
return "";
};
Flash2.rtmpSourceHandler.handleSource = function(source, tech, options) {
var srcParts = Flash2.streamToParts(source.src);
tech.setRtmpConnection(srcParts.connection);
tech.setRtmpStream(srcParts.stream);
};
Flash2.registerSourceHandler(Flash2.rtmpSourceHandler);
return Flash2;
}
var classCallCheck = function(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var inherits = function(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass)
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var possibleConstructorReturn = function(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var Tech = video_es_default.getComponent("Tech");
var Dom = video_es_default.dom;
var Url = video_es_default.url;
var createTimeRange = video_es_default.createTimeRange;
var mergeOptions = video_es_default.mergeOptions;
var navigator = import_window.default && import_window.default.navigator || {};
var Flash = function(_Tech) {
inherits(Flash2, _Tech);
function Flash2(options, ready) {
classCallCheck(this, Flash2);
var _this = possibleConstructorReturn(this, _Tech.call(this, options, ready));
if (options.source) {
_this.ready(function() {
this.setSource(options.source);
}, true);
}
if (options.startTime) {
_this.ready(function() {
this.load();
this.play();
this.currentTime(options.startTime);
}, true);
}
import_window.default.videojs = import_window.default.videojs || {};
import_window.default.videojs.Flash = import_window.default.videojs.Flash || {};
import_window.default.videojs.Flash.onReady = Flash2.onReady;
import_window.default.videojs.Flash.onEvent = Flash2.onEvent;
import_window.default.videojs.Flash.onError = Flash2.onError;
_this.on("seeked", function() {
this.lastSeekTarget_ = void 0;
});
return _this;
}
Flash2.prototype.createEl = function createEl() {
var options = this.options_;
if (!options.swf) {
options.swf = "https://vjs.zencdn.net/swf/" + version + "/video-js.swf";
}
var objId = options.techId;
var flashVars = mergeOptions({
readyFunction: "videojs.Flash.onReady",
eventProxyFunction: "videojs.Flash.onEvent",
errorEventProxyFunction: "videojs.Flash.onError",
autoplay: options.autoplay,
preload: options.preload,
loop: options.loop,
muted: options.muted
}, options.flashVars);
var params = mergeOptions({
wmode: "opaque",
bgcolor: "#000000"
}, options.params);
var attributes = mergeOptions({
id: objId,
name: objId,
"class": "vjs-tech"
}, options.attributes);
this.el_ = Flash2.embed(options.swf, flashVars, params, attributes);
this.el_.tech = this;
return this.el_;
};
Flash2.prototype.play = function play() {
if (this.ended()) {
this.setCurrentTime(0);
}
this.el_.vjs_play();
};
Flash2.prototype.pause = function pause() {
this.el_.vjs_pause();
};
Flash2.prototype.src = function src(_src) {
if (_src === void 0) {
return this.currentSrc();
}
return this.setSrc(_src);
};
Flash2.prototype.setSrc = function setSrc(src) {
var _this2 = this;
src = Url.getAbsoluteURL(src);
this.el_.vjs_src(src);
if (this.autoplay()) {
this.setTimeout(function() {
return _this2.play();
}, 0);
}
};
Flash2.prototype.seeking = function seeking() {
return this.lastSeekTarget_ !== void 0;
};
Flash2.prototype.setCurrentTime = function setCurrentTime(time) {
var seekable = this.seekable();
if (seekable.length) {
time = time > seekable.start(0) ? time : seekable.start(0);
time = time < seekable.end(seekable.length - 1) ? time : seekable.end(seekable.length - 1);
this.lastSeekTarget_ = time;
this.trigger("seeking");
this.el_.vjs_setProperty("currentTime", time);
_Tech.prototype.setCurrentTime.call(this);
}
};
Flash2.prototype.currentTime = function currentTime() {
if (this.seeking()) {
return this.lastSeekTarget_ || 0;
}
return this.el_.vjs_getProperty("currentTime");
};
Flash2.prototype.currentSrc = function currentSrc() {
if (this.currentSource_) {
return this.currentSource_.src;
}
return this.el_.vjs_getProperty("currentSrc");
};
Flash2.prototype.duration = function duration() {
if (this.readyState() === 0) {
return NaN;
}
var duration2 = this.el_.vjs_getProperty("duration");
return duration2 >= 0 ? duration2 : Infinity;
};
Flash2.prototype.load = function load() {
this.el_.vjs_load();
};
Flash2.prototype.poster = function poster() {
this.el_.vjs_getProperty("poster");
};
Flash2.prototype.setPoster = function setPoster() {
};
Flash2.prototype.seekable = function seekable() {
var duration = this.duration();
if (duration === 0) {
return createTimeRange();
}
return createTimeRange(0, duration);
};
Flash2.prototype.buffered = function buffered() {
var ranges = this.el_.vjs_getProperty("buffered");
if (ranges.length === 0) {
return createTimeRange();
}
return createTimeRange(ranges[0][0], ranges[0][1]);
};
Flash2.prototype.supportsFullScreen = function supportsFullScreen() {
return false;
};
Flash2.prototype.enterFullScreen = function enterFullScreen() {
return false;
};
Flash2.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
var videoPlaybackQuality = this.el_.vjs_getProperty("getVideoPlaybackQuality");
if (import_window.default.performance && typeof import_window.default.performance.now === "function") {
videoPlaybackQuality.creationTime = import_window.default.performance.now();
} else if (import_window.default.performance && import_window.default.performance.timing && typeof import_window.default.performance.timing.navigationStart === "number") {
videoPlaybackQuality.creationTime = import_window.default.Date.now() - import_window.default.performance.timing.navigationStart;
}
return videoPlaybackQuality;
};
return Flash2;
}(Tech);
var _readWrite = ["rtmpConnection", "rtmpStream", "preload", "defaultPlaybackRate", "playbackRate", "autoplay", "loop", "controls", "volume", "muted", "defaultMuted"];
var _readOnly = ["networkState", "readyState", "initialTime", "startOffsetTime", "paused", "ended", "videoWidth", "videoHeight"];
var _api = Flash.prototype;
function _createSetter(attr) {
var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
_api["set" + attrUpper] = function(val) {
return this.el_.vjs_setProperty(attr, val);
};
}
function _createGetter(attr) {
_api[attr] = function() {
return this.el_.vjs_getProperty(attr);
};
}
for (i = 0; i < _readWrite.length; i++) {
_createGetter(_readWrite[i]);
_createSetter(_readWrite[i]);
}
var i;
for (_i = 0; _i < _readOnly.length; _i++) {
_createGetter(_readOnly[_i]);
}
var _i;
Flash.isSupported = function() {
if (video_es_default.browser.IS_CHROME && (!video_es_default.browser.IS_ANDROID || !video_es_default.browser.IS_IOS) || video_es_default.browser.IS_SAFARI && !video_es_default.browser.IS_IOS || video_es_default.browser.IS_EDGE) {
return true;
}
return Flash.version()[0] >= 10;
};
Tech.withSourceHandlers(Flash);
Flash.nativeSourceHandler = {};
Flash.nativeSourceHandler.canPlayType = function(type) {
if (type in Flash.formats) {
return "maybe";
}
return "";
};
Flash.nativeSourceHandler.canHandleSource = function(source, options) {
var type = void 0;
function guessMimeType(src) {
var ext = Url.getFileExtension(src);
if (ext) {
return "video/" + ext;
}
return "";
}
if (!source.type) {
type = guessMimeType(source.src);
} else {
type = source.type.replace(/;.*/, "").toLowerCase();
}
return Flash.nativeSourceHandler.canPlayType(type);
};
Flash.nativeSourceHandler.handleSource = function(source, tech, options) {
tech.setSrc(source.src);
};
Flash.nativeSourceHandler.dispose = function() {
};
Flash.registerSourceHandler(Flash.nativeSourceHandler);
Flash.formats = {
"video/flv": "FLV",
"video/x-flv": "FLV",
"video/mp4": "MP4",
"video/m4v": "MP4"
};
Flash.onReady = function(currSwf) {
var el = Dom.$("#" + currSwf);
var tech = el && el.tech;
if (tech && tech.el()) {
Flash.checkReady(tech);
}
};
Flash.checkReady = function(tech) {
if (!tech.el()) {
return;
}
if (tech.el().vjs_getProperty) {
tech.triggerReady();
} else {
this.setTimeout(function() {
Flash.checkReady(tech);
}, 50);
}
};
Flash.onEvent = function(swfID, eventName) {
var tech = Dom.$("#" + swfID).tech;
var args = Array.prototype.slice.call(arguments, 2);
tech.setTimeout(function() {
tech.trigger(eventName, args);
}, 1);
};
Flash.onError = function(swfID, err) {
var tech = Dom.$("#" + swfID).tech;
if (err === "srcnotfound") {
return tech.error(4);
}
if (typeof err === "string") {
tech.error("FLASH: " + err);
} else {
err.origin = "flash";
tech.error(err);
}
};
Flash.version = function() {
var version$$1 = "0,0,0";
try {
version$$1 = new import_window.default.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
} catch (e) {
try {
if (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
version$$1 = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
}
} catch (err) {
}
}
return version$$1.split(",");
};
Flash.embed = function(swf, flashVars, params, attributes) {
var code = Flash.getEmbedCode(swf, flashVars, params, attributes);
var obj = Dom.createEl("div", { innerHTML: code }).childNodes[0];
return obj;
};
Flash.getEmbedCode = function(swf, flashVars, params, attributes) {
var objTag = '<object type="application/x-shockwave-flash" ';
var flashVarsString = "";
var paramsString = "";
var attrsString = "";
if (flashVars) {
Object.getOwnPropertyNames(flashVars).forEach(function(key) {
flashVarsString += key + "=" + flashVars[key] + "&amp;";
});
}
params = mergeOptions({
movie: swf,
flashvars: flashVarsString,
allowScriptAccess: "always",
allowNetworking: "all"
}, params);
Object.getOwnPropertyNames(params).forEach(function(key) {
paramsString += '<param name="' + key + '" value="' + params[key] + '" />';
});
attributes = mergeOptions({
data: swf,
width: "100%",
height: "100%"
}, attributes);
Object.getOwnPropertyNames(attributes).forEach(function(key) {
attrsString += key + '="' + attributes[key] + '" ';
});
return "" + objTag + attrsString + ">" + paramsString + "</object>";
};
FlashRtmpDecorator(Flash);
if (Tech.getTech("Flash")) {
video_es_default.log.warn("Not using videojs-flash as it appears to already be registered");
video_es_default.log.warn("videojs-flash should only be used with video.js@6 and above");
} else {
video_es_default.registerTech("Flash", Flash);
}
Flash.VERSION = version$1;
var videojs_flash_es_default = Flash;
// dep:videojs-flash
var videojs_flash_default = videojs_flash_es_default;
export {
videojs_flash_default as default
};
//# sourceMappingURL=videojs-flash.js.map