From 13bf0bfe27bc5c3bb3a247a41f044cb3867431b4 Mon Sep 17 00:00:00 2001 From: Benedikt Weber <44091658+bewee@users.noreply.github.com> Date: Mon, 17 May 2021 00:02:18 +0200 Subject: [PATCH 1/2] W3C compliance - Use forms instead of links in Properties, Actions, and Events --- virtual-things-adapter.js | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/virtual-things-adapter.js b/virtual-things-adapter.js index 0bc7b99..6a604bf 100644 --- a/virtual-things-adapter.js +++ b/virtual-things-adapter.js @@ -700,6 +700,13 @@ const camera = { mediaType: 'image/png', }, ], + forms: [ + { + rel: 'alternate', + href: '/media/virtual-things/image.png', + mediaType: 'image/png', + }, + ], }, }, ], @@ -728,6 +735,13 @@ const videoCamera = { mediaType: 'application/dash+xml', }, ], + forms: [ + { + rel: 'alternate', + href: '/media/virtual-things/index.mpd', + mediaType: 'application/dash+xml', + }, + ], }, }, { @@ -1084,11 +1098,20 @@ const smokeSensor = { }; if (ffmpegMajor !== null && ffmpegMajor >= 4) { - videoCamera.properties[0].metadata.links.push({ - rel: 'alternate', - href: '/media/virtual-things/master.m3u8', - mediaType: 'application/vnd.apple.mpegurl', - }); + if (this.links) { + videoCamera.properties[0].metadata.links.push({ + rel: 'alternate', + href: '/media/virtual-things/master.m3u8', + mediaType: 'application/vnd.apple.mpegurl', + }); + } + if (this.forms) { + videoCamera.properties[0].metadata.forms.push({ + rel: 'alternate', + href: '/media/virtual-things/master.m3u8', + mediaType: 'application/vnd.apple.mpegurl', + }); + } } const VIRTUAL_THINGS = [ From c891574c9c358eaf124937a11e3b17c9a2af0409 Mon Sep 17 00:00:00 2001 From: Benedikt Weber <44091658+bewee@users.noreply.github.com> Date: Mon, 17 May 2021 20:42:53 +0200 Subject: [PATCH 2/2] Fix contentType and rel --- virtual-things-adapter.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/virtual-things-adapter.js b/virtual-things-adapter.js index 6a604bf..16287af 100644 --- a/virtual-things-adapter.js +++ b/virtual-things-adapter.js @@ -702,9 +702,8 @@ const camera = { ], forms: [ { - rel: 'alternate', href: '/media/virtual-things/image.png', - mediaType: 'image/png', + contentType: 'image/png', }, ], }, @@ -737,9 +736,8 @@ const videoCamera = { ], forms: [ { - rel: 'alternate', href: '/media/virtual-things/index.mpd', - mediaType: 'application/dash+xml', + contentType: 'application/dash+xml', }, ], }, @@ -1107,9 +1105,8 @@ if (ffmpegMajor !== null && ffmpegMajor >= 4) { } if (this.forms) { videoCamera.properties[0].metadata.forms.push({ - rel: 'alternate', href: '/media/virtual-things/master.m3u8', - mediaType: 'application/vnd.apple.mpegurl', + contentType: 'application/vnd.apple.mpegurl', }); } }