Help with Web MoviePlayer

I have a file im trying to play. I set the code in the open event for the file and getting the file url. I verified the file does exist with the code and it does set the url. The movie still will not play. Any help would be appreciated. Here is the code in the videos open event.

Me.Style.BorderThickness =1
Me.Style.BorderColor = App.Color_Border

Dim fFile As New FolderItem

fFile = GetFolderItem(App.VideosPath).Child("SchoolPictures.mp4")

If fFile <> Nil Then
  If fFile.Exists Then
    Me.MovieURL = fFile.URLPath
  End If 
End If

Me.Play

You should Print() or System.DebugLog() that fFile.URLPath, it’s not what you think it is. You’ll need a WebFile to serve the file over the web for use with WebMoviePlayer

Alternatively if you use something like Lifeboat you can host the movie as a Static File, and provide that URL to the WebMoviePlayer

1 Like

As @Tim_Parnell said, you need to create a WebFile for the video:

If fFile <> Nil and fFile.Exists Then
  wfMovie = WebFile.Open( fFile ) '// This is a property on the page to keep it from going out of scope.
  Me.MovieURL = wfMovie.URL
End If 

Still not much luck. Set up a property on the page wfMovie as a WebFile and then using in the the movie’s open event in the window. Still not playing at all. Does wfMovie need to be global?
Here is the code:

Dim fFile As FolderItem

fFile = GetFolderItem(App.VideosPath).Child("SchoolPictures.mp4")

If fFile <> Nil And fFile.Exists Then
  
  wfMovie = WebFile.Open( fFile )
  Me.MovieURL = wfMovie.URL
  
End If

Me.Play

No, it shouldn’t need to be global. My test here worked as expected. If you check the browser’s console, do you see any errors?

Do you mean when Im building the app? There are no errors when I build? Not sure if thats the browsers console or not.

When you run your project and the browser window/tab opens, right-click the page and select “Inspect”. In the resulting window you should see a tab named “Console”. Messages will be logged here that may point to the issue.

Ugh. I opened in chrome to be able to inspect and the video works there. Guessing its a safari file type problem now. But it is working! Thanks so much for your help again!!

1 Like

Great! Happy to help!

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.