I want my player to play videos that are in Video
app.
I access Media Library
, and want to get list of videos, and when user selected a video, my player get the video data and play it on my own player.
How can I get the video data?
Notice that I want to play videos, not songs.
This is my code to get videos:
let predicate = MPMediaPropertyPredicate(value: MPMediaType.anyVideo.rawValue, forProperty: MPMediaItemPropertyMediaType)
let query = MPMediaQuery()
query.addFilterPredicate(predicate)
let items = query.items!
It takes videos as MPMediaItem
.
Does it takes videos correctly? If yes, I want to get a video data after user selected one.
I think @Scriptable is right. But notice that downloaded videos will not be accessible through Videos
(renamed to TV
) application! TV
shows iTunes purchased movies.
You can access downloaded videos through Photos
(Gallery). If you mean downloaded videos from the web or other apps.