Я использую токены в потоковой передаче VOD. Но когда я проверяю полученный URL-адрес, он выдает ошибку 403 Forbidden. Можете ли вы мне помочь?
Версия: 4.8.0
Пример кода, который я написал в Node.js, и снимок экрана настроек, который я сделал на панели wowza:
enter описание изображения здесь
var crypto = require('crypto');
var contentURL = 'http://192.168.1.1:1935/vod/sample.mp4/playlist.m3u8'
var sharedSecret = '9cb929910544f649';
var contentPath = 'vod/sample.mp4';
var customSecureTokenPrefix = 'randomTokenPrefix';
var CustomParameter = 'abcdef';
var starttime = '1586590774';
var endtime = '1689579075';
var toHash = contentPath + '?' +
sharedSecret + '&' +
customSecureTokenPrefix + 'CustomParameter=' + CustomParameter + '&' +
customSecureTokenPrefix + 'endtime=' + endtime + '&' +
customSecureTokenPrefix + 'starttime=' + starttime;
console.log("string for hash : " + toHash);
var hash = crypto.createHash('sha256').
update(toHash, "utf8").
digest('base64');
hash = hash.replace(/\//g, '_');
hash = hash.replace(/\+/g, '-');
var hlsURL = 'http://192.168.1.1:1935/vod/sample.mp4/playlist.m3u8?' +
customSecureTokenPrefix + 'starttime=' + starttime + '&' +
customSecureTokenPrefix + 'endTime=' + endtime + '&' +
customSecureTokenPrefix + 'CustomParameter=' + CustomParameter + '&' +
'myTokenPrefixhash=' + hash;
console.log("url for hls : " + hlsURL)
result:
string for hash : string for hash : /vod/sample.mp4?9cb929910544f649&myTokenPrefixCustomParameter=abcdef&myTokenPrefixendtime=1689579075&myTokenPrefixstarttime=1586590774
url for hls : http://192.168.1.1:1935/vod/sample.mp4/playlist.m3u8?myTokenPrefixstarttime=1586590774&myTokenPrefixendTime=1689579075&myTokenPrefixCustomParameter=abcdef&myTokenPrefixhash=sFKHqXwp8yY4PqOcJhFChAvCEjmyhpgfN2nDo41xrp8=