Author Topic: chromecast  (Read 3528 times)

0 Members and 1 Guest are viewing this topic.

Jhonny

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 0
    • View Profile
chromecast
« on: September 18, 2016, 05:10:56 AM »
Hi Everyone,
Does anybody Know how to tell voxcommando to cast to chromecast. is it possible?

Thanks,
Jhonny

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: chromecast
« Reply #1 on: September 18, 2016, 03:07:33 PM »
Welcome to the forum.

I don't have a Chromecast so I don't know if this is of use to you, but have you tried the 'Chromecast with Chrome' route -- controlled in VC using the Win plugin and some mouse and keyboard emulation?

https://support.google.com/chromecast/answer/3228332?hl=en-CA

There's also a python library on Github that's supposed to control Chromecast. It *may* work with VC's Python plugin, but would require some Python knowledge.

https://github.com/balloob/pychromecast
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: chromecast
« Reply #2 on: September 18, 2016, 05:42:35 PM »
It depends what you want to cast, but just as a 'mockup' example, here I am controlling Chrome with the Google Cast extension installed.
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.2.7-->
<commandGroup open="True" name="Chrome control" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="83" name="Chromecast song {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Once the modal popup opens, this point you'll need to add mouse emulation (see the mouse.*** actions) to select a chromecast device. Not sure how reliably it will work, since I can't test it. You'll need to experiment with adding VC.Pause in between emulations as needed, probably.">
    <action>
      <cmdType>Tools.Encode.URI</cmdType>
      <params>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.RawParam</cmdType>
      <params>
        <param>{Path.PFx86}\Google\Chrome\Application\chrome.exe</param>
        <param>C:/Users/Public/Music/Sample%20Music/{LastResult}.mp3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <params>
        <param>1500</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Window.Maximize</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Window.Focus</cmdType>
      <params>
        <param>chrome</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Mouse.MoveAbsolute</cmdType>
      <params>
        <param>500,500</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Mouse.RightClick</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <params>
        <param>50</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>InputKeys.Send</cmdType>
      <params>
        <param>{c}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Chromecast song</phrase>
    <payloadList>Kalimba,Maid with the Flaxen Hair,Sleep Away</payloadList>
  </command>
  <command id="76" name="Close Chrome" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Window.Close</cmdType>
      <params>
        <param>chrome</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Close Chrome</phrase>
  </command>
</commandGroup>

The example uses some default songs installed on everyone's Windows machines, usually. So it can be used as a test case as is. But I don't have a Chromecast so the command does not include the mouse emulation needed to select a device.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Jhonny

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 0
    • View Profile
Re: chromecast
« Reply #3 on: September 18, 2016, 08:43:53 PM »
Hi, nime5ter

  Thanks for your reply. really apreciate it. Will  figure it out and will keep you posted.

  Jhonny

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: chromecast
« Reply #4 on: September 19, 2016, 06:20:26 PM »
My proposed solution is not elegant. It's basically a poor man's hack. It should work for some things, but probably not anything and everything you may want to cast.

The Chrome browser extension is supposed to allow you to cast either a browser tab or your desktop. (Not sure what kind of audio, media format, or screen resolution issues may come up.)

In terms of VC, I don't know how reliably you'll be able to emulate selecting desktop vs. tab. It will involve figuring out the right timing for your hardware and experimenting with mouse coordinates as well, if you need to switch between those two options.

But the benefit is that you don't have to know how to program to make it work; it mostly involves a lot of patient experimentation with timing and choosing the right mouse or keyboard emulation. If you get part way there but run into challenges, we can try to make follow-up suggestions if you post your command xml and explain what's happening. But without having Chromecast hardware we can basically only give our best guesses.

If you can find a working solution, I'm sure other users would appreciate learning from your experience.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Jhonny

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 0
    • View Profile
Re: chromecast
« Reply #5 on: September 20, 2016, 01:33:54 PM »
Hi, nime5ter.

It will take me sometime to figure it out.  or I'll just wait for (Google Home) that should be out in couple of weeks or maybe i can acomplish it via echoe dot. But i preffer Google Home. And last Python?  https://github.com/balloob/pychromecast. But I don't have the skills to use python. Might  voxcommando come up with a chromecast pluggin, soon.

Thanks,
Jhonny
« Last Edit: September 20, 2016, 01:37:35 PM by Jhonny »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: chromecast
« Reply #6 on: September 20, 2016, 02:06:26 PM »
... Might  voxcommando come up with a chromecast pluggin, soon.

That is extremely unlikely.