Client Hooks

Hook Summary

PlayXDisabled()
Called when PlayX has been disabled by the client.
PlayXEnabled()
Called when PlayX has been enabled by the client.
PlayXGetSoundMultiplier(instance)
Sound fading / local sound calls this hook every 0.1 seconds to get the volume that an instance should be playing at.
PlayXMediaBegan(instance, handler, uri, start, resumeSupported, lowFramerate, handlerArgs)
Called when media has begun.
PlayXMediaEnded(instance)
Called when media has ended.
PlayXMetadataReceive(instance, existingMedia, data)
Called when metadata is received.
PlayXPlayed(instance)
Called when a player has started playing.
PlayXRequestCloseMedia()
Called a media close is requested (generally through the tool menu panel).
PlayXRequestOpenMedia(provider, uri, start, forceLowFramerate, useJW, ignoreLength)
Called when media is requested.
PlayXSelectInstance()
PlayX.GetInstance() calls this hook.
PlayXStopped(instance)
Called when a player has stopped playing (stopped by the user / server).
PlayXUpdateUI()
Called when a UI update is requested, possibly because something started or stopped playing.
PlayXVolumeSet(vol)
Called when the client has changed the overall PlayX volume.

Hooks

PlayXDisabled

PlayXDisabled()

Called when PlayX has been disabled by the client.


PlayXEnabled

PlayXEnabled()

Called when PlayX has been enabled by the client.


PlayXGetSoundMultiplier

PlayXGetSoundMultiplier(instance)

Sound fading / local sound calls this hook every 0.1 seconds to get the volume that an instance should be playing at. Return a value between 0 and 100 or nil to do nothing. This hook is only called if it was defined. PlayX checks to see whether it should be calling this hook after some certain events, such as media loading. It is recommended that this hook exist from the beginning of the game.

Parameters:

  • instance - PlayX entity

Return value:

  • Volume (0 - 100) or nil

PlayXMediaBegan

PlayXMediaBegan(instance, handler, uri, start, resumeSupported, lowFramerate, handlerArgs)

Called when media has begun.

Parameters:

  • instance - PlayX entity
  • handler
  • uri
  • start - Number of seconds
  • resumeSupported
  • lowFramerate
  • handlerArgs - Table

PlayXMediaEnded

PlayXMediaEnded(instance)

Called when media has ended.

Parameters:

  • instance - PlayX entity

PlayXMetadataReceive

PlayXMetadataReceive(instance, existingMedia, data)

Called when metadata is received. A table can be returned to replace the metadata that has been received.

Parameters:

  • instance - PlayX entity
  • existingMedia - Untouched Media table
  • data - Received metadata table

Return value:

  • New data table or nil

PlayXPlayed

PlayXPlayed(instance)

Called when a player has started playing.

Parameters:

  • instance - PlayX entity

PlayXRequestCloseMedia

PlayXRequestCloseMedia()

Called a media close is requested (generally through the tool menu panel). Return false to disallow, nil or true to pass through.

Return value:

  • False to disable, nil/true to allow

PlayXRequestOpenMedia

PlayXRequestOpenMedia(provider, uri, start, forceLowFramerate, useJW, ignoreLength)

Called when media is requested. The bookmarks manager and the tool menu panel (sandbox only) call PlayX.RequestOpenMedia(), which triggers this hook. Return false to disallow, nil or true to pass through.

Parameters:

  • provider - May be blank
  • uri
  • start - Can be a string (i.e. "2:41")
  • forceLowFramerate - Boolean
  • useJW
  • ignoreLength

Return value:

  • False to disable, nil/true to allow

PlayXSelectInstance

PlayXSelectInstance()

PlayX.GetInstance() calls this hook. That function is called by PlayX whenever a "primary" entity needs to be selected, client-side. It is primarily used by the repeater to find a PlayX player to be repeating. Hooks should return nil or a gmod_playx entity

Return value:

  • Entity or nil

PlayXStopped

PlayXStopped(instance)

Called when a player has stopped playing (stopped by the user / server).

Parameters:

  • instance - PlayX entity

PlayXUpdateUI

PlayXUpdateUI()

Called when a UI update is requested, possibly because something started or stopped playing. This may be called several times in quick succession.


PlayXVolumeSet

PlayXVolumeSet(vol)

Called when the client has changed the overall PlayX volume.

Parameters:

  • vol - New volume