react-native-video/android
Olivier Bouillet 66dcf32b56
refactor: move view type and drm in source (#3867)
* perf: ensure we do not provide callback to native if no callback provided from app

* chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size

* chore: improve issue template

* fix(android): avoid video view flickering at playback startup

* chore(android): refactor DRM props into a dedicated class

* Update android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java

* chore: fix linter

* fix: ensure drm prop is correctly cleaned

* feat(android): move viewType (secure texture) & drm inside the source

The origianl behavior has been kept for interoperability, but marked as deprecated in doc

* chore: fix linter

* chore(ios): move drm prop in source like on android

* chore: fix linter

* chore: clean log

* fix: allow to disable secure View

* chore: fix viewType resolution (source value was not handled)

* chore: use contentDeepEquals instead of manual checks

* chore: fix linter

* fix: ensure player doesn't start when view is unmounted

* Fix/ensure view drop stop playback startup (#3875)

* fix: ensure player doesn't start when view is unmounted

* chore: revert change

* chore: add warning in case of invalid Surface configuration

* chore: code clean

* fix: simplify surface management

* chore: restore previous code

* chore: fix typo

* chore: code cleanup

* feat(android): add multiDrm flag support

* docs: update docs

* chore: fix ios build

* chore: fix deprecated declaration

---------

Co-authored-by: Krzysztof Moch <krzysmoch.programs@gmail.com>
2024-07-10 12:17:22 +02:00
..
src/main refactor: move view type and drm in source (#3867) 2024-07-10 12:17:22 +02:00
.editorconfig chore: lint project (#3395) 2023-12-07 08:47:40 +01:00
build.gradle feat: add expo plugins (#3933) 2024-07-10 11:49:13 +02:00
gradle.properties feat(android): Bump default media3 version from v1.1.1 to v1.3.1 (#3977) ⚠️ need targetSdkVersion 34 2024-07-06 22:16:07 +02:00
lint.xml feat(android): bump media3 version from v1.1.1 to v1.2.0 (#3362) 2023-11-20 08:20:27 +01:00
README.md chore: move android-exoplayer to android folder 2022-06-15 22:30:24 +02:00

react-native-video - ExoPlayer

This is an Android React Native video component based on ExoPlayer v2.

ExoPlayer is an application level media player for Android. It provides an alternative to Androids MediaPlayer API for playing audio and video both locally and over the Internet. ExoPlayer supports features not currently supported by Androids MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks. Unlike the MediaPlayer API, ExoPlayer is easy to customize and extend, and can be updated through Play Store application updates.

https://github.com/google/ExoPlayer

Benefits over react-native-video@0.9.0:

  • Android Video library built by Google, with a lot of support
  • Supports DASH, HLS, & SmoothStreaming adaptive streams
  • Supports formats such as MP4, M4A, FMP4, WebM, MKV, MP3, Ogg, WAV, MPEG-TS, MPEG-PS, FLV and ADTS (AAC).
  • Fewer device specific issues
  • Highly customisable

ExoPlayer only props


  render() {
    return (
      <Video
        ...
        disableFocus={true} // disables audio focus and wake lock (default false)
        onAudioBecomingNoisy={this.onAudioBecomingNoisy} // Callback when audio is becoming noisy - should pause video
        onAudioFocusChanged={this.onAudioFocusChanged} // Callback when audio focus has been lost - pause if focus has been lost
      />
    )
  }

  onAudioBecomingNoisy = () => {
    this.setState({ pause: true })
  }

  onAudioFocusChanged = (event: { hasAudioFocus: boolean }) => {
    if (!this.state.paused && !event.hasAudioFocus) {
      this.setState({ paused: true })
    }
  }

Unimplemented props

  • Expansion file - source={{ mainVer: 1, patchVer: 0 }}