Hello
I am looking to send a URL to a UI template by means of a dropdown to play an internet radio.
I can send the URL (I get the correct url in the debug). However, the audio will not play if the URL is entered via "{msg / payload}". If I look deeper into the html code, the correct url is given. Someone who can get around this?
I had thought to provide a new UI template for each radio station, via a switch node. However when I change the radio station, the UI template remains active, resulting in multiple radios playing together.
Someone who can help me?
Thank you!
UI-template:
Correct url in source-code:
I know
I know the problem is loading the msg.payload. According to the post below, it should work through a "scope. $ Watch".However, I have no knowledge of this. Is what I quote correct? If not, someone who will help me?
My Flow:
[{"id":"64135c9.4f093a4","type":"ui_dropdown","z":"667d022a.81efdc","name":"","label":"Radio","tooltip":"Kies de gewenste radio","place":"Kies een radio","group":"ca3fa09.26dd96","order":4,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"Geen radio","value":"Geen","type":"str"},{"label":"Studio Brussel","value":"StuBru","type":"str"},{"label":"MNM Hits","value":"MNM","type":"str"},{"label":"Radio 1","value":"Radio1","type":"str"}],"payload":"","topic":"radio","x":160,"y":420,"wires":[["cc14f5cf.fc1cc8"]]},{"id":"10dd6c54.a9e554","type":"debug","z":"667d022a.81efdc","name":"Na Template","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":420,"wires":[]},{"id":"bb931fa5.c0191","type":"ui_template","z":"667d022a.81efdc","group":"ca3fa09.26dd96","name":"","order":5,"width":0,"height":0,"format":"<!DOCTYPE html>\n<html>\n<body>\n\n<audio autoplay>\n <source src=\"{{msg.payload}}.ogg\" type=\"audio/ogg\">\n <source src=\"{{msg.payload}}.mp3\" type=\"audio/mpeg\">\n</audio>\n\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":480,"y":420,"wires":[["10dd6c54.a9e554"]]},{"id":"cc14f5cf.fc1cc8","type":"function","z":"667d022a.81efdc","name":"Radiokeuze","func":"var radio = msg.payload;\n\nif (radio == \"Geen\"){\n msg.payload = \"\";\n}\n\nelse if (radio == \"StuBru\"){\n msg.payload = \"http://icecast.vrtcdn.be/stubru-high\";\n}\n\nelse if (radio == \"MNM\"){\n msg.payload = \"http://icecast.vrtcdn.be/mnm_hits-high\";\n}\n\nelse if (radio == \"Radio1\"){\n msg.payload = \"http://icecast.vrtcdn.be/radio1-high\";\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":420,"wires":[["bb931fa5.c0191"]]},{"id":"ca3fa09.26dd96","type":"ui_group","z":"","name":"Radio","tab":"2e50a2b7.45142e","order":2,"disp":false,"width":"1","collapse":false},{"id":"2e50a2b7.45142e","type":"ui_tab","z":"","name":"Aanmelden","icon":"group","order":2,"disabled":false,"hidden":false}]