代码拉取完成,页面将自动刷新
require=function e(t,s,r){function i(n,o){if(!s[n]){if(!t[n]){var d="function"==typeof require&&require;if(!o&&d)return d(n,!0);if(a)return a(n,!0);var h=new Error("Cannot find module '"+n+"'");throw h.code="MODULE_NOT_FOUND",h}var g=s[n]={exports:{}};t[n][0].call(g.exports,function(e){return i(t[n][1][e]||e)},g,g.exports,e,t,s,r)}return s[n].exports}for(var a="function"==typeof require&&require,n=0;n<r.length;n++)i(r[n]);return i}({1:[function(e,t,s){window.p2pml||(window.p2pml={}),window.p2pml.shaka=e("p2p-media-loader-shaka")},{"p2p-media-loader-shaka":"p2p-media-loader-shaka"}],2:[function(e,t,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0});const r=e("events"),i=e("p2p-media-loader-core"),a=e("./segment-manager"),n=e("./integration");s.Engine=class extends r.EventEmitter{constructor(e={}){super(),this.loader=new i.HybridLoader(e.loader),this.segmentManager=new a.SegmentManager(this.loader,e.segments),Object.keys(i.Events).map(e=>i.Events[e]).forEach(e=>this.loader.on(e,(...t)=>this.emit(e,...t)))}static isSupported(){return i.HybridLoader.isSupported()}async destroy(){await this.segmentManager.destroy()}getSettings(){return{segments:this.segmentManager.getSettings(),loader:this.loader.getSettings()}}getDetails(){return{loader:this.loader.getDetails()}}initShakaPlayer(e){n.initShakaPlayer(e,this.segmentManager)}}},{"./integration":3,"./segment-manager":6,events:"events","p2p-media-loader-core":"p2p-media-loader-core"}],3:[function(e,t,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0});const r=e("debug"),i=e("./manifest-parser-proxy"),a=e("./utils"),n=r("p2pml:shaka:index");function o(e,t,s,r){if(!t.p2pml)return shaka.net.HttpXHRPlugin(e,t,s,r);const{player:i,segmentManager:o}=t.p2pml;let h,g,u,l=o.getSettings().assetsStorage;void 0!==l&&void 0!==i.getNetworkingEngine().p2pml&&void 0!==i.getNetworkingEngine().p2pml.masterManifestUri?(h=i.getNetworkingEngine().p2pml.masterManifestUri,g=a.getMasterSwarmId(h,o.getSettings())):l=void 0;const m=i.getManifest();if(s===shaka.net.NetworkingEngine.RequestType.SEGMENT&&null!==m&&void 0!==m.p2pml&&void 0!==m.p2pml.parser&&(u=m.p2pml.parser.find(e,t.headers.Range)),void 0!==u&&"video"===u.streamType){n("request","load",u.identity);const e=o.load(u,a.getSchemedUri(i.getAssetUri?i.getAssetUri():i.getManifestUri()),d(i)),t=async()=>{n("request","abort",u.identity)};return new shaka.util.AbortableOperation(e,t)}if(l){const i=(async()=>{const i=await l.getAsset(e,t.headers.Range,g);if(void 0!==i)return{data:i.data,uri:i.responseUri,fromCache:!0};{const i=await shaka.net.HttpXHRPlugin(e,t,s,r).promise;return l.storeAsset({masterManifestUri:h,masterSwarmId:g,requestUri:e,requestRange:t.headers.Range,responseUri:i.uri,data:i.data}),i}})();return new shaka.util.AbortableOperation(i,async()=>{})}return shaka.net.HttpXHRPlugin(e,t,s,r)}function d(e){let t=0;const s=e.getPlayheadTimeAsDate();return s&&(t=s.valueOf(),e.isLive()&&(t-=e.getPresentationStartTimeAsDate().valueOf()),t/=1e3),t}s.initShakaPlayer=function(e,t){n("register parser proxies"),shaka.media.ManifestParser.registerParserByExtension("mpd",i.ShakaDashManifestParserProxy),shaka.media.ManifestParser.registerParserByMime("application/dash+xml",i.ShakaDashManifestParserProxy),shaka.media.ManifestParser.registerParserByExtension("m3u8",i.ShakaHlsManifestParserProxy),shaka.media.ManifestParser.registerParserByMime("application/x-mpegurl",i.ShakaHlsManifestParserProxy),shaka.media.ManifestParser.registerParserByMime("application/vnd.apple.mpegurl",i.ShakaHlsManifestParserProxy),n("init networking engine"),shaka.net.NetworkingEngine.registerScheme("http",o),shaka.net.NetworkingEngine.registerScheme("https",o);let s=0,r=0;e.addEventListener("loading",async()=>{s>0&&(clearInterval(s),s=0),r=0;const i=e.getManifest();i&&i.p2pml&&i.p2pml.parser.reset(),await t.destroy(),s=setInterval(()=>{const s=d(e);(s!==r||e.isBuffering())&&(t.setPlayheadTime(s),r=s)},500)}),n("register request filter"),e.getNetworkingEngine().registerRequestFilter((s,r)=>{r.p2pml={player:e,segmentManager:t}})}},{"./manifest-parser-proxy":4,"./utils":7,debug:"debug"}],4:[function(e,t,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0});const r=e("./parser-segment");class i{constructor(e){this.cache=new r.ParserSegmentCache(200),this.originalManifestParser=e}isHls(){return this.originalManifestParser instanceof shaka.hls.HlsParser}isDash(){return this.originalManifestParser instanceof shaka.dash.DashParser}start(e,t){return void 0===t.networkingEngine.p2pml&&(t.networkingEngine.p2pml={}),t.networkingEngine.p2pml.masterManifestUri=e,this.originalManifestParser.start(e,t).then(e=>{this.manifest=e;for(const t of e.periods){const e=[];for(const s of t.variants)null!=s.video&&-1==e.indexOf(s.video)&&(this.hookGetSegmentReference(s.video),e.push(s.video)),null!=s.audio&&-1==e.indexOf(s.audio)&&(this.hookGetSegmentReference(s.audio),e.push(s.audio))}return e.p2pml={parser:this},e})}configure(e){return this.originalManifestParser.configure(e)}stop(){return this.originalManifestParser.stop()}update(){return this.originalManifestParser.update()}onExpirationUpdated(){return this.originalManifestParser.onExpirationUpdated()}find(e,t){return this.cache.find(e,t)}reset(){this.cache.clear()}hookGetSegmentReference(e){e.getSegmentReferenceOriginal=e.getSegmentReference,e.getSegmentReference=t=>(this.cache.add(e,t),e.getSegmentReferenceOriginal(t)),e.getPosition=()=>this.isHls()&&"video"===e.type?this.manifest.periods[0].variants.reduce((e,t)=>(t.video&&t.video.id&&!e.includes(t.video.id)&&e.push(t.video.id),e),[]).indexOf(e.id):-1}}s.ShakaManifestParserProxy=i;s.ShakaDashManifestParserProxy=class extends i{constructor(){super(new shaka.dash.DashParser)}};s.ShakaHlsManifestParserProxy=class extends i{constructor(){super(new shaka.hls.HlsParser)}}},{"./parser-segment":5}],5:[function(e,t,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0});const r=e("./utils");class i{constructor(e,t,s,r,i,a,n,o,d,h,g,u){this.streamId=e,this.streamType=t,this.streamPosition=s,this.streamIdentity=r,this.identity=i,this.position=a,this.start=n,this.end=o,this.uri=d,this.range=h,this.prev=g,this.next=u}static create(e,t){const s=e.getSegmentReferenceOriginal(t);if(!s)return;const a=s.createUris();if(!a||0===a.length)return;const n=s.getStartTime(),o=s.getEndTime(),d=s.getStartByte(),h=s.getEndByte(),g=d||h?`bytes=${d||""}-${h||""}`:void 0,u=e.type.substring(0,1).toUpperCase(),l=e.getPosition(),m=l>=0,c=m?`${u}${l}`:`${u}${e.id}`,p=m?`${t}`:`${Number(n).toFixed(3)}`;return new i(e.id,e.type,l,c,p,t,n,o,r.getSchemedUri(a[0]),g,()=>i.create(e,t-1),()=>i.create(e,t+1))}}s.ParserSegment=i;s.ParserSegmentCache=class{constructor(e){this.segments=[],this.maxSegments=e}find(e,t){return this.segments.find(s=>s.uri===e&&s.range===t)}add(e,t){const s=i.create(e,t);s&&!this.find(s.uri,s.range)&&(this.segments.push(s),this.segments.length>this.maxSegments&&this.segments.splice(0,.2*this.maxSegments))}clear(){this.segments.splice(0)}}},{"./utils":7}],6:[function(e,t,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0});const r=e("debug"),i=e("p2p-media-loader-core"),a=e("./utils"),n={forwardSegmentCount:20,maxHistorySegments:50,swarmId:void 0,assetsStorage:void 0};s.SegmentManager=class{constructor(e,t={}){this.debug=r("p2pml:shaka:sm"),this.requests=new Map,this.manifestUri="",this.playheadTime=0,this.segmentHistory=[],this.onSegmentLoaded=e=>{this.requests.has(e.id)&&(this.reportSuccess(this.requests.get(e.id),e),this.debug("request delete",e.id),this.requests.delete(e.id))},this.onSegmentError=(e,t)=>{this.requests.has(e.id)&&(this.reportError(this.requests.get(e.id),t),this.debug("request delete from error",e.id),this.requests.delete(e.id))},this.onSegmentAbort=e=>{this.requests.has(e.id)&&(this.reportError(this.requests.get(e.id),"Internal abort"),this.debug("request delete from abort",e.id),this.requests.delete(e.id))},this.settings=Object.assign(Object.assign({},n),t),this.loader=e,this.loader.on(i.Events.SegmentLoaded,this.onSegmentLoaded),this.loader.on(i.Events.SegmentError,this.onSegmentError),this.loader.on(i.Events.SegmentAbort,this.onSegmentAbort)}async destroy(){if(0!==this.requests.size){console.error("Destroying segment manager with active request(s)!");for(const e of this.requests.values())this.reportError(e,"Request aborted due to destroy call");this.requests.clear()}this.playheadTime=0,this.segmentHistory.splice(0),void 0!==this.settings.assetsStorage&&await this.settings.assetsStorage.destroy(),await this.loader.destroy()}getSettings(){return this.settings}async load(e,t,s){this.manifestUri=t,this.playheadTime=s,this.pushSegmentHistory(e);const r=this.refreshLoad(),i=await this.loader.getSegment(r.id);return new Promise((e,t)=>{const s=new o(r.id,e,t);i?this.reportSuccess(s,i):(this.debug("request add",s.id),this.requests.set(s.id,s))})}setPlayheadTime(e){this.playheadTime=e,this.segmentHistory.length>0&&this.refreshLoad()}refreshLoad(){const e=this.segmentHistory[this.segmentHistory.length-1],t=this.playheadTime>.1?this.playheadTime:e.start,s=this.segmentHistory.reduce((e,s)=>(s.start>=t&&e.push(s),e),[]);0===s.length&&s.push(e);const r=s.length-1;do{const e=s[s.length-1].next();if(!e)break;s.push(e)}while(s.length<this.settings.forwardSegmentCount);const i=a.getMasterSwarmId(this.manifestUri,this.settings),n=s.map((e,t)=>({id:`${i}+${e.streamIdentity}+${e.identity}`,url:e.uri,masterSwarmId:i,masterManifestUri:this.manifestUri,streamId:e.streamIdentity,sequence:e.identity,range:e.range,priority:t}));return this.loader.load(n,`${i}+${e.streamIdentity}`),n[r]}pushSegmentHistory(e){this.segmentHistory.length>=this.settings.maxHistorySegments&&(this.debug("segment history auto shrink"),this.segmentHistory.splice(0,.2*this.settings.maxHistorySegments)),this.segmentHistory.length>0&&this.segmentHistory[this.segmentHistory.length-1].start>e.start&&(this.debug("segment history reset due to playhead seek back"),this.segmentHistory.splice(0)),this.segmentHistory.push(e)}reportSuccess(e,t){let s;void 0!==t.downloadBandwidth&&t.downloadBandwidth>0&&t.data&&t.data.byteLength>0&&(s=Math.trunc(t.data.byteLength/t.downloadBandwidth)),this.debug("report success",e.id),e.resolve({data:t.data,timeMs:s})}reportError(e,t){e.reject&&(this.debug("report error",e.id),e.reject(t))}};class o{constructor(e,t,s){this.id=e,this.resolve=t,this.reject=s}}},{"./utils":7,debug:"debug","p2p-media-loader-core":"p2p-media-loader-core"}],7:[function(e,t,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.getSchemedUri=function(e){return e.startsWith("//")?window.location.protocol+e:e},s.getMasterSwarmId=function(e,t){return t.swarmId&&0!==t.swarmId.length?t.swarmId:e.split("?")[0]}},{}],"p2p-media-loader-shaka":[function(e,t,s){"use strict";function r(e){for(var t in e)s.hasOwnProperty(t)||(s[t]=e[t])}Object.defineProperty(s,"__esModule",{value:!0}),s.version="0.6.2",r(e("./engine")),r(e("./segment-manager"))},{"./engine":2,"./segment-manager":6}]},{},[1]);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。