Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add now playing info for video #1324

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Matthieu-dgl
Copy link
Contributor

No description provided.

@Matthieu-dgl Matthieu-dgl self-assigned this Oct 15, 2024
@Matthieu-dgl Matthieu-dgl changed the title Feat add now playing info for video feat: Add now playing info for video Oct 15, 2024
@Matthieu-dgl Matthieu-dgl marked this pull request as draft October 15, 2024 13:20
@Matthieu-dgl Matthieu-dgl marked this pull request as ready for review October 16, 2024 06:43
@Matthieu-dgl Matthieu-dgl force-pushed the feat-add-now-playing-info-for-video branch 3 times, most recently from 696ce86 to c92cac3 Compare October 18, 2024 08:20
Copy link
Member

@PhilippeWeidmann PhilippeWeidmann left a comment

Choose a reason for hiding this comment

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

You only observe .AVPlayerItemDidPlayToEndTime.
This only set the correct metadata at the end of the track.

Maybe try to also remove MPMediaItemPropertyPlaybackDuration and MPNowPlayingInfoPropertyElapsedPlaybackTime because they should be set by the VideoPlayer

@Matthieu-dgl Matthieu-dgl force-pushed the feat-add-now-playing-info-for-video branch 2 times, most recently from ba1c29c to 0181d06 Compare November 4, 2024 05:40
@Matthieu-dgl
Copy link
Contributor Author

There's always the problem that the video title appears for 1 second and then disappears in the notfication. I'm open to an idea!

Copy link
Contributor

@adrien-coye adrien-coye left a comment

Choose a reason for hiding this comment

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

I'll check the 1 second and then disappears asap.

I'll check the "Title jumps glitch" asap

kDrive/UI/View/Files/Preview/VideoCollectionViewCell.swift Outdated Show resolved Hide resolved
Copy link
Contributor

@adrien-coye adrien-coye left a comment

Choose a reason for hiding this comment

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

I have a couple of small remarks regarding the VideoPlayer.

I don't think your branch can build right now. We usually try to have branches that can build even if the app is broken.

import MediaPlayer
import UIKit

class VideoPlayer {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since VideoPlayer is now in Core you need to make it a public type.
You could build a protocol with all the public properties you want to use from the outside.

}

@IBAction func playVideoPressed(_ sender: Any) {
guard let player else { return }
guard let player = videoPlayer?.avPlayer else {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not found of exposing directly the AVPlayer in the cell.
It goes against encapsulation, I would rather use a mechanism for decoupling (like Combine in the SingleTrackPlayer)

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed, you can use this in VideoPlayer to remove the property avPlayer

    public lazy var playerViewController: AVPlayerViewController = {
        let playerViewController = AVPlayerViewController()
        playerViewController.player = self.player
        return playerViewController
    }()

}
}

private func presentVideoPlayer(navController: VideoPlayerNavigationController,
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like it is an unused method. Should we remove it ?

@adrien-coye
Copy link
Contributor

As a "nice to have", we could also set a thumbnail. We already have one, it should be straight forward.

return player.currentTime().seconds / currentItem.duration.seconds
}

init(file: File, driveFileManager: DriveFileManager) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
init(file: File, driveFileManager: DriveFileManager) {
init(frozenFile: File, driveFileManager: DriveFileManager) {

It looks like we use a frozenFile, therefore you can rename the parameter.

@Matthieu-dgl Matthieu-dgl force-pushed the feat-add-now-playing-info-for-video branch from 1c00484 to 3bd12ae Compare November 18, 2024 05:46
Copy link

sonarcloud bot commented Nov 18, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
12.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

3 participants