Skip to content

Latest commit

 

History

History
117 lines (82 loc) · 5.13 KB

File metadata and controls

117 lines (82 loc) · 5.13 KB

Youbora

This article is a good place to start if you are looking for information on how to configure the THEOplayer Youbora pre-integration, which is part of the Analytics API.

SDKs

Web SDK Android SDK iOS SDK tvOS SDK Android TV SDK Chromecast SDK
Yes Yes Yes No Yes Yes

Code example

Web SDK

Make sure you load the Youbora plugin in the head of the page.

<script src="https://smartplugin.youbora.com/v6/js/adapters/theoplayer2/6.8.10/sp.min.js"></script>  

Include the following in your SourceDescription object:

var youbora = {  integration: "youbora",  
  accountCode: "YOUR_YOUBORA_ACCOUNT_CODE",  
  enableAnalytics: true,  
  username: "THEO",  
 "content.title": "THEO 1 (VOD)", "content.duration": 653, "content.isLive": false,}  
  
var SourceDescription = {  sources: [typedSource],  
  analytics: [youbora],  
}  
Android (TV) SDK

You need to first initialize the Youbora library on your application. You can do this in two different ways:

  • While creating the player programmatically:
// create player config  
THEOplayerConfig playerConfig = new THEOplayerConfig.Builder()  
 .analytics(new YouboraOptions.Builder("YOUR_YOUBORA_ACCOUNT_CODE").build()) .build();  
// create player  
THEOplayerView tpv = new THEOplayerView(this, playerConfig);  
  • Or through the player's XML configuration:
<com.theoplayer.android.api.THEOplayerView  
 android:id="@+id/theo_player_view" app:youboraAccountCode="YOUR_YOUBORA_ACCOUNT_CODE" />```  
  
You can then set a Youbora source like the following:  
  
```java  
YouboraOptions youbora = new YouboraOptions.Builder("YOUR_YOUBORA_ACCOUNT_CODE")  
 .put("enableAnalytics", "true") .put("username", "THEO") .put("content.title", "VOD") .put("content.duration", "653") .put("content.isLive", "false") .build();  
SourceDescription elephantsDream = SourceDescription.Builder  
 .sourceDescription(TypedSource.Builder.typedSource().src("https://cdn.theoplayer.com/video/elephants-dream/playlist.m3u8").build()) .analytics(youbora) .build();  
tpv.getPlayer().setSource(elephantsDream);  

:::info

Starting from Android SDK API 28, Google introduced some additional network security configurations. By default, http requests are blocked by the OS unless the application explicitly allows it.

In order to allow http requests (and allow Youbora data to be sent to the dashboard), you should follow the instructions in their guide: Network security configuration.

Basically there are 2 different ways to solve this on your app:

  1. Set the android:usesCleartextTraffic="true" flag under your application tag.
  2. If you are using a network security config such as: android:networkSecurityConfig="@xml/network_security_config", include this flag on your configuration, for example:
<?xml version="1.0" encoding="utf-8"?>  
<network-security-config>  
 <domain-config cleartextTrafficPermitted="true"> .... </domain-config> <base-config cleartextTrafficPermitted="false"/></network-security-config>  

:::

Legacy iOS/tvOS SDK (4.12.x)

You need to first initialize the Youbora library on your application. You can do this on your player's configuration object:

let youboraOptions = YouboraOptions(accountCode: "YOUR_YOUBORA_ACCOUNT_CODE")
youboraOptions.put(key: "enableAnalytics", value: "true")
let playerConfiguration = THEOplayerConfiguration(chromeless: true, analytics: [youboraOptions])

You can then provide different Youbora option objects per source you set:

let youbora = YouboraOptions(accountCode: "YOUR_YOUBORA_ACCOUNT_CODE")
youbora.put(key: "enableAnalytics", value: "true")
youbora.put(key: "username", value: "THEO")
youbora.put(key: "content.title", value: "THEO 1 (VOD)")
youbora.put(key: "content.duration", value: "653")
youbora.put(key: "content.isLive", value: "false")
let sourceDescription = SourceDescription(source : typedSource, analytics: [youbora])

Related links

  • Analytics API
  • NPAW's own Youbora THEOplayer plugin: Web, iOS, Android
  • Youbora documentation on NPAW's website: Web, iOS, Android (login required)

Related articles