Components of the HTML5 Player V3 Starting Sample (Deprecated)

This section describes the key components of the HTML5 sample.

Note: Ooyala Player V3 has been deprecated and is scheduled to be disabled. For details and alternatives, see the OVP Release Notes.
For this code sample, the controller code handles the server side processing of SEO and Discovery features. The controller code runs in the server side PHP CodeIgniter framework.

In addition to defining these features, the controller code:

  • Loads the Ooyala library
  • Loads the Ooyala configuration file
  • Loads some variables defined in the Ooyala library

Where to Find the Code

The controller code is located in the application directory. To get to this code in our GitHub repository, use the URL: https://github.com/ooyala/code-samples/tree/master/application/controllers.

Routes and Functions

In the web_example.php controller code file, the name of the class is the name of the general route and each function (except _contruct) is a route.

For example, we have the localhost/index.php/Web_example/index route and we have the index function in the Web_example class.

Each route following the base path (localhost/index.php) is the name of a controller. 

Route Description
Web_example/ A simple client page that shows a video with trending and related videos.
Web_example/mobile The same as the Web_example root but with page resizing.

Controller

The controller is located in the controllers directory (https://github.com/ooyala/code-samples/blob/master/application/controllers/web_example.php).

The following table describes controllers used by this sample:

Function Description
index The controller for the web page content.
mobile The controller for the mobile web page content.

Views

The views are located in the views directory (https://github.com/ooyala/code-samples/tree/master/application/views/Web_example).

The following table describes views used by this sample:

View Description
web-example.php The view for the web page content. This view contains a video embed, related videos, and videos trending now.
web-example-mobile.php Similar to the web page content, this view provides content resizing for mobile.

Configuration

The configuration files are located in the config directory (https://github.com/ooyala/code-samples/tree/master/application/config).

The configuration file used for this sample is https://github.com/ooyala/code-samples/blob/master/application/config/ooyala_config.php.

The following table describes parameters used by this sample:

Parameter Description
api_key The API key associated with your account. This parameter is available on the Developer subtab of the Backlot UI. This parameter is used by other starting samples.
api_secret The secret key associated with your account. This parameter is available on the Developer subtab of the Backlot UI. This parameter is used by other starting samples.
p_code The provider code associated with your account. This parameter is available on the Developer subtab of the Backlot UI and is the same is the api_key, before the dot. This parameter is used by other starting samples.
default_embed_code The default embed code of the video to display.
default_player_id The ID of the player in which to display the video.
twitter_user The Twitter User ID used to display the video within Twitter Cards. To use the Twitter Card code, you must set up your account with Twitter. For more information, see Integration With Twitter Player Cards.

Libraries

The library files are located in the libraries directory (https://github.com/ooyala/code-samples/tree/master/application/libraries).

The library file used for this sample is https://github.com/ooyala/code-samples/blob/master/application/libraries/ooyala.php.

The following table describes key functions used by this sample:

Function Description
get_related_videos Returns five videos related to the current video.
get_trending_videos Returns videos trending on your account. This returns five videos that are trending now using the day window.
get_twitter_card_info Gets information needed to generate Twitter Card metadata.

Was this article helpful?