Skip to content

Commit 403c836

Browse files
Enhance video content functions with HTTPHeaderList and APIs
Added support for custom HTTP headers in video content functions.
1 parent 1fa479d commit 403c836

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
@@ -96,6 +96,21 @@ The following public APIs are provided by **HISPlayerManager**
9696
* **public struct HISPlayerCaptionElement**: The information of the triggered event turns into caption’s format.
9797
* **public int playerIndex**: The index of the player where the event is triggered.
9898
* **public string caption**: The next generated caption text.
99+
100+
* **public struct HTTPHeader**: Information for a custom HTTP header:
101+
* **public string key**: Key of the HTTP header.
102+
* **public string value**: Value of the HTTP header.
103+
104+
* **public class HTTPHeaderList**: Wrapper class for a list of custom HTTP headers.
105+
* **public List \<HTTPHeader\> headers**: List of HTTP headers.
106+
* **public int Count (Read-only)**: Number of HTTP headers.
107+
* **public void Add(string key, string value)**: Adds a new HTTP header given a **key** and a **value**.
108+
* **public void Add(HTTPHeader header)**: Adds an existing **HTTPHeader**.
109+
* **public bool Remove(string key)**: Removes the first header matching the given **key**. Returns true if a header was removed.
110+
* **public bool Remove(HTTPHeader header)**: Removes a specific **HTTPHeader**. Returns true if the header was removed.
111+
* **public void Clear()**: Removes all HTTP headers.
112+
* **public bool Contains(string key)**: Returns true if a header with the given **key** exists.
113+
* **public string Get(string key)**: Returns the value of the header matching the given **key**, or null if it does not exist.
99114

100115
## Functions
101116
The following functions are provided by **HISPlayerManager**. They are **not public** so it’s necessary to create a custom script which inherits from **HISPlayerManager**.
@@ -318,6 +333,9 @@ Add new content to a certain player. If the **enableDRM** variable is true, a vi
318333
#### void AddVideoContent(int playerIndex, string url, string keyServerUri, string tokenKey = “” (optional), string tokenValue= “” (optional), HISPlayerMimeTypes mimeType = HISPlayerMimeTypes.URL_EXTENSION (optional))
319334
Add new content to a certain player and its respective key server uri (tokenKey and tokenValue are optional parameters). The enableDRM variable must be true to use 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 token key associated with the URL. Please, make sure the string is correct. The **mimeType** parameter is optional and indicates which MIME type will be used for the new url.
320335

336+
#### void AddVideoContent(int playerIndex, string url, HTTPHeaderList httpHeaderList, HISPlayerMimeTypes mimeType = HISPlayerMimeTypes.URL_EXTENSION (optional))
337+
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.
338+
321339
#### void ChangeVideoContent(int playerIndex, int urlIndex)
322340
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.
323341

@@ -330,6 +348,9 @@ Change the video’s URL of a certain player given a new URL. The next playback
330348
#### void ChangeVideoContent(int playerIndex, string url, string keyServerUri, string token key = “” (optional), string token value= “” (optional), HISPlayerMimeTypes mimeType = HISPlayerMimeTypes.URL_EXTENSION (optional))
331349
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. The **mimeType** parameter is optional and indicates which MIME type will be used for the new url.
332350

351+
#### void ChangeVideoContent(int playerIndex, string url, HTTPHeaderList httpHeaderList)
352+
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.
353+
333354
#### void RemoveVideoContent(int playerIndex, int urlIndex)
334355
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.
335356

0 commit comments

Comments
 (0)