aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts58
-rw-r--r--server/models/activitypub/actor.ts17
-rw-r--r--server/tests/api/videos/video-transcoder.ts4
-rw-r--r--server/tests/cli/optimize-old-videos.ts4
4 files changed, 50 insertions, 33 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index adf6dc12f..eee7adfd8 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -551,26 +551,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
551 } 551 }
552 } 552 }
553 553
554 private initHotkeys () {
555 this.hotkeys = [
556 new Hotkey('shift+l', () => {
557 this.setLike()
558 return false
559 }, undefined, this.i18n('Like the video')),
560
561 new Hotkey('shift+d', () => {
562 this.setDislike()
563 return false
564 }, undefined, this.i18n('Dislike the video')),
565
566 new Hotkey('shift+s', () => {
567 this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe()
568 return false
569 }, undefined, this.i18n('Subscribe to the account'))
570 ]
571 if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
572 }
573
574 private buildPlayerManagerOptions (params: { 554 private buildPlayerManagerOptions (params: {
575 video: VideoDetails, 555 video: VideoDetails,
576 videoCaptions: VideoCaption[], 556 videoCaptions: VideoCaption[],
@@ -667,4 +647,42 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
667 647
668 this.player.pause() 648 this.player.pause()
669 } 649 }
650
651 private initHotkeys () {
652 this.hotkeys = [
653 new Hotkey('shift+l', () => {
654 this.setLike()
655 return false
656 }, undefined, this.i18n('Like the video')),
657
658 new Hotkey('shift+d', () => {
659 this.setDislike()
660 return false
661 }, undefined, this.i18n('Dislike the video')),
662
663 new Hotkey('shift+s', () => {
664 this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe()
665 return false
666 }, undefined, this.i18n('Subscribe to the account')),
667
668 // These hotkeys are managed by the player
669 new Hotkey('f', e => e, undefined, this.i18n('Enter/exit fullscreen (requires player focus)')),
670 new Hotkey('space', e => e, undefined, this.i18n('Play/Pause the video (requires player focus)')),
671 new Hotkey('m', e => e, undefined, this.i18n('Mute/unmute the video (requires player focus)')),
672
673 new Hotkey('0-9', e => e, undefined, this.i18n('Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)')),
674
675 new Hotkey('up', e => e, undefined, this.i18n('Increase the volume (requires player focus)')),
676 new Hotkey('down', e => e, undefined, this.i18n('Decrease the volume (requires player focus)')),
677
678 new Hotkey('right', e => e, undefined, this.i18n('Seek the video forward (requires player focus)')),
679 new Hotkey('left', e => e, undefined, this.i18n('Seek the video backward (requires player focus)')),
680
681 new Hotkey('>', e => e, undefined, this.i18n('Increase playback rate (requires player focus)')),
682 new Hotkey('<', e => e, undefined, this.i18n('Decrease playback rate (requires player focus)')),
683
684 new Hotkey('.', e => e, undefined, this.i18n('Navigate in the video frame by frame (requires player focus)'))
685 ]
686 if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
687 }
670} 688}
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 66a13b857..e539b579c 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -1,6 +1,5 @@
1import { values } from 'lodash' 1import { values } from 'lodash'
2import { extname } from 'path' 2import { extname } from 'path'
3import * as Sequelize from 'sequelize'
4import { 3import {
5 AllowNull, 4 AllowNull,
6 BelongsTo, 5 BelongsTo,
@@ -48,7 +47,7 @@ import {
48 MActorWithInboxes 47 MActorWithInboxes
49} from '../../typings/models' 48} from '../../typings/models'
50import * as Bluebird from 'bluebird' 49import * as Bluebird from 'bluebird'
51import { Op } from 'sequelize' 50import { Op, Transaction } from 'sequelize'
52 51
53enum ScopeNames { 52enum ScopeNames {
54 FULL = 'FULL' 53 FULL = 'FULL'
@@ -285,7 +284,7 @@ export class ActorModel extends Model<ActorModel> {
285 return ActorModel.scope(ScopeNames.FULL).findByPk(id) 284 return ActorModel.scope(ScopeNames.FULL).findByPk(id)
286 } 285 }
287 286
288 static loadFromAccountByVideoId (videoId: number, transaction: Sequelize.Transaction): Bluebird<MActor> { 287 static loadFromAccountByVideoId (videoId: number, transaction: Transaction): Bluebird<MActor> {
289 const query = { 288 const query = {
290 include: [ 289 include: [
291 { 290 {
@@ -329,11 +328,11 @@ export class ActorModel extends Model<ActorModel> {
329 .then(a => !!a) 328 .then(a => !!a)
330 } 329 }
331 330
332 static listByFollowersUrls (followersUrls: string[], transaction?: Sequelize.Transaction): Bluebird<MActorFull[]> { 331 static listByFollowersUrls (followersUrls: string[], transaction?: Transaction): Bluebird<MActorFull[]> {
333 const query = { 332 const query = {
334 where: { 333 where: {
335 followersUrl: { 334 followersUrl: {
336 [ Sequelize.Op.in ]: followersUrls 335 [ Op.in ]: followersUrls
337 } 336 }
338 }, 337 },
339 transaction 338 transaction
@@ -342,7 +341,7 @@ export class ActorModel extends Model<ActorModel> {
342 return ActorModel.scope(ScopeNames.FULL).findAll(query) 341 return ActorModel.scope(ScopeNames.FULL).findAll(query)
343 } 342 }
344 343
345 static loadLocalByName (preferredUsername: string, transaction?: Sequelize.Transaction): Bluebird<MActorFull> { 344 static loadLocalByName (preferredUsername: string, transaction?: Transaction): Bluebird<MActorFull> {
346 const query = { 345 const query = {
347 where: { 346 where: {
348 preferredUsername, 347 preferredUsername,
@@ -373,7 +372,7 @@ export class ActorModel extends Model<ActorModel> {
373 return ActorModel.scope(ScopeNames.FULL).findOne(query) 372 return ActorModel.scope(ScopeNames.FULL).findOne(query)
374 } 373 }
375 374
376 static loadByUrl (url: string, transaction?: Sequelize.Transaction): Bluebird<MActorAccountChannelId> { 375 static loadByUrl (url: string, transaction?: Transaction): Bluebird<MActorAccountChannelId> {
377 const query = { 376 const query = {
378 where: { 377 where: {
379 url 378 url
@@ -396,7 +395,7 @@ export class ActorModel extends Model<ActorModel> {
396 return ActorModel.unscoped().findOne(query) 395 return ActorModel.unscoped().findOne(query)
397 } 396 }
398 397
399 static loadByUrlAndPopulateAccountAndChannel (url: string, transaction?: Sequelize.Transaction): Bluebird<MActorFull> { 398 static loadByUrlAndPopulateAccountAndChannel (url: string, transaction?: Transaction): Bluebird<MActorFull> {
400 const query = { 399 const query = {
401 where: { 400 where: {
402 url 401 url
@@ -483,7 +482,7 @@ export class ActorModel extends Model<ActorModel> {
483 return activityPubContextify(json) 482 return activityPubContextify(json)
484 } 483 }
485 484
486 getFollowerSharedInboxUrls (t: Sequelize.Transaction) { 485 getFollowerSharedInboxUrls (t: Transaction) {
487 const query = { 486 const query = {
488 attributes: [ 'sharedInboxUrl' ], 487 attributes: [ 'sharedInboxUrl' ],
489 include: [ 488 include: [
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 90ade1652..4be74901a 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -292,7 +292,7 @@ describe('Test video transcoding', function () {
292 tempFixturePath = await generateHighBitrateVideo() 292 tempFixturePath = await generateHighBitrateVideo()
293 293
294 const bitrate = await getVideoFileBitrate(tempFixturePath) 294 const bitrate = await getVideoFileBitrate(tempFixturePath)
295 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 60, VIDEO_TRANSCODING_FPS)) 295 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
296 } 296 }
297 297
298 const videoAttributes = { 298 const videoAttributes = {
@@ -331,7 +331,7 @@ describe('Test video transcoding', function () {
331 tempFixturePath = await generateHighBitrateVideo() 331 tempFixturePath = await generateHighBitrateVideo()
332 332
333 const bitrate = await getVideoFileBitrate(tempFixturePath) 333 const bitrate = await getVideoFileBitrate(tempFixturePath)
334 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 60, VIDEO_TRANSCODING_FPS)) 334 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
335 } 335 }
336 336
337 for (const fixture of [ 'video_short.mkv', 'video_short.avi' ]) { 337 for (const fixture of [ 'video_short.mkv', 'video_short.avi' ]) {
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index fa82f962c..de5d672f5 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -46,7 +46,7 @@ describe('Test optimize old videos', function () {
46 tempFixturePath = await generateHighBitrateVideo() 46 tempFixturePath = await generateHighBitrateVideo()
47 47
48 const bitrate = await getVideoFileBitrate(tempFixturePath) 48 const bitrate = await getVideoFileBitrate(tempFixturePath)
49 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 60, VIDEO_TRANSCODING_FPS)) 49 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
50 } 50 }
51 51
52 // Upload two videos for our needs 52 // Upload two videos for our needs
@@ -102,7 +102,7 @@ describe('Test optimize old videos', function () {
102 expect(videosDetails.files).to.have.lengthOf(1) 102 expect(videosDetails.files).to.have.lengthOf(1)
103 const file = videosDetails.files[0] 103 const file = videosDetails.files[0]
104 104
105 expect(file.size).to.be.below(5000000) 105 expect(file.size).to.be.below(8000000)
106 106
107 const path = join(root(), 'test' + servers[0].internalServerNumber, 'videos', video.uuid + '-' + file.resolution.id + '.mp4') 107 const path = join(root(), 'test' + servers[0].internalServerNumber, 'videos', video.uuid + '-' + file.resolution.id + '.mp4')
108 const bitrate = await getVideoFileBitrate(path) 108 const bitrate = await getVideoFileBitrate(path)