I'm trying to add a UITapGestureRecognizer
(doubleTap) to a JWPlayerController
in my app.
Currently, when you double tap a video (JWPlayer) right now it launches by default in full screen mode. The desired behavior is for this gesture to be tied to a different event (liking, à la Most), and for users who want the video fullscreen can use the fullscreen-expansion button instead.
In the SDK it appears that you're only able to alter the Boolean isInFullScreen
and that disabling the double-tap-to-fullscreen function is not feasible. Is this true?
Here's is the gesture that I'm trying to attach to the player
where currently it's attached to mediaHeaderView
.
private extension Selector {
static let doubleWasTapped = #selector(MediaViewController.doubleWasTapped(_:))
}
final class MediaViewController: UITableViewController {
@IBOutlet weak var webView: UIWebView!
@IBOutlet weak var mediaHeaderView: UIView!
weak var mediaPageDelegate: MediaPageDelegate?
var viewModel: MediaTableViewModel!
private var player: JWPlayerController?
// etc
addDoubleTapGesture()
}
func doubleWasTapped(gesture: UITapGestureRecognizer) {
viewModel.toggleLikeProducer.start()
}
func addDoubleTapGesture() {
let doubleTappedGR = UITapGestureRecognizer(target: self, action: #selector(doubleWasTapped))
doubleTappedGR.numberOfTapsRequired = 2
doubleTappedGR.delaysTouchesBegan = true
mediaHeaderView!.addGestureRecognizer(doubleTappedGR)
}
Thanks in advance!
I spoke with the jwplayer team recently. Looking at the code you see that isInFullScreen
is a readonly property (looking at the name it makes sense). The only current and not so nice fix they provide is to disable the controls over the config file (config.controls
). I you set this to false the double tap to fullscreen is not working anymore. Also there is this post on their website: https://support.jwplayer.com/customer/portal/questions/8123742-disable-fullscreen