If the user taps the video player, it will show PlayerControlView which will control how the video will be played in OdeumPlayerView. You could also change the icon of the PlayerControlView:
public enum PlayState {
case played
case paused
}
public enum AudioState {
case mute
case unmute
}
public enum ReplayStep {
case fiveSecond
case tenSecond
case thirtySecond
}
public enum ForwardStep {
case fiveSecond
case tenSecond
case thirtySecond
}
public enum FullScreenState {
case fullScreen
case minimize
}
To change the replay step and audio state time interval, you could assign it directly on playerControl:
Odeum
Odeum is a simple iOS Video player library with basic control
Example
To run the example project, clone the repo, and run
pod installfrom the Example directory first.Requirements
Installation
Cocoapods
Odeum is available through CocoaPods. To install it, simply add the following line to your Podfile:
Swift Package Manager from XCode
Swift Package Manager from Package.swift
Add as your target dependency in Package.swift
Use it in your target as
OdeumAuthor
Nayanda Haberty, hainayanda@outlook.com
License
Odeum is available under the MIT license. See the LICENSE file for more info.
Usage
Using Odeum is very easy. You could see the sample project or just read this documentation.
Since odeum player is subclass of
UIView. adding player is same like adding simpleUIView:Is up to you how you want it to be framed, using
NSLayoutConstraintsor by manually framing it.You could also add it using storyboard or XIB. Just use
UIViewand set itsCustomClassto beOdeumPlayerView.To play the player, just add URL:
there are methods to manipulate video playing in odeum:
func set(url: URL)to set url but not automatically play the videofunc play()to play the video if video is ready to playfunc play(url: URL)to set url and automatically play it if video is readyfunc pause()to pause the videofunc set(mute: Bool)to mute or unmute the videofunc forward(by second: TimeInterval) -> Boolto forward a video by givenTimeIntervalfunc replay(by second: TimeInterval) -> Boolto rewind a video by givenTimeIntervalfunc goFullScreen()to go to full screenfunc dismissFullScreen()to dismiss full screenfunc removeVideo()to stop and remove video from video playerAll those functions will run automatically on the player control hover buttons
Delegate
You could observe event and control tap behavior in the OdeumPlayerView by give them delegate:
All the methods are optional
PlayerControl
If the user taps the video player, it will show
PlayerControlViewwhich will control how the video will be played inOdeumPlayerView. You could also change the icon of thePlayerControlView:the states are:
To change the replay step and audio state time interval, you could assign it directly on
playerControl:Contribute
You know how, just clone and do pull request