In my app, the user first loads a video into a moviePlayer. He is then prompted to save his project. This has always worked fine until recently. After loading some videos, the save dialog box will come up and if you click Save, it will fail to save the project (just a text file). It’s only some videos, though, and I cannot seem to figure out why. I’ve tried re-exporting the video as H.264 with AAC audio and that usually works fine, but there seems to be something in the video preventing my app from being able to save the project file. The movie loads into the moviePlayer fine and reports back the movie duration, name, file path, height and width, etc. I have no clue what’s causing this, though. Here is the code for my SaveAs method. When these problematic movies are in the moviePlayer, it will not create the folderItem. I have that commented below. (code edited somewhat for brevity)
[code]dim f as folderItem
dim t as textoutputStream
dim i,count as integer
dim timeCode, text, seconds, txtFont, txtSize, txtStyle, txtColor, colorIndex, fontIndex, interval,sccRow as string
dim rg as New RegEx
dim myMatch as RegExMatch
dim dlg as New SaveAsDialog
dlg.InitialDirectory = getFolderItem(app.movieTextPath)//SpecialFolder.Documents
dlg.promptText = “Please save your project so the auto-save feature can work.”
dim filename() as string
dim subFilename() as string
rg.searchPattern = “:$”
for i = 0 to editorWin.ListBox1.ListCount-1
myMatch = rg.search(editorWin.listBox1.cell(i,2))
if myMatch <> nil then
editorWin.listBox1.cell(i,2) = editorWin.listBox1.cell(i,2)+ " "
end if
next
rg.searchPattern = “\r”
if app.lang = “” then
app.lang = “en”
end if
if app.movieName <> “” then
filename = Split(app.movieName, “.”)
dlg.SuggestedFileName = filename(0) + “.mcpt”
else
dlg.SuggestedFileName = “myProject.mcpt”
end if
app.textFieldSize = editorWin.bkgdHeight.text
dlg.Title = “Save Your Project”
timeCode=""
text=""
seconds=""
txtFont=""
txtSize=""
txtStyle=""
txtColor=""
colorIndex=""
fontIndex=""
f = dlg.ShowModal()
if f <> nil then
t = f.createtextFile
/// t is nil for the problematic movies. I get the Else code running below when these are loaded.
/// it will never save the file later even if i click cancel and then try to save later.
if t <> nil then ////// This works for most movies.
if app.movieName <> "" then
t.writeLine app.movieName
t.writeLine app.movieWidth
t.writeLine app.movieHeight
t.writeLine str(app.movieDuration)
//msgBox "app.movieDuration = " + str(app.movieDuration)
t.writeLine app.totalMovieTime
t.writeLine app.filePath
else
t.writeLine "No movie selected"
t.writeLine "NA"
t.writeLine "NA"
t.writeLine "NA"
t.writeLine "NA"
t.writeLine "NA"
end if
t.writeLine timeCode
//msgBox "timecode = " + timecode
t.writeLine text
t.writeLine seconds
t.writeLine txtFont
t.writeLine txtSize
t.writeLine txtStyle
t.writeLine txtColor
t.writeLine colorIndex
t.writeLine fontIndex
t.writeLine app.bgdColor
if val(app.trackPosition) > 0 then
t.writeLine app.trackPosition
else
t.writeLine "40"
end if
t.writeLine interval
t.writeLine editorWin.bkgdHeight.text
t.writeLine app.maxChar
t.writeLine app.lang
t.writeLine app.keyed
t.writeLine sccRow
t.writeLine app.moviePath
t.close
else //// problematic movies trigger this even if the file is saved to the Desktop…
msgBox "There was a problem saving the file." + endOfLine+ endOfLine + "Do you have read/write access to this folder or drive?" + endOfLine + endOfLine + "Try doing a Save As to a different location."
return
end if
app.savedFilePath = f.absolutePath
editorWin.title = “Project: " + f.name
app.projectName = f.name
app.projectName = replace(app.projectName,”.mcpt","")
app.changes = 0
else
//msgBox “Since you chose not to save this project, you will need to use the Save As… option under the File menu after you add your first caption.”
app.changes = 1
EnableMenuItems
end if
[/code]
Why would loading a movie prevent the app from merely writing a text file???