fokswang / fwplayer Goto Github PK
View Code? Open in Web Editor NEWA video player SDK for iOS, it is based on AVPlayer. https://se.linkedin.com/in/foks-huiwang, https://www.fokswang.com/
License: MIT License
A video player SDK for iOS, it is based on AVPlayer. https://se.linkedin.com/in/foks-huiwang, https://www.fokswang.com/
License: MIT License
@FoksWang
After adding the image view as a container view in the player controller. It's not showing the placeholder image just showing the black color when the video is stopped.
self.player = FWPlayerController(playerManager: playerManager, containerView: self.videoImgVw)
How to use this
Supports direct jump to a point in the timeline to play
i applied seek time but it is taking time re playing video. it is showing black screen more time then after playing
Error : Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://stream.SERVERDOMAIN.com/media/08d73fe3-3f8a-4c4d-b168-38f4ea6990bf/83364e09-184b-436f-b9d3-fddb0ac15335/2022-10-12-07-55-51.mp4, NSErrorFailingURLKey=https://SERVERDOMAIN.com/media/08d73fe3-3f8a-4c4d-b168-38f4ea6990bf/83364e09-184b-436f-b9d3-fddb0ac15335/2022-10-12-07-55-51.mp4
Please Note-
How can i disable gesture swipe fast-forward and rewind?
i do not want full screen feature in app so how can i hide this button...
documentation don’t have any description about hiding this button
There is some lags in iPhone 8 (iOS 14.2) when a video plays for the first time. I think you should set the 'automaticallyWaitsToMinimizeStalling' if it is not. The caching process is helping me so much so if you help me on this issue too that would be wonderful.
import UIKit
import FWPlayerCore
class ViewController: UIViewController {
private var player: FWPlayerController?
let playerManager = FWAVPlayerManager()
@IBOutlet weak var containerView:UIImageView!
//@IBOutlet weak var containerView:UIImageView!
@IBOutlet weak var controlView: FWPlayerControlView!
override func viewDidLoad() {
super.viewDidLoad()
controlView.fastViewAnimated = true
controlView.autoHiddenTimeInterval = 5.0
controlView.autoFadeTimeInterval = 0.5
controlView.prepareShowLoading = true
controlView.prepareShowControlView = true
playerManager.isEnableMediaCache = false
}
@IBAction func button(_ sender: Any) {
// Setup player
self.player = FWPlayerController(playerManager: playerManager, containerView: self.containerView)
self.player?.controlView = self.controlView
// Setup continue playing in the background
self.player?.pauseWhenAppResignActive = true
self.player?.orientationWillChange = { [weak self] (player, isFullScreen) in
self?.setNeedsStatusBarAppearanceUpdate()
}
// Finished playing
self.player?.playerDidToEnd = { [weak self] (asset) in
guard let strongSelf = self else {
return
}
strongSelf.player?.currentPlayerManager.replay!()
strongSelf.player?.playTheNext()
if strongSelf.player?.isLastAssetURL == false {
strongSelf.controlView.showTitle("Video Title", coverURLString: nil, fullScreenMode: .landscape)
} else {
strongSelf.player?.stop()
}
}
var urls = [URL]()
guard let url = URL(string: "https://www.radiantmediaplayer.com/media/big-buck-bunny-360p.mp4") else { return }
urls.append(url)
print(urls)
self.player?.assetURLs = urls
}
}
lovely player but i coudn't use it as well. will you help me ?
I am looking to disable the volume pan option & disable the brightness pan. I would also like the option to allow one or the other or maybe disable for portrait / landscape mode.
Thanks.
@FoksWang After changing the playback speed rate How we can get that video local path?
when video play in landscape mode by default but UIInterfaceOrientation show in portrait mode. so how can i both change like youtube player.
I want to trigger action when user tap on view fullscreen. can anyone tell how to do that.
Thank.
Can stop the player from another controller?
because when I use PlayerOverlayVideoVC.shared.playerManager.isPlaying its always return nil.
@FoksWang
first of all Thank you for this library
after I have installed the FWPlayer from pod {pod 'FWPlayer', '~> 1.0.13'}
the status-bar become white always ,
how can I stop the library from control for status bar color because I have two theme (two mode) on my app (dark and light mode) ,
before install FWPlayer everything's fine , but after install it I have this issue
Before , After
how can i change orientation programatically before i start video play
tried changing this
controlView.showTitle("Video title 1", coverURLString: kVideoCover, fullScreenMode: OrientationShouldChange ? .portrait : .landscape)
but doesn't seems to work
control view doesn't comes up when we tap on video
this issue is specific to ios 16 earlier versions are working fine
Hi,
I have a couple of questions, with regards to configuring the player control view with custom icon, color, etc..
a) Currently the player control displays the download information like - 40Kb/s - Is there any way to disable that?
b) How to show a volume button on player control (without opening full screen)?
c) How can I change the player slider color & custom icon for full-screen?
Thanks.
Hello Mr. Wang,
I really like the sdk you created. Well done!
I wanted to include into my project but I have issues making the player visible.
Here is my code:
class UserChallengeInformationViewController: UIViewController {
...
public var player:FWPlayerController?
private lazy var controlView: FWPlayerControlView = {
let view = FWPlayerControlView()
view.fastViewAnimated = true
view.autoHiddenTimeInterval = 5.0
view.autoFadeTimeInterval = 0.5
view.prepareShowLoading = true
view.prepareShowControlView = true
return view
}()
func setupView() {
...
challengeInfoTableView.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(challengeInfoTableView)
challengeInfoTableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor).isActive = true
challengeInfoTableView.widthAnchor.constraint(equalToConstant: width).isActive = true
challengeInfoTableView.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true
challengeInfoTableView.bottomAnchor.constraint(equalTo: self.cancelButton.topAnchor).isActive = true
challengeInfoTableView.delegate = self
challengeInfoTableView.dataSource = self
challengeInfoTableView.register(ChallengeInfoTimeTableViewCell.self, forCellReuseIdentifier: "timeCell")
challengeInfoTableView.register(ChallengeTitleAndDescriptionTableViewCell.self, forCellReuseIdentifier: "titleCell")
challengeInfoTableView.register(ChallengeInfoUserTableViewCell.self, forCellReuseIdentifier: "userProfileCell")
challengeInfoTableView.register(ChallengeInfoImageTableViewCell.self, forCellReuseIdentifier: "challengeImageCell")
challengeInfoTableView.separatorStyle = .none
}
private func setupVideoPlayer() {
let playerManager = FWAVPlayerManager()
playerManager.isEnableMediaCache = false
self.player = FWPlayerController(scrollView: self.challengeInfoTableView, playerManager: playerManager, containerViewTag: 100)
self.player?.controlView = self.controlView
// Setup continue playing in the background
self.player?.pauseWhenAppResignActive = true
self.player?.forceDeviceOrientation = true
self.player?.disableGestureTypes = .pan
self.player?.orientationWillChange = { [unowned self] (player, isFullScreen) in
self.setNeedsStatusBarAppearanceUpdate()
UIViewController.attemptRotationToDeviceOrientation()
self.challengeInfoTableView.scrollsToTop = !isFullScreen
}
// Finished playing
self.player?.playerDidToEnd = { [weak self] (asset) in
guard let strongSelf = self else {
return
}
strongSelf.player?.currentPlayerManager.replay!()
}
}
}
My customized **_ChallengeInfoImageTableViewCell_** looks like :
class ChallengeInfoImageTableViewCell: UITableViewCell {
...
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
initChallengeImageView()
}
private func initChallengeImageView() {
challengeImageView = UIImageView()
challengeImageView!.translatesAutoresizingMaskIntoConstraints = false
addSubview(challengeImageView!)
challengeImageView!.leadingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true
challengeImageView!.trailingAnchor.constraint(equalTo: self.trailingAnchor).isActive = true
challengeImageView!.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
challengeImageView!.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
challengeImageView!.contentMode = .scaleAspectFill
challengeImageView!.clipsToBounds = true
challengeImageView!.isUserInteractionEnabled = true
challengeImageView?.tag = 100 // SAME TAG AS IN THE VIEW CONTROLLER
}
When playing the video, I can hear the sound, but I can't see anything. Nothing pops up.
Do you have an idea why? Thanks in advance!
Hi there, am trying to use your FWPlayer framework on jailbroken arm64e device so can you please add support to arm64e?
also can you please update README with more info for Objective-C usage as I don't know Swift language and there is a lot going on in Swift usage that is missing in Objective-C usage which I would appreciate it if you update README with more Objective-C usage info
Thank you very much
HI,
Great library for video playing.
I have a question regarding setting the assetUrl in FWPlayerController
.
Is there a way to add custom header in the asset url?
For example: In Avplayer
we can add AVURLAssetHTTPHeaderFieldsKey
using AVURLAsset
.
let url = URL(string: "url")
let asset = AVURLAsset(url: url!, options: ["AVURLAssetHTTPHeaderFieldsKey" : [ "Cookie" : "tx=\(some_value)" ] ])
let PlayerItem = AVPlayerItem(asset: asset)
let player = AVPlayer(playerItem: PlayerItem)
I've implemented with the example code in document. Enable Background Mode (for Audio, AirPlay & PIP). But player pause when I go to device home screen.
How can I achieve this feature?
Pre-loading is a common use case these days because users expect videos to load instantly in scroll views.
API Details:
Let me know if you need help implementing these. Should be relatively straightforward.
Although I marked customAudioSesson = true, the library is still configuring the shared audio session. This is messing with the audio session and bugging other parts of my app. Why is this occurring?
Separate topic: why is the source code all executable? How can I change parts of the library?
Thanks @FoksWang for amazing video player, good job!
How can is add a subview to player? I need to have a watermark in fullscreen mode.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.