Skip to content

Instantly share code, notes, and snippets.

@boserup
Forked from marco79cgn/apple-event.js
Created September 15, 2020 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boserup/ed78b7b0c10c983422e895be7623a82d to your computer and use it in GitHub Desktop.
Save boserup/ed78b7b0c10c983422e895be7623a82d to your computer and use it in GitHub Desktop.
Widget which opens the Apple Event Stream on YouTube
let widget = new ListWidget()
widget.setPadding(0,0,0,0)
widget.url = "https://p-events-delivery.akamaized.net/1108byjxmnoakagswdphbwatymztxxew/m3u8/main.m3u8"
widget.backgroundColor = new Color("#FFFFFF")
await loadImage("https://cdn.vertexreport.com/wp-content/uploads/2020/09/Apple-Event-September.jpg")
Script.setWidget(widget)
Script.complete()
// download and display the cover
async function loadImage(imageUrl) {
let req = new Request(imageUrl)
let image = await req.loadImage()
let widgetImage = widget.addImage(image)
widgetImage.imageSize = new Size(280,280)
widgetImage.centerAlignImage()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment