MCPcopy Index your code
hub / github.com/JavaCS3/xterm-player / _load

Method _load

src/Player.ts:93–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 }
92
93 private _load(): void {
94 this._error = null
95 this._loading = true
96
97 this._term.reset()
98 this._timer.dispose()
99 this._queue.dispose()
100 this._timer = new NullTimer()
101 this._queue = new NullFrameQueue()
102
103 this._onLoading.fire()
104 this._onStateChanged.fire(this.state)
105
106 fetchCast(this._url).then((cast) => {
107 this._term.resize(cast.header.width, cast.header.height)
108
109 if (cast.header.audio) {
110 this._timer = new MediaTimer(this._audio)
111 this._audio.src = cast.header.audio
112 this._audio.load()
113 } else {
114 this._timer = new SimpleTimer(new AnimationFrameTicker(), cast.header.duration)
115 }
116
117 this._queue = new CastFrameQueue(cast, 30)
118 this._timer.onReady(() => {
119 this._loading = false
120 this._onReady.fire()
121 this._onStateChanged.fire(this.state)
122 this._timer.onTick(this._render.bind(this))
123 this._timer.onStateChange(() => this._onStateChanged.fire(this.state))
124 })
125 }).catch(err => {
126 console.error(err)
127 this._error = err
128 this._onStateChanged.fire(this.state)
129 })
130 }
131
132 public get url(): string { return this._url }
133 public set url(url: string) {

Callers 4

constructorMethod · 0.95
urlMethod · 0.95
bundle.min.jsFile · 0.80
vtFunction · 0.80

Calls 6

fetchCastFunction · 0.85
disposeMethod · 0.65
fireMethod · 0.65
onReadyMethod · 0.65
onTickMethod · 0.65
onStateChangeMethod · 0.65

Tested by

no test coverage detected