MoviePlayer DropObject

Hi all,

I would like to load a video via the event DropObject of the control MoviePlayer under actual OS X and Win with XOJO 2016r2.1. But the event DropObject doesn’t fire.

First I tried into the event Open
me.AcceptFileDrop(“video/avi”)
me.AcceptFileDrop(“video/mpg”)
me.AcceptFileDrop(“video/MPG”)
me.AcceptFileDrop(“video/mpeg”)
me.AcceptFileDrop(“video/MPEG”)
me.AcceptFileDrop(“video/mp4”)
me.AcceptFileDrop(“video/quicktime”)

second try with
me.AcceptFileDrop(“video/???”)

and finally with
me.AcceptFileDrop("???")

Has anybody an idea what is going wrong?

I tried covering the control with a canvas, as receptor for dropped files. It works, at least on Mac.

Where do you put the me.AcceptFileDrop… lines ?

You have to put them in either the Window1.Open (not recommanded) or MoviePlayer.Open.

Read Control.Open , a redirect from MoviePlayer.Open.

Hello Emile,

i put the “me.AccepFileDrop” into the Open event of the MoviePlayer control

Hello Michel,
I will try to cover the MoviePlayer into a Canvas
…but I can try it either tomorrow or next week end

Code placed in Window1.Open and Window1.DropObj , in Canvas1, etc.: does not works when I drop an avi file.

avi files on OS X ???

So, I searched a different video file on my hd and found one MP4: it works fine as is, when dropped on the window !.

Same code in the MoviePlayer, the file is not accepted (a Break in DropEvent is not reached !).

Hello Emile,

AVI on OS X was just a try. In OS X I have had a BREAK into the event DropObject of my MoviePlayer control too and the break was never reached.

If the MoviePlayer has an event which becomes not activated may be it is an error into the control?

Hi Michael: I too do that and I too saw that. Since my last message, I go back home, eat, drink a glass of milk and… (read below)

My deepest feeling is that this is a bug: this was working on Real Studio and REALbasic.

Now, here how you can make that working:

  1. Add a ContainerControl to your navigation project,
    (the icon is like a plastic box used to store stuff in a refrigerator; it have a blue close box)

  2. Drag that in the window where your MoviePlayer resides,

  3. Cut and Paste the MoviePlayer from/to the window so the MoviePlayer is a “Child” of the ContainerControl,

  4. Put the code in the ContainerControl Event: Open and DropObject.

Run,

drop in the MoviePlayer your movie (I used two small mp4 files, what I had on hand) and enjoy.

For the record, here are the two events with code:

Sub Open() me.AcceptFileDrop("video/mp4") End Sub

Sub DropObject(obj As DragItem, action As Integer) If Obj.FolderItemAvailable Then MP_Video.Speaker = True MP_Video.HasStep = False MP_Video.Movie = Obj.FolderItem.OpenAsMovie MP_Video.Play End If End Sub

Michael (all), ask me if this is not crystal clear.

Warning: this offer is time limited (only some days: I have bad memory, so I will have troubles to help in some days)
;-:slight_smile:

Xojo 2015r1
OS X 10.11.6

Hi all,

and many thanks for the suggestions!

Indeed if the event is not consumed by the control, it works as well in the containerControl and Windows events. It is often the solution.

As far as I see, there is no bug report yet for MoviePlayer and DropObject. It would be nice to fill one.

Know I have into my window a page panel with three pages:
first is a text page
second is a page with a canvas
and the third is a page with a container control which covers the movie player.

But I think that the movie player control has some “dysfunctions”:
The open and the drop event is not working directly out of the control
and the events ConstructContextualMenu and ContextualMenuAction isn’t working directly out of the control.

But for my need I can replace these events with the events of the container control :wink:

No need for a container control. Placing the MoviePlayer over a Canvas works just fine. That is a lot simpler.

On Windows the bug does not exist, you can rely on the MoviePlayer events. Just make sure to use a FileTypes for AcceptDrop.

Do not follow this wrong advice.

If you really want to do that, be aware that any object (file, folder) you will drop on the Canvas will be accepted. In the Canvas Drop Event, you will have to add code to exclude say txt, sqlite, jpg, etc. dropped items !

Emile, stop being unpleasant like that. How dare you saying it is wrong advice. You are not improving with age.

Indeed on Mac the filter does not work, but that is the case as well of your no better, more complex, more convoluted (go figure) ContainerControl solution.

Simpler is always better. It prevent bugs and mental confusion.

On Windows the filter works perfectly, and is actually quite severe.

Now, let me ignore that rude individual…

You’re up today you left feet (like other days) ?

The advice I gave was not my advice, it is the one I get from Xojo years ago when I complained about the trouble I wrote above.

YOU have to stop. And this will give you plenty time to do what you complains in another conversation.

BTW: do you only know what the word respect means ?

I do not believe that.