mirror of https://github.com/Chocobozzz/PeerTube
Merge branch 'release/6.1.0' into develop
commit
5dd0721bee
|
@ -15,8 +15,9 @@ my-embed {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
my-global-icon {
|
my-global-icon {
|
||||||
|
@include margin-left(3px);
|
||||||
|
|
||||||
width: 16px;
|
width: 16px;
|
||||||
margin-left: 3px;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -2px;
|
top: -2px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-bar {
|
.search-bar {
|
||||||
margin-left: auto;
|
@include margin-left(auto);
|
||||||
|
|
||||||
input {
|
input {
|
||||||
@include peertube-input-text(500px);
|
@include peertube-input-text(500px);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="second-row">
|
<div class="second-row">
|
||||||
<div class="description">{{ plugin.description }}</div>
|
<div dir="auto" class="description">{{ plugin.description }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,7 +30,7 @@ h4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
.callout-content {
|
.callout-content {
|
||||||
margin-left: 30px;
|
@include margin-left(30px);
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -47,7 +47,7 @@ h4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
.callout-content {
|
.callout-content {
|
||||||
margin-left: 0;
|
@include margin-left(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats-card {
|
.stats-card {
|
||||||
|
@include margin-right(15px);
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
min-height: 100px;
|
min-height: 100px;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
margin-right: 15px;
|
|
||||||
background-color: pvar(--submenuBackgroundColor);
|
background-color: pvar(--submenuBackgroundColor);
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
.information {
|
.information {
|
||||||
|
@include margin-left(50px);
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-left: 50px;
|
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5px;
|
|
||||||
|
@include right(5px);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
my-global-icon {
|
my-global-icon {
|
||||||
|
@include margin-right(15px);
|
||||||
|
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
margin-right: 15px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
||||||
studio: true,
|
studio: true,
|
||||||
stats: true
|
stats: true
|
||||||
}
|
}
|
||||||
@Input() placement = 'left'
|
@Input() placement = 'left auto'
|
||||||
@Input() moreActions: DropdownAction<{ video: Video }>[][] = []
|
@Input() moreActions: DropdownAction<{ video: Video }>[][] = []
|
||||||
@Input({ transform: booleanAttribute }) actionAvailabilityHint = false
|
@Input({ transform: booleanAttribute }) actionAvailabilityHint = false
|
||||||
|
|
||||||
|
|
|
@ -384,3 +384,13 @@ body {
|
||||||
// Prevent invalid height in parent: https://stackoverflow.com/a/22425601
|
// Prevent invalid height in parent: https://stackoverflow.com/a/22425601
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// RTL compatibility
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.modal .modal-header .modal-title {
|
||||||
|
margin-inline-end: auto;
|
||||||
|
margin-right: unset;
|
||||||
|
}
|
||||||
|
|
|
@ -817,6 +817,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@mixin margin ($arg1: null, $arg2: null, $arg3: null, $arg4: null) {
|
@mixin margin ($arg1: null, $arg2: null, $arg3: null, $arg4: null) {
|
||||||
@if $arg2 == null and $arg3 == null and $arg4 == null {
|
@if $arg2 == null and $arg3 == null and $arg4 == null {
|
||||||
@include margin-original($arg1, $arg1, $arg1, $arg1);
|
@include margin-original($arg1, $arg1, $arg1, $arg1);
|
||||||
|
@ -844,6 +846,8 @@
|
||||||
@include rfs($value, margin-inline-end);
|
@include rfs($value, margin-inline-end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@mixin padding-original ($block-start, $inline-end, $block-end, $inline-start) {
|
@mixin padding-original ($block-start, $inline-end, $block-end, $inline-start) {
|
||||||
@include padding-left($inline-start);
|
@include padding-left($inline-start);
|
||||||
@include padding-right($inline-end);
|
@include padding-right($inline-end);
|
||||||
|
@ -870,3 +874,32 @@
|
||||||
@mixin padding-right ($value) {
|
@mixin padding-right ($value) {
|
||||||
@include rfs($value, padding-inline-end);
|
@include rfs($value, padding-inline-end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* inset-inline properties are not supported by iOS < 14.5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@mixin right ($value) {
|
||||||
|
right: $value;
|
||||||
|
|
||||||
|
@supports (inset-inline-end: $value) {
|
||||||
|
inset-inline-end: $value;
|
||||||
|
right: unset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@mixin left ($value) {
|
||||||
|
left: $value;
|
||||||
|
|
||||||
|
@supports (inset-inline-start: $value) {
|
||||||
|
inset-inline-start: $value;
|
||||||
|
left: unset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import './embed.scss'
|
|
||||||
import * as Channel from 'jschannel'
|
import * as Channel from 'jschannel'
|
||||||
import { logger } from '../../root-helpers'
|
import { logger } from '../../root-helpers'
|
||||||
import { PeerTubeResolution, PeerTubeTextTrack } from '../embed-player-api/definitions'
|
import { PeerTubeResolution, PeerTubeTextTrack } from '../embed-player-api/definitions'
|
||||||
import { PeerTubeEmbed } from './embed'
|
import { PeerTubeEmbed } from './embed'
|
||||||
|
import './embed.scss'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Embed API exposes control of the embed player to the outside world via
|
* Embed API exposes control of the embed player to the outside world via
|
||||||
|
@ -13,7 +13,6 @@ export class PeerTubeEmbedApi {
|
||||||
private isReady = false
|
private isReady = false
|
||||||
private resolutions: PeerTubeResolution[] = []
|
private resolutions: PeerTubeResolution[] = []
|
||||||
|
|
||||||
private oldVideoElement: HTMLVideoElement
|
|
||||||
private videoElPlayListener: () => void
|
private videoElPlayListener: () => void
|
||||||
private videoElPauseListener: () => void
|
private videoElPauseListener: () => void
|
||||||
private videoElEndedListener: () => void
|
private videoElEndedListener: () => void
|
||||||
|
@ -36,8 +35,8 @@ export class PeerTubeEmbedApi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private get element () {
|
private get player () {
|
||||||
return this.embed.getPlayerElement()
|
return this.embed.player
|
||||||
}
|
}
|
||||||
|
|
||||||
private constructChannel () {
|
private constructChannel () {
|
||||||
|
@ -45,12 +44,12 @@ export class PeerTubeEmbedApi {
|
||||||
|
|
||||||
channel.bind('setVideoPassword', (txn, value) => this.embed.setVideoPasswordByAPI(value))
|
channel.bind('setVideoPassword', (txn, value) => this.embed.setVideoPasswordByAPI(value))
|
||||||
|
|
||||||
channel.bind('play', (txn, params) => this.embed.player.play())
|
channel.bind('play', (txn, params) => this.player.play())
|
||||||
channel.bind('pause', (txn, params) => this.embed.player.pause())
|
channel.bind('pause', (txn, params) => this.player.pause())
|
||||||
channel.bind('seek', (txn, time) => this.embed.player.currentTime(time))
|
channel.bind('seek', (txn, time) => this.player.currentTime(time))
|
||||||
|
|
||||||
channel.bind('setVolume', (txn, value) => this.embed.player.volume(value))
|
channel.bind('setVolume', (txn, value) => this.player.volume(value))
|
||||||
channel.bind('getVolume', (txn, value) => this.embed.player.volume())
|
channel.bind('getVolume', (txn, value) => this.player.volume())
|
||||||
|
|
||||||
channel.bind('isReady', (txn, params) => this.isReady)
|
channel.bind('isReady', (txn, params) => this.isReady)
|
||||||
|
|
||||||
|
@ -60,9 +59,9 @@ export class PeerTubeEmbedApi {
|
||||||
channel.bind('getCaptions', (txn, params) => this.getCaptions())
|
channel.bind('getCaptions', (txn, params) => this.getCaptions())
|
||||||
channel.bind('setCaption', (txn, id) => this.setCaption(id))
|
channel.bind('setCaption', (txn, id) => this.setCaption(id))
|
||||||
|
|
||||||
channel.bind('setPlaybackRate', (txn, playbackRate) => this.embed.player.playbackRate(playbackRate))
|
channel.bind('setPlaybackRate', (txn, playbackRate) => this.player.playbackRate(playbackRate))
|
||||||
channel.bind('getPlaybackRate', (txn, params) => this.embed.player.playbackRate())
|
channel.bind('getPlaybackRate', (txn, params) => this.player.playbackRate())
|
||||||
channel.bind('getPlaybackRates', (txn, params) => this.embed.player.options_.playbackRates)
|
channel.bind('getPlaybackRates', (txn, params) => this.player.options_.playbackRates)
|
||||||
|
|
||||||
channel.bind('playNextVideo', (txn, params) => this.embed.playNextPlaylistVideo())
|
channel.bind('playNextVideo', (txn, params) => this.embed.playNextPlaylistVideo())
|
||||||
channel.bind('playPreviousVideo', (txn, params) => this.embed.playPreviousPlaylistVideo())
|
channel.bind('playPreviousVideo', (txn, params) => this.embed.playPreviousPlaylistVideo())
|
||||||
|
@ -79,11 +78,11 @@ export class PeerTubeEmbedApi {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.embed.player.peertubeResolutions().select({ id: resolutionId, fireCallback: true })
|
this.player.peertubeResolutions().select({ id: resolutionId, fireCallback: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCaptions (): PeerTubeTextTrack[] {
|
private getCaptions (): PeerTubeTextTrack[] {
|
||||||
return this.embed.player.textTracks().tracks_.map(t => ({
|
return this.player.textTracks().tracks_.map(t => ({
|
||||||
id: t.id,
|
id: t.id,
|
||||||
src: t.src,
|
src: t.src,
|
||||||
label: t.label,
|
label: t.label,
|
||||||
|
@ -92,7 +91,7 @@ export class PeerTubeEmbedApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
private setCaption (id: string) {
|
private setCaption (id: string) {
|
||||||
const tracks = this.embed.player.textTracks().tracks_
|
const tracks = this.player.textTracks().tracks_
|
||||||
|
|
||||||
for (const track of tracks) {
|
for (const track of tracks) {
|
||||||
if (track.id === id) track.mode = 'showing'
|
if (track.id === id) track.mode = 'showing'
|
||||||
|
@ -112,15 +111,15 @@ export class PeerTubeEmbedApi {
|
||||||
let currentState: 'playing' | 'paused' | 'unstarted' | 'ended' = 'unstarted'
|
let currentState: 'playing' | 'paused' | 'unstarted' | 'ended' = 'unstarted'
|
||||||
|
|
||||||
this.videoElInterval = setInterval(() => {
|
this.videoElInterval = setInterval(() => {
|
||||||
const position = this.element.currentTime
|
const position = this.player?.currentTime() ?? 0
|
||||||
const volume = this.element.volume
|
const volume = this.player?.volume()
|
||||||
|
|
||||||
this.channel.notify({
|
this.channel.notify({
|
||||||
method: 'playbackStatusUpdate',
|
method: 'playbackStatusUpdate',
|
||||||
params: {
|
params: {
|
||||||
position,
|
position,
|
||||||
volume,
|
volume,
|
||||||
duration: this.embed.player.duration(),
|
duration: this.player?.duration(),
|
||||||
playbackState: currentState
|
playbackState: currentState
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -132,52 +131,48 @@ export class PeerTubeEmbedApi {
|
||||||
currentState = 'playing'
|
currentState = 'playing'
|
||||||
this.channel.notify({ method: 'playbackStatusChange', params: 'playing' })
|
this.channel.notify({ method: 'playbackStatusChange', params: 'playing' })
|
||||||
}
|
}
|
||||||
this.element.addEventListener('play', this.videoElPlayListener)
|
this.player.on('play', this.videoElPlayListener)
|
||||||
|
|
||||||
this.videoElPauseListener = () => {
|
this.videoElPauseListener = () => {
|
||||||
currentState = 'paused'
|
currentState = 'paused'
|
||||||
this.channel.notify({ method: 'playbackStatusChange', params: 'paused' })
|
this.channel.notify({ method: 'playbackStatusChange', params: 'paused' })
|
||||||
}
|
}
|
||||||
this.element.addEventListener('pause', this.videoElPauseListener)
|
this.player.on('pause', this.videoElPauseListener)
|
||||||
|
|
||||||
this.videoElEndedListener = () => {
|
this.videoElEndedListener = () => {
|
||||||
currentState = 'ended'
|
currentState = 'ended'
|
||||||
this.channel.notify({ method: 'playbackStatusChange', params: 'ended' })
|
this.channel.notify({ method: 'playbackStatusChange', params: 'ended' })
|
||||||
}
|
}
|
||||||
this.element.addEventListener('ended', this.videoElEndedListener)
|
this.player.on('ended', this.videoElEndedListener)
|
||||||
|
|
||||||
this.oldVideoElement = this.element
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
// PeerTube specific capabilities
|
// PeerTube specific capabilities
|
||||||
this.embed.player.peertubeResolutions().on('resolutions-added', () => this.loadResolutions())
|
this.player.peertubeResolutions().on('resolutions-added', () => this.loadResolutions())
|
||||||
this.embed.player.peertubeResolutions().on('resolutions-changed', () => this.loadResolutions())
|
this.player.peertubeResolutions().on('resolutions-changed', () => this.loadResolutions())
|
||||||
|
|
||||||
this.loadResolutions()
|
this.loadResolutions()
|
||||||
|
|
||||||
this.embed.player.on('volumechange', () => {
|
this.player.on('volumechange', () => {
|
||||||
this.channel.notify({
|
this.channel.notify({
|
||||||
method: 'volumeChange',
|
method: 'volumeChange',
|
||||||
params: this.embed.player.volume()
|
params: this.player.volume()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private disposeStateTracking () {
|
private disposeStateTracking () {
|
||||||
if (!this.oldVideoElement) return
|
if (!this.player) return
|
||||||
|
|
||||||
this.oldVideoElement.removeEventListener('play', this.videoElPlayListener)
|
this.player.off('play', this.videoElPlayListener)
|
||||||
this.oldVideoElement.removeEventListener('pause', this.videoElPauseListener)
|
this.player.off('pause', this.videoElPauseListener)
|
||||||
this.oldVideoElement.removeEventListener('ended', this.videoElEndedListener)
|
this.player.off('ended', this.videoElEndedListener)
|
||||||
|
|
||||||
clearInterval(this.videoElInterval)
|
clearInterval(this.videoElInterval)
|
||||||
|
|
||||||
this.oldVideoElement = undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadResolutions () {
|
private loadResolutions () {
|
||||||
this.resolutions = this.embed.player.peertubeResolutions().getResolutions()
|
this.resolutions = this.player.peertubeResolutions().getResolutions()
|
||||||
.map(r => ({
|
.map(r => ({
|
||||||
id: r.id,
|
id: r.id,
|
||||||
label: r.label,
|
label: r.label,
|
||||||
|
@ -193,6 +188,6 @@ export class PeerTubeEmbedApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
private isWebVideo () {
|
private isWebVideo () {
|
||||||
return !!this.embed.player.webVideo
|
return !!this.player.webVideo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,10 +83,6 @@ export class PeerTubeEmbed {
|
||||||
await embed.init()
|
await embed.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerElement () {
|
|
||||||
return this.playerHTML.getPlayerElement()
|
|
||||||
}
|
|
||||||
|
|
||||||
getScope () {
|
getScope () {
|
||||||
return this.playerOptionsBuilder.getScope()
|
return this.playerOptionsBuilder.getScope()
|
||||||
}
|
}
|
||||||
|
@ -420,8 +416,8 @@ export class PeerTubeEmbed {
|
||||||
playerElement.className = 'video-js vjs-peertube-skin'
|
playerElement.className = 'video-js vjs-peertube-skin'
|
||||||
playerElement.setAttribute('playsinline', 'true')
|
playerElement.setAttribute('playsinline', 'true')
|
||||||
|
|
||||||
this.playerHTML.setPlayerElement(playerElement)
|
this.playerHTML.setInitVideoEl(playerElement)
|
||||||
this.playerHTML.addPlayerElementToDOM()
|
this.playerHTML.addInitVideoElToDOM()
|
||||||
|
|
||||||
const [ { PeerTubePlayer } ] = await Promise.all([
|
const [ { PeerTubePlayer } ] = await Promise.all([
|
||||||
this.PeerTubePlayerManagerModulePromise,
|
this.PeerTubePlayerManagerModulePromise,
|
||||||
|
|
|
@ -5,36 +5,32 @@ import { Translations } from './translations'
|
||||||
export class PlayerHTML {
|
export class PlayerHTML {
|
||||||
private readonly wrapperElement: HTMLElement
|
private readonly wrapperElement: HTMLElement
|
||||||
|
|
||||||
private playerElement: HTMLVideoElement
|
private initVideoEl: HTMLVideoElement
|
||||||
private informationElement: HTMLDivElement
|
private informationElement: HTMLDivElement
|
||||||
|
|
||||||
constructor (private readonly videoWrapperId: string) {
|
constructor (private readonly videoWrapperId: string) {
|
||||||
this.wrapperElement = document.getElementById(this.videoWrapperId)
|
this.wrapperElement = document.getElementById(this.videoWrapperId)
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerElement () {
|
getInitVideoEl () {
|
||||||
return this.playerElement
|
return this.initVideoEl
|
||||||
}
|
}
|
||||||
|
|
||||||
setPlayerElement (playerElement: HTMLVideoElement) {
|
setInitVideoEl (playerElement: HTMLVideoElement) {
|
||||||
this.playerElement = playerElement
|
this.initVideoEl = playerElement
|
||||||
}
|
}
|
||||||
|
|
||||||
removePlayerElement () {
|
addInitVideoElToDOM () {
|
||||||
this.playerElement = null
|
this.wrapperElement.appendChild(this.initVideoEl)
|
||||||
}
|
|
||||||
|
|
||||||
addPlayerElementToDOM () {
|
|
||||||
this.wrapperElement.appendChild(this.playerElement)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
displayError (text: string, translations: Translations) {
|
displayError (text: string, translations: Translations) {
|
||||||
logger.error(text)
|
logger.error(text)
|
||||||
|
|
||||||
// Remove video element
|
// Remove video element
|
||||||
if (this.playerElement) {
|
if (this.initVideoEl) {
|
||||||
this.removeElement(this.playerElement)
|
this.removeElement(this.initVideoEl)
|
||||||
this.playerElement = undefined
|
this.initVideoEl = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const translatedText = peertubeTranslate(text, translations)
|
const translatedText = peertubeTranslate(text, translations)
|
||||||
|
|
|
@ -196,7 +196,7 @@ export class PlayerOptionsBuilder {
|
||||||
|
|
||||||
authorizationHeader,
|
authorizationHeader,
|
||||||
|
|
||||||
playerElement: () => this.playerHTML.getPlayerElement(),
|
playerElement: () => this.playerHTML.getInitVideoEl(),
|
||||||
enableHotkeys: true,
|
enableHotkeys: true,
|
||||||
|
|
||||||
peertubeLink: () => this.peertubeLink,
|
peertubeLink: () => this.peertubeLink,
|
||||||
|
|
|
@ -32,6 +32,13 @@ window.addEventListener('load', async () => {
|
||||||
await player.ready
|
await player.ready
|
||||||
logger.info('Player is ready.')
|
logger.info('Player is ready.')
|
||||||
|
|
||||||
|
const updatePlaylistPosition = () => {
|
||||||
|
player.getCurrentPosition()
|
||||||
|
.then(position => {
|
||||||
|
document.getElementById('playlist-position').innerHTML = position + ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const monitoredEvents = [
|
const monitoredEvents = [
|
||||||
'pause',
|
'pause',
|
||||||
'play',
|
'play',
|
||||||
|
@ -40,15 +47,19 @@ window.addEventListener('load', async () => {
|
||||||
]
|
]
|
||||||
|
|
||||||
monitoredEvents.forEach(e => {
|
monitoredEvents.forEach(e => {
|
||||||
player.addEventListener(e as PlayerEventType, (param) => logger.info(`PLAYER: event '${e}' received`, { param }))
|
player.addEventListener(e as PlayerEventType, param => {
|
||||||
logger.info(`PLAYER: now listening for event '${e}'`)
|
logger.info(`PLAYER: event '${e}' received`, { param })
|
||||||
|
|
||||||
|
if (e === 'playbackStatusChange' && isPlaylist) {
|
||||||
|
updatePlaylistPosition()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if (isPlaylist) {
|
if (isPlaylist) {
|
||||||
player.getCurrentPosition()
|
updatePlaylistPosition()
|
||||||
.then(position => {
|
|
||||||
document.getElementById('playlist-position').innerHTML = position + ''
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info(`PLAYER: now listening for event '${e}'`)
|
||||||
})
|
})
|
||||||
|
|
||||||
let playbackRates: number[] = []
|
let playbackRates: number[] = []
|
||||||
|
|
|
@ -45,7 +45,7 @@ import { cpus } from 'os'
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const LAST_MIGRATION_VERSION = 835
|
const LAST_MIGRATION_VERSION = 840
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import * as Sequelize from 'sequelize'
|
||||||
|
|
||||||
|
async function up (utils: {
|
||||||
|
transaction: Sequelize.Transaction
|
||||||
|
queryInterface: Sequelize.QueryInterface
|
||||||
|
sequelize: Sequelize.Sequelize
|
||||||
|
}): Promise<void> {
|
||||||
|
const { transaction } = utils
|
||||||
|
|
||||||
|
{
|
||||||
|
await utils.queryInterface.changeColumn('userExport', 'size', {
|
||||||
|
type: Sequelize.BIGINT,
|
||||||
|
allowNull: true
|
||||||
|
}, { transaction })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function down (options) {
|
||||||
|
throw new Error('Not implemented.')
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
down, up
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import {
|
||||||
hasAudioStream
|
hasAudioStream
|
||||||
} from '@peertube/peertube-ffmpeg'
|
} from '@peertube/peertube-ffmpeg'
|
||||||
import { LiveVideoError, LiveVideoErrorType, VideoState } from '@peertube/peertube-models'
|
import { LiveVideoError, LiveVideoErrorType, VideoState } from '@peertube/peertube-models'
|
||||||
|
import { retryTransactionWrapper } from '@server/helpers/database-utils.js'
|
||||||
import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
|
import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
|
||||||
import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config.js'
|
import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config.js'
|
||||||
import { VIDEO_LIVE, WEBSERVER } from '@server/initializers/constants.js'
|
import { VIDEO_LIVE, WEBSERVER } from '@server/initializers/constants.js'
|
||||||
|
@ -19,6 +20,7 @@ import { VideoLiveModel } from '@server/models/video/video-live.js'
|
||||||
import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'
|
import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'
|
||||||
import { VideoModel } from '@server/models/video/video.js'
|
import { VideoModel } from '@server/models/video/video.js'
|
||||||
import { MUser, MVideo, MVideoLiveSession, MVideoLiveVideo, MVideoLiveVideoWithSetting } from '@server/types/models/index.js'
|
import { MUser, MVideo, MVideoLiveSession, MVideoLiveVideo, MVideoLiveVideoWithSetting } from '@server/types/models/index.js'
|
||||||
|
import { FfprobeData } from 'fluent-ffmpeg'
|
||||||
import { readFile, readdir } from 'fs/promises'
|
import { readFile, readdir } from 'fs/promises'
|
||||||
import { Server, createServer } from 'net'
|
import { Server, createServer } from 'net'
|
||||||
import context from 'node-media-server/src/node_core_ctx.js'
|
import context from 'node-media-server/src/node_core_ctx.js'
|
||||||
|
@ -36,7 +38,6 @@ import { computeResolutionsToTranscode } from '../transcoding/transcoding-resolu
|
||||||
import { LiveQuotaStore } from './live-quota-store.js'
|
import { LiveQuotaStore } from './live-quota-store.js'
|
||||||
import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils.js'
|
import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils.js'
|
||||||
import { MuxingSession } from './shared/index.js'
|
import { MuxingSession } from './shared/index.js'
|
||||||
import { FfprobeData } from 'fluent-ffmpeg'
|
|
||||||
|
|
||||||
// Disable node media server logs
|
// Disable node media server logs
|
||||||
nodeMediaServerLogger.setLogType(0)
|
nodeMediaServerLogger.setLogType(0)
|
||||||
|
@ -84,7 +85,7 @@ class LiveManager {
|
||||||
const inputPublicUrl = session.inputOriginPublicUrl + streamPath
|
const inputPublicUrl = session.inputOriginPublicUrl + streamPath
|
||||||
|
|
||||||
this.handleSession({ sessionId, inputPublicUrl, inputLocalUrl, streamKey: splittedPath[2] })
|
this.handleSession({ sessionId, inputPublicUrl, inputLocalUrl, streamKey: splittedPath[2] })
|
||||||
.catch(err => logger.error('Cannot handle sessions.', { err, ...lTags(sessionId) }))
|
.catch(err => logger.error('Cannot handle session', { err, ...lTags(sessionId) }))
|
||||||
})
|
})
|
||||||
|
|
||||||
events.on('donePublish', (sessionId: string) => {
|
events.on('donePublish', (sessionId: string) => {
|
||||||
|
@ -558,25 +559,27 @@ class LiveManager {
|
||||||
return resolutionsEnabled
|
return resolutionsEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
private async saveStartingSession (videoLive: MVideoLiveVideoWithSetting) {
|
private saveStartingSession (videoLive: MVideoLiveVideoWithSetting) {
|
||||||
const replaySettings = videoLive.saveReplay
|
const replaySettings = videoLive.saveReplay
|
||||||
? new VideoLiveReplaySettingModel({
|
? new VideoLiveReplaySettingModel({
|
||||||
privacy: videoLive.ReplaySetting.privacy
|
privacy: videoLive.ReplaySetting.privacy
|
||||||
})
|
})
|
||||||
: null
|
: null
|
||||||
|
|
||||||
return sequelizeTypescript.transaction(async t => {
|
return retryTransactionWrapper(() => {
|
||||||
if (videoLive.saveReplay) {
|
return sequelizeTypescript.transaction(async t => {
|
||||||
await replaySettings.save({ transaction: t })
|
if (videoLive.saveReplay) {
|
||||||
}
|
await replaySettings.save({ transaction: t })
|
||||||
|
}
|
||||||
|
|
||||||
return VideoLiveSessionModel.create({
|
return VideoLiveSessionModel.create({
|
||||||
startDate: new Date(),
|
startDate: new Date(),
|
||||||
liveVideoId: videoLive.videoId,
|
liveVideoId: videoLive.videoId,
|
||||||
saveReplay: videoLive.saveReplay,
|
saveReplay: videoLive.saveReplay,
|
||||||
replaySettingId: videoLive.saveReplay ? replaySettings.id : null,
|
replaySettingId: videoLive.saveReplay ? replaySettings.id : null,
|
||||||
endingProcessed: false
|
endingProcessed: false
|
||||||
}, { transaction: t })
|
}, { transaction: t })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
type PluginType_Type
|
type PluginType_Type
|
||||||
} from '@peertube/peertube-models'
|
} from '@peertube/peertube-models'
|
||||||
import { MPlugin, MPluginFormattable } from '@server/types/models/index.js'
|
import { MPlugin, MPluginFormattable } from '@server/types/models/index.js'
|
||||||
import { FindAndCountOptions, json, QueryTypes } from 'sequelize'
|
import { FindAndCountOptions, QueryTypes, json } from 'sequelize'
|
||||||
import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Table, UpdatedAt } from 'sequelize-typescript'
|
import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Table, UpdatedAt } from 'sequelize-typescript'
|
||||||
import {
|
import {
|
||||||
isPluginDescriptionValid,
|
isPluginDescriptionValid,
|
||||||
|
@ -18,7 +18,6 @@ import {
|
||||||
isPluginTypeValid
|
isPluginTypeValid
|
||||||
} from '../../helpers/custom-validators/plugins.js'
|
} from '../../helpers/custom-validators/plugins.js'
|
||||||
import { SequelizeModel, getSort, throwIfNotValid } from '../shared/index.js'
|
import { SequelizeModel, getSort, throwIfNotValid } from '../shared/index.js'
|
||||||
import { logger } from '@server/helpers/logger.js'
|
|
||||||
|
|
||||||
@DefaultScope(() => ({
|
@DefaultScope(() => ({
|
||||||
attributes: {
|
attributes: {
|
||||||
|
@ -174,7 +173,6 @@ export class PluginModel extends SequelizeModel<PluginModel> {
|
||||||
result[name] = p.settings[name]
|
result[name] = p.settings[name]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.error('internal', { result })
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class UserExportModel extends SequelizeModel<UserExportModel> {
|
||||||
error: string
|
error: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column(DataType.BIGINT)
|
||||||
size: number
|
size: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
|
|
|
@ -89,13 +89,25 @@ object_storage:
|
||||||
bucket_name: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BUCKET_NAME"
|
bucket_name: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BUCKET_NAME"
|
||||||
prefix: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_PREFIX"
|
prefix: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_PREFIX"
|
||||||
base_url: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BASE_URL"
|
base_url: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BASE_URL"
|
||||||
upload_acl: "PEERTUBE_OBJECT_STORAGE_UPLOAD_ACL"
|
store_live_streams:
|
||||||
|
__name: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_STORE_LIVE_STREAMS"
|
||||||
|
__format: "json"
|
||||||
|
|
||||||
web_videos:
|
web_videos:
|
||||||
bucket_name: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BUCKET_NAME"
|
bucket_name: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BUCKET_NAME"
|
||||||
prefix: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_PREFIX"
|
prefix: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_PREFIX"
|
||||||
base_url: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BASE_URL"
|
base_url: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BASE_URL"
|
||||||
|
|
||||||
|
user_exports:
|
||||||
|
bucket_name: "PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_BUCKET_NAME"
|
||||||
|
prefix: "PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_PREFIX"
|
||||||
|
base_url: "PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_BASE_URL"
|
||||||
|
|
||||||
|
original_video_files:
|
||||||
|
bucket_name: "PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_BUCKET_NAME"
|
||||||
|
prefix: "PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_PREFIX"
|
||||||
|
base_url: "PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_BASE_URL"
|
||||||
|
|
||||||
webadmin:
|
webadmin:
|
||||||
configuration:
|
configuration:
|
||||||
edition:
|
edition:
|
||||||
|
|
Loading…
Reference in New Issue