Skip to content

Commit cc2820c

Browse files
authored
Update README with new player features
Added documentation for Picture-in-Picture, full-screen functionality, and seek bar thumbnail preview features in FastPix Player.
1 parent 1989c24 commit cc2820c

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,94 @@ private func isLandscapeMode() -> Bool {
520520
}
521521
```
522522

523+
### Picture-in-Picture (PiP):
524+
525+
FastPix Player supports system Picture-in-Picture (PiP) on iOS 14+, allowing playback to continue when the app goes to background.
526+
527+
#### Enable PiP:
528+
```swift
529+
playerViewController.enablePiP = true
530+
playerViewController.setupPiP(parent: self)
531+
```
532+
533+
#### Start / Stop PiP:
534+
```swift
535+
playerViewController.togglePiP()
536+
```
537+
538+
#### Handle PiP active state :
539+
```swift
540+
if playerViewController.isPiPActive() {
541+
return
542+
}
543+
```
544+
545+
#### Observe PiP state changes :
546+
```swift
547+
FastPixPiPStateChangedNotification
548+
FastPixPiPAvailabilityChangedNotification
549+
```
550+
551+
##### Note:
552+
553+
- Call setupPiP(parent:) after the view appears
554+
- Do not release the player while PiP is active
555+
556+
### Full-Screen Functionality:
557+
558+
FastPix provides a built-in full-screen manager for smooth inline full-screen transitions.
559+
560+
#### Setup Full-Screen :
561+
```swift
562+
playerViewController.setupFullscreen(
563+
parent: self,
564+
container: playerView
565+
)
566+
```
567+
568+
#### Toggle Full-Screen :
569+
```swift
570+
playerViewController.toggleFullscreen()
571+
```
572+
573+
#### Full-Screen State Updates:
574+
```swift
575+
Notification.Name("FastPixFullscreenStateChangedNotification")
576+
```
577+
578+
### Seek Bar Thumbnail Preview (Spritesheet):
579+
580+
FastPix supports spritesheet-based thumbnail previews while scrubbing the seek bar.
581+
582+
#### Enable Spritesheet Preview :
583+
```swift
584+
let previewConfig = FastPixSeekPreviewConfig()
585+
586+
playerViewController.loadSpritesheet(
587+
url: nil,
588+
previewEnable: true,
589+
config: previewConfig
590+
)
591+
592+
playerViewController.setFallbackMode(.timestamp)
593+
```
594+
595+
#### Get Preview During Scrubbing :
596+
```swift
597+
let result = playerViewController.fastpixThumbnailForPreview(at: time)
598+
599+
seekBar.updatePreviewThumbnail(
600+
result.image,
601+
time: time,
602+
useTimestamp: result.useTimestamp
603+
)
604+
```
605+
606+
##### Note :
607+
608+
- Automatically falls back to timestamp if thumbnail is unavailable
609+
- Works with playlists and custom seek bars
610+
523611
#### Each of these features is designed to enhance both flexibility and user experience, providing complete control over video playback, appearance, and user interactions in FastPix-player.
524612

525613
# Supporting tvOS

0 commit comments

Comments
 (0)