Open NobleMathews opened 3 months ago
To address the incorrect remaining time displayed above the progress bar during the buffering state, follow these steps:
updateTransportBarPosition
method to include a check for the buffering state. If the player is buffering, display a placeholder or loading indicator instead of the incorrect remaining time.- (void)updateTransportBarPosition
{
VLCPlaybackService *controller = [VLCPlaybackService sharedInstance];
VLCTransportBar *transportBar = self.transportBar;
if (controller.mediaPlayer.state == VLCMediaPlayerStateBuffering) {
transportBar.remainingTimeLabel.text = NSLocalizedString(@"Buffering...", nil);
} else {
transportBar.remainingTimeLabel.text = [[controller remainingTime] stringValue];
}
transportBar.markerTimeLabel.text = [[controller playedTime] stringValue];
transportBar.playbackFraction = controller.playbackPosition;
}
playbackPositionUpdated:
method to ensure it does not update the remaining time UI during buffering. Instead, it should only call updateTransportBarPosition
when the bottom overlay is visible and not in a buffering state.- (void)playbackPositionUpdated:(VLCPlaybackService *)controller
{
[self updateActivityIndicatorForState:controller.mediaPlayer.state];
if (self.bottomOverlayView.alpha != 0.0) {
[self updateTransportBarPosition];
}
}
remainingTime
method in VLCPlaybackService
to ensure it calculates the correct remaining time during buffering. If necessary, implement adjustments to handle the buffering state appropriately. The code snippet for this step is not provided as the implementation details of remainingTime
are not available.Remember to use the NSLocalizedString
function for the buffering placeholder text to support localization, and ensure that the VLCMediaPlayerStateBuffering
constant is correctly referenced according to the VLC-iOS project's conventions.
Sources/Playback/Player/VideoPlayer-tvOS/VLCFullscreenMovieTVViewController.m:953-1046 | Contains logic for updating remaining time and playback position, which is relevant to the issue.
Sources/Playback/Control/VLCPlaybackService.m:158-1636 | Includes playback service methods that may affect the remaining time display.
Sources/Playback/Player/VideoPlayer-tvOS/VLCTransportBar.m:103-234 | Handles playback and buffering progress, directly related to the progress bar issue.
Sources/[UI Elements](https://github.com/Mayil-AI-Sandbox/vlc-ios/tree/45901f3ebcd1809c07118666271dcf1aeac36b50/Sources/UI Elements)/[Progress Indicators](https://github.com/Mayil-AI-Sandbox/vlc-ios/tree/45901f3ebcd1809c07118666271dcf1aeac36b50/Sources/UI Elements/Progress Indicators)/[VLCProgressView.m](https://github.com/Mayil-AI-Sandbox/vlc-ios/tree/45901f3ebcd1809c07118666271dcf1aeac36b50/Sources/UI Elements/Progress Indicators/VLCProgressView.m):[1-52](https://github.com/Mayil-AI-Sandbox/vlc-ios/tree/45901f3ebcd1809c07118666271dcf1aeac36b50/Sources/UI Elements/Progress Indicators/VLCProgressView.m#L1-L52) | Defines progress view UI, which may need updates to fix the remaining time display.
Sources/Cloud/Services/OneDrive/VLCOneDriveController.m:474-530 | Manages progress updates and remaining time calculations, potentially useful for resolving the issue.
To address the incorrect remaining time displayed above the progress bar in the iOS mobile app during the buffering state, follow these steps:
Implement a check to ensure that the remaining time is only updated after the media duration is known. This can be done by adding a condition in the method that updates the remaining time.
Modify the updateTime:
method in VLCProgressView.m
to include a validation check for the time value before updating the progress label. Here's a code snippet to illustrate this:
- (void)updateTime:(NSString *)time {
if (timeIsValid(time)) { // Replace timeIsValid with the actual validation method
[self.progressLabel setText:[NSString stringWithFormat:NSLocalizedString(@"REMAINING_TIME", nil), time]];
CGSize size = [self.progressLabel.text sizeWithAttributes:self.progressLabel.font.fontDescriptor.fontAttributes];
[self.progressLabel setFrame:CGRectMake(self.progressLabel.frame.origin.x, self.progressLabel.frame.origin.y, size.width, size.height)];
}
}
In the method that calls updateTime:
, add a condition to check if the media duration is greater than zero, indicating that the duration is known and the playback has likely started. Here's an example code snippet:
// This should be placed in the appropriate caller method, such as in VLCPlaybackService.m
- (void)updateProgressViewTime {
if (self.mediaDuration > 0) { // Ensure media duration is known
NSString *remainingTime = [self calculateRemainingTime]; // Replace with the actual method to calculate remaining time
[self.progressView updateTime:remainingTime];
}
}
Please note that the methods timeIsValid
and calculateRemainingTime
are hypothetical and should be replaced with the actual methods used in your codebase to validate the time value and calculate the remaining time. The provided code snippets are conceptual and should be adapted to fit the actual implementation details of your application.
Sources/UI Elements/Progress Indicators/VLCProgressView.m:1-52 | Contains VLCProgressView implementation, including updateTime method to be modified for time validation.
Sources/Playback/Control/VLCPlaybackService.m:44-1636 | Includes VLCPlaybackService with media duration and playback update logic, relevant for adding duration check.
Sources/Playback/Player/VideoPlayer-tvOS/VLCTransportBar.h:1-36 | The VLCTransportBar class includes properties for remaining time and may provide additional context or methods that are relevant to the issue of incorrect time display above the progress bar.
Sources/UI Elements/Progress Indicators/VLCProgressView.h:1-22 | The header file for VLCProgressView class is relevant as it provides the structure of the progress view component, which includes the updateTime method that needs to be modified according to the RESPONSE.
💡 To rerun Mayil, comment mayil-ai rerun
on this issue. Mayil will incorporate any new context added to the ticket. For specific guidance, include additional details in your rerun comment!
The remaining time displayed above the progress bar does not display the correct value when the playback starts. It seems that the issue happens during the buffering state: