Create playlist, video generator and video player (#489)

Co-authored-by: Ivan Malison <IvanMalison@gmail.com>
Reviewed-on: railbird/railbird-mobile#489
Reviewed-by: Ivan Malison <ivanmalison@gmail.com>
This commit is contained in:
Kat Huang 2024-05-20 21:52:38 -06:00
parent 9b76a6b599
commit 072235f032
4 changed files with 181 additions and 45 deletions

View File

@ -378,7 +378,7 @@ export type UploadStreamGql = {
errors: Array<StreamErrorGql>; errors: Array<StreamErrorGql>;
id: Scalars["ID"]["output"]; id: Scalars["ID"]["output"];
isCompleted: Scalars["Boolean"]["output"]; isCompleted: Scalars["Boolean"]["output"];
lastIntendedSegmentBound?: Maybe<Scalars["Int"]["output"]>; lastIntendedSegmentBound: Scalars["Int"]["output"];
linksRequested: Scalars["Int"]["output"]; linksRequested: Scalars["Int"]["output"];
lowestUnuploadedSegmentIndex: Scalars["Int"]["output"]; lowestUnuploadedSegmentIndex: Scalars["Int"]["output"];
segmentProcessingCursor: Scalars["Int"]["output"]; segmentProcessingCursor: Scalars["Int"]["output"];
@ -425,7 +425,6 @@ export type VideoGql = {
__typename?: "VideoGQL"; __typename?: "VideoGQL";
averageTimeBetweenShots?: Maybe<Scalars["Float"]["output"]>; averageTimeBetweenShots?: Maybe<Scalars["Float"]["output"]>;
createdAt?: Maybe<Scalars["DateTime"]["output"]>; createdAt?: Maybe<Scalars["DateTime"]["output"]>;
currentProcessing?: Maybe<VideoProcessingGql>;
elapsedTime?: Maybe<Scalars["Float"]["output"]>; elapsedTime?: Maybe<Scalars["Float"]["output"]>;
endTime?: Maybe<Scalars["DateTime"]["output"]>; endTime?: Maybe<Scalars["DateTime"]["output"]>;
framesPerSecond: Scalars["Float"]["output"]; framesPerSecond: Scalars["Float"]["output"];
@ -463,18 +462,6 @@ export type VideoMetadataInput = {
videoName?: InputMaybe<Scalars["String"]["input"]>; videoName?: InputMaybe<Scalars["String"]["input"]>;
}; };
export type VideoProcessingErrorGql = {
__typename?: "VideoProcessingErrorGQL";
endSegmentIndex?: Maybe<Scalars["Int"]["output"]>;
message: Scalars["String"]["output"];
startSegmentIndex?: Maybe<Scalars["Int"]["output"]>;
};
export type VideoProcessingGql = {
__typename?: "VideoProcessingGQL";
errors: Array<VideoProcessingErrorGql>;
};
export type VideoTag = { export type VideoTag = {
__typename?: "VideoTag"; __typename?: "VideoTag";
name: Scalars["String"]["output"]; name: Scalars["String"]["output"];
@ -589,6 +576,10 @@ export type GetVideoMakePercentageIntervalsQuery = {
export type GetShotsQueryVariables = Exact<{ export type GetShotsQueryVariables = Exact<{
filterInput: FilterInput; filterInput: FilterInput;
includeCreatedAt?: Scalars["Boolean"]["input"];
includeUpdatedAt?: Scalars["Boolean"]["input"];
includeCueObjectFeatures?: Scalars["Boolean"]["input"];
includePocketingIntentionFeatures?: Scalars["Boolean"]["input"];
includeCueObjectDistance?: Scalars["Boolean"]["input"]; includeCueObjectDistance?: Scalars["Boolean"]["input"];
includeCueObjectAngle?: Scalars["Boolean"]["input"]; includeCueObjectAngle?: Scalars["Boolean"]["input"];
includeCueBallSpeed?: Scalars["Boolean"]["input"]; includeCueBallSpeed?: Scalars["Boolean"]["input"];
@ -728,7 +719,7 @@ export type GetStreamMonitoringDetailsQuery = {
segmentProcessingCursor: number; segmentProcessingCursor: number;
isCompleted: boolean; isCompleted: boolean;
uploadCompletionCursor: number; uploadCompletionCursor: number;
lastIntendedSegmentBound?: number | null; lastIntendedSegmentBound: number;
} | null; } | null;
currentProcessing?: { currentProcessing?: {
__typename?: "VideoProcessingGQL"; __typename?: "VideoProcessingGQL";
@ -817,14 +808,48 @@ export type GetVideosQuery = {
getVideos: Array<{ getVideos: Array<{
__typename?: "VideoGQL"; __typename?: "VideoGQL";
id: number; id: number;
name?: string | null;
framesPerSecond: number;
playlist?: { playlist?: {
__typename?: "HLSPlaylistGQL"; __typename?: "HLSPlaylistGQL";
m3u8Text: string;
segmentDurations: Array<number>; segmentDurations: Array<number>;
} | null; } | null;
stream?: {
__typename?: "UploadStreamGQL";
id: string;
segments: Array<{
__typename?: "UploadSegmentGQL";
uploaded: boolean;
valid: boolean;
segmentIndex: number;
endFrameIndex?: number | null;
framesPerSecond?: number | null;
}>; }>;
} | null;
}>;
};
export type GetVideoQueryVariables = Exact<{
videoId: Scalars["Int"]["input"];
}>;
export type GetVideoQuery = {
__typename?: "Query";
getVideo: {
__typename?: "VideoGQL";
id: number;
playlist?: {
__typename?: "HLSPlaylistGQL";
segmentDurations: Array<number>;
} | null;
stream?: {
__typename?: "UploadStreamGQL";
segments: Array<{
__typename?: "UploadSegmentGQL";
segmentIndex: number;
endFrameIndex?: number | null;
framesPerSecond?: number | null;
}>;
} | null;
};
}; };
export type CreateUploadStreamMutationVariables = Exact<{ export type CreateUploadStreamMutationVariables = Exact<{
@ -904,7 +929,7 @@ export type GetUploadStreamsWithDetailsQuery = {
stream?: { stream?: {
__typename?: "UploadStreamGQL"; __typename?: "UploadStreamGQL";
isCompleted: boolean; isCompleted: boolean;
lastIntendedSegmentBound?: number | null; lastIntendedSegmentBound: number;
uploadCompletionCursor: number; uploadCompletionCursor: number;
} | null; } | null;
}>; }>;
@ -1256,6 +1281,10 @@ export type GetVideoMakePercentageIntervalsQueryResult = Apollo.QueryResult<
export const GetShotsDocument = gql` export const GetShotsDocument = gql`
query GetShots( query GetShots(
$filterInput: FilterInput! $filterInput: FilterInput!
$includeCreatedAt: Boolean! = false
$includeUpdatedAt: Boolean! = false
$includeCueObjectFeatures: Boolean! = false
$includePocketingIntentionFeatures: Boolean! = false
$includeCueObjectDistance: Boolean! = false $includeCueObjectDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false $includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false $includeCueBallSpeed: Boolean! = false
@ -1269,15 +1298,16 @@ export const GetShotsDocument = gql`
videoId videoId
startFrame startFrame
endFrame endFrame
createdAt createdAt @include(if: $includeCreatedAt)
updatedAt updatedAt @include(if: $includeUpdatedAt)
cueObjectFeatures { cueObjectFeatures @include(if: $includeCueObjectFeatures) {
cueObjectDistance @include(if: $includeCueObjectDistance) cueObjectDistance @include(if: $includeCueObjectDistance)
cueObjectAngle @include(if: $includeCueObjectAngle) cueObjectAngle @include(if: $includeCueObjectAngle)
cueBallSpeed @include(if: $includeCueBallSpeed) cueBallSpeed @include(if: $includeCueBallSpeed)
shotDirection @include(if: $includeShotDirection) shotDirection @include(if: $includeShotDirection)
} }
pocketingIntentionFeatures { pocketingIntentionFeatures
@include(if: $includePocketingIntentionFeatures) {
targetPocketDistance @include(if: $includeTargetPocketDistance) targetPocketDistance @include(if: $includeTargetPocketDistance)
make @include(if: $includeMake) make @include(if: $includeMake)
intendedPocketType @include(if: $includeIntendedPocketType) intendedPocketType @include(if: $includeIntendedPocketType)
@ -1299,6 +1329,10 @@ export const GetShotsDocument = gql`
* const { data, loading, error } = useGetShotsQuery({ * const { data, loading, error } = useGetShotsQuery({
* variables: { * variables: {
* filterInput: // value for 'filterInput' * filterInput: // value for 'filterInput'
* includeCreatedAt: // value for 'includeCreatedAt'
* includeUpdatedAt: // value for 'includeUpdatedAt'
* includeCueObjectFeatures: // value for 'includeCueObjectFeatures'
* includePocketingIntentionFeatures: // value for 'includePocketingIntentionFeatures'
* includeCueObjectDistance: // value for 'includeCueObjectDistance' * includeCueObjectDistance: // value for 'includeCueObjectDistance'
* includeCueObjectAngle: // value for 'includeCueObjectAngle' * includeCueObjectAngle: // value for 'includeCueObjectAngle'
* includeCueBallSpeed: // value for 'includeCueBallSpeed' * includeCueBallSpeed: // value for 'includeCueBallSpeed'
@ -1979,12 +2013,19 @@ export const GetVideosDocument = gql`
query GetVideos($videoIds: [Int!]!) { query GetVideos($videoIds: [Int!]!) {
getVideos(videoIds: $videoIds) { getVideos(videoIds: $videoIds) {
id id
name
framesPerSecond
playlist { playlist {
m3u8Text
segmentDurations segmentDurations
} }
stream {
id
segments {
uploaded
valid
segmentIndex
endFrameIndex
framesPerSecond
}
}
} }
} }
`; `;
@ -2049,6 +2090,84 @@ export type GetVideosQueryResult = Apollo.QueryResult<
GetVideosQuery, GetVideosQuery,
GetVideosQueryVariables GetVideosQueryVariables
>; >;
export const GetVideoDocument = gql`
query GetVideo($videoId: Int!) {
getVideo(videoId: $videoId) {
id
playlist {
segmentDurations
}
stream {
segments {
segmentIndex
endFrameIndex
framesPerSecond
}
}
}
}
`;
/**
* __useGetVideoQuery__
*
* To run a query within a React component, call `useGetVideoQuery` and pass it any options that fit your needs.
* When your component renders, `useGetVideoQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useGetVideoQuery({
* variables: {
* videoId: // value for 'videoId'
* },
* });
*/
export function useGetVideoQuery(
baseOptions: Apollo.QueryHookOptions<GetVideoQuery, GetVideoQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<GetVideoQuery, GetVideoQueryVariables>(
GetVideoDocument,
options,
);
}
export function useGetVideoLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
GetVideoQuery,
GetVideoQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetVideoQuery, GetVideoQueryVariables>(
GetVideoDocument,
options,
);
}
export function useGetVideoSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
GetVideoQuery,
GetVideoQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetVideoQuery, GetVideoQueryVariables>(
GetVideoDocument,
options,
);
}
export type GetVideoQueryHookResult = ReturnType<typeof useGetVideoQuery>;
export type GetVideoLazyQueryHookResult = ReturnType<
typeof useGetVideoLazyQuery
>;
export type GetVideoSuspenseQueryHookResult = ReturnType<
typeof useGetVideoSuspenseQuery
>;
export type GetVideoQueryResult = Apollo.QueryResult<
GetVideoQuery,
GetVideoQueryVariables
>;
export const CreateUploadStreamDocument = gql` export const CreateUploadStreamDocument = gql`
mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) { mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) {
createUploadStream(videoMetadata: $videoMetadataInput) { createUploadStream(videoMetadata: $videoMetadataInput) {

View File

@ -1,5 +1,9 @@
query GetShots( query GetShots(
$filterInput: FilterInput! $filterInput: FilterInput!
$includeCreatedAt: Boolean! = false
$includeUpdatedAt: Boolean! = false
$includeCueObjectFeatures: Boolean! = false
$includePocketingIntentionFeatures: Boolean! = false
$includeCueObjectDistance: Boolean! = false $includeCueObjectDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false $includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false $includeCueBallSpeed: Boolean! = false
@ -13,15 +17,16 @@ query GetShots(
videoId videoId
startFrame startFrame
endFrame endFrame
createdAt createdAt @include(if: $includeCreatedAt)
updatedAt updatedAt @include(if: $includeUpdatedAt)
cueObjectFeatures { cueObjectFeatures @include(if: $includeCueObjectFeatures) {
cueObjectDistance @include(if: $includeCueObjectDistance) cueObjectDistance @include(if: $includeCueObjectDistance)
cueObjectAngle @include(if: $includeCueObjectAngle) cueObjectAngle @include(if: $includeCueObjectAngle)
cueBallSpeed @include(if: $includeCueBallSpeed) cueBallSpeed @include(if: $includeCueBallSpeed)
shotDirection @include(if: $includeShotDirection) shotDirection @include(if: $includeShotDirection)
} }
pocketingIntentionFeatures { pocketingIntentionFeatures
@include(if: $includePocketingIntentionFeatures) {
targetPocketDistance @include(if: $includeTargetPocketDistance) targetPocketDistance @include(if: $includeTargetPocketDistance)
make @include(if: $includeMake) make @include(if: $includeMake)
intendedPocketType @include(if: $includeIntendedPocketType) intendedPocketType @include(if: $includeIntendedPocketType)

View File

@ -117,11 +117,34 @@ query GetVideoDetails($videoId: Int!) {
query GetVideos($videoIds: [Int!]!) { query GetVideos($videoIds: [Int!]!) {
getVideos(videoIds: $videoIds) { getVideos(videoIds: $videoIds) {
id id
name
framesPerSecond
playlist { playlist {
m3u8Text
segmentDurations segmentDurations
} }
stream {
id
segments {
uploaded
valid
segmentIndex
endFrameIndex
framesPerSecond
}
}
}
}
query GetVideo($videoId: Int!) {
getVideo(videoId: $videoId) {
id
playlist {
segmentDurations
}
stream {
segments {
segmentIndex
endFrameIndex
framesPerSecond
}
}
} }
} }

View File

@ -217,7 +217,6 @@ type VideoGQL {
playlist: HLSPlaylistGQL playlist: HLSPlaylistGQL
tags: [VideoTag!]! tags: [VideoTag!]!
homographyHistory: [HomographyInfoGQL!]! homographyHistory: [HomographyInfoGQL!]!
currentProcessing: VideoProcessingGQL
} }
type UploadStreamGQL { type UploadStreamGQL {
@ -225,7 +224,7 @@ type UploadStreamGQL {
linksRequested: Int! linksRequested: Int!
uploadsCompleted: Int! uploadsCompleted: Int!
segmentProcessingCursor: Int! segmentProcessingCursor: Int!
lastIntendedSegmentBound: Int lastIntendedSegmentBound: Int!
isCompleted: Boolean! isCompleted: Boolean!
lowestUnuploadedSegmentIndex: Int! lowestUnuploadedSegmentIndex: Int!
uploadCompletionCursor: Int! uploadCompletionCursor: Int!
@ -293,16 +292,6 @@ type IntPoint2D {
y: Int! y: Int!
} }
type VideoProcessingGQL {
errors: [VideoProcessingErrorGQL!]!
}
type VideoProcessingErrorGQL {
message: String!
startSegmentIndex: Int
endSegmentIndex: Int
}
type PageInfoGQL { type PageInfoGQL {
hasNextPage: Boolean! hasNextPage: Boolean!
endCursor: String endCursor: String