iOS Question [ Solved ] Stop (not pause) the video player?

Sasuke Sama

Active Member
Licensed User
im using the video player from the iui8 to play http mp4 videos and it works great but when i go to another page the player still plays the video and buffur it
i tried to use videoplayer1.pause which pause the video put not stopping it so it stilss buffur in the background and when opening another video both of the new and the old one keeps on buffuring
i need something like videoplayer1.stop or somthing that dose the same
Thanx
 

Sasuke Sama

Active Member
Licensed User
There is no Stop method in AVPlayer. You are supposed to pause it.
Another option is to reuse the same player in both pages.
Yes i tried to reuse it but when i load a new url in the player the old one keeps playing and buffering and eating the internet :( even removing the video player view didnt help
 
Upvote 0

Sasuke Sama

Active Member
Licensed User
Try this:
B4X:
Dim no As NativePlayer = VideoPlayer1
no.GetField("controller").GetField("player).RunMethod("replaceCurrentItemWithPlayerItem:", Array(Null))
the code dosent work im getting an error "unkonown type NativePlayer"
but i solved it with this code
B4X:
Sub pg_Disappear
    VideoPlayer1.LoadVideo(File.DirAssets,"video.mp4")
    VideoPlayer1.Position=VideoPlayer1.Duration
End Sub
i have add a small dummy video file that lods when the page closed then set it to the end this will override the last value in the player and solve the issue
 
Upvote 0
Top