PageSourceSearch

https://alexherbo2.github.io/packages/player.js

js alexherbo2.github.io collected 2026-10-03 08:36:09 UTC 1,176 bytes, 55 lines download raw bytes

1class Player {
2  constructor(media) {
3    this.media = media
4  }
5  fullscreen() {
6    if (document.fullscreenElement) {
7      document.exitFullscreen()
8    } else {
9      this.media.requestFullscreen()
10    }
11  }
12  pictureInPicture() {
13    if (document.pictureInPictureElement) {
14      document.exitPictureInPicture()
15    } else {
16      this.media.requestPictureInPicture()
17    }
18  }
19  pause() {
20    if (this.media.paused) {
21      this.media.play()
22    } else {
23      this.media.pause()
24    }
25  }
26  seekRelative(seconds) {
27    this.media.currentTime += seconds
28  }
29  seekAbsolute(seconds) {
30    this.media.currentTime = seconds
31  }
32  seekAbsolutePercent(percent) {
33    this.media.currentTime = this.media.duration * percent
34  }
35  seekRelativePercent(percent) {
36    this.media.currentTime += this.media.duration * percent
37  }
38  mute() {
39    this.media.muted = ! this.media.muted
40  }
41  setVolume(percent) {
42    this.media.volume = percent
43  }
44  increaseVolume(percent) {
45    const volume = this.media.volume + percent
46    this.media.volume = volume > 1
47      ? 1
48      : volume < 0
49      ? 0
50      : volume
51  }
52  decreaseVolume(percent) {
53    this.increaseVolume(-percent)
54  }
55}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.