> For the complete documentation index, see [llms.txt](https://docs.fluidplayer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fluidplayer.com/es/configuracion/advertisements.md).

# Anuncios

Hay parámetros opcionales que se pueden usar para personalizar la inserción de anuncios de Fluid Player.

No se requiere ningún parámetro y se usará el valor predeterminado si no se pasa.

Las opciones VAST se relacionan con los anuncios servidos y con cómo los maneja el reproductor.

Estas opciones son específicamente para cuando se muestran anuncios en el reproductor.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adList:                     {},
            skipButtonCaption:          'Saltar anuncio en [seconds]',
            skipButtonClickCaption:     'Saltar anuncio <span class="skip_button_icon"></span>',
            adText:                     null,
            adTextPosition:             'top left',
            adCTAText:                  '¡Visita ahora!',
            adCTATextPosition:          'bottom right',
            vastTimeout:                5000,
            showPlayButton:             false,
            maxAllowedVastTagRedirects: 1,

            vastAdvanced: {
                vastLoadedCallback:       (function() {}),
                noVastVideoCallback:      (function() {}),
                vastVideoSkippedCallback: (function() {}),
                vastVideoEndedCallback:   (function() {})
            }
        }
    }
);
```

### adList

Configure una o varias etiquetas VAST. Para cada una de las etiquetas hay múltiples opciones.

Tenga en cuenta la respuesta XML de la etiqueta VAST `Content-Type` debe ser `application/xml` o `text/xml`.

* **roll (obligatorio):** Las posiciones disponibles de la línea de tiempo: *preRoll*, *midRoll*, *postRoll*, *onPauseRoll*.
* **vastTag (obligatorio):** La URL del XML VAST (consulte las etiquetas/atributos compatibles en vastLinear.xml)
* **timer (solo para mid-roll):** La propiedad timer programa cuándo debe mostrarse el anuncio. Hay dos formas de definirlo:
  * **\[seconds]:** La cantidad de segundos hasta que comience el anuncio. Ejemplo: *timer: 10*
  * **\[percentage]:** El porcentaje del video que se mostrará antes de que comience el anuncio. Ejemplo: *timer: 50%*
* **fallbackVastTags (opcional):** Un array que contiene las URL de VAST; si la URL en vastTag falla, el reproductor probará con estas.
* **adText (opcional para anuncios lineales):** La [sección adText](#adtext) describe la capacidad de establecer texto para que aparezca en los anuncios. Al usar este parámetro en **adList** puede especificar texto único para cada anuncio.
* **adTextPosition (opcional para anuncios lineales):** Solo es relevante si **adText** está en uso. Esto le permite establecer la posición de **adText** para cada anuncio.
* **adClickable (opcional para anuncios lineales):** Desactiva la apertura de la página de destino en una nueva pestaña cuando se hace clic en el reproductor, y mantiene la funcionalidad de reproducir/pausar.

Podemos establecer **múltiples&#x20;*****midRoll*****&#x20;con el mismo valor de temporizador**, además **múltiples&#x20;*****preRoll*****,&#x20;*****postRoll*****&#x20;y&#x20;*****onPauseRoll*** se pueden establecer. Vea el ejemplo a continuación:

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adList: [
                {
                    roll: 'preRoll',
                    vastTag: 'vastPreRoll_1.xml',
                    adText: 'La publicidad nos apoya directamente'
                },
                {
                    roll: 'preRoll', // varios anuncios preRoll
                    vastTag: 'vastPreRoll_2.xml',
                    adText: 'La publicidad nos apoya directamente'
                },
                {
                    roll: 'midRoll',
                    vastTag: 'vastMidRoll_1.xml',
                    timer: 8
                },
                {
                    roll: 'midRoll',
                    vastTag: 'vastMidRoll_2.xml',
                    // En caso de que vastTag falle, el reproductor recurrirá a una de las etiquetas válidas de este array
                    fallbackVastTags: ['vastMidRoll_3.xml', 'vastMidRoll_4.xml'],
                    // varios anuncios para el mismo momento
                    timer: 8
                },
                {
                    roll: 'midRoll',
                    vastTag: 'vastMidRoll_2.xml',
                    timer: 10,
                    adClickable: false // Predeterminado true
                },
                {
                    roll: 'postRoll',
                    vastTag: 'vastPostRoll.xml',
                    adText: 'Gracias por ver',
                    adTextPosition: 'top right'
                }
            ]
        }
    }
);
```

* **vAlign** (solo para nonLinear, opcional): Las posiciones verticales disponibles para anuncios noLineales: top, middle, bottom. Predeterminado: bottom.
* **nonLinearDuration** (solo para nonLinear, opcional): La cantidad de segundos hasta que se muestre el anuncio no lineal. Si no se establece ni el atributo minSuggestedDuration del XML VAST, no se cerrará hasta el final del video.
* **size** (solo para nonLinear, opcional): La dimensión del anuncio. Tamaños compatibles: 468x60, 300x250, 728x90

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adList: [
                {
                    roll: 'onPauseRoll',
                    vastTag: 'vastNonLinear.xml',
                    vAlign: 'top',
                    nonlinearDuration: 10,
                    size: '300x250'
                }
            ]
        }
    }
);
```

### skipButtonCaption

El texto para mostrar la cuenta regresiva durante un anuncio. El **\[seconds]** marcador de posición se usa para la cuenta regresiva de los segundos.\
(**Predeterminado:** "Saltar anuncio en \[seconds]")

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            skipButtonCaption: 'Espere [seconds] segundo(s) más'
        }
    }
);
```

### skipButtonClickCaption

Esto define el texto que se muestra cuando termina la cuenta regresiva y el usuario puede saltar al video principal.\
(**Predeterminado:** 'Saltar anuncio ')

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            skipButtonClickCaption: 'Ver video principal <span class="skip_button_icon"></span>'
        }
    }
);
```

### adText

Se puede mostrar texto personalizado cuando se reproduce un anuncio in-stream. Este texto aparece en la esquina superior izquierda del reproductor y se establecerá con el color principal.

Tiene un parámetro adicional `adTextPosition` parámetro, que puede tener valores como 'top right', 'top left', 'bottom right' y 'bottom left'.

El texto y la posición del anuncio también se pueden establecer de forma [individual por anuncio](#adlist).

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adText: 'La publicidad nos ayuda a mantener las luces encendidas', // Predeterminado null,
            adTextPosition: 'top left' // Predeterminado 'top left'
        }
    }
);
```

![](https://content.gitbook.com/content/8rGD7jsniiB2SIkmyD9Z/blobs/Cg86ewzPV1b9Akuiz1W4/adText.png)

### adCTAText

La página de destino del anuncio se mostrará en el `adCTAText` área. Puede agregar texto personalizado sobre esta URL, o puede elegir desactivarlo.

La captura de pantalla a continuación muestra cómo aparecerá por defecto, y el código a continuación muestra cómo modificarlo o desactivarlo.

Tiene un parámetro adicional `adCTATextPosition` parámetro, que puede tener valores como 'top right', 'top left', 'bottom right' y 'bottom left'.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            // adCTAText: '¡Suscríbete ahora!', // Predeterminado "¡Visita ahora!",
            // adCTATextPosition: 'bottom left', //Predeterminado 'bottom right'
            adCTAText: false // Desactivar adCTAText
        }
    }
);
```

El texto de llamada a la acción también puede tomarse del XML VAST que se establece mediante `adCTATextVast` parámetro. Así que, si este parámetro se establece en true, usará el texto proporcionado en el XML VAST. Si el texto del XML VAST está vacío o este parámetro no se establece, recurrirá al valor predeterminado establecido en `adCTAText`.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adCTAText: '¡Suscríbete ahora!', // Predeterminado "¡Visita ahora!",
            adCTATextPosition: 'bottom left', //Predeterminado 'bottom right',
            adCTATextVast: true, // Activado. Para usar el texto de CTA tal como se proporciona en el XML VAST.
        }
    }
);
```

![](https://content.gitbook.com/content/8rGD7jsniiB2SIkmyD9Z/blobs/RO9daXZBc0D39MnpYgN8/adctatext.png)

### vastTimeout

Este parámetro le permite establecer el tiempo, en milisegundos, para esperar a que cargue el VAST. (**Predeterminado:** 5000)

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            vastTimeout: 1000 // Predeterminado 5000
        }
    }
);
```

### vastAdvanced

Podemos especificar las funciones de devolución de llamada en los diferentes eventos VAST.

* **vastLoadedCallback:** Cuando se haya cargado el VAST.
* **noVastVideoCallback:** Cuando no hay video VAST.
* **vastVideoSkippedCallback:** Si se omite el anuncio.
* **vastVideoEndedCallback:** Cuando el anuncio ha terminado.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            vastAdvanced: {
                vastLoadedCallback:       (function() { console.log("Aquí un evento") }),
                noVastVideoCallback:      (function() { console.log("Aquí otro") }),
                vastVideoSkippedCallback: (function() { console.log("Aquí uno más") }),
                vastVideoEndedCallback:   (function() { console.log("Aquí el último") })
            }
        }
    }
);
```

### showPlayButton

Opción para mostrar el icono del botón de reproducción después de que el video del anuncio se haya detenido. De forma predeterminada, este parámetro se establecerá en **false**, pero puede habilitarse como se muestra a continuación.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            showPlayButton: true // Predeterminado false
        }
    }
);
```

### maxAllowedVastTagRedirects

Fluid Player admite wrappers VAST a través de . `maxAllowedVastTagRedirects` establece el número máximo de redirecciones permitidas (wrappers).

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            maxAllowedVastTagRedirects: 1 // Predeterminado 3
        }
    }
);
```

### adClickable

Al hacer clic en el reproductor mientras se muestra un anuncio in-stream, se abrirá la página de destino en una nueva pestaña.

Si desea desactivar esto y permitir abrir la página de destino solo mediante la [llamada a la acción](#adctatext), puede usar el **adClickable** parámetro.

Esto se puede establecer para todos los anuncios in-stream o por cada anuncio listado. Para obtener detalles sobre cómo añadirlo por anuncio, consulte la [adlist](#adlist) sección.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adClickable: false // Predeterminado true
        }
    }
);
```

### VPAID

A diferencia de los anuncios VAST normales, VPAID es muy dinámico e interactivo.

Para más información <https://www.iab.com/guidelines/digital-video-player-ad-interface-definition-vpaid-2-0/>

Para habilitar la carga de anuncios VPAID **allowVPAID** la opción debe establecerse en true (false por defecto).

El reproductor admite la versión 2.0 de VPAID

```javascript
fluidPlayer(
    'video-vpaid-ads',
    {
        vastOptions: {
            allowVPAID: true, // Predeterminado false.
            adList: [
                {
                    roll: 'preRoll',
                    vastTag: './vastxmls/vpaid_linear.xml'
                },
                {
                    roll: 'midRoll',
                    vastTag: './vastxmls/vpaid_nonlinear.xml',
                    timer: 5
                },
            ]
        }
    }
);
```

### Seguimiento VAST

Fluid Player admite los siguientes eventos.

* start
* firstQuartile
* midpoint
* thirdQuartile
* complete
* progress
* impression
* clickTracking
* iconClickTrough

Fluid Player es un reproductor de video HTML5 gratuito que puede mostrar anuncios de video de EXADS utilizando el estándar VAST.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fluidplayer.com/es/configuracion/advertisements.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
