mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-09 15:27:30 -05:00
handle play in background
This commit is contained in:
BIN
frontend/public/silence.m4a
Normal file
BIN
frontend/public/silence.m4a
Normal file
Binary file not shown.
@@ -72,7 +72,7 @@ function GroupModal(props) {
|
||||
|
||||
return (
|
||||
|
||||
<Modal open={props.open} onClose={onClose} size='tiny'>
|
||||
<Modal open={props.open} onClose={() => handleDone(onClose)} size='tiny'>
|
||||
|
||||
<Modal.Header>{system && system.name}</Modal.Header>
|
||||
<Modal.Content >
|
||||
|
||||
@@ -33,6 +33,40 @@ const MediaPlayer = (props) => {
|
||||
const regionsPlugin = useMemo(() => RegionsPlugin.create(), []);
|
||||
const plugins = useMemo(() => [regionsPlugin], [regionsPlugin]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setSourceIndex(0);
|
||||
|
||||
if ('mediaSession' in navigator) {
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
title: "Waiting for Call...",
|
||||
album: 'OpenMHz',
|
||||
artwork: [
|
||||
{ src: '/favicon-32x32.png', sizes: '32x32', type: 'image/png' },
|
||||
{ src: '/android-chrome-192x192.png', sizes: '192x192', type: 'image/png' },
|
||||
{ src: '/android-chrome-192x192.png', sizes: '512x512', type: 'image/png' },
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
wavesurfer && wavesurfer.load("/silence.m4a");
|
||||
regionsPlugin.clearRegions();
|
||||
|
||||
// // In browsers that don’t yet support this functionality,
|
||||
// // playPromise won’t be defined.
|
||||
// if (playPromise !== undefined) {
|
||||
// playPromise.then(function () {
|
||||
|
||||
// }).catch(function (error) {
|
||||
// console.log("Automatic playback failed: " + error);
|
||||
// // Show a UI element to let the user manually start playback.
|
||||
// });
|
||||
// } else {
|
||||
// audio.src = false;
|
||||
// }
|
||||
|
||||
}, [playSilence]);
|
||||
|
||||
const onReady = (ws) => {
|
||||
setWavesurfer(ws)
|
||||
setIsPlaying(false)
|
||||
|
||||
@@ -38,13 +38,26 @@ server {
|
||||
|
||||
location /favicon.ico {
|
||||
proxy_pass http://frontend:3000;
|
||||
expires 1M;
|
||||
add_header Surrogate-Control "public, max-age=2629746";
|
||||
add_header Cache-Control "max-age=2629746, public";
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location /*.png {
|
||||
proxy_pass http://frontend:3000;
|
||||
access_log off;
|
||||
}
|
||||
proxy_pass http://frontend:3000;
|
||||
access_log off;
|
||||
expires 1M;
|
||||
add_header Cache-Control "max-age=2629746, public";
|
||||
}
|
||||
|
||||
location /*.m4a {
|
||||
proxy_pass http://frontend:3000;
|
||||
access_log off;
|
||||
expires 1M;
|
||||
add_header Surrogate-Control "public, max-age=2629746";
|
||||
add_header Cache-Control "max-age=2629746, public";
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://frontend:3000;
|
||||
|
||||
@@ -16,13 +16,29 @@ server {
|
||||
|
||||
location /favicon.ico {
|
||||
proxy_pass http://frontend:3000;
|
||||
access_log off;
|
||||
expires 1M;
|
||||
add_header Surrogate-Control "public, max-age=604800";
|
||||
add_header Cache-Control "max-age=604800, public";
|
||||
access_log /dev/stdout main;
|
||||
}
|
||||
|
||||
location /*.png {
|
||||
proxy_pass http://frontend:3000;
|
||||
access_log off;
|
||||
}
|
||||
location ~* \.(gif|jpg|png)$ {
|
||||
proxy_pass http://frontend:3000;
|
||||
|
||||
add_header Pragma public;
|
||||
add_header Surrogate-Control "public, max-age=604800";
|
||||
add_header Cache-Control "max-age=604800, public";
|
||||
expires 1M;
|
||||
}
|
||||
|
||||
location /silence.m4a {
|
||||
proxy_pass http://frontend:3000;
|
||||
access_log /dev/stdout main;
|
||||
|
||||
add_header Surrogate-Control "public, max-age=604800";
|
||||
add_header Cache-Control "max-age=604800, public";
|
||||
expires 1M;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://frontend:3000;
|
||||
@@ -80,6 +96,6 @@ server {
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
access_log off;
|
||||
access_log /dev/stdout main;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user