iOS video player for trailer. You can customize layout for the control panel. Support PiP and DRM.

Related tags

Video TrailerPlayer
Overview

Trailer Player

iOS video player for trailer. You can customize layout for the control panel. Support PiP and DRM.

custom_control_panel.mov

Icons by Icons8 (https://icons8.com)

Releases

v1.3.5

  • Fixed some known bugs

v1.3.3

  • Fix an incorrect layout issue

v1.3.2

  • Update access control

v1.3.1

  • Code refactoring

v1.3.0

  • Support DRM (FairPlay)

v1.2.1

  • Code refactoring

v1.2.0

  • Support control panel
  • Support replay panel
  • Fixed some known bugs

v1.1.0

  • Support PIP
  • Fixed some known bugs

v1.0.0

  • 沒有 trailer 的 content,單純顯示 thumbnail。
  • 有 trailer 的 content,可以自動播放 trailer,且在播放途中可以隨時暫停播放。
  • Preview 功能不會有倍速播放,但是 progress bar 必須要有,且用戶可以自由調整 progress bar 觀看在不同秒數的內容。
  • Preview 功能不允許用 AirPlay 投到輸出設備上。
  • Preview 功能的聲音部份,預設是 off,但用戶可以點選音量按鈕,以打開聲音。
  • 對於同時有 thumbnail 與 trailer 的 content,會先顯示 thumbnail,此時背景會持續 loading trailer。直到 trailer loading 完成、ready to play 的時候,即顯示 trailer 並自動播放,此時縮圖會被隱藏起來。
  • Preview 功能可以全螢幕播放。
  • Trailer 的顯示 size 會跟 thumbnail 完全一致。
  • 當 trailer 播放完畢之後,播放畫面會停止,且正中間會有一個 Replay 按鈕,用戶可以選點此按鈕以重播此 trailer。
  • 可以提供 trailer 的倒數秒數,並會隨著播放而逐漸減少秒數。
  • 不可背景播放。
  • 從背景回到前景時,要繼續播放。
  • 當影片 Buffering 的時候要秀 loading。
  • trailer 顯示時,要隱藏 thumbnail image。
  • 不可在 Remote Control Center 裡顯示資訊。
  • Preview 播完後回到 thumbnail。
  • 如果用戶的網路,從連網 => 斷網 => 再連網的時候,trailer 會接續播放。
  • Support iOS 10~15
  • Support SPM

How to use

建立 TrailerPlayerView

let playerView = TrailerPlayerView()
let item = TrailerPlayerItem(
            url: URL(string: "..."),
            thumbnailUrl: URL(string: "..."))
playerView.playbackDelegate = self
playerView.set(item: item)

TrailerPlayerItem 細節設定

required public init(url: URL? = nil,                // trailer url
                     thumbnailUrl: URL? = nil,       // thumbnail url
                     thumbnailImage: UIImage? = nil, // 若已有 thumbnail 圖片時,可直接提供 
                     autoPlay: Bool = true,          // 自動播放,否則自行呼叫 play()
                     autoReplay: Bool = false,       // 播放完畢後,是否自動重新播放
                     mute: Bool = true,              // 預設播放為靜音
                     isDRMContent: Bool = false)     // 是否為 DRM 內容

TrailerPlayerPlaybackDelegate

// 當 player 播放時,可透過此 callback 更新播放時間
func trailerPlayer(_ player: TrailerPlayer, didUpdatePlaybackTime time: TimeInterval)
// 當 player 狀態改變時,可透過此 callback 更新控制面板上的播放狀態
func trailerPlayer(_ player: TrailerPlayer, didChangePlaybackStatus status: TrailerPlayerPlaybackStatus)
// 當 player item 狀態變為 readyToPlay 時觸發
func trailerPlayerPlaybackReady(_ player: TrailerPlayer)
// 當 player 播放發生錯誤時觸發
func trailerPlayer(_ player: TrailerPlayer, playbackDidFailed error: TrailerPlayerPlaybackError)

[Optional] PiP 支援

playerView.enablePictureInPicture = true

[Optional] 設置面板

let controlPanel: UIView = ... // your custom control panel
playerView.addControlPanel(controlPanel)

let replayPanel: UIView = ... // your custom replay panel
playerView.addReplayPanel(replayPanel)

[Optional] DRM 支援

URL { return URL(string: ...) // your certificate url } func ckcUrl(for player: TrailerPlayer) -> URL { return URL(string: ...) // your ckc url } } ">
let playerView = TrailerPlayerView()
let item = TrailerPlayerItem(
            url: URL(string: "..."),
            thumbnailUrl: URL(string: "..."),
            isDRMContent: true)
playerView.playbackDelegate = self
playerView.DRMDelegate = self
playerView.set(item: item)

// DRM Delegate
extension ViewController: TrailerPlayerDRMDelegate {
    
    func certUrl(for player: TrailerPlayer) -> URL {
        return URL(string: ...) // your certificate url
    }
    
    func ckcUrl(for player: TrailerPlayer) -> URL {
        return URL(string: ...) // your ckc url
    }
}

TrailerPlayerDRMDelegate

// CKC(Content Key Context) URL
func ckcUrl(for player: TrailerPlayer) -> URL
// Certificate URL
func certUrl(for player: TrailerPlayer) -> URL
// Optional: content Id for SPC(Server Playback Context) message
func contentId(for player: TrailerPlayer) -> String?
// Optional: HTTP header fields for CKC request
func ckcRequestHeaderFields(for player: TrailerPlayer) -> [(headerField: String, value: String)]?

操作細節可參考 Sample code

You might also like...
WatchTube: a standalone WatchOS youtube player utilizing Download API for search data and video streaming
WatchTube: a standalone WatchOS youtube player utilizing Download API for search data and video streaming

WatchTube is a standalone WatchOS youtube player utilizing Download API for sear

Swifty360Player - iOS 360-degree video player streaming from an AVPlayer.
Swifty360Player - iOS 360-degree video player streaming from an AVPlayer.

Swifty360Player iOS 360-degree video player streaming from an AVPlayer. Demo Requirements Swifty360Player Version Minimum iOS Target Swift Version 0.2

 VGPlayer - 📺  A simple iOS video player by Vein.
VGPlayer - 📺 A simple iOS video player by Vein.

Swift developed based on AVPlayer iOS player,support horizontal gestures Fast forward, pause, vertical gestures Support brightness and volume adjustment, support full screen, adaptive screen rotation direction.

Open Source iOS 360 Degree Panorama Video Player.
Open Source iOS 360 Degree Panorama Video Player.

🎺 🎺 🎺 🎺 🎺 🎺 🎺 🎺 🎺 🎺 🎺 The Metal with Swift 5.0 version is comming 🎺 🎺 🎺 🎺 🎺 🎺 🎺 🎺 🎺 🎺 🎺 360 VR Player A Open Source, Ad-free, Na

FWVideoPlayer is video Player for iOS in Swift.

FWVideoPlayer Desc FWVideoPlayer is video Player for iOS in Swift. It can play video and audio. You can use it easy. Example To run the example projec

360 video player for iOS written in swift - a subset of SceneKit that works
360 video player for iOS written in swift - a subset of SceneKit that works

DDDKit An open source library to support 360 videos and pictures. It's designed as a generic 3D library that you can use for much more! Example of use

Overlay alpha channel video animation player view using Metal.
Overlay alpha channel video animation player view using Metal.

Overlay alpha channel video animation player view using Metal. Example To run the example project, clone the repo, and run pod install from the Exampl

SuperVideoPlayer is video player in Objc.

SuperVideoPlayer Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation S

IINA is the modern video player for macOS.
IINA is the modern video player for macOS.

IINA IINA is the modern video player for macOS. Website · Releases · Telegram Group Features Based on mpv, which provides the best decoding capacity o

Comments
  • Autoplay issue

    Autoplay issue

    Hi, If the autoplay=false; activity indicator spins forever. It displays the pause icon. But it must show the play icon and thumbnail image. It shows the thumbnail at first, but It shows blank screen after it.

            let item = TrailerPlayerItem(
                url: URL(string: "https://multiplatform-f.akamaihd.net/i/multi/will/bunny/big_buck_bunny_,640x360_400,640x360_700,640x360_1000,950x540_1500,.f4v.csmil/master.m3u8"),
                thumbnailUrl: URL(string: "https://upload.cc/i1/2021/10/04/qGNK3M.png"),
                autoPlay: false)
    
    

    You can check it in your example code.

    Can you fix please?

    bug 
    opened by uzman 1
  • fix: Fix iOS 10 AVPlayerItem dealloc crash.

    fix: Fix iOS 10 AVPlayerItem dealloc crash.

    Fix crash in iOS 10 with error message:

    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x1700146c0 of class AVPlayerItem was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x170038540> (
    <NSKeyValueObservance 0x174852f00: Observer: 0x1708454c0, Key path: status, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x170857100>
    )'
    *** First throw call stack:
    (0x185036fe0 0x183a98538 0x185036f28 0x185a93160 0x18ca03e20 0x183f43a68 0x105ddda10 0x105de2b78 0x184fe50c8 0x184fe2ce4 0x184f12da4 0x18697d074 0x18b1cdc9c 0x1001034dc 0x183f2159c)
    libc++abi.dylib: terminating with uncaught exception of type NSException```
    bug 
    opened by davidwangXD 0
Releases(1.4.8)
Owner
Abe Wang
Abe Wang
Support customization of any player SDK and control layer

Support customization of any player SDK and control layer

紫枫 6.9k Dec 30, 2022
BMPlayer - A video player for iOS, based on AVPlayer, support the horizontal, vertical screen

A video player for iOS, based on AVPlayer, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles.

Eliyar Eziz 1.8k Jan 4, 2023
JDVideoKit - You can easily transfer your video into Three common video type.

JDVideoKit Introduction You can easily transfer your video into Three common video type. You can use set up camera easily. Installation pod 'JDVideoK

郭介騵 24 Sep 9, 2021
Musical Player - A Simple Musical Player For iOS

Musical_Player The app is a musical player. It was written as an task for a mobi

null 1 Nov 26, 2022
Yattee: video player for Invidious and Piped built for iOS 15, tvOS 15 and macOS Monterey

Video player with support for Invidious and Piped instances built for iOS 15, tvOS 15 and macOS Monterey.

Yattee 1k Dec 27, 2022
Yattee: video player for Invidious and Piped built for iOS, tvOS and macOS

Video player for Invidious and Piped instances built for iOS, tvOS and macOS. Features Native user interface built with SwiftUI Multiple instances and

Yattee 1.1k Jan 8, 2023
▶️ video player in Swift, simple way to play and stream media on iOS/tvOS

Player Player is a simple iOS video player library written in Swift. Looking for an obj-c video player? Check out PBJVideoPlayer (obj-c). Looking for

patrick piemonte 2k Jan 2, 2023
YouTube video player for iOS, tvOS and macOS

About XCDYouTubeKit is a YouTube video player for iOS, tvOS and macOS. Are you enjoying XCDYouTubeKit? You can say thank you with a tweet. I am also a

Cédric Luthi 2.9k Jan 7, 2023
Versatile Video Player implementation for iOS, macOS, and tvOS

News ?? - Since 2.1.3 VersaPlayer now supports iOS, macOS, and tvOS Example Installation Usage Basic Usage Adding Controls Advanced Usage Encrypted Co

Jose Quintero 723 Dec 26, 2022
YoutubeKit is a video player that fully supports Youtube IFrame API and YoutubeDataAPI for easily create a Youtube app

YoutubeKit YoutubeKit is a video player that fully supports Youtube IFrame API and YoutubeDataAPI to easily create Youtube applications. Important Ref

Ryo Ishikawa 555 Dec 28, 2022