Problem with new SAF storage implementation

Godot Version

4.6

Question

Hi!I'm testing GDE Gozen (ffmpeg extension for godot) in Android platform. It works fine in Godot 4.5

When testing it with Godot 4.6 i found some problems with file paths not being recogniced by the ffmpeg module, although i can read the file and check it’s size (

Digging into it i found about the new Storage Access Framework (PR 112215) and the DisplayServer

I have not much experience with android, but i understand that “content://” uris can be converted to a more common path, but can’t find an example on how to do this

Here is the piece of code where file is read:

    var dialog: FileDialog = FileDialog.new()

	dialog.title = "Open video"
	dialog.force_native = true
	dialog.use_native_dialog = true
	dialog.access = FileDialog.ACCESS_FILESYSTEM
	dialog.file_mode = FileDialog.FILE_MODE_OPEN_FILE
	_connect(dialog.file_selected, open_video)

	add_child(dialog)
	dialog.popup_centered()

and here is a try i made using DisplayServer, based on an example from the PR (with same results)

	var current_directory = OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS)
	var filters = PackedStringArray(["*.webm"])
	DisplayServer.file_dialog_show("", current_directory, "", false, DisplayServer.FILE_DIALOG_MODE_OPEN_FILE, filters, _picker_callback)


func _picker_callback(status: bool, selected_uris: PackedStringArray, _selected_filter_index: int):
	var filepath := selected_uris[0]
	open_video(filepath)

How do i read the filepath correctly?

Thanks in advance

A friend pointed me to a workaroud copying the files to the user folder, but it doesnt seem optimal forma big vídeo files

Seems imposible to convert to absolute path without using an android plugin and Java code, so i made the following workaround, in case someone find this problem…