Here’s a few more that uses some of the new features in build 16.
Watch WWDC 2018 keynote in Siri
Presents a WebView plays the WWDC 2018 keynote using YouTube. Works great in Siri.
APIs: WebView
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-brown; icon-glyph: magic-wand;
let html = `
<style>
body {
margin: 0;
padding 0;
background: black;
}
.vid {
width: 100%;
height: 100%;
}
</style>
<div id="player"></div>
<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '100%',
width: '100%',
videoId: 'UThGcWBIMpU',
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady(event) {
event.target.playVideo();
event.target.seekTo(1923, true);
}
</script>
`
WebView.loadHTML(html, null, new Size(0, 202))
Load HTML file stored in iCloud Drive
Reads the file at the path html/fun/index.html
, relative to Scriptables directory in iCloud Drive, and presents it in a web view.
APIs: FileManager, WebView
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: blue; icon-glyph: document-1;
let fm = FileManager.iCloud()
let dir = fm.documentsDirectory()
let fileName = "html/fun/index.html"
let path = fm.joinPath(dir, fileName)
WebView.loadFile(path, new Size(0, 300))