rinov/YoutubeKit

Play video IN A SMALL WINDOW, inline, - not Fullscreen

smhk opened this issue · 1 comments

smhk commented

I have the video in a small view like this:

windowed

as soon as I click Play, the video expands to full-screen on the iPhone.

How to actually play the video small, inside my view??

smhk commented

Here's the solution!

Fullscreen player...

As soon as the user clicks Play, the player will take over the iPhone screen ...

@IBOutlet var holder: UIView!
private var player: YTSwiftyPlayer!
override func viewDidLoad() {
	super.viewDidLoad()
	player = YTSwiftyPlayer(
		frame: CGRect(x: 0, y: 0, width: 320, height: 240),
		playerVars: [
			.videoID("buzsasTfC4s")
	])
	holder.addSubview(player)
       ....

Inline, windowed, player...

As soon as the user clicks Play, the player remains in the view you have it in:

@IBOutlet var holder: UIView!
private var player: YTSwiftyPlayer!
override func viewDidLoad() {
	super.viewDidLoad()
	player = YTSwiftyPlayer(
		frame: CGRect(x: 0, y: 0, width: 320, height: 240),
		playerVars: [
			.videoID("buzsasTfC4s"),
			.playsInline(true)
	])
	holder.addSubview(player)
       ....

What a great library!