Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
Add default skip offset to fluid player

fluid-player displays the "skip ad" button if the ad has an attribute skipoffset (see here). I'm trying to create client code that injects a default skipoffset to the ad so that I show the skip button even if the ad doesn't have a pre-configured skip interval.

I tried overriding the player's functions onBeforeXMLHttpRequestOpen and onBeforeXMLHttpRequest, and using those to inject a value to the responseXML, but because request.onreadystatechange() handles the skipoffset extraction, and onreadystatechange calls into private methods of the playerInstance, I can't override it through the external api onBeforeXMLHttpRequestOpen or onBeforeXMLHttpRequest.

Any thoughts on where I can inject this default value?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

So I managed to figure out the missing bit: I was attempting to override the provided onreadystatechange by re-assigning this method with my own function, and than calling into the provided method.

onBeforeXMLHttpRequestOpen: request => {
  let defaultOnReadyStateChange = request.onreadystatechange;
  request.onreadystatechange = function () {
    if (request.responseXML != null) {
      let linearElements = request.responseXML.getElementsByTagName('Linear');
        if (linearElements != null && linearElements.length) {
          linearElements[0].setAttribute('skipoffset', '00:00:05');
        }
      }
    defaultOnReadyStateChange();
};

By doing so I would get an error because when calling into defaultOnReadyStateChange, the context of the call would change and internal attributes for xmlHttpRequest would be missing.

The solution would be the above code, but the 2nd line should be

let defaultOnReadyStateChange = request.onreadystatechange.bind(request);

This works for me just fine.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda