Skip to content

Build error on 1.19.2 #410

Description

@XChikuX
> Task :react-native-compressor:compileDebugKotlin FAILED
e: file:///home/expo/workingdir/build/node_modules/react-native-compressor/android/src/main/java/com/reactnativecompressor/Video/VideoCompressor/compressor/Compressor.kt:794:9 Unresolved reference 'ensureDecodableVideoFormat'.

I don't think the latest push was build checked properly

Activity

  1. zhuminjunivan commented on Jun 29, 2026

    @zhuminjunivan

    no ensureDecodableVideoFormat import。
    android/src/main/java/com/reactnativecompressor/Video/VideoCompressor/utils/CompressorUtils.kt missing
    `// MIME type reported by MediaExtractor for Dolby Vision tracks (e.g. iPhone .MOV files)
    private const val MIMETYPE_VIDEO_DOLBY_VISION = "video/dolby-vision"

    /**

    • Check whether the device exposes a decoder for the given MIME type.
      */
      private fun hasDecoderForMime(mime: String): Boolean {
      val codecList = MediaCodecList(MediaCodecList.REGULAR_CODECS)
      for (codec in codecList.codecInfos) {
      if (codec.isEncoder) continue
      for (type in codec.supportedTypes) {
      if (type.equals(mime, ignoreCase = true)) return true
      }
      }
      return false
      }

    /**

    • Resolve the backward-compatible base-layer MIME type for a Dolby Vision track.
    • Dolby Vision profiles 8.x (DvheSt) and 4 (DvheDtr) carry an HEVC base layer, and
    • profile 9 (DvavSe) carries an AVC base layer; these can be decoded by the standard
    • HEVC/AVC decoders. Profiles 5 (DvheStn) and 7 (DvheDtb) have no usable single base
    • layer, so they return null. When the profile is unknown we assume HEVC, which covers
    • the common consumer case (e.g. iPhone records Dolby Vision profile 8).
      */
      private fun dolbyVisionBaseLayerMime(inputFormat: MediaFormat): String? {
      if (!inputFormat.containsKey(MediaFormat.KEY_PROFILE)) {
      return MediaFormat.MIMETYPE_VIDEO_HEVC
      }
      return when (inputFormat.getInteger(MediaFormat.KEY_PROFILE)) {
      MediaCodecInfo.CodecProfileLevel.DolbyVisionProfileDvavSe -> MediaFormat.MIMETYPE_VIDEO_AVC
      MediaCodecInfo.CodecProfileLevel.DolbyVisionProfileDvheSt,
      MediaCodecInfo.CodecProfileLevel.DolbyVisionProfileDvheDtr -> MediaFormat.MIMETYPE_VIDEO_HEVC
      else -> null
      }
      }

    /**

    • Ensure the input video format can be decoded on this device.
    • Some containers (notably iPhone .MOV files) expose the video track as
    • video/dolby-vision. Many Android devices have no Dolby Vision decoder, so
    • MediaCodec.createDecoderByType("video/dolby-vision") fails with NAME_NOT_FOUND.
    • When the dedicated decoder is missing but the stream carries a backward-compatible
    • base layer, this rewrites the format MIME to the base-layer codec so the standard
    • HEVC/AVC decoder can decode it. If no compatible decoder exists, it throws a clear
    • error instead of letting the cryptic native failure surface (see issue Android: .MOV video compression fails with Failed to initialize video/dolby-vision #398).
      */
      fun ensureDecodableVideoFormat(inputFormat: MediaFormat) {
      val mime = inputFormat.getString(MediaFormat.KEY_MIME) ?: return
      if (hasDecoderForMime(mime)) return
    if (mime.equals(MIMETYPE_VIDEO_DOLBY_VISION, ignoreCase = true)) {
      val fallbackMime = dolbyVisionBaseLayerMime(inputFormat)
      if (fallbackMime != null && hasDecoderForMime(fallbackMime)) {
        Log.w(
          "Compressor",
          "No Dolby Vision decoder on this device; decoding the $fallbackMime base layer instead."
        )
        inputFormat.setString(MediaFormat.KEY_MIME, fallbackMime)
        return
      }
      throw IllegalStateException(
        "This video uses Dolby Vision, which is not supported by this device's decoders " +
          "and has no backward-compatible base layer to fall back to."
      )
    }
    
    throw IllegalStateException("No decoder available for video format: $mime")
    

    }
    }`

  2. XChikuX commented on Jun 29, 2026

    @XChikuX
    ContributorAuthor

    @numandev1 Please fix and issue an update to v1

  3. XChikuX commented on Jun 29, 2026

    @XChikuX
    ContributorAuthor

    Last working build for v1 for those who are interested is 1.19.0

  4. XChikuX commented on Jul 14, 2026

    @XChikuX
    ContributorAuthor

    @numandev1

    I have pushed #413. Can we please merge it onto the 1.19.2 branch.
    So you can upload a new version in the v1 series.

    Thanks!

  5. XChikuX commented on Jul 22, 2026

    @XChikuX
    ContributorAuthor

    1.19.4 Builds with no issue.

    Safe to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions