Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Android: Remove non-functional native video OS methods #48537

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,23 +475,20 @@ int OS::get_processor_count() const {

Error OS::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
return FAILED;
};
}

bool OS::native_video_is_playing() const {
return false;
};

void OS::native_video_pause(){

};

void OS::native_video_unpause(){
}

};
void OS::native_video_pause() {
}

void OS::native_video_stop(){
void OS::native_video_unpause() {
}

};
void OS::native_video_stop() {
}

void OS::set_mouse_mode(MouseMode p_mode) {
}
Expand Down
10 changes: 5 additions & 5 deletions doc/classes/OS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -807,15 +807,15 @@
</return>
<description>
Returns [code]true[/code] if native video is playing.
[b]Note:[/b] This method is implemented on Android and iOS.
[b]Note:[/b] This method is only implemented on iOS.
</description>
</method>
<method name="native_video_pause">
<return type="void">
</return>
<description>
Pauses native video playback.
[b]Note:[/b] This method is implemented on Android and iOS.
[b]Note:[/b] This method is only implemented on iOS.
</description>
</method>
<method name="native_video_play">
Expand All @@ -831,23 +831,23 @@
</argument>
<description>
Plays native video from the specified path, at the given volume and with audio and subtitle tracks.
[b]Note:[/b] This method is implemented on Android and iOS, and the current Android implementation does not support the [code]volume[/code], [code]audio_track[/code] and [code]subtitle_track[/code] options.
[b]Note:[/b] This method is only implemented on iOS.
</description>
</method>
<method name="native_video_stop">
<return type="void">
</return>
<description>
Stops native video playback.
[b]Note:[/b] This method is implemented on Android and iOS.
[b]Note:[/b] This method is implemented on iOS.
</description>
</method>
<method name="native_video_unpause">
<return type="void">
</return>
<description>
Resumes native video playback.
[b]Note:[/b] This method is implemented on Android and iOS.
[b]Note:[/b] This method is implemented on iOS.
</description>
</method>
<method name="open_midi_inputs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,40 +536,6 @@ 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;
Expand Down
31 changes: 0 additions & 31 deletions platform/android/java_godot_io_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ GodotIOJavaWrapper::GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instanc
_set_screen_orientation = p_env->GetMethodID(cls, "setScreenOrientation", "(I)V");
_get_screen_orientation = p_env->GetMethodID(cls, "getScreenOrientation", "()I");
_get_system_dir = p_env->GetMethodID(cls, "getSystemDir", "(I)Ljava/lang/String;");
_play_video = p_env->GetMethodID(cls, "playVideo", "(Ljava/lang/String;)V");
_is_video_playing = p_env->GetMethodID(cls, "isVideoPlaying", "()Z");
_pause_video = p_env->GetMethodID(cls, "pauseVideo", "()V");
_stop_video = p_env->GetMethodID(cls, "stopVideo", "()V");
}
}

Expand Down Expand Up @@ -203,33 +199,6 @@ String GodotIOJavaWrapper::get_system_dir(int p_dir) {
}
}

void GodotIOJavaWrapper::play_video(const String &p_path) {
// Why is this not here?!?!
}

bool GodotIOJavaWrapper::is_video_playing() {
if (_is_video_playing) {
JNIEnv *env = get_jni_env();
return env->CallBooleanMethod(godot_io_instance, _is_video_playing);
} else {
return false;
}
}

void GodotIOJavaWrapper::pause_video() {
if (_pause_video) {
JNIEnv *env = get_jni_env();
env->CallVoidMethod(godot_io_instance, _pause_video);
}
}

void GodotIOJavaWrapper::stop_video() {
if (_stop_video) {
JNIEnv *env = get_jni_env();
env->CallVoidMethod(godot_io_instance, _stop_video);
}
}

// SafeNumeric because it can be changed from non-main thread and we need to
// ensure the change is immediately visible to other threads.
static SafeNumeric<int> virtual_keyboard_height;
Expand Down
8 changes: 0 additions & 8 deletions platform/android/java_godot_io_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ class GodotIOJavaWrapper {
jmethodID _set_screen_orientation = 0;
jmethodID _get_screen_orientation = 0;
jmethodID _get_system_dir = 0;
jmethodID _play_video = 0;
jmethodID _is_video_playing = 0;
jmethodID _pause_video = 0;
jmethodID _stop_video = 0;

public:
GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instance);
Expand All @@ -83,10 +79,6 @@ class GodotIOJavaWrapper {
void set_screen_orientation(int p_orient);
int get_screen_orientation() const;
String get_system_dir(int p_dir);
void play_video(const String &p_path);
bool is_video_playing();
void pause_video();
void stop_video();
};

#endif /* !JAVA_GODOT_IO_WRAPPER_H */
19 changes: 0 additions & 19 deletions platform/android/os_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,29 +798,10 @@ String OS_Android::get_unique_id() const {
return OS::get_unique_id();
}

Error OS_Android::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
// FIXME: Add support for volume, audio and subtitle tracks

godot_io_java->play_video(p_path);
return OK;
}

bool OS_Android::native_video_is_playing() const {
return godot_io_java->is_video_playing();
}

void OS_Android::native_video_pause() {
godot_io_java->pause_video();
}

String OS_Android::get_system_dir(SystemDir p_dir) const {
return godot_io_java->get_system_dir(p_dir);
}

void OS_Android::native_video_stop() {
godot_io_java->stop_video();
}

void OS_Android::set_context_is_16_bits(bool p_is_16) {
//use_16bits_fbo = p_is_16;
//if (rasterizer)
Expand Down
5 changes: 0 additions & 5 deletions platform/android/os_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ class OS_Android : public OS_Unix {
void process_event(Ref<InputEvent> p_event);
void init_video_mode(int p_video_width, int p_video_height);

virtual Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
virtual bool native_video_is_playing() const;
virtual void native_video_pause();
virtual void native_video_stop();

virtual bool is_joy_known(int p_device);
virtual String get_joy_guid(int p_device) const;
void joy_connection_changed(int p_device, bool p_connected, String p_name);
Expand Down