bot-commandnode on the editor, double click on it and configure it like shown below (if this is unfamiliar to you, you might wanna go over this more basic tutorial covering the basics of skill building).
queryon YouTube. If you notice, searching for a query on YouTube is the same thing as navigating to
functionnode (you'll find it at the top of the pallette) on to the editor and connect it to our
bot-commandnode. Double click on this node and put this code inside -
searchUrl) to the
msgobject forwarded by this node. We can now access this URL in other nodes.
Opennode (from the Maya Browser Automation module) to the editor, and double click on it.
searchUrlproperty of the
msgobject. So, select "msg." from the left dropdown on the "url" property and put "searchUrl" in the text input on the right of the dropdown.
Opennode will add a property called
msgobject, which is an array containing a single
Tabobject corresponding to the browser tab that was just opened. A
Tabobject contains these properties. This will be useful in a bit.
<a id="thumbnail">. The corresponding xpath for this element would then be:
Clicknode to click on it. First, drag a
Clicknode to the editor and double click on it. You'll should see something like this in the node's config panel.
selectorare filled out for us already, and we can leave them as is. Notice how
tabIdis set to
msg.tabsproperty was set by the
Opennode that comes right before this node, remember? We access the
idof the tab we just opened through
Clicknode to the
Opennode before it. The flow should now look like below. The only thing we need to do now is to notify the command bar that the skill has finished executing.
bot-responsenode (from the
botutilsmodule) to the editor and connect the
Clicknode to it. Your skill should look like this:
pause()method on the YouTube tab
Execute Functionnode works hehe). Here's the steps we need to take -
pause()method on this tab.
bot-commandnode should look like -
Execute Functionnode performs a page-automation action (i.e., does something with the website's interface). All page-automation actions require you to specify the ID of the tab on which you want to perform them. In our case, we need the ID of the tab which is playing the YouTube video.
Find Tabnode to the editor and double click on it. There's just one field - "query". This is a JSON field that will contain a standard chromium tab query. You can check out what a query can contain at this MDN page. We want a tab whose URL is of the pattern
*://*.youtube.com/watch*and is producing some sound. Here's the corresponding tab query:
Find Tabnode to the
Find Tabnode will set a property called
msgobject, containing an array of
Tabobjects that match the query. Ideally, only one tab should match the query (what kind of a psychopath has two audible youtube videos playing at once?), so we'll just select the first element of this array.
pause()method, and the YouTube player is no different. The
Execute Functionnode is used exactly for things like this, so drag it out to the editor and double click on it.
<video>tag. Since there is only one
<video>element on the entire page, it's xpath is simply
//video. That's what we'll put in the "selector" field.
pause()function takes no arguments, we can just set an empty JSON array (
) in the "arguments" field. The "tabId" field is already set to use the value
msg.tabs.id, which is what we want. The node config should finally look like this -
Execute Functionnode to the
Find Tabnode. The skill should finally look like this at this point -
bot-responsenode to the editor and connect it to the
Execute Functionnode. The final skill should look like this:
play()function instead of the
pause()function and in our tab query we won't be looking for an audible tab (since the tab ideally won't be playing anything). For this, just remove
"audible": truekey from the tab query in the