Using Global Variable in UI Template

Here is a post I made on sending a msg.template ---> LOLz - Nublet 101 - msg.template - i dont need no template node

also the flow

[{"id":"59bbbf3a.a700f","type":"mui_template","z":"c73d189c.ffdb98","group":"593f05c3.2566cc","name":"","order":3,"width":"6","height":"9","format":"\n<div>\n    \n    <center><b>12:34:17</b></center>\n    <video width=\"300\" controls>\n        <source src=\"/docker5/cameras/SunValleyIndoorDocksNorth01/2021-year/03-month/05-day/12-hour/2021-03-05-12-02-50.mp4\" type=\"video/mp4\">\n    </video>\n    \n</div>\n<p></p><p></p>\n<div>\n    \n    <center><b>12:34:17</b></center>\n    <video width=\"300\" controls>\n        <source src=\"/docker5/cameras/SunValleyIndoorDocksNorth01/2021-year/03-month/05-day/12-hour/2021-03-05-12-02-50.mp4\" type=\"video/mp4\">\n    </video>\n    \n</div>\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":880,"y":740,"wires":[[]]},{"id":"e2bad9b0.69a96","type":"template","z":"c73d189c.ffdb98","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html>\n<head>\n<style>\n.button {\n  background-color: #2B2B2A; /* Green */\n  border: none;\n  color: white;\n  padding: 2px 2px;\n  text-align: center;\n  text-decoration: none;\n  display: inline-block;\n  font-size: 12px;\n  margin: 0px 0px;\n  cursor: pointer;\n}\n\n.button1 {width: 30px;}\n.button2 {width: 50px;}\n</style>\n</head>\n<body>\n","output":"str","x":120,"y":740,"wires":[["e0b250d2.58c59"]]},{"id":"e0b250d2.58c59","type":"function","z":"c73d189c.ffdb98","name":"","func":"const video_URL = msg.video_URL;\nconst video_times = msg.video_times;\nconst video_uid = msg.video_uid;\nvar template = msg.template;\nvideo_URL.forEach(function(url, index){\n  template += '<div><center><b>' + video_times[index] + '</b></center><video id=\"' + video_uid[index] + '\" width=\"300\" controls preload=\"none\" poster=\"' + url + '.thumb\"><source src=\"' + url + '\"type=\"video/mp4\">Your browser does not support HTML5 video.</video><center><button class=\"button button1\" onclick=\"setPlaySpeed(0.25,' + video_uid[index] + ')\" type=\"button\"><b>1/4</b></button><button class=\"button button1\" onclick=\"setPlaySpeed(0.5,' + video_uid[index] + ')\" type=\"button\"><b>1/2</b></button><button class=\"button button2\" onclick=\"setPlaySpeed(1,' + video_uid[index] + ')\" type=\"button\"><b>Normal</b></button><button class=\"button button1\" onclick=\"setPlaySpeed(2,' + video_uid[index] + ')\" type=\"button\"><b>2x</b></button><button class=\"button button1\" onclick=\"setPlaySpeed(4,' + video_uid[index] + ')\" type=\"button\"><b>4x</b></button><button class=\"button button1\" onclick=\"setPlaySpeed(8,' + video_uid[index] + ')\" type=\"button\"><b>8x</b></button><button class=\"button button1\" onclick=\"setPlaySpeed(16,' + video_uid[index] + ')\" type=\"button\"><b>16x</b></button><button class=\"button button1\" onclick=\"setPlaySpeed(32,' + video_uid[index] + ')\" type=\"button\"><b>32x</b></button></center></div><p></p><p></p><p></p>';\n});\ntemplate += '<script>'\nvideo_uid.forEach(function(uid){\n  template += 'var ' + uid + ' = document.getElementById(\"' + uid + '\");';\n});\ntemplate += 'function setPlaySpeed(speed,id) { id.playbackRate = speed; } </script> </body> </html>';\n\nmsg.template = template;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":740,"wires":[["de6b0f68.305f3"]]},{"id":"de6b0f68.305f3","type":"change","z":"c73d189c.ffdb98","name":"msg.payload --> msg.template","rules":[{"t":"set","p":"payload","pt":"msg","to":"template","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":740,"wires":[["59bbbf3a.a700f"]]},{"id":"593f05c3.2566cc","type":"mui_group","name":"selections","tab":"928d2bd7.b131d","disp":false,"width":"6","collapse":false},{"id":"928d2bd7.b131d","type":"mui_tab","name":"Review","icon":"dashboard","disabled":false,"hidden":false}]