A while back I enquirer on here about how to get a video to play. I was given a link and used it. I have figured out how to get the video to show, but I need a way to have buttons play, pause, go to the beginning or go to the end.
def showVideo(video, viewToShowOn):
i=AVPlayerItem.playerItemWithAsset_(video)
p=AVPlayer.playerWithPlayerItem_(i)
name = str(i)
videolayer=AVPlayerLayer.playerLayerWithPlayer_(p)
V=ObjCInstance(viewToShowOn)
videolayer.frame=V.bounds()
V.layer().addSublayer_(videolayer)
This is the function I use to set the video. How would I go about calling that layer to use the play? Here is the link I was given to add the video.
https://gist.github.com/3e708b73a04e5fc2e04569d9556198e3https://gist.github.com/3e708b73a
I need to set up a button to play. But I don’t know how to call the player to have it play from outside the showVideo() function