feat: cast app id env variable, try to get session
This commit is contained in:
parent
f02c7877cd
commit
59d1d07bc3
|
@ -7,6 +7,9 @@ import { t } from 'i18next';
|
|||
import { getKexValue, setKexValue } from '@ente/shared/network/kexService';
|
||||
import { SESSION_KEYS, getKey } from '@ente/shared/storage/sessionStorage';
|
||||
import { boxSeal, toB64 } from '@ente/shared/crypto/internal/libsodium';
|
||||
import { useCastSender } from '@ente/shared/hooks/useCastSender';
|
||||
import { useEffect } from 'react';
|
||||
import { logError } from '@ente/shared/sentry';
|
||||
|
||||
interface Props {
|
||||
show: boolean;
|
||||
|
@ -19,6 +22,8 @@ enum AlbumCastError {
|
|||
}
|
||||
|
||||
export default function AlbumCastDialog(props: Props) {
|
||||
const { cast } = useCastSender();
|
||||
|
||||
const onSubmit: SingleInputFormProps['callback'] = async (
|
||||
value,
|
||||
setFieldError
|
||||
|
@ -68,6 +73,17 @@ export default function AlbumCastDialog(props: Props) {
|
|||
// hey TV, we acknowlege you!
|
||||
await setKexValue(encryptedPayloadForTvKexKey, encryptedPayload);
|
||||
};
|
||||
useEffect(() => {
|
||||
if (!cast) return;
|
||||
cast.framework.CastContext.getInstance()
|
||||
.requestSession()
|
||||
// .then(function (session) {
|
||||
// // Session started successfully
|
||||
// })
|
||||
.catch((e) => {
|
||||
logError(e, 'Failed to start cast session');
|
||||
});
|
||||
}, [cast]);
|
||||
|
||||
return (
|
||||
<DialogBoxV2
|
||||
|
|
|
@ -25,6 +25,13 @@ const load = (() => {
|
|||
'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1';
|
||||
window.__onGCastApiAvailable = (isAvailable) => {
|
||||
if (isAvailable) {
|
||||
cast.framework.CastContext.getInstance().setOptions({
|
||||
receiverApplicationId:
|
||||
process.env.NEXT_PUBLIC_CAST_APP_ID,
|
||||
autoJoinPolicy:
|
||||
chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
|
||||
});
|
||||
|
||||
resolve({
|
||||
chrome,
|
||||
cast,
|
||||
|
|
Loading…
Reference in a new issue