Play a .mov video in MoviePlayer!

Hello everyone,
I only have sound unfortunately!
mp4 playback is fine.
What can I do?
Is it possible to convert to mp4 with xojo?
Thank you for your help.

Does the video work on other playback applications on your machine? For example on Mac there is a quicktime player. If the video plays in that then it should play in MoviePlayer. If it doesn’t then you likely need a codec for the video to work.

To give some background MP4 is a container file format. Within it you can have a video stream and multiple audio streams. Each of these can be in all one of many of formats and each has its own codec to enabled playback. Some codecs are provided as standard, such as the generic mp4 video codec.

You can either obtain the correct codec or convert the video to use a new format. There is a program called Handbrake which can handle most video conversions required. It is free and available on Mac, Windows and Linux.

Loading the MP4 file into Handbrake will also tell you which codecs are being used. Most modern versions of each OS comes with stock MP4 codec. There are others like VOB and ORBIS which aren’t as common but liked by the free somewhere advocates. These typically need to be installed on each platform you are going to play the video on.

Oui la vidéo est lue sur mon mac avec quicktime player
La vidéo uploadée doit être lue juste après par mon appli xojo
Je ne peux pas faire une conversion manuelle
Quel moyen existe t il ? soit pour une conversion en interne avec une classe ou autre moyen…?
Merci.

Standard Xojo will not do video conversion. There could be an MBS or other 3rd party solution. However, video conversion is a slow process, it can take more time to convert than the duration of the video. For example a 1 hour video can take longer than 1 hour to convert.

Is this a web project or a desktop one. With you saying upload it makes me think it is Web. If it is web then does the video play if you drop it on your web browser?

The video is saved in a .mov directory and my desktop app will immediately play this video…
I’m looking at MBS to see if there’s a way with one of their classes.

Xojo’s movie player control should play the video.

But mov is a container, which can have video streams of different codecs. If you have a codec in the file, which your computer doesn’t have, you can’t play it.

Our AVPlayerViewControlMBS control may help as an alternative for macOS.

1 Like

Thank you very much Christian for your quick feedback
Your example works, which allows me to play my video in .MOV
I try to put it in my code but I get an error, I don’t know why!

Looks like you didn’t copy PlayerWindow.

1 Like

Yes! here’s the right code
But how can I start playing the video automatically and wait until the end of the video to exit the condition? Thanks for your help.
I’ve noticed that it deletes all canvas on the same window!

If picFolder <> Nil Then

Dim p As Picture
If nb > picFolder.Count-1 Then nb=0

nb = nb+1
Window2.Label2PhotosTotal.Text=picFolder.Count.ToString

f = picFolder.Item(nb)

dim player as new AVPlayerMBS(f )
dim w as new Window1

If f.Name.Right(5)=“.jpeg” or f.Name.Right(4)=“.jpg” or f.Name.Right(4)=“.png” Then

Var p2 As Picture = ProportionalScale(Picture.Open(f),Canvas1.Width,Canvas1.Height)


Canvas1.Backdrop=p2
Var P4 As Picture = ProportionalScale(Picture.Open(f),Window2.Diapo.Width,Window2.Diapo.Height)

Window2.Diapo.Backdrop=P4

Label1.text="PHOTO"

else
If f.Name.Right(4)=“.MOV” or f.Name.Right(4)=“.mp4” then

  w.player = player
  w.AVPlayerView.player = player
  
  Label1.text="VIDEO"
End If

End If

end if

Timer2.Enabled=True

Well, you could read documentation to find the player and a play method.

Then you may check addBoundaryTimeObserverForTime method to add a callback for timer.

And you check BoundaryTimeObserver event in your AVFoundationMBS subclass to catch the event.

1 Like

However, it opens a new window every time there’s a video in the loop!
I found it! Here’s the modified code

If f.Name.Right(4)=“.MOV” or f.Name.Right(4)=“.mp4” then
dim player as new AVPlayerMBS(f )
'dim w as new Window1
'w.player = player
AVPlayerView.player = player
Label1.text=“VIDEO”
End If

I can’t read the total length of the video and delay the loop accordingly. I’m sorry, I’m a beginner, but I’m looking at the examples and I’m still lost!
Please help me!