Skip to content

Conversation

@aricodeine
Copy link
Contributor

@aricodeine aricodeine commented Jan 25, 2026

Type of change(s)

  • Bug fix
  • Feature / enhancement
  • Infrastructure / tooling (CI, build, deps, tests)
  • Documentation

What changed and why

  • Added no_sound icon to use for videos without an audio track

Tests performed

  • Tested on API 36.0 emulator

Preview

ignoreImageMinify

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator (if applicable).
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • All checks are passing.

@naveensingh naveensingh changed the title added no_sound icon for videos without an audio track feat: add no_sound icon for videos without an audio track Jan 25, 2026
Comment on lines 465 to 470
// Get the format of the first track in the group to check its type.
val format = group.getTrackFormat(0)
// Check if the MIME type is an audio type (e.g., "audio/mp4a-latm").
format.sampleMimeType?.startsWith("audio/") == true
}
} ?: false //
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
// Get the format of the first track in the group to check its type.
val format = group.getTrackFormat(0)
// Check if the MIME type is an audio type (e.g., "audio/mp4a-latm").
format.sampleMimeType?.startsWith("audio/") == true
}
} ?: false //
val format = group.getTrackFormat(0)
format.sampleMimeType?.startsWith("audio/") == true
}
} ?: false

Please avoid obvious comments. Are you using some AI coding agent?

Copy link
Contributor Author

@aricodeine aricodeine Jan 25, 2026

Choose a reason for hiding this comment

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

Sorry about that. Yes I am using Gemini on Android Studio. Will do the changes..

Copy link
Member

Choose a reason for hiding this comment

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

For your information, even the latest Gemini model has a high hallucination rate. As of now, AI code contributions are usually not accepted in Fossify (mentioned in the guidelines).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will keep that in mind, however, I don't copy paste the code without going through it. Will refrain from using the model here from now on :)

} ?: false //
if (!mHasAudio) {
binding.bottomVideoTimeHolder.videoToggleMute.setImageResource(R.drawable.no_sound)
binding.bottomVideoTimeHolder.videoToggleMute.isClickable = false
Copy link
Member

@naveensingh naveensingh Jan 25, 2026

Choose a reason for hiding this comment

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

It should show a toast instead, as I proposed here. That's more user-friendly in this case.

I like This video has no audio.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should show a toast instead, as I proposed here. That's more user-friendly in this case.

You are suggesting having the toast in addition to having the no_audio icon right? -> According to your comment here

Copy link
Member

Choose a reason for hiding this comment

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

Yes. The new icon + toast This video has no audio on click. We can still slightly reduce the alpha (MEDIUM_ALPHA) to get the disabled effect.

CHANGELOG.md Outdated
## [Unreleased]
### Added
- Long press gesture to play videos at 2x speed in separate video player ([#830])
- Added a dedicated icon for videos without an audio track ([#876])
Copy link
Member

Choose a reason for hiding this comment

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

It should go under the changed section:

Suggested change
- Added a dedicated icon for videos without an audio track ([#876])
### Changed
- Mute button is now disabled for videos without an audio track ([#876])

Comment on lines 1 to 11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M616,640L560,584L664,480L560,376L616,320L720,424L824,320L880,376L776,480L880,584L824,640L720,536L616,640ZM120,600L120,360L280,360L480,160L480,800L280,600L120,600ZM400,354L314,440L200,440L200,520L314,520L400,606L400,354ZM300,480L300,480L300,480L300,480L300,480L300,480Z"/>
</vector>
Copy link
Member

Choose a reason for hiding this comment

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

File should be named ic_vector_no_sound.xml. See guidelines.

Comment on lines 458 to 478
private fun checkAudioTrack() {
mHasAudio = mExoPlayer?.let { player ->
if (player.currentTracks.groups.isEmpty()) {
return@let false
}

player.currentTracks.groups.any { group ->
// Get the format of the first track in the group to check its type.
val format = group.getTrackFormat(0)
// Check if the MIME type is an audio type (e.g., "audio/mp4a-latm").
format.sampleMimeType?.startsWith("audio/") == true
}
} ?: false //
if (!mHasAudio) {
binding.bottomVideoTimeHolder.videoToggleMute.setImageResource(R.drawable.no_sound)
binding.bottomVideoTimeHolder.videoToggleMute.isClickable = false
}
}

private fun videoPrepared() {
checkAudioTrack()
Copy link
Member

Choose a reason for hiding this comment

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

It'll be simpler and more reliable to use the existing player listener:

			// add in initListeners()
            override fun onTracksChanged(tracks: Tracks) {
                updatePlayerMuteState(tracks.containsType(C.TRACK_TYPE_AUDIO))
            }

The click listener and updatePlayerMuteState() should be reworked to accept hasAudio and process the click as required (mute/unmute or show toast).

Comment on lines 696 to 700
if (!mHasAudio) {
binding.bottomVideoTimeHolder.videoToggleMute.setImageResource(R.drawable.no_sound)
binding.bottomVideoTimeHolder.videoToggleMute.isClickable = false
}

Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't be needed here with the listener based approach.

Comment on lines 889 to 909
private fun checkAudioTrack() {
mHasAudio = mExoPlayer?.let { player ->
if (player.currentTracks.groups.isEmpty()) {
return@let false
}

player.currentTracks.groups.any { group ->
// Get the format of the first track in the group to check its type.
val format = group.getTrackFormat(0)
// Check if the MIME type is an audio type (e.g., "audio/mp4a-latm").
format.sampleMimeType?.startsWith("audio/") == true
}
} ?: false //
if (!mHasAudio) {
binding.bottomVideoTimeHolder.videoToggleMute.setImageResource(R.drawable.no_sound)
binding.bottomVideoTimeHolder.videoToggleMute.isClickable = false
}
}

private fun videoPrepared() {
checkAudioTrack()
Copy link
Member

Choose a reason for hiding this comment

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

Same suggestions as the VideoPlayerActivity.

@aricodeine
Copy link
Contributor Author

aricodeine commented Jan 25, 2026

@naveensingh done with the changes, I didn't know if the new string property should be in strings.xml, can move it if needed.

Comment on lines 299 to 301

<!-- Player-->
<string name="video_no_sound">This video has no sound</string>
Copy link
Member

Choose a reason for hiding this comment

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

Please move this section above the FAQ related strings.

I think "audio" fits better than "sound".

Suggested change
<!-- Player-->
<string name="video_no_sound">This video has no sound</string>
<!-- Player-->
<string name="video_no_sound">This video has no audio</string>

Comment on lines 511 to 516
if (!mWasVideoStarted) {
if (!mHasAudio) {
toast(R.string.video_no_sound)
}
}

Copy link
Member

Choose a reason for hiding this comment

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

By toast on click, I meant we should show a toast when there is no audio and the mute button is clicked. More info in #881 (comment).

Copy link
Contributor Author

@aricodeine aricodeine Jan 25, 2026

Choose a reason for hiding this comment

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

By toast on click, I meant we should show a toast when there is no audio and the mute button is clicked. More info in #881 (comment).

done, it will now show the toast only when the mute button is clicked, provided video was started previously in the same player session

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.

Gray Out Audio Icon (Mute Button) When Video Contains No Sound

2 participants