# iOS Player SDK

&#x20;[![Swift](https://camo.githubusercontent.com/066a529725eadc4f422543c3500d924fe5dfc6e1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f253230696e2d7377696674253230352e302d6f72616e67652e737667)](https://camo.githubusercontent.com/066a529725eadc4f422543c3500d924fe5dfc6e1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f253230696e2d7377696674253230352e302d6f72616e67652e737667)

UZPlayer is a framework allows you to play video with fully customizable controls.

Link to the Source code here: <https://github.com/uizaio/snake.sdk.ios-player>

## Compatibility

UZPlayer requires Swift 4.2+ and iOS 9+

## Installation

### CocoaPods

To integrate UZPlayer into your Xcode project using [CocoaPods](http://cocoapods.org/), specify it in your `Podfile`:

Then run the following command:

## Usage

```
let playerViewController = UZPlayerViewController()		
playerViewController.player.controlView.theme = UZTheme1()
playerViewController.player.loadVideo(url: VIDEO_URL)
present(playerViewController, animated: true, completion: nil)
```

You might have to add these lines to `Info.plist` to disable App Transport Security (ATS) to be able to play video:

```
<key>NSAppTransportSecurity</key>  
<dict>  
  <key>NSAllowsArbitraryLoads</key><true/>  
</dict>
```

## Change Player Themes

```
let playerViewController = UZPlayerViewController()
playerViewController.player.controlView.theme = UZTheme1()
```

UizaPlayer currently has 7 built-in themes:

[UZTheme1](https://github.com/uizaio/uiza-ios-player-sdk/blob/master/themes/theme1.jpg)

[UZTheme2](https://github.com/uizaio/uiza-ios-player-sdk/blob/master/themes/theme2.jpg)

[UZTheme3](https://github.com/uizaio/uiza-ios-player-sdk/blob/master/themes/theme3.jpg)

[UZTheme4](https://github.com/uizaio/uiza-ios-player-sdk/blob/master/themes/theme4.jpg)

[UZTheme5](https://github.com/uizaio/uiza-ios-player-sdk/blob/master/themes/theme5.jpg)

[UZTheme6](https://github.com/uizaio/uiza-ios-player-sdk/blob/master/themes/theme6.jpg)

[UZTheme7](https://github.com/uizaio/uiza-ios-player-sdk/blob/master/themes/theme7.jpg)

## Create CustomTheme

You can create your own custom theme by creating a class inheriting from [UZPlayerTheme Protocol](https://uizaio.github.io/uiza-sdk-player-ios/Protocols/UZPlayerTheme.html) following this template: [UZCustomTheme](https://github.com/uizaio/uiza-sdk-player-ios/blob/master/themes/UZCustomTheme.swift)

You can also create your custom end screen by subclassing `UZEndscreenView`, then set an instance to `player.controlView.endscreenView`

```
self.playerViewController.player.controlView.endscreenView = MyCustomEndScreen()
```

## Create Player with Floating Mode

You can create player with "drag down to floating mode" like Facebook or Youtube, by subclassing [UZFloatingPlayerViewController](https://uizaio.github.io/uiza-sdk-player-ios/Classes/UZFloatingPlayerViewController.html), then you can add more UI for displaying video details and add them to `detailsContainerView`

Then present using this code:

```
UZFloatingPlayerViewController().present(with: videoItem, playlist: playlist)
```

See [Example](https://github.com/uizaio/uiza-ios-player-sdk/blob/master/UZPlayerExample)

For API details, check [API Document](https://uizaio.github.io/uiza-ios-player-sdk/)

## Google ChromeCast supports

If developing using Xcode 10 and targeting iOS devices running iOS 12 or higher, the "Access WiFi Information" capability is required in order to discover and connect to Cast devices [![](https://camo.githubusercontent.com/2afb576154d43dfaa77113c9c6ed95a82a4aeea7/68747470733a2f2f646576656c6f706572732e676f6f676c652e636f6d2f636173742f696d616765732f78636f64655f776966695f6361706162696c6974795f6572726f722e706e67)](https://camo.githubusercontent.com/2afb576154d43dfaa77113c9c6ed95a82a4aeea7/68747470733a2f2f646576656c6f706572732e676f6f676c652e636f6d2f636173742f696d616765732f78636f64655f776966695f6361706162696c6974795f6572726f722e706e67)

## Support

<namnh@uiza.io>

## License

UZPlayer is released under the BSD license. See [LICENSE](https://github.com/uizaio/uiza-sdk-player-ios/blob/master/LICENSE) for details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uiza.io/2021-09-21/sdk-reference/ios-sdk/ios-player-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
