crispychicken
crispychicken

Reputation: 2662

Find path for local video in Xcode Project

I need to play locally stored Videos in my iOS app.

The videos are located in the directory: App/Resources/Videos/

When I try to get the path with:

NSBundle.mainBundle().pathForResource("myFile", ofType: "mp4", inDirectory: "App/Resources/Videos/")

I get nil. Any advice?

Upvotes: 1

Views: 908

Answers (3)

Umer Khan
Umer Khan

Reputation: 203

Swift 5.4

Bundle.main.path(forResource: VideoHelper.vName, ofType: VideoHelper.vExtension)

Upvotes: 0

crispychicken
crispychicken

Reputation: 2662

Problem solved: the error was I didn't add the Target-Membership for the Videos.

Upvotes: 2

Mukul More
Mukul More

Reputation: 564

You can go ahead and remove inDirectory from the function call. Just search for your file in your app main bundle.It shall do the job for you.

Upvotes: 0

Related Questions