From 784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Jul 2023 09:21:13 +0200 Subject: Prefer web videos in favour of webtorrent --- README.md | 2 +- .../e2e/src/suites-all/private-videos.e2e-spec.ts | 8 ++-- client/e2e/src/suites-all/videos.e2e-spec.ts | 4 +- client/e2e/src/utils/urls.ts | 6 +-- client/e2e/wdio.local-test.conf.ts | 18 ++++----- .../edit-vod-transcoding.component.html | 6 +-- .../+admin/overview/videos/video-admin.service.ts | 12 +++--- .../overview/videos/video-list.component.html | 12 +++--- .../+admin/overview/videos/video-list.component.ts | 22 +++++------ client/src/app/core/users/user.model.ts | 2 - .../app/shared/shared-main/video/video.model.ts | 4 +- .../app/shared/shared-main/video/video.service.ts | 6 +-- .../video-actions-dropdown.component.ts | 12 +++--- config/default.yaml | 8 ++-- config/production.yaml.example | 9 ++--- scripts/prune-storage.ts | 8 ++-- server/controllers/api/runners/jobs-files.ts | 4 +- server/controllers/api/users/me.ts | 9 +---- server/controllers/api/videos/files.ts | 34 ++++++++-------- server/controllers/object-storage-proxy.ts | 12 +++--- server/controllers/static.ts | 10 ++--- server/helpers/custom-validators/metrics.ts | 3 +- .../helpers/custom-validators/video-transcoding.ts | 2 +- server/helpers/query.ts | 3 +- server/initializers/checker-after-init.ts | 2 +- .../activitypub/videos/shared/abstract-builder.ts | 2 +- server/lib/activitypub/videos/shared/creator.ts | 2 +- server/lib/activitypub/videos/updater.ts | 2 +- .../job-queue/handlers/move-to-object-storage.ts | 10 ++--- server/lib/job-queue/handlers/video-file-import.ts | 6 +-- server/lib/job-queue/handlers/video-import.ts | 4 +- server/lib/job-queue/handlers/video-transcoding.ts | 32 +++++++-------- server/lib/object-storage/keys.ts | 4 +- server/lib/object-storage/pre-signed-urls.ts | 8 ++-- server/lib/object-storage/proxy.ts | 8 ++-- server/lib/object-storage/urls.ts | 8 ++-- server/lib/object-storage/videos.ts | 34 ++++++++-------- server/lib/paths.ts | 4 +- server/lib/plugins/plugin-helpers-builder.ts | 10 +++-- .../lib/runners/job-handlers/shared/vod-helpers.ts | 4 +- .../vod-audio-merge-transcoding-job-handler.ts | 2 +- .../vod-hls-transcoding-job-handler.ts | 4 +- .../lib/schedulers/videos-redundancy-scheduler.ts | 4 +- server/lib/transcoding/create-transcoding-job.ts | 2 +- .../shared/job-builders/abstract-job-builder.ts | 2 +- .../job-builders/transcoding-job-queue-builder.ts | 40 +++++++++---------- .../job-builders/transcoding-runner-job-builder.ts | 4 +- server/lib/transcoding/web-transcoding.ts | 24 +++++------ server/lib/video-file.ts | 18 ++++----- server/lib/video-path-manager.ts | 4 +- server/lib/video-privacy.ts | 16 ++++---- server/lib/video-studio.ts | 8 ++-- server/lib/video-urls.ts | 4 +- server/middlewares/validators/static.ts | 8 ++-- .../middlewares/validators/videos/video-files.ts | 26 ++++++------ server/middlewares/validators/videos/videos.ts | 6 ++- server/models/redundancy/video-redundancy.ts | 2 +- server/models/user/user.ts | 6 +-- .../video/shared/abstract-video-query-builder.ts | 4 +- .../sql/video/shared/video-file-query-builder.ts | 12 +++--- .../video/sql/video/shared/video-model-builder.ts | 20 +++++----- .../sql/video/video-model-get-query-builder.ts | 12 +++--- .../sql/video/videos-id-list-query-builder.ts | 16 +++++--- .../sql/video/videos-model-list-query-builder.ts | 10 ++--- server/models/video/video-change-ownership.ts | 2 +- server/models/video/video-file.ts | 30 +++++++------- server/models/video/video.ts | 27 ++++++++----- server/tests/api/check-params/config.ts | 2 +- server/tests/api/check-params/transcoding.ts | 14 +++---- server/tests/api/check-params/video-files.ts | 44 ++++++++++----------- .../object-storage/video-static-file-privacy.ts | 30 +++++++------- server/tests/api/object-storage/videos.ts | 38 +++++++++--------- server/tests/api/redundancy/redundancy.ts | 18 ++++----- server/tests/api/transcoding/audio-only.ts | 6 +-- server/tests/api/transcoding/create-transcoding.ts | 14 +++---- server/tests/api/transcoding/hls.ts | 2 +- server/tests/api/transcoding/transcoder.ts | 28 ++++++------- .../api/transcoding/update-while-transcoding.ts | 2 +- server/tests/api/transcoding/video-studio.ts | 6 +-- server/tests/api/users/user-videos.ts | 2 +- server/tests/api/users/users.ts | 24 +++-------- server/tests/api/videos/video-files.ts | 34 ++++++++-------- server/tests/api/videos/videos-common-filters.ts | 34 ++++++++-------- server/tests/peertube-runner/studio-transcoding.ts | 4 +- server/tests/peertube-runner/vod-transcoding.ts | 46 +++++++++++----------- server/tests/plugins/plugin-helpers.ts | 6 +-- server/tests/plugins/plugin-transcoding.ts | 2 +- server/tests/shared/videos.ts | 10 ++--- server/tools/peertube-redundancy.ts | 8 ++-- server/types/models/video/video-file.ts | 2 +- .../types/plugins/register-server-option.model.ts | 12 +++++- shared/models/search/videos-common-query.model.ts | 4 +- shared/models/server/job.model.ts | 12 +++--- shared/models/users/user-update-me.model.ts | 2 - shared/models/users/user.model.ts | 2 - .../transcoding/video-transcoding-create.model.ts | 2 +- shared/server-commands/server/config-command.ts | 8 ++-- shared/server-commands/server/servers-command.ts | 2 +- shared/server-commands/videos/videos-command.ts | 10 ++--- support/doc/api/embeds.md | 2 +- support/doc/api/openapi.yaml | 46 +++++++++++----------- support/doc/tools.md | 2 +- 102 files changed, 579 insertions(+), 570 deletions(-) diff --git a/README.md b/README.md index 0c2989c62..09585aa15 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Be it as a user or an instance administrator, you can decide what your experienc

Communities that help each other

-In addition to visitors using WebTorrent to share the load among them, instances can help each other by caching one another's videos. This way even small instances have a way to show content to a wider audience, as they will be shouldered by friend instances (more about that in our redundancy guide). +In addition to visitors using P2P with WebRTC to share the load among them, instances can help each other by caching one another's videos. This way even small instances have a way to show content to a wider audience, as they will be shouldered by friend instances (more about that in our redundancy guide).

Content creators can get help from their viewers in the simplest way possible: a support button showing a message linking to their donation accounts or really anything else. No more pay-per-view and advertisements that hurt visitors and alter creativity (more about that in our FAQ). diff --git a/client/e2e/src/suites-all/private-videos.e2e-spec.ts b/client/e2e/src/suites-all/private-videos.e2e-spec.ts index a25208bb3..829d76a84 100644 --- a/client/e2e/src/suites-all/private-videos.e2e-spec.ts +++ b/client/e2e/src/suites-all/private-videos.e2e-spec.ts @@ -31,8 +31,8 @@ describe('Private videos all workflow', () => { return loginPage.loginOnPeerTube2() }) - it('Should play an internal webtorrent video', async () => { - await go(FIXTURE_URLS.INTERNAL_WEBTORRENT_VIDEO) + it('Should play an internal web video video', async () => { + await go(FIXTURE_URLS.INTERNAL_WEB_VIDEO) await videoWatchPage.waitWatchVideoName(internalVideoName) await checkCorrectlyPlay(playerPage) @@ -52,8 +52,8 @@ describe('Private videos all workflow', () => { await checkCorrectlyPlay(playerPage) }) - it('Should play an internal WebTorrent video in embed', async () => { - await go(FIXTURE_URLS.INTERNAL_EMBED_WEBTORRENT_VIDEO) + it('Should play an internal Web Video in embed', async () => { + await go(FIXTURE_URLS.INTERNAL_EMBED_WEB_VIDEO) await videoWatchPage.waitEmbedForDisplayed() await checkCorrectlyPlay(playerPage) diff --git a/client/e2e/src/suites-all/videos.e2e-spec.ts b/client/e2e/src/suites-all/videos.e2e-spec.ts index d1ab9aef3..5d0f8c152 100644 --- a/client/e2e/src/suites-all/videos.e2e-spec.ts +++ b/client/e2e/src/suites-all/videos.e2e-spec.ts @@ -89,7 +89,7 @@ describe('Videos all workflow', () => { let videoNameToExcept = videoName if (isMobileDevice() || isSafari()) { - await go(FIXTURE_URLS.WEBTORRENT_VIDEO) + await go(FIXTURE_URLS.WEB_VIDEO) videoNameToExcept = 'E2E tests' } else { await videoListPage.clickOnVideo(videoName) @@ -176,7 +176,7 @@ describe('Videos all workflow', () => { await videoWatchPage.waitUntilVideoName(video2Name, 40 * 1000) }) - it('Should watch the webtorrent playlist in the embed', async () => { + it('Should watch the WEB VIDEO playlist in the embed', async () => { if (isUploadUnsupported()) return const accessToken = await browser.execute(`return window.localStorage.getItem('access_token');`) diff --git a/client/e2e/src/utils/urls.ts b/client/e2e/src/utils/urls.ts index cc0bdfbff..eafe0aa5d 100644 --- a/client/e2e/src/utils/urls.ts +++ b/client/e2e/src/utils/urls.ts @@ -1,14 +1,14 @@ const FIXTURE_URLS = { - INTERNAL_WEBTORRENT_VIDEO: 'https://peertube2.cpy.re/w/pwfz7NizSdPD4mJcbbmNwa?mode=webtorrent&start=0', + INTERNAL_WEB_VIDEO: 'https://peertube2.cpy.re/w/pwfz7NizSdPD4mJcbbmNwa?mode=web-video&start=0', INTERNAL_HLS_VIDEO: 'https://peertube2.cpy.re/w/pwfz7NizSdPD4mJcbbmNwa?start=0', - INTERNAL_EMBED_WEBTORRENT_VIDEO: 'https://peertube2.cpy.re/videos/embed/pwfz7NizSdPD4mJcbbmNwa?mode=webtorrent&start=0', + INTERNAL_EMBED_WEB_VIDEO: 'https://peertube2.cpy.re/videos/embed/pwfz7NizSdPD4mJcbbmNwa?mode=web-video&start=0', INTERNAL_EMBED_HLS_VIDEO: 'https://peertube2.cpy.re/videos/embed/pwfz7NizSdPD4mJcbbmNwa?start=0', INTERNAL_HLS_ONLY_VIDEO: 'https://peertube2.cpy.re/w/tKQmHcqdYZRdCszLUiWM3V?start=0', INTERNAL_EMBED_HLS_ONLY_VIDEO: 'https://peertube2.cpy.re/videos/embed/tKQmHcqdYZRdCszLUiWM3V?start=0', - WEBTORRENT_VIDEO: 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e', + WEB_VIDEO: 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e', HLS_EMBED: 'https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50', HLS_PLAYLIST_EMBED: 'https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a', diff --git a/client/e2e/wdio.local-test.conf.ts b/client/e2e/wdio.local-test.conf.ts index 96ddc67ca..6c0171372 100644 --- a/client/e2e/wdio.local-test.conf.ts +++ b/client/e2e/wdio.local-test.conf.ts @@ -24,19 +24,19 @@ module.exports = { specFileRetries: 0, capabilities: [ - { - 'browserName': 'chrome', - 'acceptInsecureCerts': true, - 'goog:chromeOptions': { - args: [ '--disable-gpu', windowSizeArg ], - prefs - } - }, + // { + // 'browserName': 'chrome', + // 'acceptInsecureCerts': true, + // 'goog:chromeOptions': { + // args: [ '--disable-gpu', windowSizeArg ], + // prefs + // } + // }, { 'browserName': 'firefox', 'moz:firefoxOptions': { binary: '/usr/bin/firefox-developer-edition', - args: [ '--headless', windowSizeArg ], + // args: [ '--headless', windowSizeArg ], prefs } diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html index fb750aca6..7218511a9 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html @@ -71,7 +71,7 @@

@@ -93,14 +93,14 @@ Requires ffmpeg >= 4.1 -

Generate HLS playlists and fragmented MP4 files resulting in a better playback than with plain WebTorrent:

+

Generate HLS playlists and fragmented MP4 files resulting in a better playback than with Web Videos:

  • Resolution change is smoother
  • Faster playback especially with long videos
  • More stable playback (less bugs/infinite loading)
-

If you also enabled WebTorrent support, it will multiply videos storage by 2

+

If you also enabled Web Videos support, it will multiply videos storage by 2

diff --git a/client/src/app/+admin/overview/videos/video-admin.service.ts b/client/src/app/+admin/overview/videos/video-admin.service.ts index 195b265a1..722495706 100644 --- a/client/src/app/+admin/overview/videos/video-admin.service.ts +++ b/client/src/app/+admin/overview/videos/video-admin.service.ts @@ -59,12 +59,12 @@ export class VideoAdminService { title: $localize`Video files`, children: [ { - value: 'webtorrent:true isLocal:true', - label: $localize`With WebTorrent` + value: 'webVideos:true isLocal:true', + label: $localize`With Web Videos` }, { - value: 'webtorrent:false isLocal:true', - label: $localize`Without WebTorrent` + value: 'webVideos:false isLocal:true', + label: $localize`Without Web Videos` }, { value: 'hls:true isLocal:true', @@ -126,8 +126,8 @@ export class VideoAdminService { prefix: 'hls:', isBoolean: true }, - hasWebtorrentFiles: { - prefix: 'webtorrent:', + hasWebVideoFiles: { + prefix: 'webVideos:', isBoolean: true }, isLive: { diff --git a/client/src/app/+admin/overview/videos/video-list.component.html b/client/src/app/+admin/overview/videos/video-list.component.html index c4f78cadc..3a4666435 100644 --- a/client/src/app/+admin/overview/videos/video-list.component.html +++ b/client/src/app/+admin/overview/videos/video-list.component.html @@ -83,8 +83,8 @@ - HLS - WebTorrent ({{ video.files.length }}) + HLS + Web Videos ({{ video.files.length }}) Live Object storage @@ -102,8 +102,8 @@
-
- WebTorrent: +
+ Web Videos:
  • @@ -112,13 +112,13 @@
-
+
HLS:
    diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts index e9c526193..52f02d8d0 100644 --- a/client/src/app/+admin/overview/videos/video-list.component.ts +++ b/client/src/app/+admin/overview/videos/video-list.component.ts @@ -99,8 +99,8 @@ export class VideoListComponent extends RestTable