I'm trying to achieve a small app where you download an MP4 video in background on the watch, and play once downloaded.
Using WKInterfaceMovie.setVideoURL works well with an https link, but I want to customize the loading UI.
After downloading the video file, I move it to a shared group :
originalURL : Optional("/private/var/mobile/Containers/Data/PluginKitPlugin/FD57E33D-4657-497B-9823-A53D289CDF0B/Library/Caches/com.apple.nsurlsessiond/Downloads/com.test.TestWatchVideo.watchkitapp.watchkitextension/CFNetworkDownload_jKLIrU.tmp")
destinationURL : Optional("/private/var/mobile/Containers/Shared/AppGroup/018DA2BA-EB53-45DA-B3EA-792D4879E601/Library/Caches/SampleVideo_360x240_1mb.mp4")
I'm using removeItemAtURL
( if old file exist ) then copyItemAtURL
to move the original file.
=> BUT when trying presentMediaPlayerControllerWithURL
, it dismisses before playing video and says :
Error: Error Domain=com.apple.watchkit.errors Code=4 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (1), NSUnderlyingError=0x16d71f20 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}, NSLocalizedDescription=The operation could not be completed}
I've read quite a few threads on StackOverflow and Forums, and none have helped me.
Thanks !