Created
October 29, 2015 00:45
-
-
Save gigafied/e178b7fbea57ec2b9544 to your computer and use it in GitHub Desktop.
UniFi Video - RTMP Streaming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
function initPlayer (url) { | |
jwplayer('playerID').setup({ | |
file : url, | |
image: '//www.longtailvideo.com/content/images/jw-player/lWMJeVvV-876.jpg', | |
width: '50%', | |
primary: 'flash', | |
aspectratio: '16:9' | |
}); | |
} | |
function loadStream (host, cameraId, channel, apiKey) { | |
var url = [host, 'stream', cameraId, channel, 'url'].join('/'); | |
url += '?apiKey=' + apiKey; | |
$.ajax({ | |
url : url, | |
xhrFields: { | |
withCredentials: true | |
}} | |
).then(function (json) { | |
json = json.data[0]; | |
initPlayer([json.rtmpPath, json.streamName].join('/')) | |
}); | |
} | |
loadStream( | |
'http://192.168.0.200:7080/api/2.0', // HOST | |
'ABC1234', // CAMERA ID | |
'1', // CHANNEL | |
'ZZZZZZZZ' // API KEY | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment