MCPcopy Create free account
hub / github.com/Moosync/Moosync / play

Method play

src/js/youtube_player.js:157–175  ·  view source on GitHub ↗
(retry = 0)

Source from the content-addressed store, hash-verified

155
156 stateChangeTimeout = null;
157 play(retry = 0) {
158 this.run("playVideo");
159
160 let stateChanged = false;
161 this.once("stateChange", () => {
162 stateChanged = true;
163 });
164
165 if (this.stateChangeTimeout != null) {
166 clearTimeout(this.stateChangeTimeout);
167 }
168 this.stateChangeTimeout = setTimeout(() => {
169 this.stateChangeTimeout = null;
170 if (!stateChanged && retry < 1) {
171 console.warn("state didn't change, trying to replay");
172 this.play(retry + 1);
173 }
174 }, 1000);
175 }
176
177 pause() {
178 if (this.stateChangeTimeout != null) {

Callers 5

loadMethod · 0.95
listen_player_stateMethod · 0.45
initializeMethod · 0.45
mobile_playMethod · 0.45
handle_commandMethod · 0.45

Calls 2

runMethod · 0.95
onceMethod · 0.95

Tested by

no test coverage detected