Error message

User warning: The following module is missing from the file system: fast_404. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1143 of /mnt/www/html/ooyala/docroot/includes/bootstrap.inc).

Ejemplos de ActionScript

Los ejemplos de ActionScript muestran la capacidad de embebido del reproductor de Ooyala y la capacidad de añadir funciones adicionales al reproductor usando la API del reproductor.

Ejemplo de Interfaz de la API Flex ActionScript 3

Los siguientes tres ejemplos "Interfaz de API Flex ActionScript 3", "Ejemplo de primeros pasos" y "Ejemplo de funcionalidades adicionales del reproductor" muestran la flexibilidad y variedad de las API ActionScript del reproductor.

El ejemplo siguiente ilustra el uso de la Interfaz ActionScript.

package com.ooyala.api
{
 /**
 * Player API
 */
 [Event (name="currentItemEmbedCodeChanged" )]
 [Event (name="embedCodeChanged" )]
 [Event (name="playComplete" , type="flash.events.Event" )]
 [Event (name="loadComplete" )]
 [Event (name="playheadTimeChanged" )]
 [Event (name="stateChanged" )]
 [Event (name="totalTimeChanged" )]
 [Event (name="volumeChanged" )]

 public class Player extends UIComponent
 {

   /**
   * Load the Ooyala player
   */
   public function load():void

   /**
   * Pass "query string parameters" to change the movie or channel in the player.
   * You can pass a string (similar to HTML Snippet query string
   * and FlashVars in direct Flash embed) or properties of an object
   */
   public function set queryStringParameters(parameters:*): void
   /**
   * embedCode of the player itself (for a channel, it will be channel)
   */
   [Bindable (event="embedCodeChanged" )]
   public function get embedCode():String
   /**
   * Convenient shortcut for set queryStringParameters('embedCode='+value)
   * i.e. Reloads movie/channel in player
   */
   public function set embedCode(value:String): void
   /**
   * Total time (in seconds) of the currently active item in the player
   * For a channel, the total length of the current video in the channel
   */
   [Bindable (event="totalTimeChanged" )]
   public function get totalTime():Number
   /**
   * Playhead time for the current active video in the player
   * For a channel, the playhead time of the current video in the channel
   */
   [Bindable (event="playheadTimeChanged" )]
   public function get playheadTime():Number
   /**
   * Seek within the active video in the channel
   */
   public function set playheadTime(value:Number): void
   /**
   * Player Volume setting
   */
   [Bindable (event="volumeChanged")]
   public function get volume():Number
   public function set volume(value:Number): void
   /**
   * The current state of the player. One of:
   * playing
   * paused
   * buffering
   * finished
   * error
   */
  [Bindable (event="stateChanged")]
  public function get state():String
  /**
  * The embedCode of the current video in the player.
  * In the case of a channel, this will be the embedCode
  * of the current video in the channel
  */
  [Bindable (event="currentItemEmbedCodeChanged" )]
  public function get currentItemEmbedCode():String
  /**
  * Play the current video or channel
  */
  public function play():void
  /**
  * Play the current video or channel
  */
  public function pause():void

 }//end of class
}

   

Ejemplos de los primeros pasos

Este es el primero de los dos ejemplos que ilustran la capacidad del reproductor de Ooyala para embeberlo en una aplicación de Adobe Flex mediante Adobe ActionScript 3. Este ejemplo muestra una integración básica, mientras que el siguiente ejemplo de "Funcionalidades adicionales" muestra cómo utilizar varias de las características expuestas en la API. El código fuente de muestra, además de estos dos ejemplos, se encuentra disponible en:

Demostración de la API Flash

Tenga en cuenta que su reproductor tendrá que utilizar Flash 10. Puede encontrar más información sobre esto en:

Obtener Flash Player 10

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
 applicationComplete="player.load()"
 backgroundColor="#000000"
 layout="vertical"
 xmlns:mx="http://www.adobe.com/2006/mxml"
 xmlns:ooyala="com.ooyala.api.*"
 >
 <ooyala:Player
   id="player"
   width="100%"
   height="100%"
   embedCode="x0b2E6REM6ksHP8PMsOaWRNkq2uwLyFv"
   loadComplete="player.playMovie()"
 />
</mx:Application>

   

Ejemplo de Funcionalidad Adicional

Además de los ejemplos ActionScript Flex, tenemos un ejemplo de proyecto Flash disponible en:

Demostración de la API Flash

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  applicationComplete="player.load()"
  backgroundColor="#000000"
  layout="absolute"
  xmlns:ooyala="com.ooyala.api.*" >
<ooyala:Player id="player" width="100%" height="100%"
  queryStringParameters="{source.selectedItem}"
/>
<mx:HBox y="0" horizontalCenter="0"
  backgroundColor="black" backgroundAlpha="0.5"
  borderColor="white" borderStyle="solid" borderThickness="1"
  cornerRadius="10"
  paddingLeft="10" paddingTop="10" paddingRight="10" paddingBottom="10">
<mx:VBox color="white" fontWeight="bold" minWidth="150">
<mx:Label text="Current Time: {player.playheadTime.toFixed(2)}s"/>
<mx:Label text="Total Time: {player.totalTime}s"/>
<mx:Label text="Volume: {(player.volume * 100).toFixed(0)}%"/>
<mx:Label text="Play State: {player.state}"/>
</mx:VBox>
<mx:ComboBox id="source" selectedIndex="0" labelField="comboboxLabel">
<mx:Array>
<mx:Object
  comboboxLabel="Sample Video #1"
  embedCode="x0b2E6REM6ksHP8PMsOaWRNkq2uwLyFv"
  hide="sharing,fullscreen,endscreen"
/>
<mx:Object
  comboboxLabel="Sample Video #2"
  embedCode="sxM2I6UiPuCkPaUuWM6KObYoyA-MOBcn"
  hide="info"
/>
</mx:Array>
</mx:ComboBox>
<mx:Button label="Play" click="player.playMovie()"
  visible="{player.state != 'playing'}"
  includeInLayout="{player.state != 'playing'}"/>
<mx:Button label="Pause" click="player.pauseMovie()"
  visible="{player.state == 'playing'}"
  includeInLayout="{player.state == 'playing'}"/>
<mx:Button label="seek -30s" click="player.playheadTime -= 30"/>
<mx:Button label="seek +30s" click="player.playheadTime += 30"/>
<mx:Button label="volume 25%" click="player.volume = 0.25"/>
</mx:HBox>
</mx:Application>