(retry = 0)
| 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) { |
no test coverage detected