Skip to content
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

Merged
merged 10 commits into from
Dec 17, 2019

Conversation

mczernek
Copy link
Contributor

@mczernek mczernek commented Nov 8, 2019

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.

…s. Update documentation to include differences between videoRef and Sound objects.
@mczernek mczernek requested a review from sjchmiela as a code owner November 8, 2019 09:35
…s. Update documentation to include differences between videoRef and Sound objects.
…:expo/expo into @mczernek/av-playback-interface-and-docs
Copy link
Contributor

@sjchmiela sjchmiela left a 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?

@@ -314,6 +314,7 @@ export default class Video extends React.Component<VideoProps, VideoState> imple
setProgressUpdateIntervalAsync!: (
progressUpdateIntervalMillis: number
) => Promise<PlaybackStatus>;
setOnPlaybackUpdateStatus!: (progressUpdateIntervalMillis: number) => Promise<PlaybackStatus>;
Copy link
Contributor

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?

Copy link
Contributor

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… 🤔

Copy link
Contributor Author

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 });
Copy link
Contributor

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?)

Copy link
Contributor Author

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.

docs/pages/versions/v35.0.0/sdk/video.md Outdated Show resolved Hide resolved
...
```

#### Example: Loop media exactly 20 times
#### Example: Loop media exactly 20 times for Sound
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
... // 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`:

@mczernek
Copy link
Contributor Author

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?

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?

@mczernek mczernek requested a review from bbarthec as a code owner December 12, 2019 17:02
@mczernek mczernek requested a review from sjchmiela December 16, 2019 14:23
Copy link
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👏

@mczernek mczernek merged commit 76ddcce into master Dec 17, 2019
@mczernek mczernek deleted the @mczernek/av-playback-interface-and-docs branch December 17, 2019 10:39
@rusakovic
Copy link

rusakovic commented Apr 11, 2020

@mczernek
Helo Michał!
I tried to solve video issues several months. Maybe you can suggest correct manual for AV.
How to loadAsync, unloadAsync, and pause/play correctly with useEffect, useState, useRef hooks. Because currently official manual is super outdated.

Currently, I opened this ticket. #7446

I'm ready to help!
Thank you!

Jamedjo pushed a commit to Jamedjo/expo that referenced this pull request Feb 4, 2021
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants