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>;
id: Scalars["ID"]["output"];
isCompleted: Scalars["Boolean"]["output"];
lastIntendedSegmentBound?: Maybe<Scalars["Int"]["output"]>;
lastIntendedSegmentBound: Scalars["Int"]["output"];
linksRequested: Scalars["Int"]["output"];
lowestUnuploadedSegmentIndex: Scalars["Int"]["output"];
segmentProcessingCursor: Scalars["Int"]["output"];
@ -425,7 +425,6 @@ export type VideoGql = {
__typename?: "VideoGQL";
averageTimeBetweenShots?: Maybe<Scalars["Float"]["output"]>;
createdAt?: Maybe<Scalars["DateTime"]["output"]>;
currentProcessing?: Maybe<VideoProcessingGql>;
elapsedTime?: Maybe<Scalars["Float"]["output"]>;
endTime?: Maybe<Scalars["DateTime"]["output"]>;
framesPerSecond: Scalars["Float"]["output"];
@ -463,18 +462,6 @@ export type VideoMetadataInput = {
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 = {
__typename?: "VideoTag";
name: Scalars["String"]["output"];
@ -589,6 +576,10 @@ export type GetVideoMakePercentageIntervalsQuery = {
export type GetShotsQueryVariables = Exact<{
filterInput: FilterInput;
includeCreatedAt?: Scalars["Boolean"]["input"];
includeUpdatedAt?: Scalars["Boolean"]["input"];
includeCueObjectFeatures?: Scalars["Boolean"]["input"];
includePocketingIntentionFeatures?: Scalars["Boolean"]["input"];
includeCueObjectDistance?: Scalars["Boolean"]["input"];
includeCueObjectAngle?: Scalars["Boolean"]["input"];
includeCueBallSpeed?: Scalars["Boolean"]["input"];
@ -728,7 +719,7 @@ export type GetStreamMonitoringDetailsQuery = {
segmentProcessingCursor: number;
isCompleted: boolean;
uploadCompletionCursor: number;
lastIntendedSegmentBound?: number | null;
lastIntendedSegmentBound: number;
} | null;
currentProcessing?: {
__typename?: "VideoProcessingGQL";
@ -817,16 +808,50 @@ export type GetVideosQuery = {
getVideos: Array<{
__typename?: "VideoGQL";
id: number;
name?: string | null;
framesPerSecond: number;
playlist?: {
__typename?: "HLSPlaylistGQL";
m3u8Text: string;
segmentDurations: Array<number>;
} | 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<{
videoMetadataInput: VideoMetadataInput;
}>;
@ -904,7 +929,7 @@ export type GetUploadStreamsWithDetailsQuery = {
stream?: {
__typename?: "UploadStreamGQL";
isCompleted: boolean;
lastIntendedSegmentBound?: number | null;
lastIntendedSegmentBound: number;
uploadCompletionCursor: number;
} | null;
}>;
@ -1256,6 +1281,10 @@ export type GetVideoMakePercentageIntervalsQueryResult = Apollo.QueryResult<
export const GetShotsDocument = gql`
query GetShots(
$filterInput: FilterInput!
$includeCreatedAt: Boolean! = false
$includeUpdatedAt: Boolean! = false
$includeCueObjectFeatures: Boolean! = false
$includePocketingIntentionFeatures: Boolean! = false
$includeCueObjectDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false
@ -1269,15 +1298,16 @@ export const GetShotsDocument = gql`
videoId
startFrame
endFrame
createdAt
updatedAt
cueObjectFeatures {
createdAt @include(if: $includeCreatedAt)
updatedAt @include(if: $includeUpdatedAt)
cueObjectFeatures @include(if: $includeCueObjectFeatures) {
cueObjectDistance @include(if: $includeCueObjectDistance)
cueObjectAngle @include(if: $includeCueObjectAngle)
cueBallSpeed @include(if: $includeCueBallSpeed)
shotDirection @include(if: $includeShotDirection)
}
pocketingIntentionFeatures {
pocketingIntentionFeatures
@include(if: $includePocketingIntentionFeatures) {
targetPocketDistance @include(if: $includeTargetPocketDistance)
make @include(if: $includeMake)
intendedPocketType @include(if: $includeIntendedPocketType)
@ -1299,6 +1329,10 @@ export const GetShotsDocument = gql`
* const { data, loading, error } = useGetShotsQuery({
* variables: {
* filterInput: // value for 'filterInput'
* includeCreatedAt: // value for 'includeCreatedAt'
* includeUpdatedAt: // value for 'includeUpdatedAt'
* includeCueObjectFeatures: // value for 'includeCueObjectFeatures'
* includePocketingIntentionFeatures: // value for 'includePocketingIntentionFeatures'
* includeCueObjectDistance: // value for 'includeCueObjectDistance'
* includeCueObjectAngle: // value for 'includeCueObjectAngle'
* includeCueBallSpeed: // value for 'includeCueBallSpeed'
@ -1979,12 +2013,19 @@ export const GetVideosDocument = gql`
query GetVideos($videoIds: [Int!]!) {
getVideos(videoIds: $videoIds) {
id
name
framesPerSecond
playlist {
m3u8Text
segmentDurations
}
stream {
id
segments {
uploaded
valid
segmentIndex
endFrameIndex
framesPerSecond
}
}
}
}
`;
@ -2049,6 +2090,84 @@ export type GetVideosQueryResult = Apollo.QueryResult<
GetVideosQuery,
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`
mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) {
createUploadStream(videoMetadata: $videoMetadataInput) {

View File

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

View File

@ -117,11 +117,34 @@ query GetVideoDetails($videoId: Int!) {
query GetVideos($videoIds: [Int!]!) {
getVideos(videoIds: $videoIds) {
id
name
framesPerSecond
playlist {
m3u8Text
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
tags: [VideoTag!]!
homographyHistory: [HomographyInfoGQL!]!
currentProcessing: VideoProcessingGQL
}
type UploadStreamGQL {
@ -225,7 +224,7 @@ type UploadStreamGQL {
linksRequested: Int!
uploadsCompleted: Int!
segmentProcessingCursor: Int!
lastIntendedSegmentBound: Int
lastIntendedSegmentBound: Int!
isCompleted: Boolean!
lowestUnuploadedSegmentIndex: Int!
uploadCompletionCursor: Int!
@ -293,16 +292,6 @@ type IntPoint2D {
y: Int!
}
type VideoProcessingGQL {
errors: [VideoProcessingErrorGQL!]!
}
type VideoProcessingErrorGQL {
message: String!
startSegmentIndex: Int
endSegmentIndex: Int
}
type PageInfoGQL {
hasNextPage: Boolean!
endCursor: String