Announcement

Collapse
No announcement yet.

Cast using script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Cast using script

    Does any one have an example on how to use the cast plugin in a script ?

    Gr.

    Solved, used HS3 example and found chromcast id in device page :-)

    #2
    i am now using this script to cast diffrent radio stations
    Created a virtual device, (0 - 10) ref. id = 911
    and created an event, on change value i call the script
    and select the corresponding radio station


    Code:
    
    Sub Main(ByVal Parms As Object)
    
    'void CastMedia(string chromecastId, string mediaUrl, string mediaMimeType, string mediaTitle, string mediaImageUrl)
    'void CastWebPage(string chromecastId, string url)
    'void GoTo(string chromecastId, double seconds)
    
    dim chromecastId
    dim mediaUrl
    dim mediaMimeType
    dim mediaTitle
    dim mediaImageUrl
    
    
    Dim device_value As Double = hs.DeviceValueEx(911)
    
    
    chromecastId = "sdfbdbrb65jh5jtuyjtyjtyjt" ' ID of crhomecast device
    mediaMimeType = ""
    
    
    hs.WriteLog("Select radio", "Radio geselecterd: " & "New Value: " & device_value)
    
    
    'hs.PluginFunction("Chromecast","","CastMedia", new Object() {"6cb5547df516c18865955e52d8ba8a70","https://icecast.omroep.nl/radio2-bb-mp3", "", "Radio 2", "https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Radio_2_Logo.svg/1000px-Radio_2_Logo.svg.png"})
    
    Select Case device_value
    Case 1
    mediaUrl = "https://icecast.omroep.nl/radio1-bb-mp3"
    mediaTitle = "Radio 1"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/NPO_Radio_1_logo_2014.svg/1280px-NPO_Radio_1_logo_2014.svg.png"
    
    Case 2
    mediaUrl = "https://icecast.omroep.nl/radio2-bb-mp3"
    mediaTitle = "Radio2"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Radio_2_Logo.svg/1000px-Radio_2_Logo.svg.png"
    
    Case 3
    mediaUrl = "https://icecast.omroep.nl/3fm-bb-mp3"
    mediaTitle = "3FM"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/4/46/NPO_3FM_logo_2020.png"
    
    Case 4
    mediaUrl = "https://icecast.omroep.nl/radio4-bb-mp3"
    mediaTitle = "Radio 4"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/NPO_Radio_4_logo_2014.svg/1200px-NPO_Radio_4_logo_2014.svg.png"
    Case 5
    mediaUrl = "https://icecast.omroep.nl/radio5-bb-mp3"
    mediaTitle = "Radio 5"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/NPO_Radio_5_logo_2016.svg/1200px-NPO_Radio_5_logo_2016.svg.png"
    
    Case 6
    mediaUrl = "https://20103.live.streamtheworld.com/RADIO538.mp3"
    mediaTitle = "538"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/e/ec/Logo_538_Nederland.png"
    
    Case 7
    mediaUrl = "https://icecast-qmusicnl-cdp.triple-it.nl/Qmusic_nl_live_96.mp3"
    mediaTitle = "Q Music"
    mediaImageUrl = "https://qmusic.nl/assets/qmusic-a1d81a5f88375b3c5507cbc0b064ce1fc8778a076a245bddfd4f2a3e2417 c330.png"
    
    Case 8
    mediaUrl = "https://19993.live.streamtheworld.com/SKYRADIO.mp3"
    mediaTitle = "Sky Radio"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/4/4e/Sky_Radio_logo_2019.png"
    
    Case 9
    mediaUrl = "https://stream.slam.nl/web14_mp3"
    mediaTitle = "Slam FM"
    mediaImageUrl = "https://www.radiofreak.nl/wp-content/uploads/2016/08/SLAM_Logo_Compact_RGB_Magenta-e1471943885300.jpg"
    
    Case 10
    mediaUrl = "http://stream.radio10.nl/radio10"
    mediaTitle = "Radio 10"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/c/c9/Radio10-logo.png"
    
    Case else
    mediaUrl = "https://icecast.omroep.nl/radio2-bb-mp3"
    mediaTitle = "Radio 2"
    mediaImageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Radio_2_Logo.svg/1000px-Radio_2_Logo.svg.png"
    
    End Select
    
    
    
    hs.PluginFunction("Chromecast","","CastMedia", new Object() {chromecastId,mediaUrl, mediaMimeType, mediaTitle, mediaImageUrl})
    
    hs.WriteLog("cast radio.vb ", "Script ended")
    end sub































    Comment

    Working...
    X