I've not found any answer in the Forum to this, what I thought would be a common question, but apologies if I've not had a thorough look.
I have some code in a legacy project which plays a video file:
B4X:
Dim mp As MediaPlayer
Dim mv As JavaObject
Dim MediaViewNode As Node
mp.Initialize("mp",File.GetUri(p,n))
mv.InitializeNewInstance("javafx.scene.media.MediaView",Array(mp))
MediaViewNode = mv
Display.fullPane.AddNode(MediaViewNode,0,0,-1,-1)
mp.play
MediaViewNode.Visible = True
There is other code which adjusts the location of the node (MediaViewNode) and size of the JavaObject (mv) to suit various circumstances.
Now I want to be able to load a sequence of other video files following completion of the originally loaded video file.
However I cannot see how I can just load the next file and play it. It seems I must create a new instance of the MediaPlayer and JavaObject for each new file and this is inconvenient because I have to resize the JavaObject and remove / relocate the MediaViewNode to match that previously used. It would be far better if I could use the existing instances and just point to the new file, but this may not be possible.
MediaView has a setMediaPlayer method, so you may be able to reuse the existing mediaview on a new mediaplayer. Docs are here. I can't see that they say you can't.
I know how to play mp4 with mediaplayer. and before play it. you need initiate it with the filename. but how can I change the file to another when it playing. For example Dim m As MediaPlayer Dim mv As JavaObject m.Initialize("m",File.GetUri(File.DirApp ,"qd.mp4"))...
Thank you @stevel05 and @Omar Parra A. for pointing me in the direction of the setMediaPlayer method. I'll now incorporate that into my code and I'll close out this thread once I confirm it's successful.