--- /dev/null
+import * as Bitfield from 'bitfield'
+import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
+
+const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
+
+class PeerTubeLoadProgressBar extends Component {
+
+ constructor (player, options) {
+ super(player, options)
+ this.partEls_ = []
+ this.on(player, 'progress', this.update)
+ }
+
+ createEl () {
+ return super.createEl('div', {
+ className: 'vjs-load-progress',
+ innerHTML: `<span class="vjs-control-text"><span>${this.localize('Loaded')}</span>: 0%</span>`
+ })
+ }
+
+ dispose () {
+ this.partEls_ = null
+
+ super.dispose()
+ }
+
+ update () {
+ const torrent = this.player().peertube().getTorrent()
+ if (!torrent) return
+
+ this.el_.style.width = (torrent.progress * 100) + '%'
+ }
+
+}
+
+Component.registerComponent('PeerTubeLoadProgressBar', PeerTubeLoadProgressBar)
import './settings-menu-button'
import './webtorrent-info-button'
import './peertube-videojs-plugin'
+import './peertube-load-progress-bar'
import { videojsUntyped } from './peertube-videojs-typings'
import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils'
'liveDisplay': {},
'flexibleWidthSpacer': {},
- 'progressControl': {},
+ 'progressControl': {
+ children: {
+ 'seekBar': {
+ children: {
+ 'peerTubeLoadProgressBar': {},
+ 'playProgressBar': {}
+ }
+ }
+ }
+ },
'webTorrentButton': {},
return this.currentVideoFile
}
+ getTorrent () {
+ return this.torrent
+ }
+
private tryToPlay (done?: Function) {
if (!done) done = function () { /* empty */ }
background-color: rgba($primary-background-color, 0.5);
}
- .vjs-slider {
- background-color: rgba(255, 255, 255, .3);
- border-radius: 2px;
- height: 5px;
-
- .vjs-slider-bar {
- background: $primary-foreground-color;
- }
- }
-
- .vjs-play-progress {
-
- &::before {
- top: -0.3em;
-
- &:hover {
- top: -0.372em;
- }
- }
-
- .vjs-time-tooltip {
- display: none;
- }
- }
-
- .vjs-load-progress {
- background: rgba($slider-bg-color, 0.5);
-
- div {
- background: rgba($slider-bg-color, 0.75);
- }
- }
-
.vjs-poster {
outline: none; /* Remove Blue Outline on Click*/
outline: 0;
opacity: $primary-foreground-opacity;
}
+ .vjs-slider {
+ background-color: rgba(255, 255, 255, .2);
+ border-radius: 2px;
+ height: 5px;
+
+ .vjs-slider-bar {
+ background: $primary-foreground-color;
+ }
+ }
+
+ .vjs-play-progress {
+
+ &::before {
+ top: -0.3em;
+
+ &:hover {
+ top: -0.372em;
+ }
+ }
+
+ .vjs-time-tooltip {
+ display: none;
+ }
+ }
+
+ .vjs-load-progress {
+ &, & div {
+ background: rgba(255, 255, 255, .2);
+ }
+ }
+
.vjs-progress-control {
bottom: 34px;
width: 100%;