The following public APIs are provided by HISPlayerManager
-
public string licenseKey: License key for making the SDK works. License key is not required for Unity Editor usage.
-
public List multiStreamProperties: List of properties for multi stream. Please, don't modify this list directly at runtime.
-
public class StreamProperties:
- public StreamProperties(bool isLoopPlaybackEnabled = true, bool isAutoTransitionEnabled = false): Constructor of the class. The received parameters will set the value of LoopPlayback and AutoTransition properties respectively.
- public HISPlayerRenderMode renderMode: Type of texture for rendering. HISPlayerRenderMode.NONE by default.
- public Material material: Reference to the Unity Material.
- public RawImage rawImage: Reference to the Unity Raw Image.
- public RenderTexture renderTexture: Reference to the Unity Render Texture.
- public List <string> url: List of the URLs for the stream.
- public list <string> urlMimeTypes: List of the HISPlayerMimeTypes attached to each URL from the url list.
- public bool autoPlay: If true, the players will start playing automatically after set-up.
- public bool EnableRendering: Determines if the stream will be rendered or not. The value can change in every moment for toggling between render or non-render mode. If true, the player will be rendered. It only can change in runtime.
- public bool LoopPlayback (Read-only): Loop the current playback. It's true by default. To modify this value, please, use the Editor or the constructor StreamProperties(loopPlayback, autoTransition).
- public bool AutoTransition (Read-only): Change the playback to the next video in the playlist. This action won't have effect when loopPlayback is true. It's false by default. To modify this value, please, use the Editor or the constructor StreamProperties(loopPlayback, autoTransition).
-
public enum HISPlayerRenderMode: Type of texture for rendering.
- RenderTexture
- Material
- RawImage
- NONE
-
public enum HISPlayerMimeTypes: The list of the supported MIME Types:
- URL_EXTENSION: The MIME type will be extracted from the URL extension
- HLS: The "application/x-mpegURL" MIME type will be used
-
public enum HISPlayerEvent: The list of events provided by HISPlayer SDK. The events can be used with the virtual functions in the next section:
- HISPLAYER_EVENT_PLAYBACK_READY
- HISPLAYER_EVENT_VIDEO_SIZE_CHANGE
- HISPLAYER_EVENT_PLAYBACK_PLAY
- HISPLAYER_EVENT_PLAYBACK_PAUSE
- HISPLAYER_EVENT_PLAYBACK_STOP
- HISPLAYER_EVENT_PLAYBACK_SEEK
- HISPLAYER_EVENT_VOLUME_CHANGE
- HISPLAYER_EVENT_END_OF_PLAYLIST
- HISPLATER_EVENT_ON_TRACK_CHANGE
- HISPLAYER_EVENT_ON_STREAM_RELEASE
- HISPLAYER_EVENT_TEXT_RENDER
- HISPLAYER_EVENT_AUTO_TRANSITION
- HISPLAYER_EVENT_PLAYBACK_BUFFERING
- HISPLAYER_EVENT_END_OF_CONTENT
-
public enum HISPlayerError: The list of errors provided by HISPlayer SDK. The errors can be used with the virtual functions in the next section:
- HISPLAYER_ERROR_LICENSE_EXPIRED (no function on this)
- HISPLAYER_ERROR_NOT_VALID_APPID (no function on this)
- HISPLAYER_ERROR_GENERAL_LICENSE_ERROR (no function on this)
- HISPLAYER_ERROR_LICENSE_DISABLED (no function on this)
- HISPLAYER_ERROR_IMPRESSIONS_LIMIT_REACHED (no function on this)
- HISPLAYER_ERROR_PLAYBACK_DURATION_LIMIT_REACHED (no function on this)
- HISPLAYER_ERROR_PLATFORM_NOT_REGISTERED (no function on this)
- HISPLAYER_ERROR_NETWORK_FAILED
-
public struct HISPlayerEventInfo: The information of the triggered event.
- public HISPlayerEvent eventType: The type of the event triggered.
- public int playerIndex: The index of the player where the event is triggered.
- public float param1: This will have different meanings depending on the event. If there is no information about the parameter, it will have the default value -1.
- public float param2: This will have different meanings depending on the event. If there is no information about the parameter, it will have the default value -1.
- public float param3: This will have different meanings depending on the event. If there is no information about the parameter, it will have the default value -1.
- public float param4: This will have different meanings depending on the event. If there is no information about the parameter, it will have the default value -1.
- public string stringInfo: Log information about the event.
-
public struct HISPlayerErrorInfo: The information of the triggered error.
- public HISPlayerError errorType: The type of the error triggered.
- public int playerIndex: The index of the player where the error is triggered.
- public float param1: This will have different meanings depending on the error. If there is no information about the parameter, it will have the default value -1.
- public string stringInfo: Log information about the error.
-
public struct HISPlayerTrack:
- public string id: Id of the track
- public int bitrate: Bitrate of the track in bits per second.
- public int width: Width of the track.
- public int height: Height of the track.
- public int framerate: Framerate of the track in frames per second.
-
public struct HISPlayerCaptionTrack:
- public string id: ID of the caption
- public string language: Language of the caption
-
public struct HisPlayerAudioTrack:
- public string id: ID of the caption
- public string language: Language of the caption
-
public struct HISPlayerCaptionElement: The information of the triggered event turns into caption’s format.
- public int playerIndex: The index of the player where the event is triggered.
- public string caption: The next generated caption text.
The following functions are provided by HISPlayerManager. They are not public so it’s necessary to create a custom script which inherits from HISPlayerManager.
These functions can be overridden.
MonoBehaviour function which will be called from the beginning of the scene. It can be overridden but to make the system work it’s necessary to call base.Awake() into the overridden function.
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_PLAYBACK_READY is triggered. This event occurs when the current playback of a stream is ready to be used. Calling functions such as GetTracks before this event is triggered will provide null information.
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_VIDEO_SIZE_CHANGE is triggered. This event occurs whenever the internal video size of the current track changes.
Name | Description |
---|---|
param1 | Width of the video. |
param2 | Heigth of the video. |
param3 | Rotation of the original video. |
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_PLAYBACK_PLAY is triggered. This event occurs whenever an internal playback has been played.
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_PLAYBACK_PAUSE is triggered. This event occurs whenever an internal playback has been paused.
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_PLAYBACK_STOP is triggered. This event occurs whenever an internal playback has been stopped.
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_PLAYBACK_SEEK is triggered. This event occurs whenever an internal playback has been sought to a new time position.
Name | Description |
---|---|
param1 | Value of the old track position in milliseconds. |
param2 | Value of the new track position in milliseconds. |
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_VOLUME_CHANGE is triggered. This event occurs whenever the volume has been modified.
Name | Description |
---|---|
param1 | New value for the volume. |
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_END_OF_PLAYLIST is triggered. This event occurs whenever an internal playlist reaches the end of the list.
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_ON_STREAM_RELEASE is triggered. This event occurs whenever a player/stream has been released.
Name | Description |
---|---|
param1 | Number of players after releasing. |
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_TEXT_RENDER is triggered. This event occurs whenever a caption's text has been generated.
Name | Description |
---|---|
caption | The next generated caption text. |
Override this method to add custom logic when HISPlayerEvent.HISPlayerEvent.HISPLAYER_EVENT_AUTO_TRANSITION is triggered. This event occurs when the playback has changed to the next video in the playlist automatically.
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_PLAYBACK_BUFFERING is triggered. This event occurs whenever an internal playback is buffering.
Override this method to add custom logic when HISPlayerEvent.HISPLAYER_EVENT_END_OF_CONTENT is triggered. This event occurs whenever an internal playlist reaches the end of the list.
Override this method to add custom logic when an error callback is triggered. Please, refer to the HISPlayerError list.
Override this method to add custom logic when HISPlayerError.HISPLAYER_ERROR_NETWORK_FAILED is triggered. This error occurs when the Internet connection fails.
These functions can’t be overridden and they can be used only inside the inherited script. If it’s needed to use some of these functions into the Unity scene, for example with buttons, it is needed to create a public function which connects the button with the API.
Initialize the player video stream system internally. It is necessary to use this function before anything else.
Free all resources internally. In the SDK v4.3.0 and below, it's necessary to call this function before changing between Unity scenes or before quitting the application. In the SDK v4.4.0 and above, the release is called automatically when changing scenes or quitting the application and it's not required to call this function.
Play a certain stream giving a playerIndex. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Pause a certain stream giving a playerIndex. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Stop a certain stream giving a playerIndex. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Seek a certain stream to a certain time giving a playerIndex and the time of the track to be sought in milliseconds. The stream is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Modify the volume of a certain stream giving a playerIndex. The volume of the track value ranges between 0.0f and 1.0f. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Add a new stream to the list multiStreamProperties. The stream must be added using this function instead of changing the list manually.
protected void AddVideoContent(int playerIndex, string url, HISPlayerMimeTypes mimeType = HISPlayerMimeTypes.URL_EXTENSION (optional))
Add new content to a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list. The url is the link to the new video. Please, make sure the string is correct. This function supports local file paths allocated in the StreamingAssets Unity folder. The mimeType parameter is optional and indicates which MIME type will be used for the new url.
Change the video’s URL of a certain player. The next playback will start paused if autoPlay is disabled. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list. The urlIndex is associated with the index of the element in the list of URLs.
Change the video’s URL of a certain player given a new URL. The next playback will start paused if autoPlay is disabled. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list. The parameter url is the link to the new video. Please, make sure the new URL is correctly written.
Change the video’s URL of a certain player given a new URL. The next playback will start paused if autoPlay is disabled. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list. The parameter url is the link to the new video. Please, make sure the new URL is correctly written. This function supports local file paths. This function will replace the Playlist with the new URL. The mimeType indicates which MIME type will be used for the new url.
Remove content from a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list. The urlIndex* is associated with the index of the element in the list of URLs.
Remove a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Modify the speed rate of a certain stream giving a playerIndex. The value of the player's speed must be greater (>) than 0.0f and less than or equal (<=) to 8.0f. The default value of player's speed is 1.0f. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Obtain the speed rate of a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Provides information about the timeline position in milliseconds, of the current video of a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Provides information about the total duration in milliseconds, of the current video of a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Provides the list of the video tracks of the current video playing on a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Get the bitrate of a certain track of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Get the width of a certain track of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Get the height of a certain track of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Get the width of the current track of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Get the height of the current track of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Get the ID of a certain track of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Get the number of tracks of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Enables the captions of the stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Provide information about all the captions of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Obtain the number of captions of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Obtain the ID of a certain caption of a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Obtain the language of a certain caption of a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Select a certain caption of a certain stream to be used. The possible caption tracks can be obtained from the tracks returned from the method GetCaptionTrackList. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Set a new maximum bitrate (in bits per second) of a specific track. This doesn't disable ABR. The possible tracks can be obtained from the tracks returned from the method GetTracks. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Select a certain track of a certain stream to be used as the main track. The possible tracks can be obtained from the tracks returned from the method GetTracks. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Provide information about all the audio tracks of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Obtain the number of audio of a certain stream. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Obtain the ID of a certain audio of a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Obtain the language of a certain audio of a certain player. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.
Select a certain audio-track of a certain stream to be used. The possible caption tracks can be obtained from the tracks returned from the method GetAudioTrackList. The playerIndex is associated with the index of the element of Multi Stream Properties, e.g. the index 0 is the element 0 in the list.