Changeset View
Changeset View
Standalone View
Standalone View
extension/content-script.js
Show First 20 Lines • Show All 252 Lines • ▼ Show 20 Line(s) | 252 | player.addEventListener("pause", function () { | |||
---|---|---|---|---|---|
253 | playerPaused(player); | 253 | playerPaused(player); | ||
254 | }); | 254 | }); | ||
255 | 255 | | |||
256 | // what about "stalled" event? | 256 | // what about "stalled" event? | ||
257 | player.addEventListener("waiting", function () { | 257 | player.addEventListener("waiting", function () { | ||
258 | sendPlayerInfo(player, "waiting"); | 258 | sendPlayerInfo(player, "waiting"); | ||
259 | }); | 259 | }); | ||
260 | 260 | | |||
261 | // playlist is now empty or being reloaded, stop player | ||||
262 | // e.g. when using Ajax page navigation and the user nagivated away | ||||
263 | player.addEventListener("emptied", function () { | ||||
264 | // could have its own signal but for compat it's easier just to pretend to have stopped | ||||
265 | sendPlayerInfo(player, "stopped"); | ||||
266 | }); | ||||
267 | | ||||
261 | // opposite of "waiting", we finished buffering enough | 268 | // opposite of "waiting", we finished buffering enough | ||
262 | // only if we are playing, though, should we set playback state back to playing | 269 | // only if we are playing, though, should we set playback state back to playing | ||
263 | player.addEventListener("canplay", function () { | 270 | player.addEventListener("canplay", function () { | ||
264 | if (!player.paused) { | 271 | if (!player.paused) { | ||
265 | sendPlayerInfo(player, "canplay"); | 272 | sendPlayerInfo(player, "canplay"); | ||
266 | } | 273 | } | ||
267 | }); | 274 | }); | ||
268 | 275 | | |||
▲ Show 20 Lines • Show All 295 Lines • Show Last 20 Lines |