Тёмный

Swift: Custom Video Player 

Vasil Blanco-Nunev
Подписаться 4,4 тыс.
Просмотров 28 тыс.
50% 1

In this video, I will show you how you can create your custom video player using AVPlayer. Please note the last 8 seconds of the video as I forgot to mention that you need to remove the observer from the player when you are deallocating it.
Download the project: bit.ly/2u9pKRS
Follow me:
Twitter: / vasilnunev
Instagram: / v.nunev

Опубликовано:

 

18 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 65   
@joshuamckinsey1013
@joshuamckinsey1013 3 года назад
Awesome! You saved me a lot time and head ache by making this video. Thank you very much!
@NishantNarola
@NishantNarola 4 года назад
Nice tutorial sir and easy to understand video player concept. Can you make video for audio player with all the concepts like play pause, fast forward, backwards, current time being changed, slider value change
@waqaskhokhar1109
@waqaskhokhar1109 3 года назад
Outstanding work and easy to understand
@Tacoslover770
@Tacoslover770 5 лет назад
Great Tutorial! I would highly recommend this to anyone.
@arvj123
@arvj123 5 лет назад
Love this. Thanks for the detailed tutorial.
@rafatwasef8518
@rafatwasef8518 2 года назад
Great job Vasil
@demoiosapp81
@demoiosapp81 2 года назад
you made May Day brother, thanks for making this type of videos,moke more video
@hiteshrasal5222
@hiteshrasal5222 4 года назад
Great tutorial with small details..thank you
@dolphinmoto3226
@dolphinmoto3226 Год назад
Thanks a lot for the video!!!
@kennethroark917
@kennethroark917 6 лет назад
Grateful for this great tutorial! Thanks Vasil!
@cesaredecal2230
@cesaredecal2230 6 лет назад
Nice video, thanks! I think using stack views would have been a much better way of handling constraints/UI.
@dheerajbhavsar9769
@dheerajbhavsar9769 4 года назад
Hello Vasil, I'm creating a player with a play button over the video(like RU-vid). Whenever I try to add button using self.view.addSubview and there isn't any button coming up. I've also googled and found that when we add layer it overwrites the subviews. Can you please help me out. Thanks
@QDWorld-SwiftUI
@QDWorld-SwiftUI 3 года назад
Can you please let me know how To play local videos instead of url
@mayankpalotra5442
@mayankpalotra5442 4 года назад
Hey Vasil, Thanks Your Great Tutorial!! Can we add zoom on double tap on player when "showsPlaybackControls = false" is false?
@videosuliketowatch
@videosuliketowatch 5 лет назад
I am working on the AVPlayer with custom controls, My app is in Portrait mode but the want to rotate video to landscape. I am able to do so, Problem is occurring when switch back to portrait mode .. Player View is not taking the same frame as it initially has. Please help me out in this.
@mozyok
@mozyok 5 лет назад
Hi Vasil, it’s very very helpful to me! Thanks!! 😍
@dennycad7859
@dennycad7859 2 года назад
Awesome video
@nicklonginow1549
@nicklonginow1549 2 года назад
Really great job, thank you!
@KarthikPandianTwister
@KarthikPandianTwister 6 лет назад
Nice Video Vasil. I need the Zoom In/Out functionalities in the AVPlayer. Please provide me the examples.
@MuhammadAsim-cf8xj
@MuhammadAsim-cf8xj 6 лет назад
Hello Vasil, The player layer goes white after some time and do not show the screen but audio is still coming from device, any idea? Regards
@Annon739
@Annon739 6 лет назад
Hi there Vasko, thank you for the tutorial but I'm still on the first part of the video where you just play the video i do everything exactly the same as you but i get Thread 1: Fatal error: Unexpectedly found nil while unwrapping an optional value could you please help me resolve this issue? Thank you in advance!
@adenjordan3659
@adenjordan3659 3 года назад
I know I'm kinda off topic but does anybody know of a good site to stream new series online ?
@santanamalcolm8048
@santanamalcolm8048 3 года назад
@Aden Jordan Lately I have been using Flixzone. You can find it by googling =)
@aliharper7705
@aliharper7705 3 года назад
@Santana Malcolm Yup, I've been using flixzone for since march myself =)
@adenjordan3659
@adenjordan3659 3 года назад
@Santana Malcolm Thanks, signed up and it seems like they got a lot of movies there :) Appreciate it!!
@santanamalcolm8048
@santanamalcolm8048 3 года назад
@Aden Jordan Happy to help =)
@add-bg5ho
@add-bg5ho 4 года назад
thanks, you saved my llife. it's really helpful
@hide226
@hide226 6 лет назад
Thanks, you have been so helpful
@anujadeshmukh7577
@anujadeshmukh7577 6 лет назад
How to add full screen functionality on button click?
@bhanu2603
@bhanu2603 4 года назад
hii its awesome.I tried the same but im not getting volume
@hongnhannguyen1509
@hongnhannguyen1509 3 года назад
Great Tutorial, thank you very much :)
@laimaspa9770
@laimaspa9770 5 лет назад
Very helpful. Thanks !
@MatheusR30
@MatheusR30 5 лет назад
Helped a lot!!!! Thanks!!!
@TV-vu9fg
@TV-vu9fg 5 лет назад
Thank you very much
@shivanisharma-lv6uy
@shivanisharma-lv6uy 4 года назад
Sir please tell why RU-vid video links are not working ??
@tejastejas3668
@tejastejas3668 5 лет назад
how to implement thumbnails with preview on slider,can u make one video
@NishantNarola
@NishantNarola 4 года назад
What if the video finishes, then how to reset the currenttimelabel to 00:00 and button title to play
@x8lue
@x8lue 4 года назад
You can add an Observer and check for the Notification to fire off. Then you can reset the "States". The Notification.Name is AVPlayerItemDidPlayToEndTime
@paullochte2950
@paullochte2950 3 года назад
Nice!
@mwjr.974
@mwjr.974 7 лет назад
hey Vasil Nunev, im a really big fan i want to become and iOS Developer like you! do you think you could teach me 1 on 1 about programming iOS Apps?
@decreer4567
@decreer4567 6 лет назад
He does bad practice...
@QDWorld-SwiftUI
@QDWorld-SwiftUI 3 года назад
He does not respond to comments
@schevgeny
@schevgeny 4 года назад
cool! work example!
@SciencePlusPlus
@SciencePlusPlus 6 лет назад
Sir! RU-vid videos link doesn't work why , even any link doesn't work why.plz tell me
@llyojlatnem5560
@llyojlatnem5560 6 лет назад
plzz provide removeTimeObserver and removeobserver function for load new video thanks in advance
@samirdesigner3324
@samirdesigner3324 7 лет назад
thanks if make for 5 file video how make this thanks to help me
@dcontreras_98
@dcontreras_98 7 лет назад
Vasil! I need your help in the video of instagram like, the feed section
@dcontreras_98
@dcontreras_98 7 лет назад
Funny Content I need to create a feed section but without the following and unfollowing option
@magnussinger
@magnussinger 7 лет назад
Hey Vasil, first of all thank you for this great tutorial, it is amazing! But I have one little problem: I have a video backed-up in Firebase, and when I run the app with the simulator, everything runs perfect, but when I try to run the app on my real iPhone, it gives me the following error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to set a slider's minimumValue (0.000000) to be larger than the maximumValue (nan)' I would be very happy if you can help me, thanks!
@VasilNunev
@VasilNunev 7 лет назад
for some reason you are setting up the maximumValue as nan, make sure that the maximum number you are putting in the slider is an actual number with a value. It would be worth debugging it and see why the maximumValue you are setting is nan.
@magnussinger
@magnussinger 7 лет назад
Vasil Nunev have you already tried it on a physically device? Because on the Simulator it works fine so in my opinion the error is only when you use it on your real iDevice
@VasilNunev
@VasilNunev 7 лет назад
+Magnus Singer Hmm, try adding the addTimeObserver() inside the observerValue(forKeyPath) just after you set the text of the duration label. Also don't forget to remove the addTimeObserver from viewDidLoad(). Let me know if this fixes the problem. The reason you want to add it there is because you are sure that you have actually got a value for your video duration and you are not setting a nan value. I have no idea why this works on simulator and not on device though
@magnussinger
@magnussinger 7 лет назад
Vasil Nunev thank you very much!! It works now perfectly!!!👍👍🙏🙏
@VasilNunev
@VasilNunev 7 лет назад
glad to help and I am sorry this didn't work at first.
@QDWorld-SwiftUI
@QDWorld-SwiftUI 3 года назад
I think you don’t respond to comments it’s ok
@talebrafiepour1388
@talebrafiepour1388 5 лет назад
How to play stream video url in AVPlayer??? any body can help me?
@charlesleota7513
@charlesleota7513 5 лет назад
Hey Taleb, you figure this out yet? am searching for the same solution. All iv come across is using VLC to stream it through.
@parveenbanu8582
@parveenbanu8582 3 года назад
Here slider got error app is crash what is happening 🥺
@vishpatel9775
@vishpatel9775 5 лет назад
not working in xcode 10
@needmore7249
@needmore7249 5 лет назад
Guys if anyone have problem with this func 👇🏻 _ = player.addPeriodicTimeObserver(forInterval: interval, queue: mainQueue, using: { [weak self] time in to fix This Problem so easy just add in right place in viewDidLoad() like this 👇🏻 player.currentItem?.addObserver(self, forKeyPath: "duration", options: [.new, .initial], context: nil) addTimeObserver() "add down This 👉🏻 player.currentItem?.addObserver(self, forKeyPath: "duration", options: [.new, .initial], context: nil)"
@hasnatasghar2338
@hasnatasghar2338 2 года назад
😇Project link not working. i am going to press dislike button😒
@omaramil9665
@omaramil9665 5 лет назад
thank you very much
Далее
How To Add Video to App in Swift 5 (Xcode 11)
6:13
Просмотров 28 тыс.
Circular Loading View (Swift 4 & XCode 9)
34:27
Просмотров 4,1 тыс.
Playing Audio + Background Play! (Swift 3 in Xcode)
10:52
Play Local GIFs! (Swift 3 in Xcode)
6:54
Просмотров 31 тыс.
How to Debug using Xcode Debugger
14:30
Просмотров 29 тыс.