AVPlayer stop UIActivityIndicator before playing

前端 未结 2 965
旧巷少年郎
旧巷少年郎 2021-01-21 16:06

I\'m trying to stop activityIndicator when AVPlayer start playing music, and also start activityIndicator when again AVPlayer start (loading, buffering). It little bit works, th

相关标签:
2条回答
  • 2021-01-21 16:55

    Regarding second problem i.e. "And also it not start again activityIndicator when it again (loading, buffering)"

    I think a workaround for that could be one of following:-

    a)

    func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath){
        print("You selected cell #\(indexPath.item)!")
    //Start activityView Animation when user clicks on any item which won't be buffered by default
    activityView.startAnimating()
    }
    

    or

    b)

    var selectIndex:Int = -1 {
    didSet {
          //Start activityView Animation when user clicks on any item which won't be buffered by default
          activityView.startAnimating()
           }
    }
    
    0 讨论(0)
  • 2021-01-21 16:58

    Well in your code, whenever a cell is pressed you have activityView.stopAnimating(). so no matter what, either the animation will start OR stop on click, depending if sender.selected == false

    So I think if you remove activityView.stopAnimating() then it will not stop animating so early. It's kind of hard to read your question and code as I am not sure exactly where the output is coming from.

    0 讨论(0)
提交回复
热议问题