mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21d1783e72 |
@@ -53,7 +53,7 @@ jobs:
|
||||
cache: 'gradle'
|
||||
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v6
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
run: gem install xcpretty
|
||||
|
||||
- name: Cache CocoaPods
|
||||
uses: actions/cache@v6
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cocoapods/repos
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
bun-version: latest
|
||||
- name: Cache bun dependencies
|
||||
id: bun-cache
|
||||
uses: actions/cache@v6
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.bun/install/cache
|
||||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
||||
|
||||
+1
-1
@@ -381,7 +381,7 @@ function PlayerExample({
|
||||
isAutoQuality && styles.selectedTrackButtonText,
|
||||
]}
|
||||
>
|
||||
Auto{isAutoQuality && tracks.renditions.find(r => r.selected) ? ` (${tracks.renditions.find(r => r.selected)!.height}p)` : ""}
|
||||
Auto
|
||||
</Text>
|
||||
</Pressable>
|
||||
{tracks.renditions.length === 0 ? (
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ ruby ">= 2.6.10"
|
||||
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
||||
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
||||
gem 'xcodeproj', '< 1.26.0'
|
||||
gem 'concurrent-ruby', '< 1.3.4'
|
||||
gem 'concurrent-ruby', '< 1.3.8'
|
||||
|
||||
# Ruby 3.4.0 has removed some libraries from the standard library.
|
||||
gem 'bigdecimal'
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
"scripts": {
|
||||
"dev": "cd example && bun start",
|
||||
"android": " cd example && bunx react-native run-android --no-packager --port 8082",
|
||||
"web": "cd example && bun web",
|
||||
"typecheck": "tsc --noEmit && tsc -p plugin/tsconfig.json --noEmit",
|
||||
"build:plugin": "tsc -p plugin/tsconfig.json",
|
||||
"build": "bun run typecheck && bob build && bun run build:plugin",
|
||||
|
||||
+7
-41
@@ -1,5 +1,4 @@
|
||||
import type { VideoPlayerStore } from "@videojs/core/dom";
|
||||
import type Hls from "hls.js";
|
||||
import { stateMapper } from "./events.web";
|
||||
import type {
|
||||
OmniPlayer,
|
||||
@@ -18,11 +17,6 @@ export class WebOmniPlayer implements OmniPlayer {
|
||||
this._store = store;
|
||||
}
|
||||
|
||||
private getHls(): Hls | null {
|
||||
const media = this._store.target?.media;
|
||||
return (media?.engine as Hls | undefined) ?? null;
|
||||
}
|
||||
|
||||
source: Source | null = null;
|
||||
|
||||
get showNotification(): boolean {
|
||||
@@ -84,9 +78,7 @@ export class WebOmniPlayer implements OmniPlayer {
|
||||
}
|
||||
|
||||
get isAutoQuality(): boolean {
|
||||
const hls = this.getHls();
|
||||
if (!hls) return false;
|
||||
return hls.autoLevelEnabled;
|
||||
return true;
|
||||
}
|
||||
|
||||
play(): void {
|
||||
@@ -120,31 +112,16 @@ export class WebOmniPlayer implements OmniPlayer {
|
||||
}
|
||||
|
||||
get videos(): Track[] {
|
||||
// hls.js does not support alternative video tracks (e.g. camera angles)
|
||||
return [];
|
||||
}
|
||||
|
||||
selectVideo(_video: Track): void {
|
||||
// hls.js does not support alternative video tracks
|
||||
}
|
||||
selectVideo(video: Track): void {}
|
||||
|
||||
get audios(): Track[] {
|
||||
const hls = this.getHls();
|
||||
if (!hls) return [];
|
||||
const currentTrackId = hls.audioTrack;
|
||||
return hls.audioTracks.map((track, index) => ({
|
||||
id: index.toString(),
|
||||
label: track.name,
|
||||
language: track.lang,
|
||||
selected: index === currentTrackId,
|
||||
}));
|
||||
return [];
|
||||
}
|
||||
|
||||
selectAudio(audio: Track): void {
|
||||
const hls = this.getHls();
|
||||
if (!hls) return;
|
||||
hls.audioTrack = parseInt(audio.id, 10);
|
||||
}
|
||||
selectAudio(audio: Track): void {}
|
||||
|
||||
get subtitles(): Track[] {
|
||||
return this._store.textTrackList
|
||||
@@ -168,21 +145,10 @@ export class WebOmniPlayer implements OmniPlayer {
|
||||
}
|
||||
|
||||
get rendition(): Rendition[] {
|
||||
const hls = this.getHls();
|
||||
if (!hls) return [];
|
||||
const currentLevel = hls.currentLevel;
|
||||
return hls.levels.map((level, index) => ({
|
||||
id: index.toString(),
|
||||
width: level.width,
|
||||
height: level.height,
|
||||
bitrate: level.bitrate,
|
||||
selected: index === currentLevel,
|
||||
}));
|
||||
return [];
|
||||
}
|
||||
|
||||
selectRendition(rendition?: Rendition): void {
|
||||
const hls = this.getHls();
|
||||
if (!hls) return;
|
||||
hls.nextLevel = rendition ? parseInt(rendition.id, 10) : -1;
|
||||
selectRendition(_rendition?: Rendition): void {
|
||||
// Auto quality is handled by videojs/HLS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ export const OmniView = ({
|
||||
autoPlay={autoplay}
|
||||
playsInline
|
||||
crossOrigin="anonymous"
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
/>
|
||||
)}
|
||||
</VideoPlayer.Container>
|
||||
|
||||
Reference in New Issue
Block a user