Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

The method TouchCastPlayerAPI.doAction() allows you to run player actions. Player actions are commands the TouchCast player is able to understand and execute. For example, you may want to pause the playback of the player.

...

Parameters


NameDescriptionType
paramsObject with these possible properties: 
  • action[string]* - mandatory, represents the player action you want to execute; see below the list of all available player actions.
  • playerId[string]* - mandatory, represents the id of the player that will run the action.


Note: this object can have other properties based on the action that's being executed.
object


List of player actions



Action TypeAction DescriptionExtra Parameters
TouchCastPlayerAPI.actions.RESUME_VIDEO
This action will trigger the video playback to resume.No extra parameters.
TouchCastPlayerAPI.actions.PAUSE_VIDEO
This action will trigger the video playback to pause.No extra parameters.
TouchCastPlayerAPI.actions.TOGGLE_PLAYBACK
This action will toggle the video playback. If the video is playing, it will resume, and if the video is resumed, it will play it.No extra parameters.
TouchCastPlayerAPI.actions.RESTART_VIDEO
This action will restart the video playback.autoPlay
  • boolean - true/false
  • specifies if the video should automatically play after restart or pause
TouchCastPlayerAPI.actions.SEEK_VIDEO
This action will seek the video to a certain timecode.seekTime
  • integer
  • represents the time to seek to in seconds
TouchCastPlayerAPI.actions.MUTE_VIDEO
This action will mute the sound.No extra parameters.
TouchCastPlayerAPI.actions.UNMUTE_VIDEO
This action will un-mute the sound.No extra parameters.
TouchCastPlayerAPI.actions.SET_VOLUME
This action will change the sound volume.volume
  • integer
  • values between 0 and 1
TouchCastPlayerAPI.actions.ENABLE_CONTROL
This action will be able to enable player controls.list
  • string
    • possible values: 
      all

      playPause

      progressBar
      share
      comment
      volume
      info
      search
      subtitles
      timeBlock
      fullscreen
      summary

  • gives user the ability to disable player controls (dim them); it’s a comma separated string
  • see all names in TouchCastPlayerAPI.fieldsForActionList


TouchCastPlayerAPI.actions.DISABLE_CONTROL
This action will be able to disable player controls.list
  • string
    • possible values: 
      all

      playPause

      progressBar
      share
      comment
      volume
      info
      search
      subtitles
      timeBlock
      fullscreen
      summary

  • gives user the ability to disable player controls (dim them); it’s a comma separated string
  • see all names in TouchCastPlayerAPI.fieldsForActionList


text

  • string
  • this is optional, and can be used only if the list parameter has a value of all;
  • will display the text on top of the controls area to give users more context of what’s going on
TouchCastPlayerAPI.actions.LOAD_TC_VIDEO
This action will load a different touchcast video in the player.videoId
  • integer
  • this should be a valid/existing touchcast video id
loadingMode
  • string
  • possible values: normal and with-back-button
  • this will instruct player how to load the new video, if as a totally new video (normal) or with ability to go back to original video (with-back-button)


Example


Code Block
languagejs
themeDJango
// this shows how you can change  player volume

var params = {
    action: TouchCastPlayerAPI.actions.SET_VOLUME,
    playerId: "player_01"
	volume: 0.6,
};

TouchCastPlayerAPI.doAction(params);

...