Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 4047

WebMoviePlayer Seek

$
0
0

I am trying to build WEB APP which has WebMoviePlayer in Xojo 2018r3.

Regular play is working normally, but when I try to seek position in MoviePlayer, nothing happens, except when I seek on first frame.

Inside App folder, I am creating symbolic links which are targeting location of video files, so I can use them in my App. I am creating url like http://127.0.0.1:8080/music/attention.mp4

Since I have 2 locations where files could be placed, this is my HandleURL code:

// Call our static content handler. Each top level folder will require it's own handler.
If (App.HandleStaticContent(Request, App.ExecutableFile.Parent.Child("mediaProxy"), "video/mp4") = True) Then
  // We overrode the default MIMEType because all files in "static1" are PDF's. This gives the browser additional context like opening the PDF inside the browser window.
  Return True
else
  If (App.HandleStaticContent(Request, App.ExecutableFile.Parent.Child("media"), "video/mp4") = True) Then
    Return True
  End If
End If

And this is HandleStaticContent method

// Verify we have a valid path so as not to catch blank GET requests.
If (Request.Path = "") Then
  Return False
End If

// Determine if we have a file that matches this path.
Dim _filePath As String
_filePath = Request.Path
#If TargetWindows = True Then
  _filePath = _filePath.ReplaceAll("/", "\")
#EndIf

Dim _folderPath As String
_folderPath = Folder.NativePath
#If TargetWindows = True Then
  _folderPath = _folderPath + "\"
#ElseIf TargetLinux = True Or TargetMacOS = True Then
  _folderPath = _folderPath + "/"
#EndIf

dim f as FolderItem = GetFolderItem(_folderPath)
if f <> Nil then
  dim folPath As String
  folPath = f.URLPath
  dim fullPath as String = folPath + _filePath
  f = GetFolderItem(folPath + _filePath, FolderItem.PathTypeURL)
end if



Dim _fullPath As String
_fullPath = _folderPath + _filePath

Dim _fileInFolder As FolderItem
_fileInFolder = GetFolderItem(_folderPath + _filePath, FolderItem.PathTypeNative)

If  f = Nil Then
  Return False
End If

If f.Exists = false Then
  Return False
End If

// We got this far which means there is a file that matches this request path. Let's set the request MIME type.
If (_fileInFolder.Name.Lowercase().Right(4) = ".css") Then
  Request.MIMEType = "text/css"
Else
  Request.MIMEType = MIMEType
End If

// We should also update the status code because some browsers are picky about this.
Request.Status = 200 // HTTP OK

// Read the file contents and append to the request.
Dim _fileStream As BinaryStream
_fileStream = BinaryStream.Open(f)

Request.Print(_fileStream.Read(_fileStream.Length))

// Return True so Xojo Web sends the file down to the browser.
Return True

If I try to play same file, but from different location (from our website), seek is working normally.

Are there any settings in Xojo, or I’m missing something in this case?

Thank you.

4 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 4047

Trending Articles