How to show video stream?

Hello,
Thanks for building and mantaining webthings.io. It is really nice!
I’m trying out with video streaming using the ONVIF add-on along with an Android app which emulates an ONVIF camera.
It configures ok (at the gateway/addon side I type URL, user, password - it applies without errors then the device shows on add things menu).
After adding the camera, enabling “stream” check button in the gateway is detected by the android app (which informs how many clients are connected)…
… but when I click on the button to see the stream in the gateway, it shows the gateway background with a close button. I suppose it is a transparent background of the stream viewer without any video from the camera.

The android app is IP Cam: https://play.google.com/store/apps/details?id=com.pas.webcam

Can you help me?
Thanks!

First thing to do is check the WT log file for interesting tidbits. Searched for ONVIF in the postings and there is nothing that would help. I’m not familiar with streaming or the addon but suppose the addon has to fork/spawn a process to view/stream the data, that could be failing and might log the reason.

Hello, Eric,

Thank you for the advice. I will examine the WT log.
Just to add information (I don’t expect someone else to dig into the log :wink:). Below follows the screen dump of WT gateway initialization. ONVIF addon and camera device were installed and turned on before init.

(the bot pointed out that this message has too many links so I have to remove some…)

… this might be something interesting…
2021-12-24 09:32:51.428 INFO : onvif-adapter: Unhandled Rejection
2021-12-24 09:32:51.429 ERROR : onvif-adapter: TypeError: Cannot read property ‘map’ of undefined
2021-12-24 09:32:51.429 ERROR : onvif-adapter: at camera.core.getScopes.then (/home/fabio/.webthings/addons/onvif-adapter/lib/onvif-adapter.js:66:52)
2021-12-24 09:32:51.430 ERROR : onvif-adapter: at process._tickCallback (internal/process/next_tick.js:68:7)

Fábio.

fabio@fabio-13Z940-G-BK71P1:~/Documentos/git/gateway$ npm start

webthings-gateway@1.1.0 start /home/fabio/Documentos/git/gateway
npm run build && node build/app.js

webthings-gateway@1.1.0 build /home/fabio/Documentos/git/gateway
rm -rf build && cp -rL src build && find build -name ‘*.ts’ -delete && tsc -p . && webpack

assets by path images/ 151 KiB 120 assets
assets by path fluent/ 680 KiB 35 assets
assets by path …/ 56.1 KiB 34 assets
assets by path css/ 96.3 KiB 23 assets
assets by path fonts/ 677 KiB
assets by path fonts/.woff 407 KiB 6 assets
assets by path fonts/
.woff2 270 KiB 6 assets
assets by path bundle/ 2.68 MiB
assets by path bundle/.js 2.59 MiB 2 assets
assets by chunk 83.2 KiB (name: style) 2 assets
asset bundle/24b63530c3891e501ac0-buildCss 5.62 KiB [emitted] [immutable] (name: buildCss)
asset index.html 23.9 KiB [emitted]
asset signup/index.html 1.39 KiB [emitted]
asset login/index.html 1.2 KiB [emitted]
asset app.webmanifest 1.05 KiB [emitted] [from: static/app.webmanifest] [copied]
runtime modules 9.77 KiB 34 modules
orphan modules 4.14 KiB [orphan] 3 modules
modules by path ./node_modules/ 2.4 MiB (javascript) 260 bytes (css/mini-extract)
javascript modules 2.39 MiB 418 modules
json modules 3.07 KiB
./node_modules/ajv/dist/refs/json-schema-draft-07.json 2.72 KiB [built] [code generated]
./node_modules/ajv/dist/refs/data.json 360 bytes [built] [code generated]
css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/mobile-drag-drop/default.css 260 bytes [code generated]
modules by path ./static/ 763 KiB (javascript) 81.3 KiB (css/mini-extract)
modules by path ./static/js/ 762 KiB 189 modules
modules by path ./static/css/
.css 750 bytes (javascript) 81.3 KiB (css/mini-extract)
cacheable modules 750 bytes 15 modules
css modules 81.3 KiB 15 modules
fs (ignored) 15 bytes [optional] [built] [code generated]

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
bundle/7801894a29a5fe54c2b9-app.js (1.1 MiB)
bundle/ce1ae6c4c6d330bb4a6c-local-token.js (950 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app.js (1.1 MiB)
bundle/7801894a29a5fe54c2b9-app.js
local-token.js (950 KiB)
bundle/ce1ae6c4c6d330bb4a6c-local-token.js

WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit “https:”//webpack.js.org/guides/code-splitting/

webpack 5.24.2 compiled with 3 warnings in 75517 ms

asset service-worker.js 42.8 KiB [emitted] [minimized] (name: service-worker.js)
runtime modules 221 bytes 1 module
modules by path ./node_modules/core-js/internals/.js 63 KiB 95 modules
modules by path ./node_modules/core-js/modules/
.js 61.9 KiB
./node_modules/core-js/modules/es.array.iterator.js 2.1 KiB [built] [code generated]
./node_modules/core-js/modules/web.dom-collections.iterator.js 1.53 KiB [built] [code generated]
./node_modules/core-js/modules/es.promise.js 13.2 KiB [built] [code generated]
./node_modules/core-js/modules/es.array.includes.js 559 bytes [built] [code generated]
./node_modules/core-js/modules/web.url.js 31.9 KiB [built] [code generated]
./node_modules/core-js/modules/es.string.iterator.js 1.01 KiB [built] [code generated]
./node_modules/core-js/modules/web.url-search-params.js 11.6 KiB [built] [code generated]
./static/service-worker.js 2.45 KiB [built] [code generated]
webpack 5.24.2 compiled successfully in 23676 ms
Opening database: /home/fabio/.webthings/config/db.sqlite3
2021-12-24 09:32:36.689 INFO : Opening database: /home/fabio/.webthings/log/logs.sqlite3
2021-12-24 09:32:36.858 INFO : HTTPS server listening on port 4443
2021-12-24 09:32:36.859 INFO : Redirector listening on port 8080
2021-12-24 09:32:36.935 DEBUG : Ignoring “xxxxs”://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/schema.json because it has no messageType
2021-12-24 09:32:37.792 DEBUG : Ignoring “xxxxs”://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/messages/definitions.json because it has no messageType
2021-12-24 09:32:41.509 ERROR : Error getting value for thingId: http—led-lamp.local-things-urn-dev-ops-my-lamp-1234 property: luz
2021-12-24 09:32:41.510 ERROR : getProperty: device: http—led-lamp.local-things-urn-dev-ops-my-lamp-1234 not found.
2021-12-24 09:32:41.511 WARN : Rule get failed { Error: getProperty: device: http—led-lamp.local-things-urn-dev-ops-my-lamp-1234 not found.
at Things.getThingProperty (/home/fabio/Documentos/git/gateway/build/models/things.js:394:19) code: 500 }
2021-12-24 09:32:41.513 ERROR : Error getting value for thingId: http—led-lamp.local-things-urn-dev-ops-my-lamp-1234 property: luz
2021-12-24 09:32:41.514 ERROR : getProperty: device: http—led-lamp.local-things-urn-dev-ops-my-lamp-1234 not found.
2021-12-24 09:32:41.515 WARN : Rule get failed { Error: getProperty: device: http—led-lamp.local-things-urn-dev-ops-my-lamp-1234 not found.
at Things.getThingProperty (/home/fabio/Documentos/git/gateway/build/models/things.js:394:19) code: 500 }
2021-12-24 09:32:41.520 INFO : Loading add-on: weather-adapter
2021-12-24 09:32:41.523 INFO : Loading add-on: telegram-sender-adapter
2021-12-24 09:32:41.524 INFO : Loading add-on: thing-url-adapter
2021-12-24 09:32:41.525 INFO : Loading add-on: onvif-adapter
2021-12-24 09:32:42.854 INFO : telegram-sender-adapter: Opening database: /home/fabio/.webthings/config/db.sqlite3
2021-12-24 09:32:42.897 INFO : thing-url-adapter: Opening database: /home/fabio/.webthings/config/db.sqlite3
2021-12-24 09:32:42.941 INFO : thing-url-adapter: Ignoring "http"s://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/schema.json because it has no messageType
2021-12-24 09:32:42.942 INFO : telegram-sender-adapter: Ignoring "http"s://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/schema.json because it has no messageType
2021-12-24 09:32:43.041 INFO : onvif-adapter: Opening database: /home/fabio/.webthings/config/db.sqlite3
2021-12-24 09:32:43.131 INFO : onvif-adapter: Ignoring “xxxxs”://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/schema.json because it has no messageType
2021-12-24 09:32:43.173 INFO : weather-adapter: Opening database: /home/fabio/.webthings/config/db.sqlite3
2021-12-24 09:32:43.243 INFO : weather-adapter: Ignoring “xxxxs”://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/schema.json because it has no messageType
2021-12-24 09:32:45.000 INFO : onvif-adapter: Ignoring “xxxxs”://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/messages/definitions.json because it has no messageType
2021-12-24 09:32:45.169 INFO : thing-url-adapter: Ignoring “xxxxs”://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/messages/definitions.json because it has no messageType
2021-12-24 09:32:45.520 INFO : weather-adapter: Ignoring “xxxxs”://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/messages/definitions.json because it has no messageType
2021-12-24 09:32:45.537 INFO : telegram-sender-adapter: Ignoring https://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/messages/definitions.json because it has no messageType
2021-12-24 09:32:46.768 INFO : PageKite connected!
2021-12-24 09:32:46.777 INFO : Starting certificate renewal.
2021-12-24 09:32:46.882 INFO : Certificate not yet due for renewal.
2021-12-24 09:32:48.666 INFO : weather-adapter: Loading add-on weather-adapter from /home/fabio/.webthings/addons/weather-adapter
2021-12-24 09:32:48.825 INFO : thing-url-adapter: Loading add-on thing-url-adapter from /home/fabio/.webthings/addons/thing-url-adapter
2021-12-24 09:32:48.869 INFO : onvif-adapter: Loading add-on onvif-adapter from /home/fabio/.webthings/addons/onvif-adapter
2021-12-24 09:32:49.205 INFO : telegram-sender-adapter: Loading add-on telegram-sender-adapter from /home/fabio/.webthings/addons/telegram-sender-adapter
2021-12-24 09:32:49.585 INFO : Checking for add-on updates…
2021-12-24 09:32:49.817 ERROR : weather-adapter: Failed to start add-on weather-adapter: No locations configured.
2021-12-24 09:32:49.818 INFO : thing-url-adapter: Starting mDNS discovery
2021-12-24 09:32:51.120 INFO : Finished updating add-ons
2021-12-24 09:32:51.428 INFO : onvif-adapter: Unhandled Rejection
2021-12-24 09:32:51.429 ERROR : onvif-adapter: TypeError: Cannot read property ‘map’ of undefined
2021-12-24 09:32:51.429 ERROR : onvif-adapter: at camera.core.getScopes.then (/home/fabio/.webthings/addons/onvif-adapter/lib/onvif-adapter.js:66:52)
2021-12-24 09:32:51.430 ERROR : onvif-adapter: at process._tickCallback (internal/process/next_tick.js:68:7)
2021-12-24 09:32:53.192 INFO : onvif-adapter: { urn: ‘urn:uuid:97EAD713-33A1-463F-999F-16BEDE4F0A6E’,
2021-12-24 09:32:53.193 INFO : onvif-adapter: name: ‘IP Webcam’,
2021-12-24 09:32:53.193 INFO : onvif-adapter: address: ‘192.168.1.100’,
2021-12-24 09:32:53.193 INFO : onvif-adapter: service: ‘“xxxx”://192.168.1.100:8080/onvif/device_service’,
2021-12-24 09:32:53.194 INFO : onvif-adapter: hardware: ‘BUILD_783’,
2021-12-24 09:32:53.194 INFO : onvif-adapter: location: ‘global’,
2021-12-24 09:32:53.194 INFO : onvif-adapter: types: [ ‘dn:NetworkVideoTransmitter’ ],
2021-12-24 09:32:53.194 INFO : onvif-adapter: xaddrs: [ ‘“xxxx”://192.168.1.100:8080/onvif/device_service’ ],
2021-12-24 09:32:53.195 INFO : onvif-adapter: scopes:
2021-12-24 09:32:53.195 INFO : onvif-adapter: [ ‘onvif://www.onvif.org/name/IP_Webcam’,
2021-12-24 09:32:53.195 INFO : onvif-adapter: ‘onvif://www.onvif.org/type/video_encoder’,
2021-12-24 09:32:53.195 INFO : onvif-adapter: ‘onvif://www.onvif.org/type/audio_encoder’,
2021-12-24 09:32:53.196 INFO : onvif-adapter: ‘onvif://www.onvif.org/hardware/BUILD_783’,
2021-12-24 09:32:53.196 INFO : onvif-adapter: ‘onvif://www.onvif.org/location/global’ ] }
2021-12-24 09:32:53.196 INFO : onvif-adapter: { Manufacturer: ‘Pavel Khlebovich’,
2021-12-24 09:32:53.197 INFO : onvif-adapter: Model: ‘IP Webcam’,
2021-12-24 09:32:53.197 INFO : onvif-adapter: FirmwareVersion: ‘783’,
2021-12-24 09:32:53.197 INFO : onvif-adapter: SerialNumber: ‘SN000000’,
2021-12-24 09:32:53.198 INFO : onvif-adapter: HardwareId: ‘Android Device’,
2021-12-24 09:32:53.198 INFO : onvif-adapter: Ptz: false }
2021-12-24 09:32:53.312 INFO : onvif-adapter: { ‘$’: { token: ‘h264_ulaw_2048x1080’, fixed: ‘true’ },
2021-12-24 09:32:53.313 INFO : onvif-adapter: Name: ‘h264_ulaw_2048x1080’,
2021-12-24 09:32:53.313 INFO : onvif-adapter: VideoSourceConfiguration:
2021-12-24 09:32:53.313 INFO : onvif-adapter: { ‘$’: { token: ‘2048x1080_Config’ },
2021-12-24 09:32:53.313 INFO : onvif-adapter: Name: ‘2048x1080_Config’,
2021-12-24 09:32:53.314 INFO : onvif-adapter: UseCount: ‘1’,
2021-12-24 09:32:53.314 INFO : onvif-adapter: SourceToken: ‘2048x1080’,
2021-12-24 09:32:53.314 INFO : onvif-adapter: Bounds: { ‘$’: [Object] } },
2021-12-24 09:32:53.315 INFO : onvif-adapter: AudioSourceConfiguration:
2021-12-24 09:32:53.315 INFO : onvif-adapter: { ‘$’: { token: ‘MicrophoneConfig’ },
2021-12-24 09:32:53.315 INFO : onvif-adapter: Name: ‘MicrophoneConfig’,
2021-12-24 09:32:53.316 INFO : onvif-adapter: UseCount: ‘1’,
2021-12-24 09:32:53.316 INFO : onvif-adapter: SourceToken: ‘Microphone’ },
2021-12-24 09:32:53.316 INFO : onvif-adapter: VideoEncoderConfiguration:
2021-12-24 09:32:53.316 INFO : onvif-adapter: { ‘$’: { token: ‘h264’ },
2021-12-24 09:32:53.317 INFO : onvif-adapter: Name: ‘h264’,
2021-12-24 09:32:53.317 INFO : onvif-adapter: UseCount: ‘1’,
2021-12-24 09:32:53.317 INFO : onvif-adapter: Encoding: ‘H264’,
2021-12-24 09:32:53.317 INFO : onvif-adapter: Resolution: { Width: ‘2048’, Height: ‘1080’ },
2021-12-24 09:32:53.318 INFO : onvif-adapter: Quality: ‘0’,
2021-12-24 09:32:53.318 INFO : onvif-adapter: RateControl:
2021-12-24 09:32:53.318 INFO : onvif-adapter: { FrameRateLimit: ‘30’,
2021-12-24 09:32:53.318 INFO : onvif-adapter: EncodingInterval: ‘1’,
2021-12-24 09:32:53.321 INFO : onvif-adapter: BitrateLimit: ‘2000’ },
2021-12-24 09:32:53.321 INFO : onvif-adapter: H264: { GovLength: ‘150’, H264Profile: ‘Baseline’ },
2021-12-24 09:32:53.321 INFO : onvif-adapter: Multicast:
2021-12-24 09:32:53.322 INFO : onvif-adapter: { Address: [Object], Port: ‘8080’, TTL: ‘30’, AutoStart: ‘false’ },
2021-12-24 09:32:53.323 INFO : onvif-adapter: SessionTimeout: ‘PT00H00M30S’ },
2021-12-24 09:32:53.324 INFO : onvif-adapter: AudioEncoderConfiguration:
2021-12-24 09:32:53.326 INFO : onvif-adapter: { ‘$’: { token: ‘AudioEncoder’ },
2021-12-24 09:32:53.327 INFO : onvif-adapter: Name: ‘AudioEncoder’,
2021-12-24 09:32:53.327 INFO : onvif-adapter: UseCount: ‘0’,
2021-12-24 09:32:53.327 INFO : onvif-adapter: Encoding: ‘G711’,
2021-12-24 09:32:53.328 INFO : onvif-adapter: Bitrate: ‘1’,
2021-12-24 09:32:53.328 INFO : onvif-adapter: SampleRate: ‘8000’,
2021-12-24 09:32:53.329 INFO : onvif-adapter: Multicast:
2021-12-24 09:32:53.329 INFO : onvif-adapter: { Address: [Object], Port: ‘8080’, TTL: ‘30’, AutoStart: ‘false’ },
2021-12-24 09:32:53.329 INFO : onvif-adapter: SessionTimeout: ‘PT00H00M30S’ },
2021-12-24 09:32:53.330 INFO : onvif-adapter: StreamUri:
2021-12-24 09:32:53.330 INFO : onvif-adapter: { Uri: ‘rtsp://192.168.1.100:8080/h264_ulaw.sdp’,
2021-12-24 09:32:53.330 INFO : onvif-adapter: InvalidAfterConnect: ‘false’,
2021-12-24 09:32:53.331 INFO : onvif-adapter: InvalidAfterReboot: ‘false’,
2021-12-24 09:32:53.331 INFO : onvif-adapter: Timeout: { ‘$’: [Object] } },
2021-12-24 09:32:53.331 INFO : onvif-adapter: SnapshotUri:
2021-12-24 09:32:53.331 INFO : onvif-adapter: { Uri: ‘“http”://192.168.1.100:8080/shot.jpg’,
2021-12-24 09:32:53.332 INFO : onvif-adapter: InvalidAfterConnect: ‘false’,
2021-12-24 09:32:53.332 INFO : onvif-adapter: InvalidAfterReboot: ‘false’,
2021-12-24 09:32:53.332 INFO : onvif-adapter: Timeout: { ‘$’: [Object] } } }
2021-12-24 09:32:59.718 INFO : thing-url-adapter: Failed to connect to “xxxx”://localhost:8888/0: FetchError: request to “http”://localhost:8888/0 failed, reason: connect ECONNREFUSED 127.0.0.1:8888
2021-12-24 09:32:59.721 INFO : thing-url-adapter: Failed to connect to “xxxx”://localhost:8888/1: FetchError: request to “http”://localhost:8888/1 failed, reason: connect ECONNREFUSED 127.0.0.1:8888
2021-12-24 09:32:59.722 INFO : thing-url-adapter: Failed to connect to “xxxx”://localhost:8888: FetchError: request to “http”://localhost:8888/ failed, reason: connect ECONNREFUSED 127.0.0.1:8888

Again, not an expert & have never tried ONVIF…

The last line shows an error attempting to fetch from localhost:8888. Assume this is the virtual onvif camera “thing” attempting to stream from camera.

In some of the ONVIF INFO lines, it mentions port 8080, which I assume is your phone emulator being probed/discovered.

Q: could there be an additional configuration that the ONVIF thing e.g.: specify the IP address and/or PORT of the camera and/or username/password?

I run with a firewall enabled and have to manually open ports…

Also, wonder how easy it would be to install a 3rd-party ONVIF program on the rpi to test streaming independent of WT?

Good luck.

Hello, Eric,

The error on localhost:8888 is caused by a webthing implementation example I was testing. https://github.com/WebThingsIO/webthing-java.
192.168.1.100 is the android phone IP;
The “:8080/onvif/device_service” part is configured by the camera app;
User and password were set the same on the ONVIF addon and on the camera app;
I didn’t check firewall settings for port 8080 - shoud do this - thanks;
Test the camera with an ONVIF viewer other than WT is a great idea - thanks;

Thanks for your help.

Hello all!
Just to keep information up-to-date:

I succeeded to see the video stream generated by the camera app on a camera viewer app. Selected protocol is ONVIF on both.

The viewer app is: https://play.google.com/store/apps/details?id=net.biyee.onvifer&hl=pt&gl=US

It was not necessary to change firewall settings.

Still not viewing video stream using the gateway.

Help is needed.

Hello!
Happy new year!
I have made some progress in understanding the ONVIF addon, but didn’t succeed to get the camera app working with the gateway.
There is a two-year old thread that is related to the same problem. I posted updates there: Camera support?