permanentLive: boolean
privacy?: VideoPrivacy
}) {
- const { saveReplay, permanentLive, privacy } = options
+ const { saveReplay, permanentLive, privacy = VideoPrivacy.PUBLIC } = options
const { uuid } = await this.create({
...options,
name: 'live',
permanentLive,
saveReplay,
+ replaySettings: { privacy },
channelId: this.server.store.channel.id,
privacy
}
playlistNumber: number
segment: number
objectStorage: boolean
+ objectStorageBaseUrl?: string
}) {
- const { server, objectStorage, playlistNumber, segment, videoUUID } = options
+ const {
+ server,
+ objectStorage,
+ playlistNumber,
+ segment,
+ videoUUID,
+ objectStorageBaseUrl = ObjectStorageCommand.getMockPlaylistBaseUrl()
+ } = options
const segmentName = `${playlistNumber}-00000${segment}.ts`
const baseUrl = objectStorage
- ? ObjectStorageCommand.getMockPlaylistBaseUrl() + 'hls'
+ ? join(objectStorageBaseUrl, 'hls')
: server.url + '/static/streaming-playlists/hls'
let error = true
while (error) {
try {
+ // Check fragment exists
await this.getRawRequest({
...options,
const video = await server.videos.get({ id: videoUUID })
const hlsPlaylist = video.streamingPlaylists[0]
- const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url })
-
+ // Check SHA generation
+ const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: objectStorage })
if (!shaBody[segmentName]) {
throw new Error('Segment SHA does not exist')
}
+ // Check fragment is in m3u8 playlist
+ const subPlaylist = await server.streamingPlaylists.get({ url: `${baseUrl}/${video.uuid}/${playlistNumber}.m3u8` })
+ if (!subPlaylist.includes(segmentName)) throw new Error('Fragment does not exist in playlist')
+
error = false
} catch {
error = true