This post was originally published on dcordero.me, where you will always find the most updated version.

CMTime is a struct representing a time value such as a timestamp or duration. CMTime is defined by CoreMedia and it is often used by AVFoundation API interfaces.

Because the interface of CMTime is horrible, and its documentation is even worse, here you have a few use cases to make it easier to work with CMTime in a daily basis.

Create a CMTime

Apart from its initializers, a CMTime is often created with the function CMTimeMake.

This function creates a CMTime with a duration of value/timescale seconds.


This post was originally published on dcordero.me, where you will always find the most updated version.

Creating a Form with a single Toggle in SwiftUI is a simple task. You can get a pretty nice result with just a few lines of code, as you can see here below:

struct ContentView: View {
var body: some View {
Form {
Section {
Toggle(isOn: $myToggleValue) {
Text("My Toggle")
}
}
}
}

// MARK: - Private

@State private var myToggleValue: Bool = false
}

But my use case was a little bit more complex. I did not have to display a…


This post was original published in dcordero.me. Where you will always find the most updated version.

As documented by Apple, HTTP Live Streaming (HLS) supports the inclusion of timed metadata in ID3 format.

In order to get this in-stream timed metadata from the client, we can make use of AVPlayerItemMetadataOutputPushDelegate.

Please notice that even though getting access to timed metadata used to be straightforward by observing the property timedMetadata of AVPlayerItem. Recently, with the release of iOS 13.0, Apple marked this property as deprecated.

You can find here below an example of a simple player catching and logging timed metadata…


This post was original published in dcordero.me. Where you will always find a more updated version.

If you ever tried to use QuickTime Movie Recording to get video output from an AppleTv that does not have a connected TV, you might have discovered that it does not work.

This is a pain in the situations when you can’t have a TV with you, for example when traveling, or when you are in home office and your family wants to watch TV.

This problem occurs because when there is no TV connected the AppleTv disables the video output, so QuickTime can’t get anything from it.

The workaround to solve this problem is connecting an HDMI Headless adapter to your AppleTv. Doing that will enable the video output and will make it work with QuickTime.


This post was original published in dcordero.me. Where you will always find a more updated version.

Even though I am one of the few persons who actually like watching series intros and never uses this button, the truth is that the ‘Skip Intro’ button introduced by Netflix a few years ago is most probably one of the most beloved features in their Apps.

Knowing that AVPlayerViewController does not allow adding interactive elements easily, and any attempt to do it might result in a lot of pain dealing with Siri Remote, I wondered how Netflix developers could have implemented this skip…


This post was original published in dcordero.me. Where you will always find a more updated version.

The AirPods are equipped with sensors that allow users to trigger some gestures like double-tap or automatic ear detection, to control media playback.

The behavior of each of these gestures can be configured in the Settings of the operating system among the options: Siri, Play/Pause, Next Track, Previous Track, or Off.

By default, if you are using AVPlayerViewController, some of these gestures (like Play/Pause) will work out of the box.

If you are using your custom player, or you still need to extend the…


This post was original published in dcordero.me. Where you will always find a more updated version.

My personal cheat sheet for working with Conda.


This post was original published in dcordero.me. Where you will always find a more updated version.

If you ever tried to display HTML content in tvOS, you might have discovered that it is not as easy as initially expected.

That is because there is no web browser, UIWebView, or even WKWebView available in tvOS.

Nevertheless, there is an alternative solution that can be useful to present simple HTML content as Term and Conditions, Privacy Policies, etc…

The idea is to use an instance of UITextView with an attributed String with HTML Doctype.

Here you can find the implementation of the…


This post was originally published on dcordero.me

The world of operating systems for mobile devices has been dominated by Apple and Google for the last ten years.

Both android and iOS have been around for quite a while already, and in their current versions, 9 and 12 respectively, they have reached a huge level of stability and customer satisfaction.

They also offer a huge number of Apps available in their App stores which make of them great platforms to smoothly achieve every kind of daily tasks.

A world of tracking systems

Sadly, apart from these advantages, one of the characteristics of these two dominant mobile…


Together with Apple Tv 4th Generation, Apple introduced its new remote control, Siri Remote. Which is a completely new concept to navigate on big screen interfaces.

In a world of remote controls with tons of buttons, Apple had the courage 😜 to release a box controlled by only six buttons and a little digitizer, having only two of the buttons and the digitizer available for developers.

As we saw in Being a tvOS Developer, due to these limitations, Siri Remote is in practice one of the biggest handicaps to create tvOS Apps.

In addition to that, as we will see…

David Cordero

iOS and tvOS developer at Zattoo. Passionate about coding and lifelong learning.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store