Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to I embed YTSwiftyPlayer inside a UIView and make it honor the UIView's bounds? #70

Closed
vittalk opened this issue Apr 13, 2020 · 2 comments

Comments

@vittalk
Copy link

vittalk commented Apr 13, 2020

Hi,
I have a question. How do I embed YTSwiftyPlayer(ie WKWebView) inside a UIView and make it honor the UIView's bounds?
I have tried but it looks like the YTSwiftyPlayer ignores the bounds. Greatly appreciate any help.
Thanks Vittal
(email-dot-vittal-at-gmail-dot-com)

@IBOutlet weak var viewForYTPlayer: UIView!
player = YTSwiftyPlayer(
frame: viewForYTPlayer.bounds,
playerVars: [
.playsInline(true),
.videoID("0GCW7VkojeQ"),
.loopVideo(true),
.showRelatedVideo(false)
])
viewForYTPlayer.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.viewForYTPlayer.addSubview(player)

@hlwanhoj
Copy link

You should set autoresizingMask on player to let it responds to superview's bounds changes

@che1404
Copy link

che1404 commented Jul 3, 2020

Hi @vittalk , I'm trying to do the same. Did you manage to do it?

@rinov rinov closed this as completed May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants