: null,
embedUrl: video.embedUrl,
+ isLive: video.isLive,
+
language: this.localeId,
userWatching: user && user.videosHistoryEnabled === true ? {
const maxRetries = 3
-function segmentValidatorFactory (segmentsSha256Url: string) {
+function segmentValidatorFactory (segmentsSha256Url: string, isLive: boolean) {
let segmentsJSON = fetchSha256Segments(segmentsSha256Url)
const regex = /bytes=(\d+)-(\d+)/
return async function segmentValidator (segment: Segment, retry = 1) {
+ // Wait for hash generation from the server
+ if (isLive) await wait(1000)
+
const filename = basename(segment.url)
const segmentValue = (await segmentsJSON)[filename]
}
if (!segmentValue) {
- await wait(1000)
-
console.log('Refetching sha segments for %s.', filename)
+ await wait(1000)
+
segmentsJSON = fetchSha256Segments(segmentsSha256Url)
await segmentValidator(segment, retry + 1)
videoViewUrl: string
embedUrl: string
+ isLive: boolean
+
language?: string
videoCaptions: VideoJSCaption[]
const p2pMediaLoaderConfig = {
loader: {
trackerAnnounce,
- segmentValidator: segmentValidatorFactory(options.p2pMediaLoader.segmentsSha256Url),
+ segmentValidator: segmentValidatorFactory(options.p2pMediaLoader.segmentsSha256Url, options.common.isLive),
rtcConfig: getRtcConfig(),
requiredSegmentsPriority: 1,
segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager),
inactivityTimeout: 2500,
videoViewUrl: this.getVideoUrl(videoInfo.uuid) + '/views',
+ isLive: videoInfo.isLive,
+
playerElement: this.playerElement,
onPlayerElementChange: (element: HTMLVideoElement) => this.playerElement = element,