Backwards compatible WSGI camera fix

This commit is contained in:
Paulus Schoutsen 2016-05-15 23:57:17 -07:00
parent a0a2299d1a
commit 44ca449de5
2 changed files with 4 additions and 2 deletions

View File

@ -51,8 +51,9 @@ export default new Polymer({
},
updateCameraFeedSrc(stateObj) {
const attr = stateObj.attributes;
const time = (new Date()).getTime();
this.cameraFeedSrc = `${stateObj.attributes.entity_picture}?time=${time}`;
this.cameraFeedSrc = `${attr.entity_picture}?token=${attr.access_token}&time=${time}`;
},
imageLoadSuccess() {

View File

@ -17,7 +17,8 @@ export default new Polymer({
if (__DEMO__) {
return '/demo/webcam.jpg';
} else if (stateObj) {
return `/api/camera_proxy_stream/${this.stateObj.entityId}`;
return `/api/camera_proxy_stream/${stateObj.entityId}` +
`?token=${stateObj.attributes.access_token}`;
}
// Return an empty image if no stateObj (= dialog not open)
return 'data:image/gif;base64,R0lGODlhAQABAAAAACw=';