1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Display Server support

This commit is contained in:
PouleyKetchoupp
2020-03-27 17:30:18 +01:00
parent af424b1c7c
commit e167af3737
14 changed files with 953 additions and 748 deletions

View File

@@ -53,8 +53,6 @@ public class GodotIO {
Godot activity;
GodotEditText edit;
MediaPlayer mediaPlayer;
final int SCREEN_LANDSCAPE = 0;
final int SCREEN_PORTRAIT = 1;
final int SCREEN_REVERSE_LANDSCAPE = 2;
@@ -530,46 +528,16 @@ public class GodotIO {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
} break;
}
};
}
public int getScreenOrientation() {
return activity.getRequestedOrientation();
}
public void setEdit(GodotEditText _edit) {
edit = _edit;
}
public void playVideo(String p_path) {
Uri filePath = Uri.parse(p_path);
mediaPlayer = new MediaPlayer();
try {
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(activity.getApplicationContext(), filePath);
mediaPlayer.prepare();
mediaPlayer.start();
} catch (IOException e) {
System.out.println("IOError while playing video");
}
}
public boolean isVideoPlaying() {
if (mediaPlayer != null) {
return mediaPlayer.isPlaying();
}
return false;
}
public void pauseVideo() {
if (mediaPlayer != null) {
mediaPlayer.pause();
}
}
public void stopVideo() {
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}
}
public static final int SYSTEM_DIR_DESKTOP = 0;
public static final int SYSTEM_DIR_DCIM = 1;
public static final int SYSTEM_DIR_DOCUMENTS = 2;