Skip to content

Instantly share code, notes, and snippets.

@marco79cgn
Last active September 15, 2020 20:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marco79cgn/52d9d6e6f04445100805704d93177104 to your computer and use it in GitHub Desktop.
Save marco79cgn/52d9d6e6f04445100805704d93177104 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