Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/lvpr-tv/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type LowLatency = Booleanish | "force";
type ObjectFit = "contain" | "cover";
type Constant = Booleanish;
type Debug = Booleanish;
type IngestPlayback = Booleanish;

type PlayerSearchParams = {
v?: string;
Expand All @@ -31,6 +32,7 @@ type PlayerSearchParams = {
jwt?: string;
accessKey?: string;
debug?: Debug;
ingestPlayback?: IngestPlayback;
};

export default async function PlayerPage({
Expand Down Expand Up @@ -60,6 +62,7 @@ export default async function PlayerPage({
jwt: searchParams?.jwt ?? null,
accessKey: searchParams?.accessKey ?? null,
debug: coerceToBoolean(searchParams?.debug, false),
ingestPlayback: coerceToBoolean(searchParams?.ingestPlayback, false),
};

return (
Expand Down
2 changes: 2 additions & 0 deletions apps/lvpr-tv/src/components/player/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type PlayerProps = Partial<{
jwt: string | null;
accessKey: string | null;
debug: boolean;
ingestPlayback: boolean;
}>;

const getPlaybackInfoUncached = cache(async (playbackId: string) => {
Expand Down Expand Up @@ -106,6 +107,7 @@ export async function PlayerWithControls(props: PlayerProps) {
src={src}
aspectRatio={null}
storage={null}
ingestPlayback={props.ingestPlayback}
>
<Player.Container className="flex-1 h-full w-full overflow-hidden bg-black outline-none transition-all">
<Player.Video
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/media/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ export type InitialProps = {
* The viewerId for the viewer. A unique identifier for the user or session watching the media.
*/
viewerId: string | null;

ingestPlayback: boolean;
};

export type DeviceInformation = {
Expand Down Expand Up @@ -538,6 +540,7 @@ export const createControllerStore = ({
hasRecentWebRTCTimeout: getHasRecentWebRTCTimeout(
initialProps.cacheWebRTCFailureMs,
),
ingestPlayback: initialProps.ingestPlayback ?? false,
});

const initialControls: ControlsState = {
Expand Down Expand Up @@ -658,6 +661,7 @@ export const createControllerStore = ({
videoQuality: initialVideoQuality,
viewerId: initialProps.viewerId ?? null,
volume: initialVolume ?? null,
ingestPlayback: initialProps.ingestPlayback ?? false,
},

__device: device,
Expand Down Expand Up @@ -856,6 +860,7 @@ export const createControllerStore = ({
hasRecentWebRTCTimeout: getHasRecentWebRTCTimeout(
__initialProps.cacheWebRTCFailureMs,
),
ingestPlayback: __initialProps.ingestPlayback,
});

return {
Expand Down Expand Up @@ -1178,6 +1183,7 @@ export const createControllerStore = ({
sessionToken: __controls.sessionToken,
source: nextSource,
videoQuality,
ingestPlayback: __initialProps.ingestPlayback,
});

return {
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/media/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export const parseCurrentSourceAndPlaybackId = ({
sessionToken,
source,
videoQuality,
ingestPlayback,
}: {
accessKey: InitialProps["accessKey"];
aspectRatio: InitialProps["aspectRatio"];
Expand All @@ -235,6 +236,7 @@ export const parseCurrentSourceAndPlaybackId = ({
sessionToken: string;
source: Src | null;
videoQuality: VideoQuality;
ingestPlayback: InitialProps["ingestPlayback"];
}) => {
if (!source) {
return null;
Expand Down Expand Up @@ -277,6 +279,10 @@ export const parseCurrentSourceAndPlaybackId = ({
}
}

if (ingestPlayback) {
url.searchParams.append("ingestpb", String(ingestPlayback));
}

// override the url with the new URL
const newSrc = {
...source,
Expand Down Expand Up @@ -309,6 +315,7 @@ export const getNewSource = ({
src,
videoQuality,
hasRecentWebRTCTimeout,
ingestPlayback,
}: {
accessKey: InitialProps["accessKey"] | undefined;
aspectRatio: InitialProps["aspectRatio"] | undefined;
Expand All @@ -321,6 +328,7 @@ export const getNewSource = ({
src: Src[] | string | null | undefined;
videoQuality: VideoQuality;
hasRecentWebRTCTimeout: boolean;
ingestPlayback: InitialProps["ingestPlayback"];
}) => {
const sortedSources = sortSources({
src,
Expand All @@ -340,6 +348,7 @@ export const getNewSource = ({
sessionToken: sessionToken,
source: sortedSources?.[0] ?? null,
videoQuality,
ingestPlayback,
});

return {
Expand Down
Loading