UNPKG

ng-cw-v12

Version:

Angular UI component library

816 lines (802 loc) 44.2 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('hls.js'), require('flv.js')) : typeof define === 'function' && define.amd ? define('ng-cw-v12/video', ['exports', '@angular/core', '@angular/common', 'hls.js', 'flv.js'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["ng-cw-v12"] = global["ng-cw-v12"] || {}, global["ng-cw-v12"].video = {}), global.ng.core, global.ng.common, global.Hls, global.flvjs)); })(this, (function (exports, i0, i2, Hls, flvjs) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n["default"] = e; return Object.freeze(n); } var i0__namespace = /*#__PURE__*/_interopNamespace(i0); var i2__namespace = /*#__PURE__*/_interopNamespace(i2); var Hls__default = /*#__PURE__*/_interopDefaultLegacy(Hls); var flvjs__default = /*#__PURE__*/_interopDefaultLegacy(flvjs); /****************************************************************************** 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. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); }; } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.push(_); } else if (_ = accept(result)) { if (kind === "field") initializers.push(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; } ; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; } ; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); } ; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); } ; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } 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()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function (o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function () { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function (o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; } ; var __setModuleDefault = Object.create ? (function (o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function (o, v) { o["default"] = v; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } var LocalService = /** @class */ (function () { function LocalService() { } /** * 格式化时间 * @param type 格式化类型yyyy-MM-dd HH:mm:ss,注意MM为月份、mm为分钟 * @param time 可选。默认当前时间 * @returns yyyy-MM-dd HH:mm:ss */ LocalService.prototype.formatDate = function (type, time) { if (!time) { time = new Date(); } else { time = new Date(time); } if (!type) { return ''; } var year = time.getFullYear(); var month = (time.getMonth() + 1).toString().padStart(2, '0'); var date = (time.getDate()).toString().padStart(2, '0'); var hours = (time.getHours()).toString().padStart(2, '0'); var minute = (time.getMinutes()).toString().padStart(2, '0'); var second = (time.getSeconds()).toString().padStart(2, '0'); return type.replace('yyyy', year).replace('MM', month).replace('dd', date).replace('HH', hours).replace('mm', minute).replace('ss', second); }; /** * 获取文件后缀 * @param filename string 文件名 * @returns extension */ LocalService.prototype.getFileExtension = function (filename) { if (!filename) { return ''; } var filenameArr = filename.split('.'); if (filenameArr.length == 0) { return ''; } else { var extension = filenameArr.pop(); return extension.toLowerCase(); } }; return LocalService; }()); LocalService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: LocalService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable }); LocalService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: LocalService, providedIn: 'root' }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: LocalService, decorators: [{ type: i0.Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: function () { return []; } }); var VideoComponent = /** @class */ (function () { function VideoComponent(eleRef, ls) { this.eleRef = eleRef; this.ls = ls; this.videoUrl = ''; this.videoHover = false; this.playError = false; this.ncCoverUrl = ''; //封面图片地址 this.ncLoaded = new i0.EventEmitter(); //返回video this.ncPlaying = new i0.EventEmitter(); //返回播放状态 this.mutedMode = true; this.autoplayMode = false; this.loopMode = false; this.fillMode = false; this.screenshotMode = false; this.coverMode = false; this.controlsMode = true; } Object.defineProperty(VideoComponent.prototype, "ncUrl", { set: function (value) { var _this = this; this.videoUrl = value; setTimeout(function () { //加延迟,防止其他传入参数未获取到 _this.initVideo(); }); }, enumerable: false, configurable: true }); ; Object.defineProperty(VideoComponent.prototype, "ncMuted", { //静音 set: function (value) { this.mutedMode = value !== null && value !== undefined && value !== false && value !== 'false'; }, enumerable: false, configurable: true }); Object.defineProperty(VideoComponent.prototype, "ncAutoplay", { //自动播放 set: function (value) { this.autoplayMode = value !== null && value !== undefined && value !== false && value !== 'false'; }, enumerable: false, configurable: true }); Object.defineProperty(VideoComponent.prototype, "ncLoop", { //循环播放 set: function (value) { this.loopMode = value !== null && value !== undefined && value !== false && value !== 'false'; }, enumerable: false, configurable: true }); Object.defineProperty(VideoComponent.prototype, "ncFill", { //铺满 set: function (value) { this.fillMode = value !== null && value !== undefined && value !== false && value !== 'false'; }, enumerable: false, configurable: true }); Object.defineProperty(VideoComponent.prototype, "ncScreenshot", { //截图 set: function (value) { this.screenshotMode = value !== null && value !== undefined && value !== false && value !== 'false'; }, enumerable: false, configurable: true }); Object.defineProperty(VideoComponent.prototype, "ncCover", { //封面 set: function (value) { this.coverMode = value !== null && value !== undefined && value !== false && value !== 'false'; }, enumerable: false, configurable: true }); Object.defineProperty(VideoComponent.prototype, "ncControls", { //隐藏控制栏 set: function (value) { this.controlsMode = value !== null && value !== undefined && value !== false && value !== 'false'; }, enumerable: false, configurable: true }); VideoComponent.prototype.ngOnInit = function () { }; VideoComponent.prototype.ngOnDestroy = function () { this.destroyAll(); }; //初始化 VideoComponent.prototype.initVideo = function () { return __awaiter(this, void 0, void 0, function () { var extension, img, coverDom_1, dataUrl; var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: this.destroyAll(); //加载前先销毁 this.video = this.eleRef.nativeElement.querySelector('#video'); //获取video extension = this.ls.getFileExtension(this.videoUrl); if (extension == 'm3u8') { //hls(m3u8) if (this.video.canPlayType('application/vnd.apple.mpegurl')) { this.video.src = this.videoUrl; } else if (Hls__default["default"].isSupported()) { this.hls = new Hls__default["default"](); this.hls.loadSource(this.videoUrl); this.hls.attachMedia(this.video); //错误监听 this.hls.on(Hls__default["default"].Events.ERROR, function (event, data) { if (data.details == 'bufferStalledError') { console.warn('warning:', data.error); } else if (data.details == 'fragParsingError') { console.warn('warning:', data.error); } else if (data.details == 'bufferNudgeOnStall') { console.warn('warning:', data.error); } else { _this.playError = true; console.error('error:', data.details); console.error('error:', data.error); } }); } } else if (extension == 'flv') { //HTTP-FLV(flv) if (flvjs__default["default"].isSupported()) { this.flv = flvjs__default["default"].createPlayer({ type: 'flv', url: this.videoUrl }); this.flv.attachMediaElement(this.video); this.flv.load(); //错误监听 this.flv.on(flvjs__default["default"].Events.ERROR, function (error) { _this.playError = true; console.error('error:', error); }); } } else { //静态视频地址 this.video.src = this.videoUrl; } if (!this.coverMode) return [3 /*break*/, 4]; img = document.createElement('img'); img.style.width = '100%'; img.style.height = '100%'; coverDom_1 = this.eleRef.nativeElement.querySelector('.cover'); this.video.addEventListener('play', function () { coverDom_1.style.display = 'none'; }); if (!!this.ncCoverUrl) return [3 /*break*/, 2]; return [4 /*yield*/, this.captureVideoFrame(this.videoUrl)]; case 1: dataUrl = _a.sent(); img.src = dataUrl; return [3 /*break*/, 3]; case 2: //使用传入封面 img.src = this.ncCoverUrl; _a.label = 3; case 3: coverDom_1.appendChild(img); _a.label = 4; case 4: //播放监听 this.video.addEventListener('play', function () { _this.ncPlaying.emit(true); }); //暂停监听 this.video.addEventListener('pause', function () { _this.ncPlaying.emit(false); }); //返回video对象 this.ncLoaded.emit(this.video); return [2 /*return*/]; } }); }); }; //截图 VideoComponent.prototype.screenshot = function () { var canvas = document.createElement('canvas'); canvas.width = this.video.videoWidth; canvas.height = this.video.videoHeight; canvas.getContext('2d').drawImage(this.video, 0, 0, canvas.width, canvas.height); var a = document.createElement('a'); a.download = '截图【' + this.ls.formatDate('yyyy-MM-dd HH-mm-ss') + '】'; a.href = canvas.toDataURL('image/png'); a.click(); }; //销毁 VideoComponent.prototype.destroyAll = function () { if (this.hls) { this.hls.destroy(); } if (this.flv) { this.flv.destroy(); } if (this.video) { this.destroyVideo(this.video); } }; VideoComponent.prototype.destroyVideo = function (video) { video.pause(); video.src = ''; video.removeEventListener('play', function () { }); video.removeEventListener('pause', function () { }); video.removeEventListener('loadedmetadata', function () { }); video.remove(); }; //获取视频截图作为封面 VideoComponent.prototype.captureVideoFrame = function (url, time) { var _this = this; if (time === void 0) { time = 1; } return new Promise(function (resolve) { var video = document.createElement('video'); video.crossOrigin = "anonymous"; video.currentTime = time; video.muted = true; video.autoplay = true; var extension = _this.ls.getFileExtension(url); //判断地址类型 var hls; var flv; if (extension == 'm3u8') { //hls(m3u8) hls = new Hls__default["default"](); hls.loadSource(url); hls.attachMedia(video); } else if (extension == 'flv') { //HTTP-FLV(flv) flv = flvjs__default["default"].createPlayer({ type: 'flv', url: url }); flv.attachMediaElement(video); flv.load(); } else { //静态视频地址 video.src = url; } video.addEventListener('loadedmetadata', function () { video.oncanplay = function () { var canvas = document.createElement('canvas'); canvas.width = video.videoWidth; canvas.height = video.videoHeight; canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height); var dataUrl = canvas.toDataURL('image/png'); resolve(dataUrl); if (hls) { hls.destroy(); } if (flv) { flv.destroy(); } if (video) { _this.destroyVideo(video); } }; }); }); }; return VideoComponent; }()); VideoComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: VideoComponent, deps: [{ token: i0__namespace.ElementRef }, { token: LocalService }], target: i0__namespace.ɵɵFactoryTarget.Component }); VideoComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: VideoComponent, selector: "nc-video", inputs: { ncUrl: "ncUrl", ncCoverUrl: "ncCoverUrl", ncMuted: "ncMuted", ncAutoplay: "ncAutoplay", ncLoop: "ncLoop", ncFill: "ncFill", ncScreenshot: "ncScreenshot", ncCover: "ncCover", ncControls: "ncControls" }, outputs: { ncLoaded: "ncLoaded", ncPlaying: "ncPlaying" }, ngImport: i0__namespace, template: "<div class=\"video-container\" (mouseenter)=\"videoHover = true\" (mouseleave)=\"videoHover = false\">\r\n <div class=\"playError\" *ngIf=\"playError\">\r\n <svg t=\"1724830569178\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"\r\n p-id=\"10496\" width=\"64\" height=\"64\">\r\n <path\r\n d=\"M725.333333 469.333333c129.6 0 234.666667 105.066667 234.666667 234.666667s-105.066667 234.666667-234.666667 234.666667-234.666667-105.066667-234.666666-234.666667 105.066667-234.666667 234.666666-234.666667z m128-341.333333a128 128 0 0 1 128 128v294.101333a300.224 300.224 0 0 0-85.312-91.221333L896 426.666667h-59.605333c-34.346667-13.76-71.808-21.333333-111.061334-21.333334v-192H298.666667v597.333334h147.626666a298.453333 298.453333 0 0 0 50.282667 85.354666L170.666667 896a128 128 0 0 1-128-128V256a128 128 0 0 1 128-128h682.666666z m-119.466666 661.333333h-17.066667a21.333333 21.333333 0 0 0-21.333333 21.333334v17.066666a21.333333 21.333333 0 0 0 21.333333 21.333334h17.066667a21.333333 21.333333 0 0 0 21.333333-21.333334V810.666667a21.333333 21.333333 0 0 0-21.333333-21.333334zM213.333333 682.666667H128v85.333333a42.666667 42.666667 0 0 0 39.466667 42.56L170.666667 810.666667h42.666666v-128z m520.533334-128h-17.066667a21.333333 21.333333 0 0 0-21.184 18.837333L695.466667 576v149.333333a21.333333 21.333333 0 0 0 18.837333 21.184L716.8 746.666667h17.066667a21.333333 21.333333 0 0 0 21.184-18.837334L755.2 725.333333v-149.333333a21.333333 21.333333 0 0 0-21.333333-21.333333z m-266.026667-187.114667l2.773333 1.6 114.090667 71.296a298.965333 298.965333 0 0 0-154.432 217.002667 42.24 42.24 0 0 1-24.832-35.584L405.333333 618.666667V405.333333c0-32.426667 34.517333-52.608 62.506667-37.781333zM213.333333 426.666667H128v170.666666h85.333333v-170.666666z m0-213.333334H170.666667a42.666667 42.666667 0 0 0-42.56 39.466667L128 256v85.333333h85.333333v-128z m640 0h-42.666666v128h85.333333v-85.333333a42.666667 42.666667 0 0 0-39.466667-42.56L853.333333 213.333333z\"\r\n fill=\"#cdcdcd\" p-id=\"10497\"></path>\r\n </svg>\r\n <div class=\"errorText\">\u64AD\u653E\u5931\u8D25</div>\r\n </div>\r\n <div class=\"cover\" *ngIf=\"coverMode\"></div>\r\n <div class=\"screenshot\" *ngIf=\"screenshotMode && videoHover\" (click)=\"screenshot()\" title=\"\u622A\u56FE\">\r\n <svg t=\"1720708671726\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"\r\n p-id=\"1830\" width=\"24\" height=\"24\">\r\n <path\r\n d=\"M981.333333 789.333333h-106.666666V256c0-59.733333-46.933333-106.666667-106.666667-106.666667H234.666667V42.666667c0-25.6-17.066667-42.666667-42.666667-42.666667s-42.666667 17.066667-42.666667 42.666667v106.666666H42.666667c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h106.666666V768c0 59.733333 46.933333 106.666667 106.666667 106.666667h533.333333V981.333333c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667v-106.666666H981.333333c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667z m-213.333333-554.666666c12.8 0 21.333333 8.533333 21.333333 21.333333v341.333333l-145.066666-140.8c-17.066667-17.066667-42.666667-17.066667-59.733334 0l-140.8 145.066667L384 541.866667c-17.066667-17.066667-38.4-17.066667-55.466667-4.266667l-89.6 72.533333V234.666667H768z m-512 554.666666c-12.8 0-21.333333-8.533333-21.333333-21.333333v-42.666667l115.2-93.866666 64 64c8.533333 8.533333 17.066667 12.8 29.866666 12.8s21.333333-4.266667 29.866667-12.8l140.8-145.066667 174.933333 166.4v72.533333H256z\"\r\n p-id=\"1831\" fill=\"#ffffff\"></path>\r\n <path\r\n d=\"M384 482.133333c51.2 0 93.866667-42.666667 93.866667-93.866666s-42.666667-93.866667-93.866667-93.866667-93.866667 38.4-93.866667 89.6 42.666667 98.133333 93.866667 98.133333z m0-128c17.066667 0 34.133333 12.8 34.133333 34.133334s-17.066667 29.866667-34.133333 29.866666-34.133333-17.066667-34.133333-34.133333 17.066667-29.866667 34.133333-29.866667z\"\r\n p-id=\"1832\" fill=\"#ffffff\"></path>\r\n </svg>\r\n </div>\r\n <video class=\"video\" [ngStyle]=\"{'object-fit': fillMode ? 'fill' : 'contain' }\" crossOrigin=\"anonymous\"\r\n [controls]=\"controlsMode\" [muted]=\"mutedMode\" [autoplay]=\"autoplayMode\" [loop]=\"loopMode\" id=\"video\"></video>\r\n</div>", styles: [".video-container{width:100%;height:100%;position:relative}.video-container .playError{background-color:#000;width:100%;height:100%;position:absolute;left:0;top:0;display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:2}.video-container .playError .errorText{color:#cdcdcd;font-size:16px;margin-top:10px;letter-spacing:1px}.video-container .cover{width:100%;height:100%;position:absolute;left:0;right:0}.video-container .screenshot{z-index:1;position:absolute;right:5px;top:5px;background-color:#2b333fb3;padding:3px;border-radius:2px;display:flex;align-items:center;justify-content:center;cursor:pointer}.video-container .screenshot:hover{background-color:#2b333fcc}.video-container .video{width:100%;height:100%}\n"], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: VideoComponent, decorators: [{ type: i0.Component, args: [{ selector: 'nc-video', templateUrl: './video.component.html', styleUrls: ['./video.component.less'] }] }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: LocalService }]; }, propDecorators: { ncUrl: [{ type: i0.Input }], ncCoverUrl: [{ type: i0.Input }], ncLoaded: [{ type: i0.Output }], ncPlaying: [{ type: i0.Output }], ncMuted: [{ type: i0.Input }], ncAutoplay: [{ type: i0.Input }], ncLoop: [{ type: i0.Input }], ncFill: [{ type: i0.Input }], ncScreenshot: [{ type: i0.Input }], ncCover: [{ type: i0.Input }], ncControls: [{ type: i0.Input }] } }); var NcVideoModule = /** @class */ (function () { function NcVideoModule() { } return NcVideoModule; }()); NcVideoModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NcVideoModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule }); NcVideoModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NcVideoModule, declarations: [VideoComponent], imports: [i2.CommonModule], exports: [VideoComponent] }); NcVideoModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NcVideoModule, imports: [[ i2.CommonModule ]] }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NcVideoModule, decorators: [{ type: i0.NgModule, args: [{ declarations: [ VideoComponent ], imports: [ i2.CommonModule ], exports: [ VideoComponent ] }] }] }); /** * Generated bundle index. Do not edit. */ exports.NcVideoModule = NcVideoModule; exports.VideoComponent = VideoComponent; Object.defineProperty(exports, '__esModule', { value: true }); })); //# sourceMappingURL=ng-cw-v12-video.umd.js.map