Referencia de kit de desarrollo de software de JavaScript

Anterior Siguiente

Esta sección describe todos los métodos de JavaScript disponibles en el kit de desarrollo de software.

player.version

Return the Triton Digital Web Player SDK version

console.log(player.version)

player.play( params )

Comience la reproducción de un stream de audio/video en vivo.

The autoplay feature is disabled on mobile (iOS, Android) with HTML5. For related information, see Using Auto-play.

Parámetros:

params (object). Required: Yes.

El objeto de configuración de la reproducción

Propiedades:

station (String) or mount (String). Required: Yes.

La estación en la plataforma de Triton Digital. Ejemplo: TRITONRADIOMUSIC

Montaje en la plataforma de Triton Digital. Ejemplo: TRITONRADIOMUSICAAC

connectionTimeOut (Number). Required: No.

Duración de la conexión de stream en vivo antes de expirar (minutos) - el valor predeterminado 0 (desactivado). When a connectionTimeOut value is defined, after "connectionTimeOut" minutes, the controller sends a "timeout-alert" event that the stream will stop.

Cuando se recibe esa alerta, el desarrollador del sitio web (cliente) debe mostrar un mensaje al usuario, como por ejemplo: "Para mantener la conexión activa, haga clic aquí o de lo contrario el stream se detendrá".

The user can continue to listen to the live stream by clicking on this message: the website developer (client side) needs to call the function restartConnectionTimeOut() (see below) and hide the message. Si el usuario no hace clic en el mensaje, entonces 30 segundos después de mostrarse la alerta, el stream se detendrá automáticamente. El controlador envía un evento "timeout-reached". Si el usuario quiere escuchar de nuevo el stream, el desarrollador del sitio web (cliente) debe mostrar otro mensaje. Por ejemplo:

"El stream se detuvo (la conexión expiró). Para escuchar de nuevo el stream en vivo, haga clic aquí. Thank you." When the user clicks on this message, the website developer (client side) need to call the function play() and hide the message.

timeShift (Boolean). Required: No.

Set to true to enable client-side Timehift Radio. Set to false to disable TimeShifting. Default value is false.

Create a player.seek() heading. (Only applicable for Timeshift enabled mounts.)

- Use to seek forward and backward.

e.g.: seek(10), seek(-10)

Create a player.seekLive() heading. (Only applicable for Timeshift enabled mounts.)

- Use to seek to the live position in the stream.

trackingParameters (Object). Required: No.

The trackingParameters values are appended to the stream URL. Se usan para registrar información desde el reproductor. Ejemplo:

player.play( {
      station: 'STATION_NAME',
      trackingParameters: {
      dist: 'triton',
      KEY2: 'value2',
      KEY3: 'value3'
      }
} );
Example: Play the TRITONRADIOMUSIC station stream:

player.play( {station: 'TRITONRADIOMUSIC'} );

Example: Play the TRITONRADIOMUSICAAC mount stream:
player.play( {mount: 'TRITONRADIOMUSICAAC'} );

 
Example: Play the TRITONRADIOMUSIC station stream with the connection timeout set to 60 minutes and the TimeShifting enabled.

player.play( {station: 'TRITONRADIOMUSIC', connectionTimeOut:60, timeShift:true} );

player.pause()

Stop the stream. Functions the same as player.stop()

player.pause();

player.stop()

Detener el stream.

player.stop();

player.resume()

Start the stream. Functions the same as player.play()

player.resume();

player.restartConnectionTimeOut()

Reiniciar la expiración de la conexión.

Please refer to the play() function documentation (parameter connectionTimeOut).

player.restartConnectionTimeOut();

player.changePlayBackRate(rate)

Change the podcast playback speed.

The rate value is a float, with a value between 0 and infinity.

Examples: If the value changes to 2 then the speed is doubled. If the value changes to 0,50 then it plays at half speed.

player.setVolume( volumePercent )

Configura el volumen del audio/video del controlador

No compatible: iOS, Android debido a limitaciones incorporadas.

Definición

volumePercent (Number). Required: Yes

The new volume percentage between 0 and 1. Example: 0,75 for 75 %

Ejemplo:

player.setVolume(1);

player.getVolume

Volver al volumen actual

No compatible: iOS, Android, debido a que el nivel de audio está siempre bajo el control físico del usuario en el dispositivo móvil.

player.getVolume();

player.mute()

Stop the stream. Functions the same as player.stop()

player.mute();

player.unMute()

Start the stream. Functions the same as player.play()

player.unMute();

player.playAd( adServerType, config )

Reproducir un anuncio (audio/video) - puede usarse antes, durante o después del podcast.

Definición

adServerType (String). Required: Yes.

adServerType define qué Ad Plugin usar, los posibles valores son:

  • vastAd: The vastAd plugin is required in the configuration to use this feature.
  • tap: The tap plugin is required in the configuration to use this feature.
  • mediaAd: The mediaAd plugin is required in the configuration to use this feature.

adConfig (Object). Required: Yes.

For adServerType vastAd, adConfig properties are:

  • adConfig.sid (integer) - TritonRunSpot Station Id - If value is  set, the TritonRunSpot API is called.
  • adConfig.mediaformat (integer) - Optional value for TritonRunSpot API content format. El valor predeterminado es 21.

o

  • adConfig.url - If value is  set, the VAST Ad URL is called by using adConfig.url.
  • adConfig.rawXML - If value is set, the VAST Ad response (pre-parsed XML) is used by using adConfig.rawXML.
If both adConfig.url and adConfig.sid are set in the adConfig object, the sid is used 
by default.

For adServerType tap, adConfig properties are:

  • adConfig.host (String) - Host name to use for on-demand ad requests. Requerido: sí.
  • adConfig.type (String) - Ad type. Valid values : preroll or midroll. Requerido: sí.
  • adConfig.format (String) - Rendering format. Valores válidos: vast, vast-jsonp, daast. Requerido: no. Predeterminado: vast.
  • adConfig.stationName (String) - Station Name. Required : yes.
  • adConfig.stationId (integer) - Station ID. Requerido: sí.
  • adConfig.maxAds (integer) - Maximum number of ads. Requerido: no.
  • adConfig.assetType (String) - Asset Type. Required : no.
  • adConfig.minFileSize (integer) - Minimum size. Requerido: no.
  • adConfig.maxFileSize (integer) - Maximum size. Requerido: no.
  • adConfig.fileFormat (String) - File format. Lista separada por comas de: mp3, adts, flv, mp4, ogg. Requerido: no.
  • adConfig.minDuration (integer) - Minimum duration. Requerido: no.
  • adConfig.maxDuration (integer) - Maximum duration. Requerido: no.
  • adConfig.minBitrate (integer) - Minimum bitrate. Requerido: no.
  • adConfig.maxBitrate (integer) - Maximum bitrate. Requerido: no.
  • adConfig.minWidth (integer) - Minimum width. Requerido: no.
  • adConfig.maxWidth (integer) - Maximum width. Requerido: no.
  • adConfig.minHeight (integer) - Minimum height. Requerido: no.
  • adConfig.maxHeight (integer) - Maximum height. Requerido: no.
  • adConfig.audioCodec (String) - Audio codec. Requerido: no.
  • adConfig.audioMinChannels (integer) - Minimum chanels. Requerido: no.
  • adConfig.audioMaxChannels (integer) - Maximum chanels. Requerido: no.
  • adConfig.audioSampleRates (String) - Audio samples rates. Requerido: no.
  • adConfig.videoCodec (String) - Video codec. Requerido: no.
  • adConfig.videoAspectRatio (String) - Aspect radio. Requerido: no.
  • adConfig.minFrameRate (integer) - Minimum frame rate. Requerido: no.
  • adConfig.maxFrameRate (integer) - Maximum frame rate. Requerido: no.
  • adConfig.excludedCategories (String) - Excluded categories. Only available with Triton Digital SSP/Exchange ads. Requerido: no.

Note: Either the Station ID or station name must be specified when calling the On-Demand Ad Request Service. While both IDs and names are supported, it is strongly recommended that you use station names. If both ID and name are provided, the name is used (there is no validation check that the ID matches the name).

For adServerType bloom, adConfig properties are:

  • adConfig.id - The mandatory BloomAd Spot ID, must be a Media Ad type only (i.e. video/audio file). Los banners complementarios Bloom NO son gestionados por el kit de desarrollo de software de reproductor, deben cargarse dentro de un iFrame en JavaScript.

For adServerType mediaAd, adConfig properties are:

  • adConfig.mediaUrl String - video/audio media ad file to play.
  • adConfig.linkUrl String - associated link with the media ad.

trackingParameters property may be used to pass targeting information to the Ad server.

volume property may be useful to define volume level of Ad playback.

Ejemplos:

//VAST Ad full URL
playAd( 'vastAd', { url:
'http://runspot4.tritondigital.com/RunSpotV4.svc/GetVASTAd?&StationID=8441&MediaForm
at=21&RecordImpressionOnCall=false&AdMinimumDuration=0&AdMaximumDuration=900&AdLevel
Placement=1&AdCategory=1' } );
 
//Call Triton Ad Platform (TAP)
player.playAd( 'tap', { host:'cmod.live.streamtheworld.com', type:'preroll', format:'vast', stationId:77583 } );
 
//Call TritonRunSpot V 4,00+ (Campaign manager) VAST Ad Preroll with preroll-synced banner. sid (integer) is the TritonRunSpot Station ID (required).
playAd( 'vastAd', { sid: 8441 } );
 
//Call Media Ad
player.playAd( 'mediaAd', { mediaUrl:
'http://cdnp.tremormedia.com/video/acudeo/Carrot_400x300_500kb.flv',
linkUrl:'http://www.google.fr/' } );
 
//Call Bloom Ad Spot id
player.playAd( 'bloom', { id: 4974 } );
 
//Call with trackingParamters. TritonRunSpot V 4,00+ (Campaign manager) VAST Ad
Preroll with preroll-synced banner. sid (integer) is the TritonRunSpot Station ID
(required).
 
player.playAd( 'vastAd', { sid: 8441, trackingParameters:{banners:300x250} } );

player.skipAd()

Saltarse el anuncio actual

player.skipAd();

NowPlayingApi.load( {mount:mount, hd:true, numberToFetch:10, eventType:'track', } )

Cargar el historial de reproducción en curso

mount (String). Required: Yes.

El montaje de la estación en la plataforma de Triton Digital.

hd (Boolean). Required: No.

Falso predeterminado. Configurar en verdadero si el montaje tiene AAC.

numberToFetch (Number). Required: No.

Cantidad de elementos a buscar

eventType (String). Required: No.

"Pista" predeterminada

player.NowPlayingApi.load({mount:'STD_PLAYER_DEMO1', hd:true, numberToFetch:10});

© 2026 Triton Digital. Todos los derechos reservados.