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

[New Arch] Support New Architecture Fabric Component #3122

Open
wants to merge 169 commits into
base: master
Choose a base branch
from

Conversation

yungblud
Copy link
Contributor

@yungblud yungblud commented May 8, 2023

Update the documentation

README.md was not updated yet. It will be updated soon.

Update the changelog

CHANGELOG.md was not updated yet. It will be updated soon.

Provide an example of how to test the change

  • First, we created new FabricExample app in examples/FabricExample
  • Go to new fabric example app: cd examples/FabricExample
    • bundle install: bundle install
    • iOS pod install: cd ios and RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
  • start metro server: yarn start
    • run iOS: yarn ios
    • run android: yarn android

we created some video-testing UI for the new fabric example app.

Focus the PR on only one area

  • Only for Fabric support

Describe the changes

Notes

  • This PR supports both new arch and old arch native component view
  • But, for now react-native codegen for new arch is not supporting array type of event method callback parameters. see this issue
    • onTimedMetadata
    • onAudioTracks
    • onTextTracks
    • onVideoTracks
    • we marked comment for upper methods with @todo: fix type

Splitting PR by features

@yungblud
Copy link
Contributor Author

@freeboub We finished our tasks including old arch support.
So do you want to split this PR step by step?


fun arrayToObject(field: String?, array: WritableArray?): WritableMap? {
val event = Arguments.createMap()
// @todo: temporarily remove put array on event callback parameter (codegen issue)
Copy link
Collaborator

Choose a reason for hiding this comment

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

still not possible to do it with new arch ?

fun arrayToObject(field: String?, array: WritableArray?): WritableMap? {
val event = Arguments.createMap()
// @todo: temporarily remove put array on event callback parameter (codegen issue)
// event.putArray(field!!, array)
Copy link
Collaborator

Choose a reason for hiding this comment

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

still not possible with new arch ? If it is an issue with new Arch, it would be good to disable it only for old arch


val event = Arguments.createMap()
// @todo: temporarily remove put array on event callback parameter (codegen issue)
// event.putArray(EVENT_PROP_TIMED_METADATA, metadataArray)
Copy link
Collaborator

Choose a reason for hiding this comment

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

to reactivate on old arch

val naturalSize: WritableMap? = aspectRatioToNaturalSize(videoWidth, videoHeight)
event.putMap(EVENT_PROP_NATURAL_SIZE, naturalSize)
event.putString(EVENT_PROP_TRACK_ID, trackId)
// @todo: temporarily remove put array on event callback parameter (codegen issue)
Copy link
Collaborator

Choose a reason for hiding this comment

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

to reactivate on old arch

}

companion object {
const val EVENT_NAME = "topOnVideoPlaybackStateChanged"
Copy link
Collaborator

Choose a reason for hiding this comment

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

are you sure of this EVENT_NAME ? I think you did a copy past issue :) (top)

}

companion object {
const val EVENT_NAME = "topOnVideoProgress"
Copy link
Collaborator

Choose a reason for hiding this comment

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

topOnVideoProgress instead of onVideoProgress

private val EVENT_PROP_ORIENTATION = "orientation"
private val EVENT_PROP_VIDEO_TRACKS = "videoTracks"
private val EVENT_PROP_AUDIO_TRACKS = "audioTracks"
private val EVENT_PROP_TEXT_TRACKS = "textTracks"
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can remove unused constant here

fun arrayToObject(field: String?, array: WritableArray?): WritableMap? {
val event = Arguments.createMap()
// @todo: temporarily remove put array on event callback parameter (codegen issue)
// event.putArray(field!!, array)
Copy link
Collaborator

Choose a reason for hiding this comment

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

to reactivate in old arch

@freeboub
Copy link
Collaborator

@yungblud thank you very much !
Yes if you have time to split the PR it would be wonderful!
Sorry, but I merged some other changes past week which causes conflicts...
Do you want me to guide you on the steps ?
you still not detail API changes in README, but you can just comment here, we will reintegrate it once it will be merged.
Thank you again !

The events management on android seems a good first step in my point of view, I just review this part.

  • why did you prefix all event by top ?
  • for the array issue, this is not possible to disable tracks management... can you at least reenable it for old architecture.

@@ -0,0 +1,31 @@
import type { OnBandwidthUpdateData, OnBufferData, OnLoadData, OnLoadStartData, OnProgressData, OnSeekData, OnPlaybackData, OnExternalPlaybackChangeData, OnPictureInPictureStatusChangedData, OnReceiveAdEventData, OnVideoErrorData, OnPlaybackStateChangedData, OnAudioFocusChangedData, OnTimedMetadataData, OnAudioTracksData, OnTextTracksData, OnVideoTracksData } from '../fabric/VideoNativeComponent';
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this file be in fabric folder ?

@yungblud
Copy link
Contributor Author

@freeboub Yep. I think it would be better to follow your guide about splitting PR.
So, we will make the first PR for Android Event management.
I will mention you after we create new PR!

And for the existing reviews that you wrote, we will ignore it for now.
I think it would be happy for us if you do same review again on the new PR.

@yungblud
Copy link
Contributor Author

@freeboub
I am splitting PR.
Can you check this PR?

@@ -36,8 +51,8 @@ class RCTVideoManager: RCTViewManager {
})
}

@objc(setLicenseResultError:reactTag:)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did you change this ? Is there an issue ?
please see: #3406

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