SwiftUI: VideoPlayer

SwiftUI: VideoPlayer

At WWDC 2020, Apple introduced a view that can play local videos or videos from a URL. Is there a way to disable the default video controls (play/pause/scrubber/etc) on the new SwiftUI VideoPlayer in iOS14, so I could create a custom one?

Disclaimer: You won’t be able to use videos from YouTube.

“A view that displays the video content from a player object along with system-supplied playback controls.” — Apple Developer


To follow along with this tutorial, you’ll need some basic knowledge in:

  • Swift
  • At least Xcode 12+

Note: This only supports iOS 14+.

Getting Started With VideoPlayer

To begin, you will first need to import the required module:

import AVKit

For the purpose of illustration, I will download the Nyan Cat video from YouTube, which will have an mp4 extension. The file will then be placed inside the project as shown below. Please make sure that the target is selected or else your app will crash:

Please test this only on your device. Testing it on the simulator will not work.

swift xcode swiftui programming mobile

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Build a Rotation Animation in SwiftUI

Build a number of different rotation animations How to Build a Rotation Animation in SwiftUI

How to Create a Draggable Card in SwiftUI

Build a bottom card view with a drag gesture. First, let’s make our CardView. For the tutorial, I only have a ZStack with color and some text.

SwiftUI 2.0 Course App - SwiftUI 2.0 Custom Tab Bar With Navigation Views - Xcode 12 - SwiftUI 2.0

In this Video i'm going to show how to create a Stylish Courses App UI With Custom Tab Bar - Navigation Views And With Swipe Gestures Using SwiftUI 2.0

SwiftUI Splash Screen Using Xcode 12 - Twitter Animated Splash Screen Using SwiftUI 2.0

In this Video i'm going to show how to Implement Twitter Splash Screen Using Xcode 12 And SwiftUI 2.0

Routing in SwiftUI

2 solutions for routing in SwiftUI. The router is defined by a protocol, which the View will require in the constructor. The viewFor(route: _, content: _) function should take a 'route', ...