diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2021-05-07 16:50:19 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-05-07 20:40:24 +0200 |
commit | 35ec0e9be78ec551e4e68497eeab1a35f48a0da4 (patch) | |
tree | 578e62db8df983971f827901c1252274eb1c8032 | |
parent | 8976594f4b90edd42a926e483815c829a540d8d2 (diff) |
OS: Remove native video API only implemented on iOS
See discussion in #43811, it was only implemented on iOS and even that
implementation was fairly limited. This would best be provided as plugins
for Android and iOS without cluttering the shared OS API.
-rw-r--r-- | doc/classes/DisplayServer.xml | 60 | ||||
-rw-r--r-- | platform/android/display_server_android.cpp | 1 | ||||
-rw-r--r-- | platform/iphone/SCsub | 1 | ||||
-rw-r--r-- | platform/iphone/display_server_iphone.h | 6 | ||||
-rw-r--r-- | platform/iphone/display_server_iphone.mm | 65 | ||||
-rw-r--r-- | platform/iphone/native_video_view.h | 41 | ||||
-rw-r--r-- | platform/iphone/native_video_view.m | 266 | ||||
-rw-r--r-- | platform/iphone/os_iphone.mm | 8 | ||||
-rw-r--r-- | platform/iphone/view_controller.h | 5 | ||||
-rw-r--r-- | platform/iphone/view_controller.mm | 24 | ||||
-rw-r--r-- | platform/javascript/display_server_javascript.cpp | 1 | ||||
-rw-r--r-- | servers/display_server.cpp | 28 | ||||
-rw-r--r-- | servers/display_server.h | 8 |
13 files changed, 9 insertions, 505 deletions
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 91e90d051d..0c9df071a7 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -469,46 +469,6 @@ <description> </description> </method> - <method name="native_video_is_playing" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="native_video_pause"> - <return type="void"> - </return> - <description> - </description> - </method> - <method name="native_video_play"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="path" type="String"> - </argument> - <argument index="1" name="volume" type="float"> - </argument> - <argument index="2" name="audio_track" type="String"> - </argument> - <argument index="3" name="subtitle_track" type="String"> - </argument> - <argument index="4" name="screen" type="int"> - </argument> - <description> - </description> - </method> - <method name="native_video_stop"> - <return type="void"> - </return> - <description> - </description> - </method> - <method name="native_video_unpause"> - <return type="void"> - </return> - <description> - </description> - </method> <method name="process_events"> <return type="void"> </return> @@ -1065,25 +1025,23 @@ </constant> <constant name="FEATURE_CUSTOM_CURSOR_SHAPE" value="8" enum="Feature"> </constant> - <constant name="FEATURE_NATIVE_VIDEO" value="9" enum="Feature"> - </constant> - <constant name="FEATURE_NATIVE_DIALOG" value="10" enum="Feature"> + <constant name="FEATURE_NATIVE_DIALOG" value="9" enum="Feature"> </constant> - <constant name="FEATURE_CONSOLE_WINDOW" value="11" enum="Feature"> + <constant name="FEATURE_CONSOLE_WINDOW" value="10" enum="Feature"> </constant> - <constant name="FEATURE_IME" value="12" enum="Feature"> + <constant name="FEATURE_IME" value="11" enum="Feature"> </constant> - <constant name="FEATURE_WINDOW_TRANSPARENCY" value="13" enum="Feature"> + <constant name="FEATURE_WINDOW_TRANSPARENCY" value="12" enum="Feature"> </constant> - <constant name="FEATURE_HIDPI" value="14" enum="Feature"> + <constant name="FEATURE_HIDPI" value="13" enum="Feature"> </constant> - <constant name="FEATURE_ICON" value="15" enum="Feature"> + <constant name="FEATURE_ICON" value="14" enum="Feature"> </constant> - <constant name="FEATURE_NATIVE_ICON" value="16" enum="Feature"> + <constant name="FEATURE_NATIVE_ICON" value="15" enum="Feature"> </constant> - <constant name="FEATURE_ORIENTATION" value="17" enum="Feature"> + <constant name="FEATURE_ORIENTATION" value="16" enum="Feature"> </constant> - <constant name="FEATURE_SWAP_BUFFERS" value="18" enum="Feature"> + <constant name="FEATURE_SWAP_BUFFERS" value="17" enum="Feature"> </constant> <constant name="MOUSE_MODE_VISIBLE" value="0" enum="MouseMode"> </constant> diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index 51cea39a43..7a32184139 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -61,7 +61,6 @@ bool DisplayServerAndroid::has_feature(Feature p_feature) const { //case FEATURE_MOUSE_WARP: //case FEATURE_NATIVE_DIALOG: //case FEATURE_NATIVE_ICON: - //case FEATURE_NATIVE_VIDEO: //case FEATURE_WINDOW_TRANSPARENCY: case FEATURE_CLIPBOARD: case FEATURE_KEEP_SCREEN_ON: diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub index ee7b2f4ab5..58b574a72f 100644 --- a/platform/iphone/SCsub +++ b/platform/iphone/SCsub @@ -19,7 +19,6 @@ iphone_lib = [ "godot_view_gesture_recognizer.mm", "device_metrics.m", "keyboard_input_view.mm", - "native_video_view.m", ] env_ios = env.Clone() diff --git a/platform/iphone/display_server_iphone.h b/platform/iphone/display_server_iphone.h index 7bf1557873..34c56382a4 100644 --- a/platform/iphone/display_server_iphone.h +++ b/platform/iphone/display_server_iphone.h @@ -190,12 +190,6 @@ public: virtual void screen_set_keep_on(bool p_enable) override; virtual bool screen_is_kept_on() const override; - virtual Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track, int p_screen = SCREEN_OF_MAIN_WINDOW) override; - virtual bool native_video_is_playing() const override; - virtual void native_video_pause() override; - virtual void native_video_unpause() override; - virtual void native_video_stop() override; - void resize_window(CGSize size); }; diff --git a/platform/iphone/display_server_iphone.mm b/platform/iphone/display_server_iphone.mm index a852bea207..9e74de0842 100644 --- a/platform/iphone/display_server_iphone.mm +++ b/platform/iphone/display_server_iphone.mm @@ -36,7 +36,6 @@ #import "godot_view.h" #include "ios.h" #import "keyboard_input_view.h" -#import "native_video_view.h" #include "os_iphone.h" #import "view_controller.h" @@ -305,7 +304,6 @@ bool DisplayServerIPhone::has_feature(Feature p_feature) const { // case FEATURE_MOUSE_WARP: // case FEATURE_NATIVE_DIALOG: // case FEATURE_NATIVE_ICON: - // case FEATURE_NATIVE_VIDEO: // case FEATURE_WINDOW_TRANSPARENCY: case FEATURE_CLIPBOARD: case FEATURE_KEEP_SCREEN_ON: @@ -569,69 +567,6 @@ bool DisplayServerIPhone::screen_is_kept_on() const { return [UIApplication sharedApplication].idleTimerDisabled; } -Error DisplayServerIPhone::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track, int p_screen) { - FileAccess *f = FileAccess::open(p_path, FileAccess::READ); - bool exists = f && f->is_open(); - - String user_data_dir = OSIPhone::get_singleton()->get_user_data_dir(); - - if (!exists) { - return FAILED; - } - - String tempFile = OSIPhone::get_singleton()->get_user_data_dir(); - - if (p_path.begins_with("res://")) { - if (PackedData::get_singleton()->has_path(p_path)) { - printf("Unable to play %s using the native player as it resides in a .pck file\n", p_path.utf8().get_data()); - return ERR_INVALID_PARAMETER; - } else { - p_path = p_path.replace("res:/", ProjectSettings::get_singleton()->get_resource_path()); - } - } else if (p_path.begins_with("user://")) { - p_path = p_path.replace("user:/", user_data_dir); - } - - memdelete(f); - - printf("Playing video: %s\n", p_path.utf8().get_data()); - - String file_path = ProjectSettings::get_singleton()->globalize_path(p_path); - - NSString *filePath = [[NSString alloc] initWithUTF8String:file_path.utf8().get_data()]; - NSString *audioTrack = [NSString stringWithUTF8String:p_audio_track.utf8()]; - NSString *subtitleTrack = [NSString stringWithUTF8String:p_subtitle_track.utf8()]; - - if (![AppDelegate.viewController playVideoAtPath:filePath - volume:p_volume - audio:audioTrack - subtitle:subtitleTrack]) { - return OK; - } - - return FAILED; -} - -bool DisplayServerIPhone::native_video_is_playing() const { - return [AppDelegate.viewController.videoView isVideoPlaying]; -} - -void DisplayServerIPhone::native_video_pause() { - if (native_video_is_playing()) { - [AppDelegate.viewController.videoView pauseVideo]; - } -} - -void DisplayServerIPhone::native_video_unpause() { - [AppDelegate.viewController.videoView unpauseVideo]; -}; - -void DisplayServerIPhone::native_video_stop() { - if (native_video_is_playing()) { - [AppDelegate.viewController.videoView stopVideo]; - } -} - void DisplayServerIPhone::resize_window(CGSize viewSize) { Size2i size = Size2i(viewSize.width, viewSize.height) * screen_get_max_scale(); diff --git a/platform/iphone/native_video_view.h b/platform/iphone/native_video_view.h deleted file mode 100644 index 2df5e27fa4..0000000000 --- a/platform/iphone/native_video_view.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************/ -/* native_video_view.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#import <UIKit/UIKit.h> - -@interface GodotNativeVideoView : UIView - -- (BOOL)playVideoAtPath:(NSString *)filePath volume:(float)videoVolume audio:(NSString *)audioTrack subtitle:(NSString *)subtitleTrack; -- (BOOL)isVideoPlaying; -- (void)pauseVideo; -- (void)unpauseVideo; -- (void)stopVideo; - -@end diff --git a/platform/iphone/native_video_view.m b/platform/iphone/native_video_view.m deleted file mode 100644 index f126749600..0000000000 --- a/platform/iphone/native_video_view.m +++ /dev/null @@ -1,266 +0,0 @@ -/*************************************************************************/ -/* native_video_view.m */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#import "native_video_view.h" -#import <AVFoundation/AVFoundation.h> - -@interface GodotNativeVideoView () - -@property(strong, nonatomic) AVAsset *avAsset; -@property(strong, nonatomic) AVPlayerItem *avPlayerItem; -@property(strong, nonatomic) AVPlayer *avPlayer; -@property(strong, nonatomic) AVPlayerLayer *avPlayerLayer; -@property(assign, nonatomic) CMTime videoCurrentTime; -@property(assign, nonatomic) BOOL isVideoCurrentlyPlaying; - -@end - -@implementation GodotNativeVideoView - -- (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - - if (self) { - [self godot_commonInit]; - } - - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)coder { - self = [super initWithCoder:coder]; - - if (self) { - [self godot_commonInit]; - } - - return self; -} - -- (void)godot_commonInit { - self.isVideoCurrentlyPlaying = NO; - self.videoCurrentTime = kCMTimeZero; - - [self observeVideoAudio]; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - - self.avPlayerLayer.frame = self.bounds; -} - -- (void)observeVideoAudio { - printf("******** adding observer for sound routing changes\n"); - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(audioRouteChangeListenerCallback:) - name:AVAudioSessionRouteChangeNotification - object:nil]; -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if (object == self.avPlayerItem && [keyPath isEqualToString:@"status"]) { - [self handleVideoOrPlayerStatus]; - } - - if (object == self.avPlayer && [keyPath isEqualToString:@"rate"]) { - [self handleVideoPlayRate]; - } -} - -// MARK: Video Audio - -- (void)audioRouteChangeListenerCallback:(NSNotification *)notification { - printf("*********** route changed!\n"); - NSDictionary *interuptionDict = notification.userInfo; - - NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue]; - - switch (routeChangeReason) { - case AVAudioSessionRouteChangeReasonNewDeviceAvailable: { - NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable"); - NSLog(@"Headphone/Line plugged in"); - } break; - case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: { - NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable"); - NSLog(@"Headphone/Line was pulled. Resuming video play...."); - if ([self isVideoPlaying]) { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [self.avPlayer play]; // NOTE: change this line according your current player implementation - NSLog(@"resumed play"); - }); - } - } break; - case AVAudioSessionRouteChangeReasonCategoryChange: { - // called at start - also when other audio wants to play - NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange"); - } break; - } -} - -// MARK: Native Video Player - -- (void)handleVideoOrPlayerStatus { - if (self.avPlayerItem.status == AVPlayerItemStatusFailed || self.avPlayer.status == AVPlayerStatusFailed) { - [self stopVideo]; - } - - if (self.avPlayer.status == AVPlayerStatusReadyToPlay && self.avPlayerItem.status == AVPlayerItemStatusReadyToPlay && CMTimeCompare(self.videoCurrentTime, kCMTimeZero) == 0) { - // NSLog(@"time: %@", self.video_current_time); - [self.avPlayer seekToTime:self.videoCurrentTime]; - self.videoCurrentTime = kCMTimeZero; - } -} - -- (void)handleVideoPlayRate { - NSLog(@"Player playback rate changed: %.5f", self.avPlayer.rate); - if ([self isVideoPlaying] && self.avPlayer.rate == 0.0 && !self.avPlayer.error) { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [self.avPlayer play]; // NOTE: change this line according your current player implementation - NSLog(@"resumed play"); - }); - - NSLog(@" . . . PAUSED (or just started)"); - } -} - -- (BOOL)playVideoAtPath:(NSString *)filePath volume:(float)videoVolume audio:(NSString *)audioTrack subtitle:(NSString *)subtitleTrack { - self.avAsset = [AVAsset assetWithURL:[NSURL fileURLWithPath:filePath]]; - - self.avPlayerItem = [AVPlayerItem playerItemWithAsset:self.avAsset]; - [self.avPlayerItem addObserver:self forKeyPath:@"status" options:0 context:nil]; - - self.avPlayer = [AVPlayer playerWithPlayerItem:self.avPlayerItem]; - self.avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:self.avPlayer]; - - [self.avPlayer addObserver:self forKeyPath:@"status" options:0 context:nil]; - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(playerItemDidReachEnd:) - name:AVPlayerItemDidPlayToEndTimeNotification - object:[self.avPlayer currentItem]]; - - [self.avPlayer addObserver:self forKeyPath:@"rate" options:NSKeyValueObservingOptionNew context:0]; - - [self.avPlayerLayer setFrame:self.bounds]; - [self.layer addSublayer:self.avPlayerLayer]; - [self.avPlayer play]; - - AVMediaSelectionGroup *audioGroup = [self.avAsset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible]; - - NSMutableArray *allAudioParams = [NSMutableArray array]; - for (id track in audioGroup.options) { - NSString *language = [[track locale] localeIdentifier]; - NSLog(@"subtitle lang: %@", language); - - if ([language isEqualToString:audioTrack]) { - AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters]; - [audioInputParams setVolume:videoVolume atTime:kCMTimeZero]; - [audioInputParams setTrackID:[track trackID]]; - [allAudioParams addObject:audioInputParams]; - - AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix]; - [audioMix setInputParameters:allAudioParams]; - - [self.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup:audioGroup]; - [self.avPlayer.currentItem setAudioMix:audioMix]; - - break; - } - } - - AVMediaSelectionGroup *subtitlesGroup = [self.avAsset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]; - NSArray *useableTracks = [AVMediaSelectionGroup mediaSelectionOptionsFromArray:subtitlesGroup.options withoutMediaCharacteristics:[NSArray arrayWithObject:AVMediaCharacteristicContainsOnlyForcedSubtitles]]; - - for (id track in useableTracks) { - NSString *language = [[track locale] localeIdentifier]; - NSLog(@"subtitle lang: %@", language); - - if ([language isEqualToString:subtitleTrack]) { - [self.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup:subtitlesGroup]; - break; - } - } - - self.isVideoCurrentlyPlaying = YES; - - return true; -} - -- (BOOL)isVideoPlaying { - if (self.avPlayer.error) { - printf("Error during playback\n"); - } - return (self.avPlayer.rate > 0 && !self.avPlayer.error); -} - -- (void)pauseVideo { - self.videoCurrentTime = self.avPlayer.currentTime; - [self.avPlayer pause]; - self.isVideoCurrentlyPlaying = NO; -} - -- (void)unpauseVideo { - [self.avPlayer play]; - self.isVideoCurrentlyPlaying = YES; -} - -- (void)playerItemDidReachEnd:(NSNotification *)notification { - [self stopVideo]; -} - -- (void)finishPlayingVideo { - [self.avPlayer pause]; - [self.avPlayerLayer removeFromSuperlayer]; - self.avPlayerLayer = nil; - - if (self.avPlayerItem) { - [self.avPlayerItem removeObserver:self forKeyPath:@"status"]; - self.avPlayerItem = nil; - } - - if (self.avPlayer) { - [self.avPlayer removeObserver:self forKeyPath:@"status"]; - self.avPlayer = nil; - } - - self.avAsset = nil; - - self.isVideoCurrentlyPlaying = NO; -} - -- (void)stopVideo { - [self finishPlayingVideo]; - - [self removeFromSuperview]; -} - -@end diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm index 51c4da2960..458834ce3a 100644 --- a/platform/iphone/os_iphone.mm +++ b/platform/iphone/os_iphone.mm @@ -301,10 +301,6 @@ void OSIPhone::on_focus_out() { [AppDelegate.viewController.godotView stopRendering]; - if (DisplayServerIPhone::get_singleton() && DisplayServerIPhone::get_singleton()->native_video_is_playing()) { - DisplayServerIPhone::get_singleton()->native_video_pause(); - } - audio_driver.stop(); } } @@ -319,10 +315,6 @@ void OSIPhone::on_focus_in() { [AppDelegate.viewController.godotView startRendering]; - if (DisplayServerIPhone::get_singleton() && DisplayServerIPhone::get_singleton()->native_video_is_playing()) { - DisplayServerIPhone::get_singleton()->native_video_unpause(); - } - audio_driver.start(); } } diff --git a/platform/iphone/view_controller.h b/platform/iphone/view_controller.h index 52fb6fbbf2..400145b8b7 100644 --- a/platform/iphone/view_controller.h +++ b/platform/iphone/view_controller.h @@ -37,11 +37,6 @@ @interface ViewController : UIViewController @property(nonatomic, readonly, strong) GodotView *godotView; -@property(nonatomic, readonly, strong) GodotNativeVideoView *videoView; @property(nonatomic, readonly, strong) GodotKeyboardInputView *keyboardView; -// MARK: Native Video Player - -- (BOOL)playVideoAtPath:(NSString *)filePath volume:(float)videoVolume audio:(NSString *)audioTrack subtitle:(NSString *)subtitleTrack; - @end diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm index 6cef244567..2723ac4706 100644 --- a/platform/iphone/view_controller.mm +++ b/platform/iphone/view_controller.mm @@ -34,7 +34,6 @@ #import "godot_view.h" #import "godot_view_renderer.h" #import "keyboard_input_view.h" -#import "native_video_view.h" #include "os_iphone.h" #import <AVFoundation/AVFoundation.h> @@ -43,7 +42,6 @@ @interface ViewController () <GodotViewDelegate> @property(strong, nonatomic) GodotViewRenderer *renderer; -@property(strong, nonatomic) GodotNativeVideoView *videoView; @property(strong, nonatomic) GodotKeyboardInputView *keyboardView; @property(strong, nonatomic) UIView *godotLoadingOverlay; @@ -151,10 +149,6 @@ } - (void)dealloc { - [self.videoView stopVideo]; - - self.videoView = nil; - self.keyboardView = nil; self.renderer = nil; @@ -243,22 +237,4 @@ } } -// MARK: Native Video Player - -- (BOOL)playVideoAtPath:(NSString *)filePath volume:(float)videoVolume audio:(NSString *)audioTrack subtitle:(NSString *)subtitleTrack { - // If we are showing some video already, reuse existing view for new video. - if (self.videoView) { - return [self.videoView playVideoAtPath:filePath volume:videoVolume audio:audioTrack subtitle:subtitleTrack]; - } else { - // Create autoresizing view for video playback. - GodotNativeVideoView *videoView = [[GodotNativeVideoView alloc] initWithFrame:self.view.bounds]; - videoView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self.view addSubview:videoView]; - - self.videoView = videoView; - - return [self.videoView playVideoAtPath:filePath volume:videoVolume audio:audioTrack subtitle:subtitleTrack]; - } -} - @end diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index 234e42376d..736a8a9a34 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -827,7 +827,6 @@ bool DisplayServerJavaScript::has_feature(Feature p_feature) const { //case FEATURE_MOUSE_WARP: //case FEATURE_NATIVE_DIALOG: //case FEATURE_NATIVE_ICON: - //case FEATURE_NATIVE_VIDEO: //case FEATURE_WINDOW_TRANSPARENCY: //case FEATURE_KEEP_SCREEN_ON: //case FEATURE_ORIENTATION: diff --git a/servers/display_server.cpp b/servers/display_server.cpp index 2fa333cc05..7bd1075006 100644 --- a/servers/display_server.cpp +++ b/servers/display_server.cpp @@ -253,27 +253,6 @@ bool DisplayServer::get_swap_cancel_ok() { void DisplayServer::enable_for_stealing_focus(OS::ProcessID pid) { } -//plays video natively, in fullscreen, only implemented in mobile for now, likely not possible to implement on linux also. -Error DisplayServer::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track, int p_screen) { - ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Native video not supported by this display server."); -} - -bool DisplayServer::native_video_is_playing() const { - return false; -} - -void DisplayServer::native_video_pause() { - WARN_PRINT("Native video not supported by this display server."); -} - -void DisplayServer::native_video_unpause() { - WARN_PRINT("Native video not supported by this display server."); -} - -void DisplayServer::native_video_stop() { - WARN_PRINT("Native video not supported by this display server."); -} - Error DisplayServer::dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback) { WARN_PRINT("Native dialogs not supported by this display server."); return OK; @@ -477,12 +456,6 @@ void DisplayServer::_bind_methods() { ClassDB::bind_method(D_METHOD("enable_for_stealing_focus", "process_id"), &DisplayServer::enable_for_stealing_focus); - ClassDB::bind_method(D_METHOD("native_video_play", "path", "volume", "audio_track", "subtitle_track", "screen"), &DisplayServer::native_video_play); - ClassDB::bind_method(D_METHOD("native_video_is_playing"), &DisplayServer::native_video_is_playing); - ClassDB::bind_method(D_METHOD("native_video_stop"), &DisplayServer::native_video_stop); - ClassDB::bind_method(D_METHOD("native_video_pause"), &DisplayServer::native_video_pause); - ClassDB::bind_method(D_METHOD("native_video_unpause"), &DisplayServer::native_video_unpause); - ClassDB::bind_method(D_METHOD("dialog_show", "title", "description", "buttons", "callback"), &DisplayServer::dialog_show); ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_input_text); @@ -518,7 +491,6 @@ void DisplayServer::_bind_methods() { BIND_ENUM_CONSTANT(FEATURE_VIRTUAL_KEYBOARD); BIND_ENUM_CONSTANT(FEATURE_CURSOR_SHAPE); BIND_ENUM_CONSTANT(FEATURE_CUSTOM_CURSOR_SHAPE); - BIND_ENUM_CONSTANT(FEATURE_NATIVE_VIDEO); BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG); BIND_ENUM_CONSTANT(FEATURE_CONSOLE_WINDOW); BIND_ENUM_CONSTANT(FEATURE_IME); diff --git a/servers/display_server.h b/servers/display_server.h index 3aab572120..f05aa1f59a 100644 --- a/servers/display_server.h +++ b/servers/display_server.h @@ -97,7 +97,6 @@ public: FEATURE_VIRTUAL_KEYBOARD, FEATURE_CURSOR_SHAPE, FEATURE_CUSTOM_CURSOR_SHAPE, - FEATURE_NATIVE_VIDEO, FEATURE_NATIVE_DIALOG, FEATURE_CONSOLE_WINDOW, FEATURE_IME, @@ -324,13 +323,6 @@ public: virtual void enable_for_stealing_focus(OS::ProcessID pid); - //plays video natively, in fullscreen, only implemented in mobile for now, likely not possible to implement on linux also. - virtual Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track, int p_screen = SCREEN_OF_MAIN_WINDOW); - virtual bool native_video_is_playing() const; - virtual void native_video_pause(); - virtual void native_video_unpause(); - virtual void native_video_stop(); - virtual Error dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback); virtual Error dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback); |