|
|
@@ -828,7 +828,7 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- var regenerator = runtime_1;
|
|
|
+ var D__project_vapSource_web_node_modules__babel_runtime_regenerator = runtime_1;
|
|
|
|
|
|
function _classCallCheck(instance, Constructor) {
|
|
|
if (!(instance instanceof Constructor)) {
|
|
|
@@ -972,45 +972,56 @@
|
|
|
|
|
|
var possibleConstructorReturn = _possibleConstructorReturn;
|
|
|
|
|
|
- /*! *****************************************************************************
|
|
|
- Copyright (c) Microsoft Corporation.
|
|
|
-
|
|
|
- Permission to use, copy, modify, and/or distribute this software for any
|
|
|
- purpose with or without fee is hereby granted.
|
|
|
-
|
|
|
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
|
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
- PERFORMANCE OF THIS SOFTWARE.
|
|
|
- ***************************************************************************** */
|
|
|
-
|
|
|
- function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
- return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
- step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
- });
|
|
|
+ var getPrototypeOf$1 = createCommonjsModule(function (module) {
|
|
|
+ function _getPrototypeOf(o) {
|
|
|
+ module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
|
+ return o.__proto__ || Object.getPrototypeOf(o);
|
|
|
+ };
|
|
|
+ return _getPrototypeOf(o);
|
|
|
+ }
|
|
|
+
|
|
|
+ module.exports = _getPrototypeOf;
|
|
|
+ });
|
|
|
+
|
|
|
+ /*! *****************************************************************************
|
|
|
+ Copyright (c) Microsoft Corporation.
|
|
|
+
|
|
|
+ Permission to use, copy, modify, and/or distribute this software for any
|
|
|
+ purpose with or without fee is hereby granted.
|
|
|
+
|
|
|
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
|
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
+ PERFORMANCE OF THIS SOFTWARE.
|
|
|
+ ***************************************************************************** */
|
|
|
+
|
|
|
+ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
+ return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- /*
|
|
|
- * Tencent is pleased to support the open source community by making vap available.
|
|
|
- *
|
|
|
- * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
|
|
|
- *
|
|
|
- * Licensed under the MIT License (the "License"); you may not use this file except in
|
|
|
- * compliance with the License. You may obtain a copy of the License at
|
|
|
- *
|
|
|
- * http://opensource.org/licenses/MIT
|
|
|
- *
|
|
|
- * Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
|
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
- * either express or implied. See the License for the specific language governing permissions and
|
|
|
- * limitations under the License.
|
|
|
+ /*
|
|
|
+ * Tencent is pleased to support the open source community by making vap available.
|
|
|
+ *
|
|
|
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
|
|
|
+ *
|
|
|
+ * Licensed under the MIT License (the "License"); you may not use this file except in
|
|
|
+ * compliance with the License. You may obtain a copy of the License at
|
|
|
+ *
|
|
|
+ * http://opensource.org/licenses/MIT
|
|
|
+ *
|
|
|
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
|
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
+ * either express or implied. See the License for the specific language governing permissions and
|
|
|
+ * limitations under the License.
|
|
|
*/
|
|
|
|
|
|
var FrameParser = /*#__PURE__*/function () {
|
|
|
@@ -1026,8 +1037,8 @@
|
|
|
createClass(FrameParser, [{
|
|
|
key: "init",
|
|
|
value: function init() {
|
|
|
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
|
- return regenerator.wrap(function _callee$(_context) {
|
|
|
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/D__project_vapSource_web_node_modules__babel_runtime_regenerator.mark(function _callee() {
|
|
|
+ return D__project_vapSource_web_node_modules__babel_runtime_regenerator.wrap(function _callee$(_context) {
|
|
|
while (1) {
|
|
|
switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
@@ -1098,10 +1109,10 @@
|
|
|
|
|
|
var src = this.srcData = {};
|
|
|
return Promise.all((dataJson.src || []).map(function (item) {
|
|
|
- return __awaiter(_this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
|
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/D__project_vapSource_web_node_modules__babel_runtime_regenerator.mark(function _callee2() {
|
|
|
var _this2 = this;
|
|
|
|
|
|
- return regenerator.wrap(function _callee2$(_context2) {
|
|
|
+ return D__project_vapSource_web_node_modules__babel_runtime_regenerator.wrap(function _callee2$(_context2) {
|
|
|
while (1) {
|
|
|
switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
@@ -1165,10 +1176,10 @@
|
|
|
}));
|
|
|
}));
|
|
|
}
|
|
|
- /**
|
|
|
- * 下载json文件
|
|
|
- * @param jsonUrl json外链
|
|
|
- * @returns {Promise}
|
|
|
+ /**
|
|
|
+ * 下载json文件
|
|
|
+ * @param jsonUrl json外链
|
|
|
+ * @returns {Promise}
|
|
|
*/
|
|
|
|
|
|
}, {
|
|
|
@@ -1191,9 +1202,9 @@
|
|
|
xhr.send();
|
|
|
});
|
|
|
}
|
|
|
- /**
|
|
|
- * 文字转换图片
|
|
|
- * @param {*} param0
|
|
|
+ /**
|
|
|
+ * 文字转换图片
|
|
|
+ * @param {*} param0
|
|
|
*/
|
|
|
|
|
|
}, {
|
|
|
@@ -1236,20 +1247,20 @@
|
|
|
return FrameParser;
|
|
|
}();
|
|
|
|
|
|
- /*
|
|
|
- * Tencent is pleased to support the open source community by making vap available.
|
|
|
- *
|
|
|
- * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
|
|
|
- *
|
|
|
- * Licensed under the MIT License (the "License"); you may not use this file except in
|
|
|
- * compliance with the License. You may obtain a copy of the License at
|
|
|
- *
|
|
|
- * http://opensource.org/licenses/MIT
|
|
|
- *
|
|
|
- * Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
|
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
- * either express or implied. See the License for the specific language governing permissions and
|
|
|
- * limitations under the License.
|
|
|
+ /*
|
|
|
+ * Tencent is pleased to support the open source community by making vap available.
|
|
|
+ *
|
|
|
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
|
|
|
+ *
|
|
|
+ * Licensed under the MIT License (the "License"); you may not use this file except in
|
|
|
+ * compliance with the License. You may obtain a copy of the License at
|
|
|
+ *
|
|
|
+ * http://opensource.org/licenses/MIT
|
|
|
+ *
|
|
|
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
|
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
+ * either express or implied. See the License for the specific language governing permissions and
|
|
|
+ * limitations under the License.
|
|
|
*/
|
|
|
function createShader(gl, type, source) {
|
|
|
var shader = gl.createShader(type);
|
|
|
@@ -1382,6 +1393,8 @@
|
|
|
video.crossOrigin = 'anonymous';
|
|
|
video.autoplay = false;
|
|
|
video.preload = 'auto';
|
|
|
+ video.setAttribute('playsinline', '');
|
|
|
+ video.setAttribute('webkit-playsinline', '');
|
|
|
|
|
|
if (options.mute) {
|
|
|
video.muted = true;
|
|
|
@@ -1525,7 +1538,7 @@
|
|
|
return VapVideo;
|
|
|
}();
|
|
|
|
|
|
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }
|
|
|
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf$1(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf$1(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }
|
|
|
|
|
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
|
var clearTimer = null;
|
|
|
@@ -1568,8 +1581,8 @@
|
|
|
createClass(WebglRenderVap, [{
|
|
|
key: "init",
|
|
|
value: function init() {
|
|
|
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
|
- return regenerator.wrap(function _callee$(_context) {
|
|
|
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/D__project_vapSource_web_node_modules__babel_runtime_regenerator.mark(function _callee() {
|
|
|
+ return D__project_vapSource_web_node_modules__babel_runtime_regenerator.wrap(function _callee$(_context) {
|
|
|
while (1) {
|
|
|
switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
@@ -1666,8 +1679,8 @@
|
|
|
return gl;
|
|
|
}
|
|
|
}
|
|
|
- /**
|
|
|
- * 顶点着色器
|
|
|
+ /**
|
|
|
+ * 顶点着色器
|
|
|
*/
|
|
|
|
|
|
}, {
|
|
|
@@ -1676,8 +1689,8 @@
|
|
|
var gl = this.instance.gl;
|
|
|
return createShader(gl, gl.VERTEX_SHADER, "attribute vec2 a_position; // \u63A5\u53D7\u9876\u70B9\u5750\u6807\n attribute vec2 a_texCoord; // \u63A5\u53D7\u7EB9\u7406\u5750\u6807\n attribute vec2 a_alpha_texCoord; // \u63A5\u53D7\u7EB9\u7406\u5750\u6807\n varying vec2 v_alpha_texCoord; // \u63A5\u53D7\u7EB9\u7406\u5750\u6807\n varying vec2 v_texcoord; // \u4F20\u9012\u7EB9\u7406\u5750\u6807\u7ED9\u7247\u5143\u7740\u8272\u5668\n void main(void){\n gl_Position = vec4(a_position, 0.0, 1.0); // \u8BBE\u7F6E\u5750\u6807\n v_texcoord = a_texCoord; // \u8BBE\u7F6E\u7EB9\u7406\u5750\u6807\n v_alpha_texCoord = a_alpha_texCoord; // \u8BBE\u7F6E\u7EB9\u7406\u5750\u6807\n }");
|
|
|
}
|
|
|
- /**
|
|
|
- * 片元着色器
|
|
|
+ /**
|
|
|
+ * 片元着色器
|
|
|
*/
|
|
|
|
|
|
}, {
|
|
|
@@ -1692,13 +1705,15 @@
|
|
|
|
|
|
if (textureSize > 0) {
|
|
|
var imgColor = [];
|
|
|
+ var samplers = [];
|
|
|
|
|
|
for (var i = 0; i < textureSize; i++) {
|
|
|
- imgColor.push("if(ndx == ".concat(i, "){\n color = texture2D(textures[").concat(i, "],uv);\n }"));
|
|
|
+ imgColor.push("if(ndx == ".concat(i + 1, "){\n color = texture2D(u_image").concat(i + 1, ",uv);\n }"));
|
|
|
+ samplers.push("uniform sampler2D u_image".concat(i + 1, ";"));
|
|
|
}
|
|
|
|
|
|
- sourceUniform = "\n uniform sampler2D u_image[".concat(textureSize, "];\n uniform float image_pos[").concat(textureSize * PER_SIZE, "];\n vec4 getSampleFromArray(sampler2D textures[").concat(textureSize, "], int ndx, vec2 uv) {\n vec4 color;\n ").concat(imgColor.join(' else '), "\n return color;\n }\n ");
|
|
|
- sourceTexure = "\n vec4 srcColor,maskColor;\n vec2 srcTexcoord,maskTexcoord;\n int srcIndex;\n float x1,x2,y1,y2,mx1,mx2,my1,my2; //\u663E\u793A\u7684\u533A\u57DF\n\n for(int i=0;i<".concat(textureSize * PER_SIZE, ";i+= ").concat(PER_SIZE, "){\n if ((int(image_pos[i]) > 0)) {\n srcIndex = int(image_pos[i]);\n \n x1 = image_pos[i+1];\n x2 = image_pos[i+2];\n y1 = image_pos[i+3];\n y2 = image_pos[i+4];\n \n mx1 = image_pos[i+5];\n mx2 = image_pos[i+6];\n my1 = image_pos[i+7];\n my2 = image_pos[i+8];\n \n \n if (v_texcoord.s>x1 && v_texcoord.s<x2 && v_texcoord.t>y1 && v_texcoord.t<y2) {\n srcTexcoord = vec2((v_texcoord.s-x1)/(x2-x1),(v_texcoord.t-y1)/(y2-y1));\n maskTexcoord = vec2(mx1+srcTexcoord.s*(mx2-mx1),my1+srcTexcoord.t*(my2-my1));\n srcColor = getSampleFromArray(u_image,srcIndex,srcTexcoord);\n maskColor = texture2D(u_image_video, maskTexcoord);\n srcColor.a = srcColor.a*(maskColor.r);\n \n bgColor = vec4(srcColor.rgb*srcColor.a,srcColor.a) + (1.0-srcColor.a)*bgColor;\n \n } \n }\n }\n ");
|
|
|
+ sourceUniform = "\n ".concat(samplers.join('\n'), "\n uniform float image_pos[").concat(textureSize * PER_SIZE, "];\n vec4 getSampleFromArray(int ndx, vec2 uv) {\n vec4 color;\n ").concat(imgColor.join(' else '), "\n return color;\n }\n ");
|
|
|
+ sourceTexure = "\n vec4 srcColor,maskColor;\n vec2 srcTexcoord,maskTexcoord;\n int srcIndex;\n float x1,x2,y1,y2,mx1,mx2,my1,my2; //\u663E\u793A\u7684\u533A\u57DF\n\n for(int i=0;i<".concat(textureSize * PER_SIZE, ";i+= ").concat(PER_SIZE, "){\n if ((int(image_pos[i]) > 0)) {\n srcIndex = int(image_pos[i]);\n \n x1 = image_pos[i+1];\n x2 = image_pos[i+2];\n y1 = image_pos[i+3];\n y2 = image_pos[i+4];\n \n mx1 = image_pos[i+5];\n mx2 = image_pos[i+6];\n my1 = image_pos[i+7];\n my2 = image_pos[i+8];\n \n \n if (v_texcoord.s>x1 && v_texcoord.s<x2 && v_texcoord.t>y1 && v_texcoord.t<y2) {\n srcTexcoord = vec2((v_texcoord.s-x1)/(x2-x1),(v_texcoord.t-y1)/(y2-y1));\n maskTexcoord = vec2(mx1+srcTexcoord.s*(mx2-mx1),my1+srcTexcoord.t*(my2-my1));\n srcColor = getSampleFromArray(srcIndex,srcTexcoord);\n maskColor = texture2D(u_image_video, maskTexcoord);\n srcColor.a = srcColor.a*(maskColor.r);\n \n bgColor = vec4(srcColor.rgb*srcColor.a,srcColor.a) + (1.0-srcColor.a)*bgColor;\n \n } \n }\n }\n ");
|
|
|
}
|
|
|
|
|
|
var fragmentSharder = "\n precision lowp float;\n varying vec2 v_texcoord;\n varying vec2 v_alpha_texCoord;\n uniform sampler2D u_image_video;\n ".concat(sourceUniform, "\n \n void main(void) {\n vec4 bgColor = ").concat(bgColor, "\n ").concat(sourceTexure, "\n // bgColor = texture2D(u_image[0], v_texcoord);\n gl_FragColor = bgColor;\n }\n ");
|
|
|
@@ -1720,7 +1735,7 @@
|
|
|
var resource = resources[key];
|
|
|
this.textures.push(createTexture(gl, i, resource.img));
|
|
|
|
|
|
- var _sampler = gl.getUniformLocation(this.program, "u_image[".concat(i, "]"));
|
|
|
+ var _sampler = gl.getUniformLocation(this.program, "u_image".concat(i));
|
|
|
|
|
|
gl.uniform1i(_sampler, i);
|
|
|
this.vapFrameParser.textureMap[resource.srcId] = i++;
|
|
|
@@ -1793,7 +1808,7 @@
|
|
|
var gl = this.instance.gl;
|
|
|
|
|
|
if (!gl) {
|
|
|
- get(getPrototypeOf(WebglRenderVap.prototype), "drawFrame", this).call(this);
|
|
|
+ get(getPrototypeOf$1(WebglRenderVap.prototype), "drawFrame", this).call(this);
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
@@ -1841,7 +1856,7 @@
|
|
|
|
|
|
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
|
|
|
|
- get(getPrototypeOf(WebglRenderVap.prototype), "drawFrame", this).call(this);
|
|
|
+ get(getPrototypeOf$1(WebglRenderVap.prototype), "drawFrame", this).call(this);
|
|
|
}
|
|
|
}, {
|
|
|
key: "destroy",
|
|
|
@@ -1861,7 +1876,7 @@
|
|
|
} // glUtil.cleanWebGL(gl, this.shaders, this.program, this.textures, this.buffers)
|
|
|
|
|
|
|
|
|
- get(getPrototypeOf(WebglRenderVap.prototype), "destroy", this).call(this);
|
|
|
+ get(getPrototypeOf$1(WebglRenderVap.prototype), "destroy", this).call(this);
|
|
|
|
|
|
this.clearMemoryCache();
|
|
|
}
|
|
|
@@ -1882,10 +1897,10 @@
|
|
|
}(VapVideo);
|
|
|
|
|
|
var isCanWebGL;
|
|
|
- /**
|
|
|
- * @param options
|
|
|
- * @constructor
|
|
|
- * @return {null}
|
|
|
+ /**
|
|
|
+ * @param options
|
|
|
+ * @constructor
|
|
|
+ * @return {null}
|
|
|
*/
|
|
|
|
|
|
function index (options) {
|