Put instance name in embed button

pull/5098/head
Chocobozzz 2022-06-28 14:04:03 +02:00
parent 9f4109e263
commit bd2b51be4b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
9 changed files with 37 additions and 24 deletions

View File

@ -627,6 +627,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
embedUrl: video.embedUrl,
embedTitle: video.name,
instanceName: this.serverConfig.instance.name,
isLive: video.isLive,
liveOptions,

View File

@ -5,6 +5,8 @@ import { PeerTubeLinkButtonOptions } from '../../types'
const Button = videojs.getComponent('Button')
class PeerTubeLinkButton extends Button {
private instanceName: string
constructor (player: videojs.Player, options?: PeerTubeLinkButtonOptions) {
super(player, options as any)
}
@ -24,7 +26,7 @@ class PeerTubeLinkButton extends Button {
private buildElement () {
const el = videojs.dom.createEl('a', {
href: this.buildLink(),
innerHTML: 'PeerTube',
innerHTML: (this.options_ as PeerTubeLinkButtonOptions).instanceName,
title: this.player().localize('Video page (new window)'),
className: 'vjs-peertube-link',
target: '_blank'

View File

@ -51,7 +51,10 @@ export class ControlBarOptionsBuilder {
if (this.options.peertubeLink === true) {
Object.assign(children, {
peerTubeLinkButton: { shortUUID: this.options.videoShortUUID } as PeerTubeLinkButtonOptions
peerTubeLinkButton: {
shortUUID: this.options.videoShortUUID,
instanceName: this.options.instanceName
} as PeerTubeLinkButtonOptions
})
}

View File

@ -51,6 +51,8 @@ export interface CommonOptions extends CustomizationOptions {
inactivityTimeout: number
poster: string
instanceName: string
theaterButton: boolean
captions: boolean

View File

@ -127,6 +127,7 @@ type NextPreviousVideoButtonOptions = {
type PeerTubeLinkButtonOptions = {
shortUUID: string
instanceName: string
}
type PeerTubeP2PInfoButtonOptions = {

View File

@ -160,8 +160,8 @@
.vjs-peertube {
@include margin-right(6px);
@include margin-left(auto);
width: 100%;
line-height: $control-bar-height;
text-align: end;
overflow: hidden;
@ -358,11 +358,13 @@
.vjs-peertube-link {
@include disable-outline;
@include disable-default-a-behaviour;
@include ellipsis;
text-decoration: none;
line-height: $control-bar-height;
font-weight: $font-semibold;
padding: 0 5px;
max-width: 150px;
}
.vjs-theater-control {
@ -420,6 +422,10 @@
}
@media screen and (max-width: $screen-width-570) {
.vjs-volume-control {
display: none;
}
.vjs-peertube {
padding: 0 !important;
@ -428,6 +434,10 @@
}
}
.vjs-peertube-link {
max-width: 100px;
}
&.vjs-live {
.vjs-duration {
display: none !important;
@ -440,7 +450,6 @@
}
@media screen and (max-width: $screen-width-350) {
.vjs-volume-control,
.vjs-next-video,
.vjs-previous-video {
display: none !important;
@ -458,6 +467,12 @@
@include margin-right($first-control-bar-element-margin-left-small-width);
}
.vjs-play-control {
@include margin-left(0);
width: 30px;
}
&.vjs-live {
.vjs-current-time {
display: none !important;

View File

@ -40,25 +40,6 @@ body {
.vjs-poster {
background-size: 100% auto;
}
@media screen and (max-width: 350px) {
.vjs-play-control {
padding: 0 5px !important;
width: 25px !important;
}
.vjs-volume-control {
display: none !important;
}
.vjs-volume-panel {
width: 26px !important;
}
.vjs-peertube-link {
padding: 0;
}
}
}
#error-block {

View File

@ -196,6 +196,8 @@ export class PeerTubeEmbed {
captionsResponse,
alreadyHadPlayer,
translations,
serverConfig: this.config,
onVideoUpdate: (uuid: string) => this.loadVideoAndBuildPlayer(uuid),
playlistTracker: this.playlistTracker,

View File

@ -148,6 +148,8 @@ export class PlayerManagerOptions {
captionsResponse: Response
live?: LiveVideo
serverConfig: HTMLServerConfig
alreadyHadPlayer: boolean
translations: Translations
@ -163,7 +165,8 @@ export class PlayerManagerOptions {
alreadyHadPlayer,
translations,
playlistTracker,
live
live,
serverConfig
} = options
const videoCaptions = await this.buildCaptions(captionsResponse, translations)
@ -205,7 +208,10 @@ export class PlayerManagerOptions {
videoDuration: video.duration,
enableHotkeys: true,
peertubeLink: this.peertubeLink,
instanceName: serverConfig.instance.name,
poster: window.location.origin + video.previewPath,
theaterButton: false,