PAM Native Video
Start here
Section titled “Start here”Every PAM Native product runs on the PAM runtime. Install and verify PAM first, create a Native application, and add this package through PAM Composer:
curl -fsSL https://github.com/push-in/pam/releases/latest/download/install.sh | shpam doctorpam init my-app --template nativecd my-apppam composer require pushinbr/pam-native-videopam doctorpam native devpushinbr/pam-native-video 0.4 renders one native view (video.player):
Media3 1.9.3 on Android (HLS, DASH, progressive) and AVPlayer/AVKit on iOS
(HLS, progressive). Decoding, buffering and controls stay native. Requires PAM
Native >=0.8.0 <2.0.0.
use Pam\Native\Video\{VideoDrmConfiguration, VideoDrmScheme, VideoEventKind, VideoPlaybackState, VideoPlayer, VideoResizeMode};
return VideoPlayer::make('https://cdn.example.com/master.m3u8') ->autoPlay() ->controls() ->resizeMode(VideoResizeMode::Cover) ->seekTo($this->seekMs) // a changed value seeks once ->progressEvery(1_000) ->subtitle('https://cdn.example.com/subtitles/pt-BR.vtt') ->onEvent(function (VideoEventKind $kind, array $event): void { match ($kind) { VideoEventKind::State => $this->state = VideoPlaybackState::tryFrom((int) $event['state']), VideoEventKind::Progress => $this->position = (int) $event['positionMillis'], VideoEventKind::Error => $this->error = (string) $event['message'], default => null, }; }) ->toElement();- DRM:
->drm(new VideoDrmConfiguration(VideoDrmScheme::FairPlay, $licenseUrl, 'Bearer '.$token, contentId: 'movie-42', certificateUrl: $certUrl)); Widevine and ClearKey on Android, FairPlay on iOS. An unsupported scheme is a playback error, never unprotected playback. - External WebVTT, SRT and TTML subtitles on both platforms (iOS loads at most 2 MiB).
playbackRate()0.25–4,preferredPeakBitRate(),preferredForwardBuffer(),loop(),muted(),volume().
For feed, story and chat media the core <MediaPlayer> is usually enough (Zé
Chat uses it); add this package for DRM, DASH, external subtitles and streaming
controls.