I'm trying to figure out if it's possible to play an m4v file in the background with buttons that overlay ontop of the video? The video is basically an animation (no sound) but I need to be able to add additional navigation on top of the animation to bring in other calls in the app.
Is that possible to do? If so what is the call that would be required? I've tried hunting around but can't find an answer yet
You can use MPMoviePlayerController, set control style to none, and put your own buttons on top of it.
http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/Reference/Reference.html
Related
I am integrating youtube player via cocoapods. I am using storyboard, problem is while loading video, youtube player shows blank white space it gives very ugly look to my complete UI. How can I show some sort of loader while it is loading.
I have also tried to use activity indicator behind the player but I guess player view itself has white color which hides my indicator. Also, I tried to use indicator on the player but it kept on showing even if video got load.
And I didn't find any possible solution in delegate by which I can find that weather the video loads or not?
Any possible solution Please????? Thanks in advance.
You can take an imageview on top of your player and set the background to black and in player delegate when player state become ready , set the image background color to clear.
Hope this will work, this works for me.
Is there any way to hide only Next and Previous buttons in AVPlayer while playing a video
You can only either hide them all or show them all via the AVPlayerViewController showsPlaybackControls property, so what I would recommend doing is using an open source or third party library or framework that controls AVPlayer for you.
Such as what's suggested by this related question, which ultimately points to this GitHub project. You can then remove or hide the controls you don't want to be visible.
Alternatively, you could create your own controls that call into, and control, AVPlayer.
=> you can get notification when ply or pause and stop
when you got notification of play at that time you can hide both next and preivios button
Anyone know how to add the auto playing video background in iOS? I am guessing its actually images? But the video lasts for 15 seconds so if its images then at 24fps minimum that is a lot of images.
I tried using the UIImageView swapping of images, but it seems like a hack way to do this.
See Uber's app and I think Airbnb has it also.
You can make them images as you guessed, or play video using either MPMoviePlayerController or AvPlayer. Just add any as a subview to your view and make it play at viewWillAppear. I used AvPlayer as the app home screen background before and it worked perfectly.
I have to make an animated infographic in iOS. Its consists of about 140 images all 900x700 large. Whats the best approach to do this? I tried CALayerwith indivual images, and also a spritesheet. But it just takes way too long to load and the playback is awful. I also have the animation in a video file, but it needs to be added to a view in a set frame and not be played in full screen.
Try and play the animation video using MPMoviePlayerController. You can play it in a view with custom frame. You can refer the link for sample code too.
I have a video in my iPad app, but I dont want it to be able to go to fullscreen. However I do potentially want the user to be able to navigate to the part of the video that they want to see.
As far as I can tell there are only three options for the controls that you give the user:
None, Embedded, or Fullscreen.
None gives the user no control.
Embedded and Fullscreen basically give the use the same amount of control but just start in different states.
Basically what I want is Embedded with the switch to Fullscreen option taken out.
Anybody know if its possible? Thanks
You can set the controls style to "None", and then add your own custom view to navigate using a UISlider (I've done this in the past).
MPMoviePlayerController adheres to the MPMediaPlayback protocol, so you take the total playback time of the movie, multiply it by the UISlider value (when it changes), and then adjust the movie's playback head position.
You'll also need an NSTimer or KVO to monitor the playback time so it can update the slider UI element in realtime.