Funkcjonalność tej witryny będzie ograniczona w czasie konserwacji. Jeśli artykuł nie rozwiązuje twojego problemu i chcesz zadać pytanie, to nasza społeczność wsparcia jest dostępna na @FirefoxSupport na Twitterze i /r/firefox na Reddicie.

Przeszukaj pomoc

Unikaj oszustw związanych z pomocą.Nigdy nie będziemy prosić Cię o dzwonienie na numer telefonu, wysyłanie SMS-ów ani o udostępnianie danych osobowych. Zgłoś podejrzaną aktywność, korzystając z opcji „Zgłoś nadużycie”.

Więcej informacji

Does Firefox support service workers for videos loaded from a video element?

  • 1 odpowiedź
  • 0 osób ma ten problem
  • Ostatnia odpowiedź od TyDraniu

more options

I'm trying to use a service worker to add some additional headers to image and video requests but on Firefox the fetch event is only being invoked for the images and not the videos. On Chrome it is called for both.

I cannot find any documentation that says Firefox does not support service workers for video but this appears to be the case. Can anybody point me in the right direction?

sw.js 'use strict';

self.addEventListener("install", (event) => {

 // Force the newly installed service worker to replace any earlier version
 self.skipWaiting();

});

self.addEventListener("activate", (event) => {

 // Activate the service worker immediately in all clients  
 event.waitUntil(self.clients.claim());

});

self.addEventListener('fetch', (event) => {

 console.log(`SW.js: ${event.request.url}`);
 const updatedHeaders = new Headers(event.request.headers);
 //updatedHeaders.set('Accept', '*');
 // Create a new request object with the updated headers
 const updatedRequest = new Request(event.request, {
   headers: updatedHeaders
 });
 event.respondWith(fetch(updatedRequest));

});

I'm trying to use a service worker to add some additional headers to image and video requests but on Firefox the fetch event is only being invoked for the images and not the videos. On Chrome it is called for both. I cannot find any documentation that says Firefox does not support service workers for video but this appears to be the case. Can anybody point me in the right direction? sw.js 'use strict'; self.addEventListener("install", (event) => { // Force the newly installed service worker to replace any earlier version self.skipWaiting(); }); self.addEventListener("activate", (event) => { // Activate the service worker immediately in all clients event.waitUntil(self.clients.claim()); }); self.addEventListener('fetch', (event) => { console.log(`SW.js: ${event.request.url}`); const updatedHeaders = new Headers(event.request.headers); //updatedHeaders.set('Accept', '*'); // Create a new request object with the updated headers const updatedRequest = new Request(event.request, { headers: updatedHeaders }); event.respondWith(fetch(updatedRequest)); });

Zmodyfikowany przez wootiful w dniu

Wszystkie odpowiedzi (1)

more options

Check out these two bugz: 1637325 1921989.

Pomocne?

Zadaj pytanie

Aby odpowiadać na posty, musisz zalogować się na swoje konto. Zadaj pytanie, jeśli nie masz jeszcze konta.