Removed android bg audio and vidstack
This commit is contained in:
@@ -16,7 +16,6 @@ dependencies {
|
||||
implementation project(':capacitor-status-bar')
|
||||
implementation project(':capgo-inappbrowser')
|
||||
implementation project(':hugotomazi-capacitor-navigation-bar')
|
||||
implementation project(':mediagrid-capacitor-native-audio')
|
||||
implementation project(':capacitor-nodejs')
|
||||
|
||||
}
|
||||
|
||||
@@ -23,8 +23,5 @@ project(':capgo-inappbrowser').projectDir = new File('../node_modules/@capgo/ina
|
||||
include ':hugotomazi-capacitor-navigation-bar'
|
||||
project(':hugotomazi-capacitor-navigation-bar').projectDir = new File('../node_modules/@hugotomazi/capacitor-navigation-bar/android')
|
||||
|
||||
include ':mediagrid-capacitor-native-audio'
|
||||
project(':mediagrid-capacitor-native-audio').projectDir = new File('../node_modules/@mediagrid/capacitor-native-audio/android')
|
||||
|
||||
include ':capacitor-nodejs'
|
||||
project(':capacitor-nodejs').projectDir = new File('../node_modules/capacitor-nodejs/android')
|
||||
|
||||
Generated
+5
-82
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "materialious",
|
||||
"version": "1.7.10",
|
||||
"version": "1.7.15",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "materialious",
|
||||
"version": "1.7.10",
|
||||
"version": "1.7.15",
|
||||
"dependencies": {
|
||||
"@capacitor-community/electron": "^5.0.1",
|
||||
"@capacitor/android": "^6.1.2",
|
||||
@@ -19,7 +19,6 @@
|
||||
"@capacitor/status-bar": "^6.0.1",
|
||||
"@capgo/inappbrowser": "^6.6.8",
|
||||
"@hugotomazi/capacitor-navigation-bar": "^4.0.1",
|
||||
"@mediagrid/capacitor-native-audio": "^1.0.0",
|
||||
"beercss": "^3.8.0",
|
||||
"bgutils-js": "^3.1.3",
|
||||
"capacitor-nodejs": "https://github.com/EdenwareApps/Capacitor-NodeJS/releases/download/v1.0.0-beta.7/capacitor6-nodejs.tgz",
|
||||
@@ -39,7 +38,6 @@
|
||||
"svelte-infinite-loading": "^1.4.0",
|
||||
"svelte-persisted-store": "^0.12.0",
|
||||
"terser": "^5.34.1",
|
||||
"vidstack": "^1.12.12",
|
||||
"youtubei.js": "^12.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -2650,31 +2648,6 @@
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/core": {
|
||||
"version": "1.6.9",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.9.tgz",
|
||||
"integrity": "sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@floating-ui/utils": "^0.2.9"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/dom": {
|
||||
"version": "1.6.13",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.13.tgz",
|
||||
"integrity": "sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@floating-ui/core": "^1.6.0",
|
||||
"@floating-ui/utils": "^0.2.9"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/utils": {
|
||||
"version": "0.2.9",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.9.tgz",
|
||||
"integrity": "sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@formatjs/ecma402-abstract": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-2.3.2.tgz",
|
||||
@@ -3104,15 +3077,6 @@
|
||||
"integrity": "sha512-0FCeqG6WvK4/Cc06F/xXMd/pv4FeisI0c1tUpBbfhA2n9Y8eZEv4Karjbmf2ZqQCPUWMrGp8A571tCjizxoTiQ==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@mediagrid/capacitor-native-audio": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@mediagrid/capacitor-native-audio/-/capacitor-native-audio-1.2.0.tgz",
|
||||
"integrity": "sha512-w9WIUzHX7pq6UHMOclT4T/6uoRae7BxRKUjMZtgHe6tiHDLkUkNJWPNfBiXizHeoZnQHRITa1Iiisfz3yQLCKg==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@capacitor/core": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@msgpack/msgpack": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-2.8.0.tgz",
|
||||
@@ -3908,7 +3872,9 @@
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
||||
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
|
||||
"license": "MIT"
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "7.18.0",
|
||||
@@ -9010,15 +8976,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lit-html": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.8.0.tgz",
|
||||
"integrity": "sha512-o9t+MQM3P4y7M7yNzqAyjp7z+mQGa4NS4CxiyLqFPyFWyc4O+nodLrkrxSaCTrla6M5YOLaT3RpbbqjszB5g3Q==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@types/trusted-types": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/load-json-file": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
||||
@@ -13210,19 +13167,6 @@
|
||||
"node": ">= 10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/unplugin": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.16.1.tgz",
|
||||
"integrity": "sha512-4/u/j4FrCKdi17jaxuJA0jClGxB1AvU2hw/IuayPc4ay1XGaJs/rbb4v5WKwAjNifjmXK9PIFyuPiaK8azyR9w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^8.14.0",
|
||||
"webpack-virtual-modules": "^0.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/untildify": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
||||
@@ -13320,21 +13264,6 @@
|
||||
"spdx-expression-parse": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vidstack": {
|
||||
"version": "1.12.12",
|
||||
"resolved": "https://registry.npmjs.org/vidstack/-/vidstack-1.12.12.tgz",
|
||||
"integrity": "sha512-7413cfsyk6F0TtjiAA1QK1uyxgiTb6i0YFJSsQlXSJQaQQ/ZeQ/Fa4KDfC6EFCLPHoHPyW0Ejs5a6HFF64JXLQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.6.10",
|
||||
"lit-html": "^2.8.0",
|
||||
"media-captions": "^1.0.4",
|
||||
"unplugin": "^1.12.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "6.0.11",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.0.11.tgz",
|
||||
@@ -13949,12 +13878,6 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/webpack-virtual-modules": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz",
|
||||
"integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/webrtc-adapter": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webrtc-adapter/-/webrtc-adapter-9.0.1.tgz",
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
"@capacitor/status-bar": "^6.0.1",
|
||||
"@capgo/inappbrowser": "^6.6.8",
|
||||
"@hugotomazi/capacitor-navigation-bar": "^4.0.1",
|
||||
"@mediagrid/capacitor-native-audio": "^1.0.0",
|
||||
"beercss": "^3.8.0",
|
||||
"bgutils-js": "^3.1.3",
|
||||
"capacitor-nodejs": "https://github.com/EdenwareApps/Capacitor-NodeJS/releases/download/v1.0.0-beta.7/capacitor6-nodejs.tgz",
|
||||
@@ -71,7 +70,6 @@
|
||||
"svelte-infinite-loading": "^1.4.0",
|
||||
"svelte-persisted-store": "^0.12.0",
|
||||
"terser": "^5.34.1",
|
||||
"vidstack": "^1.12.12",
|
||||
"youtubei.js": "^12.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
<script lang="ts">
|
||||
import 'vidstack/bundle';
|
||||
|
||||
import { page } from '$app/stores';
|
||||
import { getBestThumbnail } from '$lib/images';
|
||||
import { padTime, videoLength } from '$lib/time';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { ScreenOrientation, type ScreenOrientationResult } from '@capacitor/screen-orientation';
|
||||
import { StatusBar, Style } from '@capacitor/status-bar';
|
||||
import { NavigationBar } from '@hugotomazi/capacitor-navigation-bar';
|
||||
import { AudioPlayer } from '@mediagrid/capacitor-native-audio';
|
||||
import type { Page } from '@sveltejs/kit';
|
||||
import { SponsorBlock, type Category, type Segment } from 'sponsorblock-api';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { _ } from 'svelte-i18n';
|
||||
import { get } from 'svelte/store';
|
||||
import type { FullscreenChangeEvent, MediaTimeUpdateEvent, PlayerSrc } from 'vidstack';
|
||||
import type { MediaPlayerElement } from 'vidstack/elements';
|
||||
import { deleteVideoProgress, getVideoProgress, saveVideoProgress } from '../api';
|
||||
import type { VideoPlay } from '../api/model';
|
||||
import { proxyVideoUrl, pullBitratePreference, type PhasedDescription } from '../misc';
|
||||
import { pullBitratePreference, type PhasedDescription } from '../misc';
|
||||
import {
|
||||
authStore,
|
||||
instanceStore,
|
||||
playerAlwaysLoopStore,
|
||||
playerAndroidBgPlayer,
|
||||
playerAndroidLockOrientation,
|
||||
playerAutoPlayStore,
|
||||
playerDefaultLanguage,
|
||||
@@ -311,59 +303,6 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (data.video.fallbackPatch === undefined && get(playerAndroidBgPlayer)) {
|
||||
const highestBitrateAudio = data.video.adaptiveFormats
|
||||
.filter((format) => format.type.startsWith('audio/'))
|
||||
.reduce((prev, current) => {
|
||||
return parseInt(prev.bitrate) > parseInt(current.bitrate) ? prev : current;
|
||||
});
|
||||
|
||||
const audioId = { audioId: data.video.videoId };
|
||||
|
||||
let isPlayingInBackground = false;
|
||||
|
||||
await AudioPlayer.create({
|
||||
...audioId,
|
||||
audioSource: !data.video.fallbackPatch
|
||||
? proxyVideoUrl(highestBitrateAudio.url)
|
||||
: highestBitrateAudio.url,
|
||||
friendlyTitle: data.video.title,
|
||||
useForNotification: true,
|
||||
loop: player.loop,
|
||||
isBackgroundMusic: false
|
||||
});
|
||||
|
||||
AudioPlayer.onAppGainsFocus(audioId, async () => {
|
||||
if (!isPlayingInBackground) return;
|
||||
|
||||
isPlayingInBackground = false;
|
||||
|
||||
await AudioPlayer.pause(audioId);
|
||||
|
||||
const audioPlayerTime = await AudioPlayer.getCurrentTime(audioId);
|
||||
|
||||
const audioPlayerTimeRounded = Math.round(audioPlayerTime.currentTime);
|
||||
if (audioPlayerTimeRounded > player.currentTime) {
|
||||
player.currentTime = audioPlayerTimeRounded;
|
||||
}
|
||||
|
||||
await player.play();
|
||||
});
|
||||
|
||||
AudioPlayer.onAppLosesFocus(audioId, async () => {
|
||||
if (player.paused) return;
|
||||
|
||||
isPlayingInBackground = true;
|
||||
await AudioPlayer.play(audioId);
|
||||
await AudioPlayer.seek({
|
||||
...audioId,
|
||||
timeInSeconds: Math.round(player.currentTime)
|
||||
});
|
||||
});
|
||||
|
||||
await AudioPlayer.initialize(audioId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
playerIsLive = true;
|
||||
@@ -464,8 +403,6 @@
|
||||
|
||||
onDestroy(async () => {
|
||||
if (Capacitor.getPlatform() === 'android') {
|
||||
await AudioPlayer.destroy({ audioId: data.video.videoId });
|
||||
|
||||
if (originalOrigination) {
|
||||
await StatusBar.setOverlaysWebView({ overlay: false });
|
||||
await StatusBar.show();
|
||||
@@ -490,32 +427,6 @@
|
||||
<div style="margin-top: 40vh;"></div>
|
||||
{/if}
|
||||
|
||||
<media-player
|
||||
bind:this={player}
|
||||
id="video"
|
||||
autoPlay={$playerAutoPlayStore && !isSyncing}
|
||||
loop={$playerAlwaysLoopStore}
|
||||
title={data.video.title}
|
||||
streamType={playerIsLive ? 'live' : 'on-demand'}
|
||||
viewType={audioMode ? 'audio' : 'video'}
|
||||
keep-alive
|
||||
{src}
|
||||
>
|
||||
<media-provider>
|
||||
{#if !audioMode}
|
||||
<media-poster class="vds-poster" src={getBestThumbnail(data.video.videoThumbnails, 1251, 781)}
|
||||
></media-poster>
|
||||
{/if}
|
||||
</media-provider>
|
||||
<media-audio-layout></media-audio-layout>
|
||||
{#if data.video.storyboards && data.video.storyboards.length > 3}
|
||||
<media-video-layout thumbnails={`${get(instanceStore)}${data.video.storyboards[3].url}`}
|
||||
></media-video-layout>
|
||||
{:else}
|
||||
<media-video-layout></media-video-layout>
|
||||
{/if}
|
||||
</media-player>
|
||||
|
||||
{#if !isEmbed}
|
||||
<div class="snackbar" id="snackbar-alert">
|
||||
<span class="bold" style="text-transform: capitalize;">{snackBarAlert}</span>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import { get } from 'svelte/store';
|
||||
import {
|
||||
playerAlwaysLoopStore,
|
||||
playerAndroidBgPlayer,
|
||||
playerAndroidLockOrientation,
|
||||
playerAutoPlayStore,
|
||||
playerAutoplayNextByDefaultStore,
|
||||
@@ -76,22 +75,6 @@
|
||||
</div>
|
||||
|
||||
{#if Capacitor.getPlatform() === 'android'}
|
||||
<div class="field no-margin">
|
||||
<nav class="no-padding">
|
||||
<div class="max">
|
||||
<div>{$_('layout.player.backgroundPlay')}</div>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={$playerAndroidBgPlayer}
|
||||
onclick={() => playerAndroidBgPlayer.set(!$playerAndroidBgPlayer)}
|
||||
/>
|
||||
<span></span>
|
||||
</label>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="field no-margin">
|
||||
<nav class="no-padding">
|
||||
<div class="max">
|
||||
|
||||
@@ -39,7 +39,6 @@ export const playerTheatreModeByDefaultStore = persisted('theatreModeByDefault',
|
||||
export const playerAutoplayNextByDefaultStore = persisted('autoplayNextByDefault', false);
|
||||
export const playerYouTubeJsFallback = persisted('youTubeJsFallback', true);
|
||||
export const playerYouTubeJsAlways = persisted('youTubeJsAlways', false);
|
||||
export const playerAndroidBgPlayer = persisted('androidBgPlayer', true);
|
||||
export const playerAndroidLockOrientation = persisted('androidLockOrientation', true);
|
||||
export const playerDefaultLanguage = persisted('defaultLanguage', '');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user