Skip to content

Commit ac1f8b8

Browse files
Introduce HTTPHeader and HTTPHeaderList structures and APIs
Added HTTPHeader and HTTPHeaderList structures for custom HTTP headers management.
1 parent 60d6f83 commit ac1f8b8

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

hisplayer-api.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,21 @@ The following public APIs are provided by **HISPlayerManager**:
119119
* **public struct HISPlayerCaptionElement**: The information of the triggered event turns into caption’s format.
120120
* **public int playerIndex**: The index of the player where the event is triggered.
121121
* **public string caption**: The next generated caption text.
122+
123+
* **public struct HTTPHeader**: Information for a custom HTTP header:
124+
* **public string key**: Key of the HTTP header.
125+
* **public string value**: Value of the HTTP header.
126+
127+
* **public class HTTPHeaderList**: Wrapper class for a list of custom HTTP headers.
128+
* **public List \<HTTPHeader\> headers**: List of HTTP headers.
129+
* **public int Count (Read-only)**: Number of HTTP headers.
130+
* **public void Add(string key, string value)**: Adds a new HTTP header given a **key** and a **value**.
131+
* **public void Add(HTTPHeader header)**: Adds an existing **HTTPHeader**.
132+
* **public bool Remove(string key)**: Removes the first header matching the given **key**. Returns true if a header was removed.
133+
* **public bool Remove(HTTPHeader header)**: Removes a specific **HTTPHeader**. Returns true if the header was removed.
134+
* **public void Clear()**: Removes all HTTP headers.
135+
* **public bool Contains(string key)**: Returns true if a header with the given **key** exists.
136+
* **public string Get(string key)**: Returns the value of the header matching the given **key**, or null if it does not exist.
122137

123138
## Functions
124139
The following functions are provided by **HISPlayerManager**. They are not public so it’s necessary to create a custom script which inherits from **HISPlayerManager**.
@@ -396,6 +411,9 @@ Add new content to a certain player. If the **enableDRM** variable is true, a vi
396411
#### void AddVideoContent(int playerIndex, string url, string keyServerUri, string tokenKey = “” (optional), string tokenValue = “” (optional), HISPlayerMimeTypes mimeType = HISPlayerMimeTypes.URL_EXTENSION(optional))
397412
Add new content to a certain player and its respective key server uri and tokens if needed (tokenKey and tokenValue are optional parameters). The **enableDRM** variable must be true for using this function. 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. The **keyServerUri** is the license key associated with the URL. Please, make sure the string is correct. This function supports local file paths. The **mimeType** parameter is optional and indicates which MIME type will be used for the new url.
398413

414+
#### void AddVideoContent(int playerIndex, string url, HTTPHeaderList httpHeaderList, HISPlayerMimeTypes mimeType = HISPlayerMimeTypes.URL_EXTENSION (optional))
415+
Add new content to a certain player including custom HTTP headers. 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. The **httpHeaderList** contains the custom HTTP headers that will be attached to the requests for this content. The parameter **mimeType** is optional and indicates which MIME type will be used for the new url.
416+
399417
#### void ChangeVideoContent(int playerIndex, int urlIndex)
400418
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.
401419

@@ -408,6 +426,9 @@ Change the video’s URL of a certain player given a new URL. The next playback
408426
#### void ChangeVideoContent(int playerIndex, string url, string keyServerUri, string tokenKey = “” (optional), string tokenValue= “” (optional), HISPlayerMimeTypes, mimeType = HISPlayerMimeTypes.URL_EXTENSION(optional))
409427
Change the video’s URL of a certain player given a new URL with DRM protection (tokenKey and tokenValue are optional parameters). 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. The **keyServerUri** is the license key associated with the URL. Please, make sure the parameters are correctly written. This function supports local file paths. This function will replace the Playlist with the new element. The **mimeType** parameter is optional and indicates which MIME type will be used for the new url.
410428

429+
#### void ChangeVideoContent(int playerIndex, string url, HTTPHeaderList httpHeaderList)
430+
Change the video's URL of a certain player given a new URL including custom HTTP headers. 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 **httpHeaderList** contains the custom HTTP headers that will be attached to the requests for this content.
431+
411432
#### void RemoveVideoContent(int playerIndex, int urlIndex)
412433
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.
413434

0 commit comments

Comments
 (0)