How to integrate a streaming or video even with tracking token

Typical streaming is a URL or m3u8 list where the app can automatically play the content, but in some cases it is necessary to add tokens, process data in some format, etc. and therefore it is not possible to reproduce it directly because it requires that the app has some logic. It is in this case there are different solutions, let’s look at it!

First of all, the app has logic to search the first call. Imagine that the server sends a JSONP file or an HTML Web, in which within a lot of code… A m3u8 URL is found. The app is able to recognize this URL and even supports that the URL contains even token if it does not contain foreign characters in the URL. A quick way to try it is to use the “search on the Web” option that has the app. But… how do we use this for example in a m3u list? Very easy, the app recognizes that it should act with this mode when the URL starts with “tvonlineuniv://” along with the URL including HTTP. An example, would be like this: tvonlineuniv://http://midominio.com/path/in the case of Windows these URLs also invoke the app if they are launched from the browser. All platforms are recognized in the M3U list.

Useful, isn’t it?

But it is not always possible to meet the needs with this method, for example, imagine that we want to realize our own integration of YouTube instead of using the integrated in the app. For this we need to make a call to the YouTube API and in the process response to get the URL or make another additional call. The app supports connecting to an external server so that the app makes the calls and passes the information to the external server to indicate next step. The first step is to mount the URL, which is made up of 4 parts, the first the indicator for the app to act with in this mode. The 2nd is the identifier for the external server. The third part is the URL to which the app should invoke, and in 4th place the URL where it will send the response to be processed. The separation between each field is used “#”. Here’s an example:

URL to call: Https://weboriginal.com/pathvideo

Server URL: Https://miserver.com/path

Server ID: Id6785

Template URL: Tvonlineunivext<id servidor=””>#<url>#<url servidor=””>

Final URL: tvonlineunivextId6785#https://weboriginal.com/pathvideo#https://miserver.com/path

The app once you have made the call will send the answer to the indicated server, for it the response received becomes Base64 and is sent as variable POST “d”. The ID to be recognized by the server is sent as a POST “m” variable. In this way, it is possible to use an MVC schema in PHP for example so that the same path of the server serves for multiple channels.

Once the server has processed the data, you have to send the answer to the app. The answer must be in JSON format and the data structure is as follows:

{

“u”: “Video url”,

“h”: [

{“k”: “User-agent”,

“v”: “App”

}],

“m”: “GET”,

“d”: “”

}

The key “U” is the one that contains the URL to which the app should call. The method to use in the HTTP call is indicated in “M” with uppercase letters. These can be get/POST/PUT. In “H” is a JSON array where “K” and “V” are the key-value of the headers to use. And finally, “D” if you want to have the call some payload this must be different from “”.

The fields are mandatory, and calls can be concatenated again if you require multiple iterations.

If you have more questions, write me to help you do the integration.