0

Looked around and did not find an answer to this:

I am trying to play a Sound file, but am missing something in the process... I already have loaded a FolderItem sound file succesfully, but I can't track down this NilException. I just started with Xojo yesterday and can't believe how FAST I'm prototyping things... however documentation could be better I guess. Hopefully the community is active :D Code below

Var selectedIndex As Integer
selectedIndex = FIleListbox.selectedRowIndex
Var selectedString As String
selectedString = FileListbox.CellValueAt(selectedIndex, 1)
// Fetch the FolderItem located at FilesMap with a Key of the selected Filename
Var selectedFolderItem As New FolderItem
selectedFolderItem = FilesMap.value(selectedString)
Var soundFile As New Sound
If selectedFolderItem.Exists Then
  Try
    soundFile = soundFile.Open(selectedFolderItem)
    soundFile.Play
  Catch error As IOException
    MessageBox("Error")
  End Try
End If

This is the line that throws the error:

soundFile.Play

Ideas?

1 Answers1

0

Issue resolved! Attempting to load an OGG sound file leaves the Sound variable nil :) I tried with an MP3 and it worked perfect!