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] Android Fabric #3204

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0aceefb
feat: :zap: added gitignore
yungblud Apr 25, 2023
649b2e9
feat: :zap: turn on newarch enabled on example app
yungblud Apr 25, 2023
5c371bb
feat: :zap: setup example app new arch
yungblud Apr 25, 2023
8782d7a
feat: :zap: setup android example app for fabric android
yungblud Apr 26, 2023
6bd2489
feat: :zap: setup kotlin
yungblud May 1, 2023
d851d56
feat: :zap: migrate to fabric
yungblud May 1, 2023
ddcb252
refactor: js to ts
jiyong1 Apr 15, 2023
37c5a02
chore: update pacakge
jiyong1 Apr 15, 2023
43a8645
fabric support for js
jiyong1 Apr 20, 2023
8ba7950
feat: :zap: added gitignore
yungblud Apr 25, 2023
68320b0
feat: modified seek, headers
yungblud May 2, 2023
153186d
fix: fixed drm headers type android
yungblud May 2, 2023
797f527
chore: modified type
yungblud May 3, 2023
ace7e55
feat: modified package json
yungblud May 3, 2023
70afe83
refactor: remove legacy video js
yungblud Aug 11, 2023
dbec302
fix: fixed android fabric include isssue
yungblud May 2, 2023
92448ba
feat: modified seek, headers
yungblud May 2, 2023
5db9e7e
fix: fixed drm headers type android
yungblud May 2, 2023
63f4131
refactor: refactored properties
yungblud May 10, 2023
20842fb
feat: replaced null to map
yungblud May 15, 2023
f3948a5
feat: temporarily remove put array on event callback parameter (codeg…
yungblud May 15, 2023
dcee4ff
fix: fix selected props typo
jiyong1 May 19, 2023
b8b6f53
fix: add useExternalGetLicense field
yungblud Aug 11, 2023
54f4fdc
feat: changed prop name
yungblud May 26, 2023
310b4e2
fix: fixed drmType value
yungblud May 17, 2023
80f56ca
fix: upgrade deprecated kotlin plugin
jiyong1 May 30, 2023
e53ad84
fix: add onDropViewInstance method
jiyong1 Jun 12, 2023
0df0282
fix: fixed endTime
yungblud Aug 11, 2023
33e9144
feat: video seek param update
jiyong1 Jun 15, 2023
ebae8eb
feat: video seek event android
jiyong1 Jun 15, 2023
4ac3550
fix: fixed codegen types
yungblud Aug 11, 2023
52c1527
feat: added finished
yungblud Jul 10, 2023
80b61d7
feat: modified drmType, selected audio, text type oldarch
yungblud Jul 10, 2023
781b9b6
fix: fixed finished
yungblud Jul 10, 2023
894cce3
chore: added .npmignore on android
yungblud Jul 10, 2023
3cfaf81
chore: modified npm files
yungblud Jul 11, 2023
3ad51a6
chore: removed publishConfig
yungblud Aug 11, 2023
aac3350
Merge remote-tracking branch 'upstream/master' into feature/newarch-a…
yungblud Dec 13, 2023
dc1529a
feat: implemented Fabric android video event emitter
yungblud Dec 13, 2023
95a3b4c
feat: modified handling props src header array for Fabric types
yungblud Dec 13, 2023
06accdf
Merge branch 'master' into feature/newarch-android
yungblud Dec 13, 2023
490b56a
fix: fixed typescript
yungblud Dec 13, 2023
0b554b3
chore: removed unusing VideoView
yungblud Dec 13, 2023
fe890b5
chore: lint fix
yungblud Dec 21, 2023
5cb06e5
chore: modified tsconfig.json
yungblud Dec 21, 2023
dbca3ec
chore: modified Podfile.lock
yungblud Dec 21, 2023
72de90c
fix: fixed VideoEventEmitter with fabric
yungblud Dec 21, 2023
9bfe250
feat: modified typescripts
yungblud Dec 21, 2023
f105bf5
feat: modified android events
yungblud Dec 21, 2023
9945637
fix: synced build.gradle Fabric example
yungblud Dec 21, 2023
03b0ab2
feat: modified react exo player android
yungblud Dec 21, 2023
7863d9c
fix: fixed basic example metro.config.js
yungblud Jan 2, 2024
61cb62e
fix: fixed VideoEventEmitter import class, metadata array
yungblud Jan 2, 2024
58bf621
chore: modified tsconfig.json
yungblud Jan 2, 2024
b57185d
feat: implemented receiveCommand
yungblud Jan 2, 2024
32eb9d2
feat: removed unnecessary VideoResizeMode.ts
yungblud Jan 12, 2024
b3a1857
refactor: refactored on timed metadata event
yungblud Jan 12, 2024
de4bfa6
chore: removed unnecessary import
yungblud Jan 12, 2024
3f12e34
feat: modified codegen naming property of selected video track
yungblud Jan 12, 2024
a813592
feat: modified package.json main property
yungblud Jan 12, 2024
52a56a0
Merge remote-tracking branch 'upstream/master' into feature/newarch-a…
yungblud Jan 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import com.android.Version

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'

buildscript {
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNVideo_kotlinVersion']
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnAudioFocusChangedEvent(viewTag: Int, private val hasFocus: Boolean): Event<OnAudioFocusChangedEvent>(viewTag) {
private val EVENT_PROP_HAS_AUDIO_FOCUS = "hasAudioFocus"
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnAudioFocusChanged"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
val event = Arguments.createMap()
event.putBoolean(EVENT_PROP_HAS_AUDIO_FOCUS, hasFocus)
rctEventEmitter?.receiveEvent(viewTag, getEventName(), event)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.brentvatne.exoplayer.events

import com.brentvatne.common.Track
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.WritableArray
import com.facebook.react.bridge.WritableMap
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnAudioTracksEvent(viewTag: Int, private val audioTracks: ArrayList<Track>) : Event<OnAudioTracksEvent>(viewTag) {
private val EVENT_PROP_AUDIO_TRACKS = "audioTracks"
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnAudioTracks"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
rctEventEmitter?.receiveEvent(viewTag, getEventName(), arrayToObject(EVENT_PROP_AUDIO_TRACKS, audioTracksToArray(audioTracks)))
}

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)
return event
}

fun audioTracksToArray(audioTracks: java.util.ArrayList<Track>?): WritableArray? {
val waAudioTracks = Arguments.createArray()
if (audioTracks != null) {
for (i in audioTracks.indices) {
val format = audioTracks[i]
val audioTrack = Arguments.createMap()
audioTrack.putInt("index", i)
audioTrack.putString("title", if (format.m_title != null) format.m_title else "")
audioTrack.putString("type", if (format.m_mimeType != null) format.m_mimeType else "")
audioTrack.putString("language", if (format.m_language != null) format.m_language else "")
audioTrack.putInt("bitrate", format.m_bitrate)
audioTrack.putBoolean("selected", format.m_isSelected)
waAudioTracks.pushMap(audioTrack)
}
}
return waAudioTracks
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnPlaybackRateChangeEvent(viewTag: Int, private val rate: Float): Event<OnPlaybackRateChangeEvent>(viewTag) {
private val EVENT_PROP_PLAYBACK_RATE = "playbackRate"
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnPlaybackRateChange"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
val event = Arguments.createMap()
event.putDouble(EVENT_PROP_PLAYBACK_RATE, rate.toDouble())
rctEventEmitter?.receiveEvent(viewTag, getEventName(), event)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnReadyForDisplayEvent(viewTag: Int) : Event<OnReadyForDisplayEvent>(viewTag) {
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnReadyForDisplay"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
rctEventEmitter?.receiveEvent(viewTag, getEventName(), Arguments.createMap())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnReceiveAdEventEvent(viewTag: Int, private val event: String): Event<OnReceiveAdEventEvent>(viewTag) {
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnReceiveAdEventEvent"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
val map = Arguments.createMap()
map.putString("event", event)
rctEventEmitter?.receiveEvent(viewTag, getEventName(), map)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.brentvatne.exoplayer.events

import com.brentvatne.common.Track
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.WritableArray
import com.facebook.react.bridge.WritableMap
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnTextTracksEvent(viewTag: Int, private val textTracks: ArrayList<Track>) : Event<OnTextTracksEvent>(viewTag) {
private val EVENT_PROP_TEXT_TRACKS = "textTracks"
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnTextTracks"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
rctEventEmitter?.receiveEvent(viewTag, getEventName(), arrayToObject(EVENT_PROP_TEXT_TRACKS, textTracksToArray(textTracks)))
}

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.

Is it possible to ensure these event are correctly sent when we uses old architecture ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, this event will not be used on old architecture.
For old arch, we use android/src/oldarch/java/com/brentvatne/exoplayer/VideoEventEmitter.java

return event
}

fun textTracksToArray(textTracks: ArrayList<Track>?): WritableArray? {
val waTextTracks = Arguments.createArray()
if (textTracks != null) {
for (i in textTracks.indices) {
val format = textTracks[i]
val textTrack = Arguments.createMap()
textTrack.putInt("index", i)
textTrack.putString("title", if (format.m_title != null) format.m_title else "")
textTrack.putString("type", if (format.m_mimeType != null) format.m_mimeType else "")
textTrack.putString("language", if (format.m_language != null) format.m_language else "")
textTrack.putBoolean("selected", format.m_isSelected)
waTextTracks.pushMap(textTrack)
}
}
return waTextTracks
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter
import com.google.android.exoplayer2.metadata.emsg.EventMessage
import com.google.android.exoplayer2.metadata.id3.Id3Frame
import com.google.android.exoplayer2.metadata.id3.TextInformationFrame

class OnTimedMetadataEvent(viewTag: Int, private val metadata: com.google.android.exoplayer2.metadata.Metadata): Event<OnTimedMetadataEvent>(viewTag) {
private val EVENT_PROP_TIMED_METADATA = "metadata"
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnTimedMetadata"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
val metadataArray = Arguments.createArray()

for (i in 0 until metadata.length()) {
val entry = metadata[i]
if (entry is Id3Frame) {
val frame = entry
var value = ""
if (frame is TextInformationFrame) {
value = frame.value
}
val identifier = frame.id
val map = Arguments.createMap()
map.putString("identifier", identifier)
map.putString("value", value)
metadataArray.pushMap(map)
} else if (entry is EventMessage) {
val eventMessage = entry
val map = Arguments.createMap()
map.putString("identifier", eventMessage.schemeIdUri)
map.putString("value", eventMessage.value)
metadataArray.pushMap(map)
}
}

val event = Arguments.createMap()
// @todo: temporarily remove put array on event callback parameter (codegen issue)
// event.putArray(EVENT_PROP_TIMED_METADATA, metadataArray)
rctEventEmitter?.receiveEvent(viewTag, getEventName(), event)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnVideoAudioBecomingNoisyEvent(viewTag: Int): Event<OnVideoAudioBecomingNoisyEvent>(viewTag) {
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnVideoAudioBecomingNoisy"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
rctEventEmitter?.receiveEvent(viewTag, getEventName(), Arguments.createMap())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnVideoBandwidthUpdateEvent(
viewTag: Int,
private val bitRateEstimate: Double,
private val height: Int,
private val width: Int,
private val id: String
) : Event<OnVideoBandwidthUpdateEvent>(viewTag) {
private val EVENT_PROP_BITRATE = "bitrate"
private val EVENT_PROP_WIDTH = "width"
private val EVENT_PROP_HEIGHT = "height"
private val EVENT_PROP_TRACK_ID = "trackId"
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnVideoBandwidthUpdate"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
val event = Arguments.createMap()
event.putDouble(EVENT_PROP_BITRATE, bitRateEstimate)
event.putInt(EVENT_PROP_WIDTH, width)
event.putInt(EVENT_PROP_HEIGHT, height)
event.putString(EVENT_PROP_TRACK_ID, id)
rctEventEmitter?.receiveEvent(viewTag, getEventName(), event)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnVideoBufferEvent(viewTag: Int, private val isBuffering: Boolean) : Event<OnVideoBufferEvent>(viewTag) {
private val EVENT_PROP_IS_BUFFERING = "isBuffering"
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnVideoBuffer"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
val event = Arguments.createMap()
event.putBoolean(EVENT_PROP_IS_BUFFERING, isBuffering)
rctEventEmitter?.receiveEvent(viewTag, getEventName(), event)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.brentvatne.exoplayer.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
import com.facebook.react.uimanager.events.RCTEventEmitter

class OnVideoEndEvent(viewTag: Int): Event<OnVideoEndEvent>(viewTag) {
override fun getEventName(): String {
return EVENT_NAME
}

companion object {
const val EVENT_NAME = "topOnVideoEnd"
}

override fun dispatch(rctEventEmitter: RCTEventEmitter?) {
rctEventEmitter?.receiveEvent(viewTag, getEventName(), Arguments.createMap())
}
}
Loading
Loading