index-legacy-2d36378e.js 4.0 KB

1
  1. System.register(["./instrument-legacy-46adc00c.js"],(function(e,i){"use strict";var t,n,o,a,r,d,l,s,u,c,m,p,v,g,_,h,x,f,M,S,w,y,b,I=document.createElement("style");return I.textContent="body{overflow:hidden}._skeleton_li4n4_4{position:fixed;left:0;top:0;width:100vw;height:100vh;padding:.53333rem .8rem;background-color:#fff;z-index:1000;--van-skeleton-paragraph-height: .8rem}._detail_li4n4_15{width:100vw;height:auto;overflow:hidden;--header-height: 1.65333rem;background:transparent;position:relative}._detail_li4n4_15 ._mask_li4n4_23{position:absolute;z-index:6;width:100%;height:100%}._detail_li4n4_15 ._container_li4n4_29{margin:0;border-radius:.26667rem}._detail_li4n4_15 #osmdCanvasPage1{position:relative!important}._detail_li4n4_15 #musicAndSelection{height:initial!important;max-height:initial!important}._detail_li4n4_15 .smoothAnimationBox{height:0!important;overflow:hidden}._detail_li4n4_15 #cursorImg-0{margin-top:-20PX!important;opacity:0!important}._whiteBg_li4n4_48{background:#fff}\n",document.head.appendChild(I),{setters:[e=>{t=e.d,n=e.g,o=e.r,a=e.o,r=e.s,d=e.J,l=e.x,s=e.b,u=e.M,c=e.R,m=e.S,p=e.U,v=e.V,g=e.W,_=e.X,h=e.O,x=e.n,f=e.Y,M=e.Z,S=e.Q,w=e._,y=e.$,b=e.a0}],execute:function(){const i="_detail_li4n4_15",I="_mask_li4n4_23",T="_container_li4n4_29",N="_whiteBg_li4n4_48";e("default",t({name:"simple-detail",setup(){const e=n(),t=o({isLoading:!0,currentTime:0,totalTime:0,backgroundRendMode:""}),k=e=>{var i,n,o,a;let d={};try{d="string"==typeof(null==e?void 0:e.data)?JSON.parse(e.data):e.data}catch(h){console.error("parse_error: Invalid JSON data received")}if("api_play"===(null===(i=d)||void 0===i?void 0:i.api)&&(console.log("h5开始播放"),r.playState="play",B()),"api_paused"===(null===(n=d)||void 0===n?void 0:n.api)){var l,s;const e=null===(l=d)||void 0===l||null===(s=l.content)||void 0===s?void 0:s.currentTime;console.log("暂停播放",e),r.playState="paused",0===e&&setTimeout((()=>{t.currentTime=0,r.activeNoteIndex=0,r.activeMeasureIndex=r.times[0].MeasureNumberXML,P(!0)}),200)}var u,p,v;if("api_updateProgress"===(null===(o=d)||void 0===o?void 0:o.api)&&(console.log("拖动的进度",r.playState),"paused"===r.playState&&(t.currentTime=null!==(u=null===(p=d)||void 0===p||null===(v=p.content)||void 0===v?void 0:v.currentTime)&&void 0!==u?u:t.currentTime,r.activeNoteIndex=0,r.activeMeasureIndex=r.times[0].MeasureNumberXML,P(!0))),"api_playProgress"===(null===(a=d)||void 0===a?void 0:a.api)){var g,_;const e=null===(g=d)||void 0===g||null===(_=g.content)||void 0===_?void 0:_.currentTime;if(e){if(e<t.currentTime){r.activeNoteIndex=0;let i=c(e)||r.times[0];i.i===r.activeNoteIndex&&(r.activeMeasureIndex=i.MeasureNumberXML),e<=r.times[0].fixtime&&m(!0)}t.currentTime=e}}};a((async()=>{const i=e.id||"",n=e.userMusicId||"";t.backgroundRendMode=e.backgroundRendMode,r.isSimplePage=!0,r.partIndex=e["part-index"]?Number(e["part-index"]):0,await d(i,"open",n),t.isLoading=!1,r.isSingleLine=!0,window.addEventListener("message",k)})),l((()=>{r.isSimplePage=!1,window.removeEventListener("message",k)}));const L=async e=>{var i;const t=null===(i=document.getElementById("scrollContainer"))||void 0===i?void 0:i.getBoundingClientRect().height;r.osmd=e,0===r.originSpeed&&(r.originSpeed=r.speed=e.bpm||e.Sheet.userStartTempoInBPM||100);const n=(p.get("speeds")||{})[r.examSongId]||r.speed||e.bpm||e.Sheet.userStartTempoInBPM;n&&v(n),g(),_(),r.times=h(e),console.log("🚀 ~ state.times:",r.times,r),x((()=>{r.activeMeasureIndex=r.times[0].MeasureNumberXML})),f(r.times),M(),S(),console.log("渲染完成",t),window.parent.postMessage({api:"api_musicPage",height:t},"*"),w({height:t})},P=e=>{const i=t.currentTime;let n=c(i)||r.times[0];n&&y(n,e),r.activeNoteIndex=(null==n?void 0:n.i)||0,r.isSingleLine&&b(i,!0)},B=()=>{if("play"!==r.playState)return void console.log("暂停播放");let e=Date.now();requestAnimationFrame((()=>{Date.now()-e<16.7?(P(),B()):setTimeout((()=>{P(),B()}),16.7)}))};return()=>s("div",{class:[i,"video"===t.backgroundRendMode&&N]},[s("div",{class:I},null),s("div",{id:"scrollContainer",class:[T]},[!t.isLoading&&s(u,{onRendered:L,musicColor:"#000000"},null)])])}}))}}}));