diff --git a/client/package.json b/client/package.json index 862e7dbef..0b7c041ed 100644 --- a/client/package.json +++ b/client/package.json @@ -52,8 +52,8 @@ "@ngx-loading-bar/core": "^6.0.0", "@ngx-loading-bar/http-client": "^6.0.0", "@ngx-loading-bar/router": "^6.0.0", - "@peertube/p2p-media-loader-core": "^1.0.7", - "@peertube/p2p-media-loader-hlsjs": "^1.0.11", + "@peertube/p2p-media-loader-core": "^1.0.13", + "@peertube/p2p-media-loader-hlsjs": "^1.0.13", "@peertube/videojs-contextmenu": "^5.5.0", "@peertube/xliffmerge": "^2.0.3", "@popperjs/core": "^2.11.5", @@ -96,7 +96,7 @@ "expect-webdriverio": "^3.4.0", "focus-visible": "^5.0.2", "geckodriver": "^3.0.1", - "hls.js": "^1.0.7", + "hls.js": "1.2.0-beta.2", "html-loader": "^3.0.1", "html-webpack-plugin": "^5.3.1", "https-browserify": "^1.0.0", diff --git a/client/src/assets/player/shared/manager-options/hls-options-builder.ts b/client/src/assets/player/shared/manager-options/hls-options-builder.ts index ed12f6e8b..a572febc2 100644 --- a/client/src/assets/player/shared/manager-options/hls-options-builder.ts +++ b/client/src/assets/player/shared/manager-options/hls-options-builder.ts @@ -82,7 +82,7 @@ export class HLSOptionsBuilder { httpFailedSegmentTimeout: 1000, segmentValidator: segmentValidatorFactory(this.options.p2pMediaLoader.segmentsSha256Url, this.options.common.isLive), - segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager, 1), + segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager), useP2P: this.options.common.p2pEnabled, consumeOnly, @@ -123,6 +123,7 @@ export class HLSOptionsBuilder { private getP2PMediaLoaderVODOptions (): Partial { return { requiredSegmentsPriority: 3, + skipSegmentBuilderPriority: 1, cachedSegmentExpiration: 86400000, cachedSegmentsCount: 100, @@ -158,6 +159,7 @@ export class HLSOptionsBuilder { ...base, abrEwmaDefaultEstimate: averageBandwidth * 8, // We want bit/s + backBufferLength: 90, startLevel: -1, testBandwidth: false, debug: false diff --git a/client/src/assets/player/shared/p2p-media-loader/segment-url-builder.ts b/client/src/assets/player/shared/p2p-media-loader/segment-url-builder.ts index 9d324078a..ad0e460ae 100644 --- a/client/src/assets/player/shared/p2p-media-loader/segment-url-builder.ts +++ b/client/src/assets/player/shared/p2p-media-loader/segment-url-builder.ts @@ -1,11 +1,8 @@ import { Segment } from '@peertube/p2p-media-loader-core' import { RedundancyUrlManager } from './redundancy-url-manager' -function segmentUrlBuilderFactory (redundancyUrlManager: RedundancyUrlManager, useOriginPriority: number) { +function segmentUrlBuilderFactory (redundancyUrlManager: RedundancyUrlManager) { return function segmentBuilder (segment: Segment) { - // Don't use redundancy for high priority segments - if (segment.priority <= useOriginPriority) return segment.url - return redundancyUrlManager.buildUrl(segment.url) } } diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.js index 547e8aa63..3f2805192 100644 --- a/client/webpack/webpack.video-embed.js +++ b/client/webpack/webpack.video-embed.js @@ -24,6 +24,8 @@ module.exports = function () { modules: [ helpers.root('src'), 'node_modules' ], + symlinks: true, + alias: { 'video.js$': path.resolve('node_modules/video.js/core.js'), 'hls.js$': path.resolve('node_modules/hls.js/dist/hls.light.js'), diff --git a/client/yarn.lock b/client/yarn.lock index 81eae1cea..573497376 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -1823,10 +1823,10 @@ node-addon-api "^3.2.1" node-gyp-build "^4.3.0" -"@peertube/p2p-media-loader-core@^1.0.7": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@peertube/p2p-media-loader-core/-/p2p-media-loader-core-1.0.7.tgz#605a6bd248dc95cf8e73a65e37183dcb9f4a795a" - integrity sha512-J5VQBaS/L6b0yVNIBLnES4WcsHp4Z6IrAuYNIgG3iC5UcejeA1YHftZ/dAOlzZXQx77qYM7OJtmYAUsQ+2Pd4g== +"@peertube/p2p-media-loader-core@^1.0.13", "@peertube/p2p-media-loader-core@^1.0.8": + version "1.0.13" + resolved "https://registry.yarnpkg.com/@peertube/p2p-media-loader-core/-/p2p-media-loader-core-1.0.13.tgz#36744a291b69c001b2562c1a93017979f8534ff8" + integrity sha512-ArSAaeuxwwBAG0Xd3Gj0TzKObLfJFYzHz9+fREvmUf+GZQEG6qGwWmrdVWL6xjPiEuo6LdFeCOnHSQzAbj/ptg== dependencies: bittorrent-tracker "^9.19.0" debug "^4.3.4" @@ -1834,11 +1834,12 @@ sha.js "^2.4.11" simple-peer "^9.11.1" -"@peertube/p2p-media-loader-hlsjs@^1.0.11": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@peertube/p2p-media-loader-hlsjs/-/p2p-media-loader-hlsjs-1.0.11.tgz#1dba2e020ea7df766c5e951839811f21ffeda542" - integrity sha512-6BbcTRK/Dfaxq7XvWZU0sgLKiyVdaW9CWKMpNxnYjN3YGkKrXgJpY7rEnyydzaCxdVMQ5/qXKil/nOdf1aZ3BA== +"@peertube/p2p-media-loader-hlsjs@^1.0.13": + version "1.0.13" + resolved "https://registry.yarnpkg.com/@peertube/p2p-media-loader-hlsjs/-/p2p-media-loader-hlsjs-1.0.13.tgz#5305e2008041d01850802544d1c49298f79dd67a" + integrity sha512-2BO2oaRsSHEhLkgi2iw1r4n1Yqq1EnyoOgOZccPDqjmHUsZSV/wNrno8WYr6LsleudrHA26Imu57hVD1jDx7lg== dependencies: + "@peertube/p2p-media-loader-core" "^1.0.8" debug "^4.3.4" events "^3.3.0" m3u8-parser "^4.7.1" @@ -6211,10 +6212,10 @@ he@1.2.0, he@^1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -hls.js@^1.0.7: - version "1.1.5" - resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-1.1.5.tgz#923a8a8cfdf09542578696d47c8ae435da981ffd" - integrity sha512-mQX5TSNtJEzGo5HPpvcQgCu+BWoKDQM6YYtg/KbgWkmVAcqOCvSTi0SuqG2ZJLXxIzdnFcKU2z7Mrw/YQWhPOA== +hls.js@1.2.0-beta.2: + version "1.2.0-beta.2" + resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-1.2.0-beta.2.tgz#4a23f854c3bd69e86353e5570433637297372b4b" + integrity sha512-2+eruNX25TfoO0RRtqdQrlbwbqpKSnJZdXvVHDDGaVfDRmAAcJ3pSIQrRCxIJCiXxu0wECO8qmcj6Qjcw7eOCQ== hosted-git-info@^2.1.4: version "2.8.9"