Hello,
I'm struggling with some authorisation code to protect my live streams.
I have a flussonic stream server with token authentication.
All is fine when i use the option but that player isn't my first choice,i just want to use jwplayer.
I have follwing code from the stream server with auth token...
$password,
"name" => $streamname,
"ip" => $_SERVER["REMOTE_ADDR"],
"salt" => bin2hex(openssl_random_pseudo_bytes(16)),
"starttime" => time(),
"endtime" => time() + $session_lifetime*3600));
$token = file_get_contents("$flussonic/securetoken/sign?$query");
$embed = "$flussonic/$streamname/index.m3u8?token=$token";
?>
And the html i use is...
Loading the player...
// Setup the player
const player = jwplayer('player').setup({
file: ''
});
// Listen to an event
player.on('pause', (event) => {
alert('Why did my user pause their video instead of watching it?');
});
// Call the API
const bumpIt = () => {
const vol = player.getVolume();
player.setVolume(vol + 10);
}
bumpIt();
When i do it this way i get error Uncaught SyntaxError: Invalid or unexpected token
When i use the player without the token scrip the player runs perfect!!
Loading the player...
// Setup the player
const player = jwplayer('player').setup({
file: 'https://xxxx.xxx.sc/Stream-7/index.m3u8'
});
// Listen to an event
player.on('pause', (event) => {
alert('Why did my user pause their video instead of watching it?');
});
// Call the API
const bumpIt = () => {
const vol = player.getVolume();
player.setVolume(vol + 10);
}
bumpIt();
When i use the standard iframe embed option from the streamserver i have excactly the same streamurl with the token
Does anyone know what the problem here is i searching already a week to find the solution!!
Thanks in advance
↧