Skip to content

[video_player_avplay] Fixed an issue where subtitles for content with pre-roll/insesrted ads in DASH could not be rendered.#1007

Open
gin7773 wants to merge 5 commits intoflutter-tizen:masterfrom
gin7773:subtitle_issue03
Open

[video_player_avplay] Fixed an issue where subtitles for content with pre-roll/insesrted ads in DASH could not be rendered.#1007
gin7773 wants to merge 5 commits intoflutter-tizen:masterfrom
gin7773:subtitle_issue03

Conversation

@gin7773
Copy link
Copy Markdown
Contributor

@gin7773 gin7773 commented Apr 20, 2026

No description provided.

@gin7773 gin7773 marked this pull request as draft April 20, 2026 09:34
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the caption selection logic in video_player.dart to include start-time checks for both text and picture captions. A logic error was identified in the picture caption implementation where the greater-than operator was used instead of the less-than operator for the start time check, which would cause captions to be hidden incorrectly during their display window.

Comment thread packages/video_player_avplay/lib/video_player.dart Outdated
@gin7773 gin7773 marked this pull request as ready for review April 23, 2026 10:52
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the video_player_avplay package to version 0.8.8 and modifies the _currentCaptions getter to prevent subtitle rendering when the playback position is before the caption start time. Feedback identifies critical safety issues where the new conditional checks could cause runtime crashes due to null or empty list access, and notes that similar logic in other methods remains inconsistent. Additionally, a typo was found in the changelog.

Comment on lines 204 to +206
(captions.textCaptions == <TextCaption>[TextCaption.none] ||
position > captions.textCaptions![0].end)
position > captions.textCaptions![0].end ||
position < captions.textCaptions![0].start)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The conditional check for textCaptions is unsafe and potentially incorrect for several reasons:

  1. Null/Empty Safety: If captions.textCaptions is null or an empty list, accessing [0] will cause a runtime crash. The current check captions.textCaptions == <TextCaption>[TextCaption.none] is also unreliable in Dart as it performs a reference comparison on a new list literal, which will likely evaluate to false even if the contents are identical.
  2. Logic Inconsistency: This fix only addresses _currentCaptions. However, _getCaptionAt (line 1159) appears to have identical logic that was not updated in this PR. Since _updatePosition relies on _getCaptionAt, the issue with subtitles being rendered outside their time range might persist during normal playback updates.

Consider using a more robust check that handles null/empty cases and ensures consistency across the file.

Suggested change
(captions.textCaptions == <TextCaption>[TextCaption.none] ||
position > captions.textCaptions![0].end)
position > captions.textCaptions![0].end ||
position < captions.textCaptions![0].start)
(captions.textCaptions == null ||
captions.textCaptions!.isEmpty ||
captions.textCaptions![0] == TextCaption.none ||
position > captions.textCaptions![0].end ||
position < captions.textCaptions![0].start)

Comment on lines 210 to +212
(captions.pictureCaption == PictureCaption.none ||
position > captions.pictureCaption!.end)
position > captions.pictureCaption!.end ||
position < captions.pictureCaption!.start)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This check is unsafe if captions.pictureCaption is null. Accessing .end or .start will result in a crash. Also, ensure this logic is synchronized with _getPictureCaptionAt (line 1179) for consistency.

Suggested change
(captions.pictureCaption == PictureCaption.none ||
position > captions.pictureCaption!.end)
position > captions.pictureCaption!.end ||
position < captions.pictureCaption!.start)
(captions.pictureCaption == null ||
captions.pictureCaption == PictureCaption.none ||
position > captions.pictureCaption!.end ||
position < captions.pictureCaption!.start)


* Update the conditional statement for the `_currentCaptions`.
* Update plusplayer
1. [DASH] Fix the issue where subtitles for content with pre-roll/insesrted ads in DASH could not be rendered.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Typo: "insesrted" should be "inserted".

Suggested change
1. [DASH] Fix the issue where subtitles for content with pre-roll/insesrted ads in DASH could not be rendered.
1. [DASH] Fix the issue where subtitles for content with pre-roll/inserted ads in DASH could not be rendered.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant