@bananajoe ich hatte ein script in der vis, welches einen dp abfrägt und dann den player startet oder stoppt
dazu ein html widget, in dem der player definiert ist
html widget:
Spoiler
<audio id="myAudio" muted=true >
<source src={0_userdata.0.CONTROL-OWN.ECHO8.Echo2PlayStream} type="audio/mpeg" >
Your browser does not support the audio element.
</audio>
<script>
/* autoplay */
</script>
PLAYER
das script im script-tab des vis-editors:
(da sind noch andere sachen drin - müßte vereinfacht werden)
Spoiler
let timeout12 = 8500;
setTimeout( () => {
var isRunning=true;
var Self = this;
vis.setValue('0_userdata.0.CONTROL-OWN.ECHO8.Echo2SteuerungAudio','');
vis.setValue('0_userdata.0.CONTROL-OWN.ECHO8.Echo2SilkRunning',true);
var x = document.getElementById("myAudio");
/*let timeout12 = 5500; //Zeit erhöhen wenn der Klick nicht angenommen wird
setTimeout( () => {*/
/ $('#w00010').trigger('click'); */
function playAudio() {
x.load()
setTimeout( () => {
x.play();
x.muted=false;
}, 1000);
/*console.log("bin in play audio")*/
}
function pauseAudio() {
x.pause();
x.muted=true;
x.currentTime = 0;
}
setInterval(function(){
vis.setValue('0_userdata.0.CONTROL-OWN.ECHO8.Echo2SilkRunning',true);
Self.servConn.getStates(['0_userdata.0.CONTROL-OWN.ECHO8.Echo2Player-PP','javascript.0.YouTube.whichDevice'], (error, states) => { /*console.log(states); */
/* vis.setValue('0_userdata.0.CONTROL-OWN.ECHO8.Echo2SilkRunning',true);*/
if (states['javascript.0.YouTube.whichDevice'].val != 2) {
if (x.duration > 0 && !x.paused) {
vis.setValue('0_userdata.0.CONTROL-OWN.ECHO8.Echo2PlayerStatus',true);
isRunning=true;
//Its playing...do your job
/*console.log("playing")*/
} else {
vis.setValue('0_userdata.0.CONTROL-OWN.ECHO8.Echo2PlayerStatus',false);
isRunning=false;
//Not playing...maybe paused, stopped or never played.
/* console.log("paused")*/}
Self.servConn.getStates(['0_userdata.0.CONTROL-OWN.ECHO8.Echo2Player-PP'], (error, states) => {
if(states['0_userdata.0.CONTROL-OWN.ECHO8.Echo2Player-PP'].val && !isRunning) playAudio();
if(!states['0_userdata.0.CONTROL-OWN.ECHO8.Echo2Player-PP'].val && isRunning) pauseAudio(); } );
}
} ); /* ende getState*/
}, 5000) /* ende Interval*/
}, timeout12);
das ganze wird mit einem widget ein/aus geschalten ('0_userdata.0.CONTROL-OWN.ECHO8.Echo2Player-PP)