Triton Digital JavaScript Player API Reference - Version 2.0

The JavaScript Api allows users to embed a chromeless live stream player via JavaScript.
The player UI interface and skinning can be done in HTML/CSS.

JavaScript Modules
The API is based on the Asynchronous Module Definition (AMD) API.
Media Player
Live audio/video stream playback with Flash (minimum requirement: version 10.2.0) and automaticHTML5 fallback
Stream status
Customizable connection time-out
Client-side time-shifting feature
NowPlaying, Ad Break & Custom CuePoints
Ads: Triton RunSpot V 4.0+, VAST 1.0 / 2.0, Bloom, Media Ads (playback of audio/video ad url's with associated link)
NowPlaying Api
Retrieves a stream playback history. Useful for Song History and Ad history
NowPlaying Enhanced
Song cover art, Artist biography, Artist pictures, Discography
PlayerWebAdmin
Station configuration
Sync Banners
Listen for commercial ad breaks to display synchronised ad banners (bigbox and leaderboard)
TargetSpot
Play TargetSpot prerolls and display TargetSpot synchronised banners (bigbox, Flash only)

Note: Ads (preroll & synced banners) are not supported in HTML5 in the current version of the API.
On iOS / Android devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript.

Choose the platformid:

Loading...

Now Playing:

Player
Synced Bigbox
Synced Leaderboard

Module Action Method (example)
MediaPlayer player.play('KMTTFM', 'hdAlternate', 60, true)
Play KMTTFM station with hdAlternate connection strategy, timeout after 60 minutes, with time-shifting enabled.
MediaPlayer player.stop()
Stop the live stream
MediaPlayer player.pause()
Pause the live stream (time-shifting)
MediaPlayer player.resume()
Resume the live stream (time-shifting)
MediaPlayer player.seekLive()
Back to live stream (time-shifting)
MediaPlayer player.setVolume(.5)
MediaPlayer player.mute()
MediaPlayer player.unMute()
MediaPlayer

player.playAd('vastAd', { sid: 8441 })

Warning!

The plugin 'vastAd' is required in the MediaPlayer plugins configuration
MediaPlayer

player.playAd('vastAd', { url: http://vast-url-here })

Warning!

The plugin 'vastAd' is required in the MediaPlayer plugins configuration
MediaPlayer

player.playAd( 'bloom', { id: 4974 } )

Warning!

The plugin 'bloom' is required in the MediaPlayer plugins configuration
MediaPlayer

player.playAd( 'mediaAd', { mediaUrl: '...', linkUrl:'...' } )

Warning!

The plugin 'mediaAd' is required in the MediaPlayer plugins configuration
MediaPlayer player.skipAd()
NowPlayingApi player.NowPlayingApi.load({ mount:'KMTTFM', hd:true, numberToFetch:10 })
PlayerWebAdmin player.PlayerWebAdmin.load(mount, streamid)
Npe

Warning!

To retrieve the Npe metadata when receiving a new song (event 'track-cue-point'), call this function in the Npe module: player.Npe.loadNpeMetadata( cuePoint.nowplayingURL )
Npe player.Npe.fetchBiography( npeId )
Npe player.Npe.fetchArtist( npeId )
Npe player.Npe.fetchAlbum( npeId )
Npe player.Npe.fetchDiscography( npeId )
Npe player.Npe.fetchPhotos( npeId )