AndrewBoryk / ABMediaView

Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.
MIT License
82 stars 9 forks source link

Question #1

Closed iceman201 closed 7 years ago

iceman201 commented 7 years ago

how to detect if the video play when it's end? didnt see any delegate on there

AndrewBoryk commented 7 years ago

Currently, there are delegate methods for pause and play. Delegate for when the video ends/loops would be good to have. I've been wanting to put an update to this project. Currently I was working on converting this to Swift.

What else would be desirable in the delegate (for the Objective-C project)?

iceman201 commented 7 years ago
    func mediaViewWillPresent(_ mediaView: ABMediaView!) {
        NotificationCenter.default.addObserver(self, selector: #selector(self.didPlayToEnd), name: .AVPlayerItemDidPlayToEndTime, object: nil)
    }

    func didPlayToEnd() {
        print("hahaha")
    }

Actually, I just figure out how to make it work. Since your ABPlayer is AVplayer, so it could just create an observe listener the AVplayer status. lol

I think your delegate has already cover quite large range usages. Awesome framework man

iceman201 commented 7 years ago

would be nice if it has something like "dismiss full screen after play til end of the video"?

AndrewBoryk commented 7 years ago

I committed an updated to dev - (void)mediaViewDidFinishVideo:(ABMediaView *)mediaView withLoop:(BOOL)didLoop;

And thanks for the compliment! This started as just a project to play around with the minimization idea, and I figured I could keep building on it. Still a lot that I want to do, I just got settled into a new job, so I plan on getting back to adding features to this.

To clarify on the feature you just proposed, you mean something like "dismissAfterVideoCompletion" and then after a video completes playing, the view will automatically close?

iceman201 commented 7 years ago

yes like that, Congratulation for your new job btw lol

iceman201 commented 7 years ago

is there anyway could dismiss that fullscreen manually???

AndrewBoryk commented 7 years ago

Yes^ By calling

[mediaView dismissMediaViewAnimated:YES withCompletion:^(BOOL completed) {
    // Executes after mediaView finishes dismissing itself
}];

Please refer to the "Calling the Manager" section of the Documentation

iceman201 commented 7 years ago

hm..... if i just do mediaView.sharedManager() it will return me error.

if i do ABMediaView.sharedManager() it gives me this image

AndrewBoryk commented 7 years ago

The function I just sent you is called on the mediaView itself, not on the shared manager. I've been thinking about moving that function in the docs, and adding a section for Presentation and Dismissal

iceman201 commented 7 years ago

even i use this postVideo.dismiss(animated: true, withCompletion: nil) still doesnt dismiss when its playing in fullscreen.

AndrewBoryk commented 7 years ago

Hmm I will look at this tomorrow, and I'll get a new version out to you with a few updates. Is that cool?

iceman201 commented 7 years ago

Cool awesome.

Thanks in advance

On 29/06/2017, at 1:08 PM, Andrew Boryk notifications@github.com<mailto:notifications@github.com> wrote:

Hmm I will look at this tomorrow, and I'll get a new version out to you with a few updates. Is that cool?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/AndrewBoryk/ABMediaView/issues/1#issuecomment-311833893, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEy4dRs2mtgeg8XK51Cy2xbXmYMjTT6Jks5sIvkSgaJpZM4OGWap.