return fallbackToMediaSource()
})
- preparedElem.addEventListener('loadstart', onLoadStart)
+ preparedElem.addEventListener('canplay', onLoadStart)
return videostream(file, preparedElem)
}
return callback(err)
})
- preparedElem.addEventListener('loadstart', onLoadStart)
+ preparedElem.addEventListener('canplay', onLoadStart)
const wrapper = new MediaElementWrapper(preparedElem)
const writable = wrapper.createWriteStream(codecs)
}
function onLoadStart () {
- preparedElem.removeEventListener('loadstart', onLoadStart)
+ preparedElem.removeEventListener('canplay', onLoadStart)
if (opts.autoplay) preparedElem.play()
callback(null, renderer)
const videos = res.body.data
expect(videos).to.have.lengthOf(2)
+ let infoHashes: { [ id: number ]: string }
+
for (const video of videos) {
const res2 = await getVideo(server.url, video.uuid)
const videoDetail: VideoDetails = res2.body
if (video.uuid === video2UUID) {
expect(videoDetail.files).to.have.lengthOf(4)
+
+ if (!infoHashes) {
+ infoHashes = {}
+
+ for (const file of videoDetail.files) {
+ infoHashes[file.resolution.id.toString()] = file.magnetUri
+ }
+ } else {
+ for (const resolution of Object.keys(infoHashes)) {
+ const file = videoDetail.files.find(f => f.resolution.id.toString() === resolution)
+ expect(file.magnetUri).to.equal(infoHashes[resolution])
+ }
+ }
} else {
expect(videoDetail.files).to.have.lengthOf(1)
}