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

[Task #6697] offline music #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thanhhvt
Copy link
Collaborator

@thanhhvt thanhhvt commented Mar 6, 2019

[Pull request title]

Offline Music

[Redmine link]

https://edu-redmine.framgia.vn/issues/6697

Screenshots (nếu có)

@thanhhvt
Copy link
Collaborator Author

thanhhvt commented Mar 6, 2019

ready

}

private func setupViews() {
navigationItem.title = NavigationConstant.offlineMusicNavItemTitle
tableView.then {
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
tableView.then {
tableView.do {


private func getLocalMusic() {
let secondQuery = MPMediaQuery.songs()
guard let result = secondQuery.collections else { return }
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
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)
Copy link
Contributor

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 }
Copy link
Contributor

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)
Copy link
Contributor

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 {
Copy link
Contributor

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

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.

2 participants