I am going to fetch a local video clip ( mp4 ) to display at my https site. In service worker I use the following code to retrieve the clip :
self.addEventListener('message', function(event) {
var init = { method: 'GET',
headers: {
"Content-Type": "video/mp4",
}
};
event.ports[0].postMessage( response.json() );
}, function ( error_message ) {
console.log ( error_message ) ;
event.ports[0].postMessage( error_message ) ;
});
});
However , this fetch is blocked with error :
Given a Request request, a user agent determines whether the Request request should proceed or not via the following algorithm: ...
4.Return allowed if one or more of the following conditions are met:
request’s initiator is "fetch" and destination is "subresource", and request is a passthrough request.
request’s type is "image", and initiator is not "imageset".
request’s type is "video".
request’s type is "audio".
So what is wrong ?
Regards !
Xiaoming Ding