diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-15 15:30:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-18 11:37:18 +0200 |
commit | 42b40636991b97fe818007fab19091764fc5db73 (patch) | |
tree | db431787c06ce898d22e91ff771f795219274fc6 /client/src/assets/player/shared/p2p-media-loader/segment-validator.ts | |
parent | 654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (diff) | |
download | PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.gz PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.zst PeerTube-42b40636991b97fe818007fab19091764fc5db73.zip |
Add ability for client to create server logs
Diffstat (limited to 'client/src/assets/player/shared/p2p-media-loader/segment-validator.ts')
-rw-r--r-- | client/src/assets/player/shared/p2p-media-loader/segment-validator.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts b/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts index f7f83a8a4..18cb6750f 100644 --- a/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts +++ b/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { wait } from '@root-helpers/utils' | ||
2 | import { Segment } from '@peertube/p2p-media-loader-core' | ||
3 | import { basename } from 'path' | 1 | import { basename } from 'path' |
2 | import { Segment } from '@peertube/p2p-media-loader-core' | ||
3 | import { logger } from '@root-helpers/logger' | ||
4 | import { wait } from '@root-helpers/utils' | ||
4 | 5 | ||
5 | type SegmentsJSON = { [filename: string]: string | { [byterange: string]: string } } | 6 | type SegmentsJSON = { [filename: string]: string | { [byterange: string]: string } } |
6 | 7 | ||
@@ -23,7 +24,7 @@ function segmentValidatorFactory (segmentsSha256Url: string, isLive: boolean) { | |||
23 | } | 24 | } |
24 | 25 | ||
25 | if (!segmentValue) { | 26 | if (!segmentValue) { |
26 | console.log('Refetching sha segments for %s.', filename) | 27 | logger.info(`Refetching sha segments for ${filename}`) |
27 | 28 | ||
28 | await wait(1000) | 29 | await wait(1000) |
29 | 30 | ||
@@ -71,7 +72,7 @@ function fetchSha256Segments (url: string) { | |||
71 | return fetch(url) | 72 | return fetch(url) |
72 | .then(res => res.json() as Promise<SegmentsJSON>) | 73 | .then(res => res.json() as Promise<SegmentsJSON>) |
73 | .catch(err => { | 74 | .catch(err => { |
74 | console.error('Cannot get sha256 segments', err) | 75 | logger.error('Cannot get sha256 segments', err) |
75 | return {} | 76 | return {} |
76 | }) | 77 | }) |
77 | } | 78 | } |