Disable auto resolution on HTTP fallback
This commit is contained in:
parent
1a49822c32
commit
c4082b8b4e
|
@ -57,6 +57,7 @@ class PeerTubePlugin extends Plugin {
|
||||||
private renderer
|
private renderer
|
||||||
private fakeRenderer
|
private fakeRenderer
|
||||||
private autoResolution = true
|
private autoResolution = true
|
||||||
|
private forbidAutoResolution = false
|
||||||
private isAutoResolutionObservation = false
|
private isAutoResolutionObservation = false
|
||||||
|
|
||||||
private videoViewInterval
|
private videoViewInterval
|
||||||
|
@ -304,11 +305,17 @@ class PeerTubePlugin extends Plugin {
|
||||||
this.trigger('autoResolutionUpdate')
|
this.trigger('autoResolutionUpdate')
|
||||||
}
|
}
|
||||||
|
|
||||||
disableAutoResolution () {
|
disableAutoResolution (forbid = false) {
|
||||||
|
if (forbid === true) this.forbidAutoResolution = true
|
||||||
|
|
||||||
this.autoResolution = false
|
this.autoResolution = false
|
||||||
this.trigger('autoResolutionUpdate')
|
this.trigger('autoResolutionUpdate')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isAutoResolutionForbidden () {
|
||||||
|
return this.forbidAutoResolution === true
|
||||||
|
}
|
||||||
|
|
||||||
getCurrentVideoFile () {
|
getCurrentVideoFile () {
|
||||||
return this.currentVideoFile
|
return this.currentVideoFile
|
||||||
}
|
}
|
||||||
|
@ -509,6 +516,8 @@ class PeerTubePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fallbackToHttp (done?: Function, play = true) {
|
private fallbackToHttp (done?: Function, play = true) {
|
||||||
|
this.disableAutoResolution(true)
|
||||||
|
|
||||||
this.flushVideoFile(this.currentVideoFile, true)
|
this.flushVideoFile(this.currentVideoFile, true)
|
||||||
this.torrent = null
|
this.torrent = null
|
||||||
|
|
||||||
|
@ -555,7 +564,7 @@ class PeerTubePlugin extends Plugin {
|
||||||
this.player.controlBar.on('mouseenter', () => disableInactivity())
|
this.player.controlBar.on('mouseenter', () => disableInactivity())
|
||||||
settingsDialog.on('mouseenter', () => disableInactivity())
|
settingsDialog.on('mouseenter', () => disableInactivity())
|
||||||
this.player.controlBar.on('mouseleave', () => enableInactivity())
|
this.player.controlBar.on('mouseleave', () => enableInactivity())
|
||||||
settingsDialog.on('mouseleave', () => enableInactivity())
|
// settingsDialog.on('mouseleave', () => enableInactivity())
|
||||||
}
|
}
|
||||||
|
|
||||||
private pickAverageVideoFile () {
|
private pickAverageVideoFile () {
|
||||||
|
|
|
@ -12,6 +12,7 @@ class ResolutionMenuButton extends MenuButton {
|
||||||
this.player = player
|
this.player = player
|
||||||
|
|
||||||
player.peertube().on('videoFileUpdate', () => this.updateLabel())
|
player.peertube().on('videoFileUpdate', () => this.updateLabel())
|
||||||
|
player.peertube().on('autoResolutionUpdate', () => this.updateLabel())
|
||||||
}
|
}
|
||||||
|
|
||||||
createEl () {
|
createEl () {
|
||||||
|
|
|
@ -19,6 +19,8 @@ class ResolutionMenuItem extends MenuItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClick (event) {
|
handleClick (event) {
|
||||||
|
if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return
|
||||||
|
|
||||||
super.handleClick(event)
|
super.handleClick(event)
|
||||||
|
|
||||||
// Auto resolution
|
// Auto resolution
|
||||||
|
@ -32,6 +34,15 @@ class ResolutionMenuItem extends MenuItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSelection () {
|
updateSelection () {
|
||||||
|
// Check if auto resolution is forbidden or not
|
||||||
|
if (this.id === -1) {
|
||||||
|
if (this.player_.peertube().isAutoResolutionForbidden()) {
|
||||||
|
this.addClass('disabled')
|
||||||
|
} else {
|
||||||
|
this.removeClass('disabled')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.player_.peertube().isAutoResolutionOn()) {
|
if (this.player_.peertube().isAutoResolutionOn()) {
|
||||||
this.selected(this.id === -1)
|
this.selected(this.id === -1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -99,8 +99,11 @@ $setting-transition-easing: ease-out;
|
||||||
transition: all $setting-transition-duration $setting-transition-easing;
|
transition: all $setting-transition-duration $setting-transition-easing;
|
||||||
|
|
||||||
.vjs-menu-item {
|
.vjs-menu-item {
|
||||||
|
font-size: 1em;
|
||||||
|
text-transform: initial;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
background-color: rgba(255, 255, 255, 0.2);
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,14 +114,11 @@ $setting-transition-easing: ease-out;
|
||||||
&:last-child {
|
&:last-child {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
&.disabled {
|
||||||
font-size: 1em;
|
opacity: 0.5;
|
||||||
text-transform: initial;
|
cursor: default !important;
|
||||||
|
background-color: inherit !important;
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue