Secure XDR Player V3 Sample (Deprecated)

Secure XDR code sample can help you get started in creating a multi-feature playback experience with Ooyala Cross-Device Resume, Google IMA ads integration, and Ooyala Player Token authentication.


Important: Ooyala Player V3 is deprecated and is scheduled to be disabled on 2018-01-31. After that date, Player V3 will no longer play your video or audio content. Customers still using Player V3 need to migrate to Player V4 (see Migrating from Player V3 and Player Migration FAQ).

Secure XDR is a multi-feature code sample that you can inspect and use as a template for working with Player V3 features, the Player APIs and EVENTS. This sample has two basic parts:

  • Server-side logic implemented in PHP. We use CodeIgniter as our PHP framework and a controller. In this sample, the controller takes care of routing, handling requests, and sending parameters to each client-side view.
  • Client-side views (web pages) that implement Player features including a simple player embed, Cross-Device Resume, Google IMA, Message Bus-based event handling, Ooyala Token Authentication, and all of these features used in combination. The views are additive: they progress from the simplest interaction to the final view, which contains all of the code for the features used in combination.

Where to Find the Code

All of the sample code is located in the application directory. To get to this code in our GitHub repository, use the URL:

To work with this sample, you only need to focus on the code in these directories: assets, config, controllers, libraries, third_party, and views.

The following diagram shows the organization of the Secure XDR and Google IMA directories. You will see other directories. These are for another sample, so you can skip over them.

├── application (Main folder where the CodeIgniter application lives)
│   ├── assets  (Folder where we keep our CSS and JS)
│   │   ├──  Secure_XDR_GoogleIMA 
│   │   │    └──javascript
│   ├── cache   (CodeIgniter cache, you don't need to worry about this)
│   ├── config  (Here we have all the configuration files, both for CodeIgniter and ooyala. You only need to peek at ooyala_config)
│   ├── controllers (This is where the main logic lives. Here we handle routing and passing all the server data to the views)
|       └──  secure_xdr_googleima.php  
│   ├── core    (CodeIgniter core. Don't touch this)
│   ├── errors  (CodeIgniter specific)
│   ├── helpers (CodeIgniter specific)
│   ├── hooks   (CodeIgniter specific)
│   ├── language    (CodeIgniter specific)
│   │   └── english (CodeIgniter specific)
│   ├── libraries   (Here you can define your own libraries, and here lives our ooyala.php library)
│   ├── logs        (CodeIgniter specific)
│   ├── models      (CodeIgniter specific)
│   ├── third_party (This folder holds all third-party libraries, helpers, and so forth that you bring to the application)
│   │   └── php-v2-sdk  (This is the Ooyala SDK for php)
│   │       └── test    (This is the test suite for the SDK)
│   └── views (Here we define all the views for the application. This folder, along with controllers, are the main points of interest for this example)
|   |   └── Secure_XDR_GoogleIMA         
├── system      (CodeIgniter system. You don't need to review or modify this code)
└──   (Here we have information about the code sample that you should review)
└── index.php   (CodeIgniter file. You don't need to review or modify this code)
└── license.php   (CodeIgniter file. You don't need to modify this code)

Installing the Sample Code

To install the Sample Code, you need to:

  1. Have your Customer Success Manager enable Ooyala Player Token, Google IMA, and Cross-Device Resume features, if you do not already have them.
  2. Have a web server running that can interpret PHP, like Apache or Nginx.
  3. Go to our GitHub repository. The URL is:
  4. Clone the GitHub code-samples repository in your server.
  5. Provide your local path in your browser URL. The path for the example would be "your_base_path/code-samples/index.php". So, if you are running this from your localhost, you will have a URL like "localhost/code-samples/index.php".
  6. To get more than the default welcome page, you need to modify the values in application/config/ooyala_config.php. There you will be asked for you API key, secret, embed code and some other stuff. For more information about this you can check our API keys and Partner Code documentation.

Use the Ooyala PHP Server SDK included with the sample in GitHub. If needed, you can also download the Ooyala PHP Server SDK from the Ooyala Support > Developers >Resources web page.

Was this article helpful?