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.

...

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.

...

  • SWITCH_PIP_

...

  • MODEThis action switches a native picture-in-picture mode.

    isPiPMode

    • boolean(optional)*

    *If don't set isPiPMode value this works like toggle

    TouchCastPlayerAPI.actions.TOGGLE_SEARCHThis action will toggle search mode in the player and the article viewer.

    opened

    • boolean (optional)
    TouchCastPlayerAPI.actions.SET_TEXT_FIELDSThis action will change some text fields in the player UI.

    value

    • possible values
      • null (set value by default)
      • chatPlaceholders 
        • null (set value by default)
        • live (set placeholder in chat input for live video)
          • string
          • null (set value by default)
        • liveMobile (set placeholder in chat input for live video for mobile)
          • string
          • null (set value by default)
        • vod (set placeholder in chat input for VOD video)
          • string
          • null (set value by default)
        • vodMobile (set placeholder in chat input for VOD video for mobile)
          • string
          • null (set value by default)
      • articleTip 
        • null (set value by default)
        • header (set value for header of article popup)
          • string
          • null (set value by default)
        • body (set value for body of article popup)
          • string
          • null (set value by default)
      • questionTip
        • null (set value by default)
        • header (set value for header of question popup)
          • null (set value by default)
          • string
        • body (set value for body of question popup) 
          • null (set value by default)
          • string
        • mobileBody (set value for body of article popup for mobile)
          • null (set value by default)
          • string
    • All parameters are optional.

          

    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.TOGGLE_FULL_

...

  • SCREENThis action will toggle the video

...

  • mode to full screen mode and back. If the video is

...

  • in full screen mode, it will

...

  • be minimized,

...

  • if

...

  • it is

...

  • minimized, it will

...

  • expand to full screen.No extra parameters.
    TouchCastPlayerAPI.actions.SWITCH_FULL_SCREENThis is the action will enable or disable full screen mode.

    isFullScreen

    • boolean
    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
    • number
    • 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
    • number
    • 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
        volume
        search
        subtitles
        timeBlock
        fullscreen
        summary
        speedButton
        chapters
        more

    • 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
        volume
        search
        subtitles
        timeBlock
        fullscreen
        summary
        speedButton
        chapters
        more
    • 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.SWITCH_SUBTITLESThis action will switch language of subtitles in player(loop).No extra parameters.
    TouchCastPlayerAPI.actions.SET_SUBTITLESThis action will set one  language of subtitles in player.

    lang


    • string
      • possible values: 
        off
        en
        ...


    TouchCastPlayerAPI.actions.SEND_CUSTOM_ANALYTICSThis action will pass custom data to fabric tracker.

    info

    • Object
    TouchCastPlayerAPI.actions.HIDE_CONTROLThis action will full hide controls on player.No extra parameters.
    TouchCastPlayerAPI.actions.SHOW_CONTROLThis action will show controls on player(after  full hide).No extra parameters.
    TouchCastPlayerAPI.actions.SET_HLS_QUALITYThis action will set hls quality. if it is =-1  it will activate auto switching of quality

    level


    • number
      • possible values: 
        -1
        0
        1
        ...
    TouchCastPlayerAPI.actions.DISABLE_FS_LOGICThis action will disable or activate logic for go to fullScreen. If it is disabled -after click on fullScreenButton will sent only event without  go to fullScreen

    value


    • boolean
    TouchCastPlayerAPI.actions.SWITCH_SPEED

    This action will switch playback speed


    direction


    • string

      TouchCastPlayerAPI.speedDirection.LOOP
      TouchCastPlayerAPI.speedDirection.DOWN
      TouchCastPlayerAPI.speedDirection.UP


    TouchCastPlayerAPI.actions.SWITCH_LIVE_CHATThis action will show or hide chat on liveStream.

    show


    • boolean
    TouchCastPlayerAPI.actions.SHOW_QUESTION_CHAT_POPUPThis action will show  popup of question chat.No extra parameters.
    TouchCastPlayerAPI.actions.FORCE_PLAY_WITH_SOUNDThis action will try to start play with sound if it is not possible video will play without sound.No extra parameters.
    TouchCastPlayerAPI.actions.SHOW_COACHMARKThis action will show coachmark

    name


    • string, one of:

      qc
      subs
      audio

      article


    TouchCastPlayerAPI.actions.SET_EMOJIThis action will configure emoji and show/hide skin menu, the same that we have on /wiki/spaces/ISD/pages/749764609 fields:
     likeMenuContentAndOrder and 
    emojiSkinButton

    names


    • Array of names
    • empty Array - player will use default values - all emoji

      skinMenu


      • boolean


    TouchCastPlayerAPI.actions.SET_GA


    This action will disable or activate google analytics

    value


    • boolean


    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);

...