I need to implement music player using AV Player in SWIFT

自闭症网瘾萝莉.ら 提交于 2019-12-13 09:44:58

问题


I need to implement streaming music player using AV Player in SWIFT

that music file Stored in server.Please help me to any one..How to implement this one


回答1:


According to this: http://www.techotopia.com/index.php/IOS_8_Video_Playback_using_AVPlayer_and_AVPlayerViewController

You could add following code in your ViewController, like viewDidLoad method or viewWillAppear, depends on the view will show repeatedly or not. If Yes, add it in the viewWillAppear method.

let player = AVPlayer(URL: url)
let playerController = AVPlayerViewController()

playerController.player = player
self.addChildViewController(playerController)
self.view.addSubview(playerController.view)
playerController.view.frame = self.view.frame

player.play()


来源:https://stackoverflow.com/questions/31427763/i-need-to-implement-music-player-using-av-player-in-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!