//@liv-in-sky Januar 2021 14.2-15:46 let myecho8="alexa2.0.Echo-Devices.G0916D10016202R7.Commands.textCommand"; //ab hier nix mehr ändern let mySender = [{"0":"beenden"},{"1":"ARD"},{"2":"ZDF"},{"3":"WDR"},{"4":"NDR"},{"5":"rbb"},{"6":"MDR"},{"7":"KiKa"}, {"8":"arte"},{"9":"3Sat"},{"10":"ONE"},{"11":"tagesschau24"},{"12":"ZDF Neo"},{"13":"ZDF Heute"}, {"14":"ZDF Info"},{"15":"MTV"},{"16":"Beats TV"},{"17":"Alex Berlin"},{"18":"Phoenix"},{"19":"n24"}, {"20":"Servus TV"},{"21":"Sky Sport News"},{"22":"NASA Media"},{"23":"NASA Public"}] let myWidget="javascript." + instance + ".YouTube.StreamplayerVIS" let nachBeenden="stopp" let nachBeenden2="öffne firefox" on({id: myWidget, ack: false, change: "any"}, function (obj) { log("get "+getState(myWidget).val) if(getState(myWidget).val!=0 && getState(myWidget).val<=24 ) {setState(myecho8,"sage stream player kanal "+getState(myWidget).val)} else {setState(myecho8,nachBeenden); setStateDelayed(myecho8,nachBeenden2,5000)} if(getState(myWidget).val==24 ) {setState(myecho8,"öffne firefox"); /*setStateDelayed(myecho8,"öffne firefox",5000)*/}; if(getState(myWidget).val==25 ) {setState(myecho8,"gehe zur Startseite");/* setStateDelayed(myecho8,"gehe auf startseite",3000)*/}; }); async function doStuff() { //für einzelne Koordinaten Abfrage if (!(await existsStateAsync("javascript." + instance + ".YouTube.VISValueList"))) { await createStateAsync("YouTube.VISValueList",{type: "number", name: "ValueList_DP_for_VIS", role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.Command"))) { await createStateAsync("YouTube.Command",{type: "string", name: "Command_to_YT-Player", role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.Visible"))) { await createStateAsync("YouTube.Visible", false,{type: "boolean", name: "Vis _Sichtbarkeit", role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.VideoId"))) { await createStateAsync("YouTube.VideoId", "leer", {type: "string", name: "Video_ID_from_Youtube", role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.VideoDuration"))) { await createStateAsync("YouTube.VideoDuration", 0, {type: "number", name: "Video_Duration", min: 0, max: 100000, role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.VideoCurrent"))) { await createStateAsync("YouTube.VideoCurrent", 0, {type: "number", name: "Video_CurrentTime", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.Volume"))) { await createStateAsync("YouTube.Volume", 0, {type: "number", name: "Volume", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.PlayerStatus"))) { await createStateAsync("YouTube.PlayerStatus", 0, {type: "number", name: "Player_Status", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.PlayerStatus2"))) { await createStateAsync("YouTube.PlayerStatus2", 0, {type: "string", name: "Player_Status Bedeutung", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.StreamplayerVIS"))) { await createStateAsync("YouTube.StreamplayerVIS", 0, {type: "number", name: "Stream_Player_VIS", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.VideoDauer"))) { await createStateAsync("YouTube.VideoDauer", "", {type: "string", name: "VideoDauer_Umrechnung", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.EchoVIS"))) { await createStateAsync("YouTube.EchoVIS", 0, {type: "number", name: "Echo_VIS", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.BigSize"))) { await createStateAsync("YouTube.BigSize", 0, {type: "boolean", name: "Anzeige_Size", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.Spiele"))) { await createStateAsync("YouTube.Spiele", "", {type: "string", name: "Wird_im_Moment_gespielt", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.MomentanURL"))) { await createStateAsync("YouTube.MomentanURL", "", {type: "string", name: "URL_im_Moment_gespielt", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.PlaylistAnzahl"))) { await createStateAsync("YouTube.PlaylistAnzahl", 0, {type: "number", name: "Anzahl_wieviele-geladen", min: 0, max: 100000,role: "value", read: true, write: true, } ); } if (!(await existsStateAsync("javascript." + instance + ".YouTube.VideoTitle"))) { await createStateAsync("YouTube.VideoTitle", "", {type: "string", name: "Video_Title", min: 0, max: 100000,role: "value", read: true, write: true, } ); } } on({id: "javascript." + instance + ".YouTube.Volume", change: "ne"}, function (obj) { let af=""; var value = Number(obj.state.val); setState(myecho8.replace(".Commands.textCommand",".Player.volume"),value) }); on({id: "javascript." + instance + ".YouTube.BigSize", change: "ne"}, function (obj) { let af=""; var value = Number(obj.state.val); setState("javascript." + instance + ".YouTube.VISValueList",6) }); on({id: "javascript." + instance + ".YouTube.VideoId", change: "ne"}, function (obj) { let af=""; var value = obj.state.val.split(","); log(value.toString()) let helpisch="\[" for(let u=0;uplayer.loadPlaylist({playlist: ['XNTMa-gDDDQ','I4_CKUGAOmA']}); ['XNTMa-gDDDQ','I4_CKUGAOmA'] }); on({id: "javascript." + instance + ".YouTube.EchoVIS", change: "ne"}, function (obj) { let af=""; var value = Number(obj.state.val); switch (value) { case 0: setState("javascript." + instance + ".YouTube.VISValueList",6) //Refresh setStateDelayed("javascript." + instance + ".YouTube.EchoVIS",88,1000); break; case 1: setState(myecho8,"öffne Firefox"); //FIREFOX setStateDelayed("javascript." + instance + ".YouTube.EchoVIS",88,1000); break; case 2: setState(myecho8,"gehe zur Startseite"); //HOME setStateDelayed("javascript." + instance + ".YouTube.EchoVIS",88,1000); break; default: break; } }); on({id: "javascript." + instance + ".YouTube.VISValueList", change: "ne"}, function (obj) { var value = Number(obj.state.val); var oldValue = obj.oldState.val; let af=""; log(String(value)) let videoID=getState("javascript." + instance + ".YouTube.VideoId").val switch (value) { case 0: setState("javascript." + instance + ".YouTube.Visible",false); setState("javascript." + instance + ".YouTube.Command",af+""+en); setStateDelayed("javascript." + instance + ".YouTube.VideoDuration",0); setStateDelayed("javascript." + instance + ".YouTube.VideoCurrent",0); setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 1: setState("javascript." + instance + ".YouTube.Visible",true) setState("javascript." + instance + ".YouTube.Command",af+"player.playVideo()"+en) // setState("javascript." + instance + ".YouTube.Command",af+"player.playVideoAt(0)"+en) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 2: setState("javascript." + instance + ".YouTube.Command",af+"player.pauseVideo()"+en) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 3: setState("javascript." + instance + ".YouTube.Command",af+"player.seekTo(100, true);"+en) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 4: setState("javascript." + instance + ".YouTube.Command",af+"player.seekTo(0, true);"+en) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 5: setState("javascript." + instance + ".YouTube.Visible",true) let nowie=getState("javascript." + instance + ".YouTube.VideoId").val setState("javascript." + instance + ".YouTube.VideoId",""); setStateDelayed("javascript." + instance + ".YouTube.VideoId",nowie,1000) // setState("javascript." + instance + ".YouTube.Command",af+"player.loadVideoById({videoId:'"+videoID+"\'});"+en) // setState("javascript." + instance + ".YouTube.Command",af+"player.loadVideoById({videoId:'"+videoID+"?version=3&loop=1\'});"+en) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 6: setState("javascript." + instance + ".YouTube.Command",af+"javascript:history.go(0)"+en); setStateDelayed("javascript." + instance + ".YouTube.Command",""); setStateDelayed("javascript." + instance + ".YouTube.VideoDuration",0); setStateDelayed("javascript." + instance + ".YouTube.VideoCurrent",0); setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 7: setState("javascript." + instance + ".YouTube.Visible",true) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 8: setState(myWidget,24) //FIREFOX setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 9: setState("javascript." + instance + ".YouTube.Command",af+"player.seekTo(0, true);"+en) setStateDelayed("javascript." + instance + ".YouTube.VideoDuration",0); setStateDelayed("javascript." + instance + ".YouTube.VideoCurrent",0); setStateDelayed("javascript." + instance + ".YouTube.VideoDauer",""); setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 10: setState(myWidget,25) // HOME setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 11: setState("javascript." + instance + ".YouTube.Command",af+"player.seekTo("+(Number(getState("javascript." + instance + ".YouTube.VideoCurrent").val)+30)+", true);"+en); log((Number(getState("javascript." + instance + ".YouTube.VideoCurrent").val)+30).toString()) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 12: setState("javascript." + instance + ".YouTube.Command",af+"player.seekTo("+(Number(getState("javascript." + instance + ".YouTube.VideoCurrent").val)+120)+", true);"+en); log((Number(getState("javascript." + instance + ".YouTube.VideoCurrent").val)+30).toString()) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 13: setState("javascript." + instance + ".YouTube.Command",af+"player.previousVideo()"+en) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; case 14: setState("javascript." + instance + ".YouTube.Command",af+"player.nextVideo()"+en) setStateDelayed("javascript." + instance + ".YouTube.VISValueList",99,1000); break; default: break; } }); doStuff();