I have a window with a movieplayer on it. I’m able to load a movie file into the movie property and to set it’s position to 10 seconds with the Position Method. Now I want to copy the picture shown into a canvas.
My idea was to use the Movieplayer.copy method to copy it to the clipboard to be able to paste it in a canvas. But the copy method returns nothing into the clipboard.

What do I miss here?

What OS targets are you working for?

To get the image you need to open the file as an EditableMovie, which unfortunately is deprecated and crashes Cocoa. Here’s some example code that works in Carbon (maybe Windows?).

[code]//load up editable movie
Sub Action()
dim f As FolderItem = GetOpenFolderItem("") //you may need a filetype here
if f = nil then return

dim em As EditableMovie = f.OpenEditableMovie
if em = nil then
MsgBox “not a movie?”

MoviePlayer1.Movie = em

End Sub

//assign current image to canvas’s backdrop
Sub Action()

dim p As Picture, em As EditableMovie

em = EditableMovie(MoviePlayer1.Movie) //cast to editablemovie

em.Position = MoviePlayer1.Position //copy position (always necessary?)

p = em.Picture //get image at current position

Canvas1.Backdrop = p

End Sub[/code]

The retrieved image will be the same size as what’s shown in the player. So if the player is scaled or distorted the image is the same. To do better I think will take declares or there’s probably plugins.

OK, for Cocoa I see in macoslib: Cocoa.QTKit.QTMovie.FrameImage(time) As NSImage

Thanks for your reply.
I target Cocoa, and I’m not able to use editablemovie. I just thought that movieplayer.copy should work. If not, why is it there?
Using declares is above my level of knowledge. I already used some declares that were completely described for usage in Xojo and it worked fine, but I’m not able to write this myself :frowning:

Copy() works with SelStart and SelLength to produce some sort of video clip, not a Picture. Haven’t used it much but here’s an example that repeats the 5 seconds after the current position.

[code]Sub Action()

MoviePlayer1.EditingEnabled = true

//select from current position out 5 seconds
MoviePlayer1.SelStart = MoviePlayer1.Position
MoviePlayer1.SelLength = 5.0

MoviePlayer1.Copy //copy that video

MoviePlayer1.SelLength = 0.0 //clear selection range

MoviePlayer1.Paste //paste video

//position gets moved to end of pasted range, move back
MoviePlayer1.Position = MoviePlayer1.Position - 5.0

End Sub[/code]

As far as declares, I had the assumption a QTKit.QTMovie could be made from Movie.Handle. That’s not there and simply using Movie.Handle as the QTMovies id instance Ptr doesn’t work. You can create a QTMovie from a FolderItem though so I think you might be able to open the file as both Movie and QTMovie, one for playing, one for getting pictures. Something like…

[code]//when you open a file create a QTMovie too
parallelQTMovie = QTKit.QTMovie.LoadFromFile(theMovieFile)

//then to get a Picture at current position…

parallelQTMovie.Time = MoviePlayer1.Position

dim p As Picture = parallelQTMovie.FrameImage.MakePicture[/code]

This is if it’s valid to open a file twice like this. If not there’s a player as part of QTKit, you could rebuild around that instead of Movie+MoviePlayer. The only other option is plugins, MBS I’m sure but I think there might be others.

OK. Thank you. I will not reinvent the wheel and I’ve found a doable and easy solution. My client has folders full of movies and someones two or three times with different names or encodings. He wanted a solution to view a poster at a certain time f.ex 15 secs (as the beginning is often a black screen) to compare them and find duplicates. Duplicate scanners often do not work as the encodings are different.
I told him to buy Thumbs, an app for 9.99$. It creates pictures of the movie at a given timestamp and saves them to a folder. Now he can view the in icon view in the Finder and find duplicates.

That’s fine, but it’s a shame that Xojo aborted editablemovie.