Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim mp As MediaPlayer
Dim mp1 As JavaObject
Dim Duration As JavaObject
Dim iv As ImageView
Dim snapshotParams As JavaObject
Dim form2 As Form
Dim b As Button
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
b.Initialize("b") ' button to trigger snapshot
b.Text = "snapshot"
form2.Initialize("",400,400) ' form to display the snapshot image
form2.SetOwner(MainForm)
mp.Initialize("mp",File.GetUri("the directory tree to the file","the name of the file.mp4")) ' address of file dir,filename
mp1.InitializeNewInstance("javafx.scene.media.MediaView",Array(mp))
Duration.InitializeNewInstance("javafx.util.Duration",Array(1000.00d*60.00D*5.00D)) ' 5 minutes into film
MainForm.RootPane.AddNode(mp1,10,50,400,300)
MainForm.RootPane.AddNode(b,0,0,100,30)
asJO(mp).RunMethod("setStartTime",Array(Duration)) ' jump to my start time
mp.play ' play the film
End Sub
Sub b_Click ' sub to grab snapshot
Dim im As JavaObject
im.InitializeNewInstance("javafx.scene.image.WritableImage",Array(200,100)) ' snapshot image 200,100
snapshotParams.InitializeNewInstance("javafx.scene.SnapshotParameters",Null) ' create default params
im = mp1.RunMethod("snapshot",Array(snapshotParams,Null))
iv.Initialize("") ' the imageview
iv.SetImage(im) ' load into imageview
form2.RootPane.AddNode(iv,0,0,200,100) ' add imageview to new form
form2.show ' show the form
End Sub
Sub asJO(o As JavaObject)As JavaObject
Return o
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub