Skip to content

Instantly share code, notes, and snippets.

@denilsonsa
denilsonsa / README.md
Last active July 15, 2024 18:07
Embed VTT subtitles into HTML

Embed VTT subtitles into HTML

Objective

I have a video file on my local disk. I also have some subtitles (in HTML5's [WebVTT][] format).

I want to create an HTML file to play that video with subtitles, all from the local filesystem.

Problem

@boherna
boherna / gist:9e3d223be4c8f2491a87
Last active November 1, 2023 23:57
To animate (fade) text change in UILabel (SWIFT)
The proper way to fade a UILabel (or any UIView for that matter) is to use a Core Animation Transition. This will not flicker, nor will it fade to black if the content is unchanged.
A portable and clean solution is to use a Extension in Swift (invoke prior changing visible elements)
// Usage: insert view.fadeTransition right before changing content
extension UIView {
func fadeTransition(duration:CFTimeInterval) {
let animation:CATransition = CATransition()
animation.timingFunction = CAMediaTimingFunction(name:
kCAMediaTimingFunctionEaseInEaseOut)