Hi,
I tried to use the Gemini Android SDK (v. 0.6.0) to prompt something about a video.
Here is my code :
private val generativeModel = GenerativeModel(
modelName = "gemini-1.5-pro",
apiKey = appConfig.geminiApiKey,
)
val inputContent = content {
fileData(videoUri, "video/mp4")
text(prompt)
}
val response = generativeModel.generateContent(inputContent)
I tried with lot of video URI : videos from the Android Photo picker, but also videos created by the app using a dedicated file:
val outputFile = File(filesDir, "temp_video2.mp4")
val uri = outputFile.path
I tried:
outputFile.toURI().rawPath
outputFile.canonicalPath
outputFile.absolutePath
outputFile.path
outputFile.toURI().path
I even tried to send a video URL from the web as video URI…
but I have always the same error:
com.google.ai.client.generativeai.type.ServerException: Invalid or unsupported file uri:
Does anyone understand how to send the file ?
I saw someone advice to use File API, but it doesn’t look available on the Android SDK…