-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AV] Correct Playback interface so that it contains all common method… #6213
Conversation
…s. Update documentation to include differences between videoRef and Sound objects.
…s. Update documentation to include differences between videoRef and Sound objects.
…:expo/expo into @mczernek/av-playback-interface-and-docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, maybe we should just expose a setOnPlaybackUpdateStatus
method from Video.tsx
(which shouldn't be too difficult, we would just save the callback as an instance variable and call in _handleNewStatus
?
packages/expo-av/src/Video.tsx
Outdated
@@ -314,6 +314,7 @@ export default class Video extends React.Component<VideoProps, VideoState> imple | |||
setProgressUpdateIntervalAsync!: ( | |||
progressUpdateIntervalMillis: number | |||
) => Promise<PlaybackStatus>; | |||
setOnPlaybackUpdateStatus!: (progressUpdateIntervalMillis: number) => Promise<PlaybackStatus>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no other setOnPlaybackUpdateStatus
anywhere in the repo, are you sure this is the name you wanted to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there even be this method here? It isn't set by PlaybackMixin
… 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, is should not. Will delete.
@@ -250,14 +254,14 @@ export interface Playback extends AV { | |||
*/ | |||
export const PlaybackMixin = { | |||
async playAsync(): Promise<PlaybackStatus> { | |||
return ((this as any) as AV).setStatusAsync({ shouldPlay: true }); | |||
return ((this as any) as Playback).setStatusAsync({ shouldPlay: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we change AV
to Playback
, so make the required interface more concrete? (While AV
would suffice?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea was, that we really require this
to implement Playback
interface, and PlaybackMixin
is designed to add implementation to some methods.
So it is sufficient, but would be logically wrong to pass here AV
implementation. I know that this does not guard us anyhow, but I thought that this way our intentions are expressed more clearly.
... | ||
``` | ||
|
||
#### Example: Loop media exactly 20 times | ||
#### Example: Loop media exactly 20 times for Sound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#### Example: Loop media exactly 20 times for Sound | |
#### Example: Loop sound exactly 20 times |
@@ -351,11 +355,11 @@ _onPlaybackStatusUpdate = playbackStatus => { | |||
}; | |||
|
|||
... // Load the playbackObject and obtain the reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... // Load the playbackObject and obtain the reference. | |
... // Load the sound and obtain the reference. |
Co-Authored-By: Stanisław Chmiela <sjchmiela@users.noreply.github.com>
@@ -184,16 +184,14 @@ This dismisses the fullscreen video view. | |||
|
|||
A `Promise` that is fulfilled with the `PlaybackStatus` of the video once the fullscreen player has finished dismissing, or rejects if there was an error, or if this was called on an Android device. | |||
|
|||
The rest of the API on the `Video` component ref is the same as the API for `Audio.Sound`-- see the [AV documentation](../av/) for further information: | |||
The rest of the API on the `Video` component ref is almost the same as the API for `Audio.Sound`. Only exception is - `setOnPlaybackStatusUpdate(onPlaybackStatusUpdate)` method, which is not available for `videoRef` -- see the [AV documentation](../av/) for further information: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the API on the `Video` component ref is almost the same as the API for `Audio.Sound`. Only exception is - `setOnPlaybackStatusUpdate(onPlaybackStatusUpdate)` method, which is not available for `videoRef` -- see the [AV documentation](../av/) for further information: | |
The rest of the API on the `Video` component ref is almost the same as the API for `Audio.Sound`. The only exception is the `setOnPlaybackStatusUpdate(onPlaybackStatusUpdate)` method, which is not available for `videoRef` -- see the [AV documentation](../av/) for further information: |
@@ -64,7 +64,7 @@ render() { | |||
|
|||
## Playback API | |||
|
|||
On the `playbackObject` reference, the following API is provided: | |||
On the `playbackObject` reference, the following API is provided for both Audio and Video: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the `playbackObject` reference, the following API is provided for both Audio and Video: | |
On the `playbackObject` reference, the following API is provided for both `Audio` and `Video`: |
I guess we could do that, but I do not think we want to do it backward. What about just updating docs for now, and creating another issue for adding this method? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 👏
@mczernek Currently, I opened this ticket. #7446 I'm ready to help! |
expo#6213) * [AV] Correct Playback interface so that it contains all common methods. Update documentation to include differences between videoRef and Sound objects. * [AV] Correct Playback interface so that it contains all common methods. Update documentation to include differences between videoRef and Sound objects. * Build files. * Update docs/pages/versions/v35.0.0/sdk/video.md Co-Authored-By: Stanisław Chmiela <sjchmiela@users.noreply.github.com> * Correct docs. Reove unavailable method from Video.tsx. * [AV] Add on update callback to video ref object. * Changelog.
Why
Documentation includes method for Video reference, which is not available since at least sdk32. Some users reports this inconsistence.
How
Updating documentation and updating Playback interface for Audio and Video objects.