ios - How to stop downloading a youtube video in XCDYouTubeClient? [Swift] -


i'm making job company requires user view videos youtube. has player, , i'm using xcdyoutubeclient download videos, if tap on cancel button, ios continues downloading video, consuming user data plan unnecessarily. here's code far:

xcdyoutubeclient.defaultclient().getvideowithidentifier(videoid) { [weak playerviewcontroller] (video: xcdyoutubevideo?, error: nserror?) in             if let streamurl = (video?.streamurls[xcdyoutubevideoqualityhttplivestreaming] ??                 video?.streamurls[xcdyoutubevideoquality.hd720.rawvalue] ??                 video?.streamurls[xcdyoutubevideoquality.medium360.rawvalue] ??                 video?.streamurls[xcdyoutubevideoquality.small240.rawvalue]) {                     //play video                     }             } else {                 //dismiss player             }         } 

then have function when user press cancel:

func playerdonebuttontouched() {     //dismiss player } 

i belive in function need have code stop downloading.

thanks (:


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -