[LINUX] Stream videos to Chromecast with Gravio

background

Last time, I even used CATT to stream videos to my Chromecast device. Click here for how to use CATT. → https://qiita.com/zrock/items/522a629262222645aefe Now let's control this with Gravio. If you can control it with Gravio, various delusions will spread.

usage environment

Same as last time. Gravio is increasing.

Overview

Gravio has a component that runs a shell script called ** RunScript **. It does not support CATT itself, but it can be achieved by creating a shell script and executing it.

procedure

First, create a shell script. Since it only casts the video, the device name etc. will be embedded. I want to pass the video itself as a parameter, so use $ 1. It's very simple.

play-video.sh


catt -d "Chromecast 4K" cast "$1"

Place this. For Linux, the location is under / var / opt / gravio / action / scripts. You can also upload from Gravio Studio, which will come out later. When connecting with SSH etc., you can put it directly or make it with vim etc.

Once the file is created, make it owner ** root ** and give it execute permission. Otherwise, you will not be able to run it on the ** RunScript ** component.

$ cd /var/opt/gravio/action/scripts
$ sudo chown root play-video.sh
$ sudo chmod +x play-video.sh

The rest is the setting in Gravio. Log in to Gravio Studio and create an action. Place the ** RunScript ** component inside the action. catt2.png In the properties, specify the play-video.sh created earlier in the ** file **. If you have already placed it, click the browse button and select play-video.sh. If you have not placed it, use the upload button to place the file created in your local environment. However, the execution right is not given just by placing it, so be sure to give the execution right to the script file in the upload destination folder by SSH etc. with the above command. Please specify the URL of the video in ** Arguments **.

That's all. After that, click the play button and the video will be played on the specified device.

After that, if you assign an action with the trigger of the button click event like this, or create a trigger that is executed by the value of the sensor, the combined technique of IoT and Chromecast is completed.

catt1.png

By the way, the command is cast_site to display the site, so let's create another shell script. You can embed commands with parameters, but it's easier to understand if you change the script.

show-site.sh


catt -d "Chromecast 4K" cast_site "$1"

Finally

As I wrote at the beginning, Gravio supports various sensors, and you can perform various actions while watching the state of the sensor, so it is very delusional. With the enterprise version of AI Edition, face recognition will also be possible, so it will be possible for visitors to play their favorite images. By the way, this time it was realized on Linux / Raspberry Pi, but it can also be realized on Windows by installing Python. There is a little trick, so I will come back to it later.

Recommended Posts

Stream videos to Chromecast with Gravio
How to download youtube videos with youtube-dl
Stream redmine updates to hipchat with python
Convert 202003 to 2020-03 with pandas
Try to factorial with recursion
Connect to BigQuery with Python
Connect to Wikipedia with Python
Post to slack with Python 3
Connect to Postgresql with GO
Output to syslog with Loguru
Introduction to RDB with sqlalchemy Ⅰ
Easy to make with syntax
How to update with SQLAlchemy?
To run gym_torcs with ubutnu16
How to cast with Theano
How to Alter with SQLAlchemy?
Switch python to 2.7 with alternatives
Write to csv with Python
How to separate strings with','
How to RDP with Fedora31
2 ways to deal with SessionNotCreatedException
How to Delete with SQLAlchemy?