I'm trying to set up a Siri Shortcut on iOS to make AirPlaying a YouTube video to an Apple TV easy.
(我正在尝试在iOS上设置Siri快捷方式,以使AirPlay轻松将YouTube视频播放到Apple TV。)
As part of that process, I want to select the quality of the video (presumably using Javascript), but I'm having trouble getting that going.(作为该过程的一部分,我想选择视频的质量(大概使用Javascript),但是我很难做到这一点。)
Here's what I've got so far ( imgur link to view on desktop/non-iOS devices ).(这是到目前为止我所能获得的 ( imgur链接可在台式机/非iOS设备上查看 )。)
That successfully uses JavaScript to pause the video, rewind it back to the beginning since YouTube autoplays, then connects to the Apple TV with AirPlay, waits for the TV to turn on, and clicks on the video to unmute it.(这样就可以成功地使用JavaScript暂停视频,将其倒回YouTube自动播放的开始位置,然后通过AirPlay连接到Apple TV,等待电视打开,然后单击视频以取消静音。)
However, everything I've tried to set the video quality hasn't worked, and I'm tearing my hair out over here.(但是,我尝试设置视频质量的所有操作均无效,并且我正在这里扯头发。)
Anyone have any idea if that's possible?(有人知道这是否可能吗?)
Is it a parameter of the video that can be set?(可以设置视频的参数吗?)
Or can I use JavaScript to click on the settings button and pick the quality?(还是可以使用JavaScript单击设置按钮并选择质量?)
My Javascript is very weak, so any help pointing me in the right direction would be very much appreciated.(我的Java语言功能很弱,因此向我指出正确方向的任何帮助将不胜感激。)
Here's the Javascript I've got so far:
(这是到目前为止我得到的Javascript:)
ytplayer = document.querySelector('video');
ytplayer.pause();
ytplayer.currentTime = 0;
ytplayer.click();
ytplayer.play();
completion();
ask by Lennon translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…