-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Task #6697] offline music #10
base: master
Are you sure you want to change the base?
Conversation
ready |
} | ||
|
||
private func setupViews() { | ||
navigationItem.title = NavigationConstant.offlineMusicNavItemTitle | ||
tableView.then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tableView.then { | |
tableView.do { |
|
||
private func getLocalMusic() { | ||
let secondQuery = MPMediaQuery.songs() | ||
guard let result = secondQuery.collections else { return } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guard let result = secondQuery.collections else { return } | |
guard let result = MPMediaQuery.songs().collections else { return } |
musicPlayer.index = 0 | ||
musicPlayer.stop() | ||
let url = musicPlayer.prepare(index: 0) | ||
musicPlayer.play(url: url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chỉ gọi method play() còn các method khác để trước khi play thì bỏ vào method play() của MediaManager
guard let result = secondQuery.collections else { return } | ||
for item in result { | ||
let track = Track() | ||
guard let representativeItem = item.representativeItem else { return } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Đưa lên trên cùng
musicPlayer.index = indexPath.row - 1 | ||
musicPlayer.stop() | ||
let streamUrl = musicPlayer.prepare(index: musicPlayer.index) | ||
musicPlayer.play(url: streamUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chỉ gọi method play() còn các method khác để trước khi play thì bỏ vào method play() của MediaManager
} | ||
|
||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
if indexPath.row > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nếu click lại vào bài đang chạy thì nó hiển thị player lên thôi chứ không chạy lại bài hát
[Pull request title]
Offline Music
[Redmine link]
https://edu-redmine.framgia.vn/issues/6697
Screenshots (nếu có)