Currently WCS does not support domain restriction.is it possible to restrict video to play only on authorize domain? Example; only *.trustdomain.com/* can load the ws/wss/rtmp/rtsp stream
For authentication, you can generate temporary short-living tokens and pass the tokens to play() method. You can also authorize by IP address.Those with unauthorized domain or ip will not be able to play or received stream.
session.createStream({name: 'stream1',display: myDisplay, custom:{token:'abcdef-1000ms-alive'}}).play();
{
"name": "stream1",
"custom": {token:'abcdef-1000ms-alive'},
"sessionId": "192.168.88.22/10.0.0.1"
}
Starting from the following buildsAlthough I did not open this thread, I am also interested in the same topic: Is there also a possibility to add a token for method Flashphoner.roomApi.connect() ?
connection = Flashphoner.roomApi.connect({urlServer: url, username: username, token: '12345'}).on(SESSION_STATUS.FAILED, function(session){
setStatus('#status', session.status());
onLeft();
}).on(SESSION_STATUS.DISCONNECTED, function(session) {
setStatus('#status', session.status());
onLeft();
}).on(SESSION_STATUS.ESTABLISHED, function(session) {
setStatus('#status', session.status());
joinRoom();
});
URL:http://localhost:9091/RoomApp/connect
OBJECT:
{
"nodeId" : "ET3IqW3xNOdbMzy8xarh4LwBCz7JetSz@192.168.88.59",
"appKey" : "roomApp",
"sessionId" : "/192.168.88.254:51050/192.168.88.59:8443",
"useWsTunnel" : false,
"useWsTunnelPacketization2" : false,
"useBase64BinaryEncoding" : false,
"mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
"clientVersion" : "0.5.24",
"clientOSVersion" : "5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"clientBrowserVersion" : "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"custom" : {
"login" : "222",
"token" : "12345"
}
}
update app -k roomApp2 roomApp
> show apps
owner name appKey id URL
----------------------------------------------------------------------------------
admin flashChatApp flashChatApp 6 http://localhost:9091/ChatApp
admin conferenceApp conferenceApp 10 http://localhost:9091/ConferenceApp
admin sfu sfu 13 http://localhost:9091/EchoApp
admin clickToCallApp clickToCallApp 12 http://localhost:9091/ClickToCallApp
admin qaApp qaApp 3 http://localhost:9091/QAApp
admin chatRoomApp roomApp2 9 http://localhost:9091/RoomApp
admin chatRoomApp flashRoomApp 5 http://localhost:9091/RoomApp
admin wcs3App wcs3App 2 http://localhost:9091/EchoApp
admin websocketChatApp websocketChatApp 7 http://localhost:9091/ChatApp
admin callApp callApp 11 http://localhost:9091/CallApp
admin defaultApp defaultApp 1 http://localhost:9091/EchoApp
admin flashStreamingApp flashStreamingApp 4 http://localhost:9091/EchoApp
admin chatRoomApp chatRoomApp 8 http://localhost:9091/ChatRoomApp
connection = Flashphoner.roomApi.connect({urlServer: url, username: username, appKey: 'roomApp'}).on(SESSION_STATUS.FAILED, function(session){
setStatus('#status', session.status());
onLeft();
}).on(SESSION_STATUS.DISCONNECTED, function(session) {
setStatus('#status', session.status());
onLeft();
}).on(SESSION_STATUS.ESTABLISHED, function(session) {
setStatus('#status', session.status());
joinRoom();
});
URL:http://localhost:9091/EchoApp/connect
OBJECT:
{
"nodeId" : "4pAdCKlDJ87jZMR5oEOvtE3ymhuUzFeb@192.168.10.10",
"appKey" : "defaultApp",
"sessionId" : "/192.168.10.20:56725/192.168.10.10:8443",
"useWsTunnel" : false,
"useWsTunnelPacketization2" : false,
"useBase64BinaryEncoding" : false,
"mediaProviders" : [ "WebRTC", "WSPlayer" ],
"clientVersion" : "0.5.23",
"clientOSVersion" : "5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36",
"clientBrowserVersion" : "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36",
"origin" : "https://192.168.10.10"
}
add-app-rest-method myApp connect
add-app-rest-method -a myApp
remove app-rest-method -a myApp
rtmp://192.168.88.59/live?name=value
stream2229
URL:http://localhost:9091/EchoApp/connect
OBJECT:
{
"nodeId" : "ET3IqW3xNOdbMzy8xarh4LwBCz7JetSz@192.168.88.59",
"appKey" : "flashStreamingApp",
"sessionId" : "70d58925-f646-4099-ad2e-926040d6d06f",
"useWsTunnel" : false,
"useWsTunnelPacketization2" : false,
"useBase64BinaryEncoding" : false,
"custom" : {
"name" : "value"
}
}
ffmpeg -re -i /tmp/VIDEO2findingnews.mp4 -acodec aac -vcodec libx264 -f flv -ar 44100 -rtmp_conn "O:1 NS:appKey:flashStreamingApp NS:name:12121212 NS:stream:12121212 NO:custom:O:1 NS:auth:22222222 NS:stream:3333333 O:0 O:0" rtmp://192.168.33.200:1935/12121212
ssh -p 2000 admin@localhost
add app myApp myAppKey http://192.168.1.5/rest/my_api
update app -m com.flashphoner.server.client.handler.wcs4.FlashStreamingHandler myAppKey
update app -c com.flashphoner.server.client.handler.wcs4.FlashStreamingCallbackHandler myAppKey
add app-rest-method -a myApp
ffmpeg -re -y -rtbufsize 1k -i /tmp/video.avi -preset ultrafast -acodec aac -vcodec h264 -strict -2 -f flv -rtmp_conn "O:1 NS:appKey:myAppKey NS:token:12345" rtmp://192.168.1.5:1935/live/stream1