Insert Clientside Ads
As of 2023, Samsung states that Tizen TV's are not optimized for .NET applications. Samsung strongly recommends using JS/Web applications instead of C#/.NET applications for TVs. Please check the Lura Player Web SDK
Client-side ads are important for delivering a seamless and engaging user experience. With client-side rendering, video ads are processed and rendered directly on the user's device, allowing for faster ad load times, smoother playback, and reduced buffering. Client-side ads also enable dynamic ad insertion, allowing for personalized and targeted ad content based on user behavior and preferences. Additionally, client-side ads provide more flexibility in ad formats, such as interactive video ads and rich media ads, which can captivate users and boost ad engagement.
Generic Clientside Ad Configuration
Lura Player comes equipped with its own fully VAST-compliant ad manager, making it easy for you to monetize your content by including multimedia ads within your apps. With Lura Player's ad manager, you can seamlessly integrate ads and serve them to your audience while maintaining full control over your content video playback. You can also customize the ad experience to suit your needs and preferences, including ad format, placement, and frequency. By leveraging Lura Player's ad manager, you can optimize your ad revenue and enhance your user engagement.
To configure Lura Player Ad Manager, you need to configure the ads object as follows:
- Create an
Adsconfiguration object - Set the
ClientSideconfiguration - Inside
ClientSide, setProviderto"generic" - Create a
Genericconfiguration object - Create a
Breaksarray insideGenericobject - Insert VAST or VMAP configurations based on the table below
| Attribute | Type | Required | Description |
|---|---|---|---|
| Url | string | yes | URL of the VAST or VMAP Ad Tag |
| Offset | string | int | only if VAST URL is provided | Offset of the VAST Ad Tag. The offset value can be provided in "preroll", "postroll", "NN%", "HH:MM:SS.mmm" and seconds as number format. |
Lura Player Ad Manager will assume that the entered URL is a VMAP URL if no offset is provided and will try to fetch the data from the provided URL. However, if the response is not a VMAP, Lura Player Ad Manager will ignore it.
Here is a configuration example that uses Lura Player Ad Manager:
var config = new Configuration
{
Ads = new AdsConfiguration
{
ClientSide = new AdsClientSideConfiguration
{
Provider = AdsClientSideProvider.Generic,
Generic = new AdsGenericConfiguration
{
Breaks = new List<ClientsideGenericAdsInterface>
{
// Ad will play before the content
new ClientsideGenericAdsInterface
{
Offset = "preroll",
Url = "https://example.com/your_vast_url"
},
// Ad will play in the middle of the content
new ClientsideGenericAdsInterface
{
Offset = "50%",
Url = "https://example.com/your_vast_url"
},
// Ad will play 1 minute 10 seconds from the beginning of the video
new ClientsideGenericAdsInterface
{
Offset = "00:01:10.000",
Url = "https://example.com/your_vast_url"
},
// Ad will play 125 seconds from the beginning of the video
new ClientsideGenericAdsInterface
{
Offset = 125,
Url = "https://example.com/your_vast_url"
},
// Ads will be aligned based on the time of ads in the VMAP
new ClientsideGenericAdsInterface
{
Url = "https://example.com/your_vmap_url"
}
}
}
}
}
};
player.SetConfig(config);
You can also provide macros in your configuration and URL. The macros provided in the macro attribute will replace macros in the URL.
| Attribute | Type | Required | Description |
|---|---|---|---|
| Macros | Dictionary<string, string> | no | Values that you want to be replaced in the URL |
Lura Player also includes reserved macros that are all prefixed with LURA_.
If you include a macro key that is prefixed with LURA_, Lura Player will
ignore it and use its own logic. Please see macros for more detail.
var config = new Configuration
{
Ads = new AdsConfiguration
{
Macros = new Dictionary<string, string>
{
{ "CUSTOM_MACRO", "my-url-safe-macro" }
},
ClientSide = new AdsClientSideConfiguration
{
Provider = AdsClientSideProvider.Generic,
Generic = new AdsGenericConfiguration
{
Breaks = new List<ClientsideGenericAdsInterface>
{
new ClientsideGenericAdsInterface
{
Offset = "preroll",
Url = "https://example.com/your_vast_url?custom=[CUSTOM_MACRO]&pal_nonce=[LURA_PAL_NONCE]&correlator=[LURA_CORRELATOR]"
},
new ClientsideGenericAdsInterface
{
Offset = "postroll",
Url = "https://example.com/your_vast_url?custom=[CUSTOM_MACRO]&pal_nonce=[LURA_PAL_NONCE]&correlator=[LURA_CORRELATOR]"
}
}
}
}
}
};
player.SetConfig(config);