> 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/pt/configuracao/advertisements.md).

# Anúncios

Existem parâmetros opcionais que podem ser usados para personalizar a veiculação de anúncios do Fluid Player.

Nenhum parâmetro é obrigatório e terá um valor predefinido se não for passado.

As opções VAST dizem respeito aos anúncios servidos e à forma como o player os trata.

Estas opções são especificamente para quando os anúncios são mostrados no player.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adList:                     {},
            skipButtonCaption:          'Pular anúncio em [seconds]',
            skipButtonClickCaption:     'Pular anúncio <span class="skip_button_icon"></span>',
            adText:                     null,
            adTextPosition:             'top left',
            adCTAText:                  'Visite agora!',
            adCTATextPosition:          'bottom right',
            vastTimeout:                5000,
            showPlayButton:             false,
            maxAllowedVastTagRedirects: 1,

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

### adList

Configure uma ou várias tags VAST. Para cada uma das tags existem várias opções.

Observe que a resposta XML da tag VAST `Content-Type` deve ser `application/xml` ou `text/xml`.

* **roll (obrigatório):** As posições disponíveis na linha temporal: *preRoll*, *midRoll*, *postRoll*, *onPauseRoll*.
* **vastTag (obrigatório):** O URL do XML VAST (consulte as etiquetas/atributos suportados vastLinear.xml)
* **timer (apenas para mid-roll):** A propriedade timer agenda quando o anúncio deve ser exibido. Existem duas formas de definir isto:
  * **\[seconds]:** O número de segundos até o anúncio começar. Exemplo: *timer: 10*
  * **\[percentage]:** A percentagem do vídeo a mostrar antes de o anúncio começar. Exemplo: *timer: 50%*
* **fallbackVastTags (Opcional):** Um array que contém os URLs VAST; se o URL em vastTag falhar, o player tentará com estes.
* **adText (Opcional para anúncios lineares):** A [secção adText](#adtext) descreve a capacidade de definir texto para aparecer nos anúncios. Ao usar este parâmetro em **adList** pode especificar texto único por anúncio.
* **adTextPosition (Opcional para anúncios lineares):** Só é relevante se **adText** estiver em uso. Isto permite definir a posição de **adText** por anúncio.
* **adClickable (Opcional para anúncios lineares):** Desative a abertura da página de destino num novo separador quando o player for clicado e mantenha a funcionalidade de reproduzir/pausar.

Podemos definir **vários&#x20;*****midRoll*****&#x20;com o mesmo valor de timer**, também **vários&#x20;*****preRoll*****,&#x20;*****postRoll*****&#x20;e&#x20;*****onPauseRoll*** podem ser definidos. Veja o exemplo abaixo:

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adList: [
                {
                    roll: 'preRoll',
                    vastTag: 'vastPreRoll_1.xml',
                    adText: 'A publicidade apoia-nos diretamente'
                },
                {
                    roll: 'preRoll', //múltiplos anúncios preRoll
                    vastTag: 'vastPreRoll_2.xml',
                    adText: 'A publicidade apoia-nos diretamente'
                },
                {
                    roll: 'midRoll',
                    vastTag: 'vastMidRoll_1.xml',
                    timer: 8
                },
                {
                    roll: 'midRoll',
                    vastTag: 'vastMidRoll_2.xml',
                    // Caso vastTag falhe, o player fará fallback para uma das tags válidas deste array
                    fallbackVastTags: ['vastMidRoll_3.xml', 'vastMidRoll_4.xml'],
                    // múltiplos anúncios para o mesmo momento
                    timer: 8
                },
                {
                    roll: 'midRoll',
                    vastTag: 'vastMidRoll_2.xml',
                    timer: 10,
                    adClickable: false // Predefinição true
                },
                {
                    roll: 'postRoll',
                    vastTag: 'vastPostRoll.xml',
                    adText: 'Obrigado por assistir',
                    adTextPosition: 'top right'
                }
            ]
        }
    }
);
```

* **vAlign** (apenas para nonLinear, opcional): As posições verticais disponíveis para anúncios nonLinear: topo, meio, fundo. Predefinição: fundo.
* **nonLinearDuration** (apenas para nonLinear, opcional): O número de segundos até o anúncio nonLinear ser exibido. Se não for definido, nem o atributo minSuggestedDuration do XML VAST, então não fechará até ao fim do vídeo.
* **size** (apenas para nonLinear, opcional): A dimensão do anúncio. Tamanhos suportados: 468x60, 300x250, 728x90

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

### skipButtonCaption

O texto a exibir na contagem decrescente durante um anúncio. O **\[seconds]** espaço reservado é usado para a contagem decrescente dos segundos.\
(**Predefinição:** "Pular anúncio em \[seconds]")

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

### skipButtonClickCaption

Isto define o texto a mostrar quando a contagem decrescente termina e o utilizador pode saltar para o vídeo principal.\
(**Predefinição:** 'Pular anúncio ')

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

### adText

Pode ser mostrado texto personalizado quando um anúncio in-stream é reproduzido. Este texto aparece no canto superior esquerdo do player e será definido com a cor principal.

Tem um parâmetro adicional `adTextPosition` que pode ter valores como 'top right', 'top left', 'bottom right', 'bottom left'.

O texto e a posição do anúncio também podem ser definidos numa base [por anúncio](#adlist).

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adText: 'A publicidade ajuda-nos a manter as luzes acesas', // Predefinição null,
            adTextPosition: 'top left' // Predefinição 'top left'
        }
    }
);
```

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

### adCTAText

A página de destino do anúncio será mostrada na `adCTAText` área. Pode adicionar texto personalizado acima deste URL ou optar por desativar isto.

A imagem abaixo mostra como aparecerá por predefinição, e o código abaixo mostra como alterá-lo ou desativá-lo.

Tem um parâmetro adicional `adCTATextPosition` que pode ter valores como 'top right', 'top left', 'bottom right', 'bottom left'.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            // adCTAText: 'Subscreva agora!', // Predefinição "Visite agora!",
            // adCTATextPosition: 'bottom left', //Predefinição 'bottom right'
            adCTAText: false // Desativar adCTAText
        }
    }
);
```

O texto CTA também pode ser obtido do XML VAST definido através do `adCTATextVast` parâmetro. Assim, se este parâmetro estiver definido como true, será usado o texto fornecido no XML VAST. Caso o texto XML VAST esteja vazio ou este parâmetro não esteja definido, fará fallback para o valor predefinido em `adCTAText`.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adCTAText: 'Subscreva agora!', // Predefinição "Visite agora!",
            adCTATextPosition: 'bottom left', //Predefinição 'bottom right’,
            adCTATextVast: true, // Ativado. Para usar o texto CTA conforme fornecido no XML VAST.
        }
    }
);
```

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

### vastTimeout

Este parâmetro permite definir o tempo, em milissegundos, a aguardar pelo carregamento do VAST. (**Predefinição:** 5000)

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            vastTimeout: 1000 // Predefinição 5000
        }
    }
);
```

### vastAdvanced

Podemos especificar as funções de callback nos diferentes eventos VAST.

* **vastLoadedCallback:** Quando o VAST tiver carregado.
* **noVastVideoCallback:** Quando não houver vídeo VAST.
* **vastVideoSkippedCallback:** Se o anúncio for ignorado.
* **vastVideoEndedCallback:** Quando o anúncio terminar.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            vastAdvanced: {
                vastLoadedCallback:       (function() { console.log("Aqui um evento") }),
                noVastVideoCallback:      (function() { console.log("Aqui outro") }),
                vastVideoSkippedCallback: (function() { console.log("Aqui mais um") }),
                vastVideoEndedCallback:   (function() { console.log("Aqui está o último") })
            }
        }
    }
);
```

### showPlayButton

Opção para mostrar o ícone do botão de reproduzir depois de o vídeo do anúncio parar. Por predefinição, este parâmetro será definido como **false**, mas pode ser ativado como mostrado abaixo.

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            showPlayButton: true // Predefinição false
        }
    }
);
```

### maxAllowedVastTagRedirects

O Fluid Player suporta wrappers VAST através de . `maxAllowedVastTagRedirects` define o número máximo de redirecionamentos permitidos (wrappers).

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            maxAllowedVastTagRedirects: 1 // Predefinição 3
        }
    }
);
```

### adClickable

Clicar no player enquanto um anúncio in-stream é mostrado abrirá a página de destino num novo separador.

Se quiser desativar isto e permitir abrir a página de destino apenas através do [call to action](#adctatext), pode usar o **adClickable** parâmetro.

Isto pode ser definido para todos os anúncios in-stream ou por anúncio listado. Para detalhes sobre como adicioná-lo por anúncio, consulte a [secção adlist](#adlist) .

```javascript
fluidPlayer(
   'my-video',
    {
        vastOptions: {
            adClickable: false // Predefinição true
        }
    }
);
```

### VPAID

Ao contrário dos anúncios VAST normais, o VPAID é muito dinâmico e interativo.

Para mais informações <https://www.iab.com/guidelines/digital-video-player-ad-interface-definition-vpaid-2-0/>

Para ativar o carregamento de anúncios VPAID **allowVPAID** a opção tem de estar definida como true (false por predefinição).

O player suporta VPAID versão 2.0

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

### Rastreamento VAST

Os seguintes eventos são suportados pelo Fluid Player.

* início
* primeiro quartil
* ponto médio
* terceiro quartil
* conclusão
* progresso
* impressão
* clickTracking
* iconClickTrough

O Fluid Player é um reprodutor de vídeo HTML5 gratuito que pode veicular anúncios em vídeo da EXADS usando o padrão 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/pt/configuracao/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.
