$.ajax({
type: 'GET',
url: 'http://localhost:8080/api/file/play/559',
xhrFields: {
responseType: 'blob'
},
beforeSend: (xhr) => {
xhr.setRequestHeader('Range', 'bytes=' + 1200000 + '-')
},
success: (data, status, xhr) => {
let blobData = new Blob([data], {type: 'octet/stream'})
let el = document.querySelector('#jquery_jplayer_1 > video')
const url = URL.createObjectURL(blobData)
const htmlNewEl = url
const htmlOldEl = el.currentSrc
if (htmlOldEl && htmlOldEl.startsWith('blob:')) {
el.src = ''
URL.revokeObjectURL(htmlOldEl)
}
el.src = htmlNewEl
el.load()
}
})
I don't think there's a video header.
If you try to play the video after calling the API, an error as shown in the picture below is displayed.
Uncaught (in Promise) DOMException: Failed to load because no supported source was found.