get stream real time setting menu working

This commit is contained in:
True Zhuanjia committed 2024-07-08 23:59:42 +08:00
1 parent 6f1773d512
commit 38343c20cb
5 files changed
+77 -37

No files matched your search

+3
View File
@@ -28,7 +28,10 @@
interactionDelegate:(id<UserInteractionDelegate>)interactionDelegate interactionDelegate:(id<UserInteractionDelegate>)interactionDelegate
config:(StreamConfiguration*)streamConfig; config:(StreamConfiguration*)streamConfig;
- (void) showOnScreenControls; - (void) showOnScreenControls;
- (void) setOnScreenControls;
- (void) disableOnScreenControls; - (void) disableOnScreenControls;
- (void) reloadOnScreenControlsRealtimeWith:(ControllerSupport*)controllerSupport
andConfig:(StreamConfiguration*)streamConfig;
- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport - (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport
andConfig:(StreamConfiguration*)streamConfig; andConfig:(StreamConfiguration*)streamConfig;
- (CGSize) getVideoAreaSize; - (CGSize) getVideoAreaSize;
+16 -1
View File
@@ -271,16 +271,31 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
[onScreenControls show]; [onScreenControls show];
#endif #endif
} }
- (void) setOnScreenControls{
}
- (void) disableOnScreenControls { - (void) disableOnScreenControls {
#if !TARGET_OS_TV #if !TARGET_OS_TV
[onScreenControls setLevel:OnScreenControlsLevelOff]; [onScreenControls setLevel:OnScreenControlsLevelOff];
#endif #endif
} }
- (void) reloadOnScreenControlsRealtimeWith:(ControllerSupport*)controllerSupport
andConfig:(StreamConfiguration*)streamConfig {
[self reloadOnScreenControlsWith:controllerSupport andConfig:streamConfig];
bool oscEnabled = (settings.touchMode.intValue == RELATIVE_TOUCH || settings.touchMode.intValue == REGULAR_NATIVE_TOUCH) && settings.onscreenControls.intValue != OnScreenControlsLevelOff;
if(oscEnabled) [self showOnScreenControls];
else [self disableOnScreenControls];
}
- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport - (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport
andConfig:(StreamConfiguration*)streamConfig { andConfig:(StreamConfiguration*)streamConfig {
onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport streamConfig:streamConfig]; onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport streamConfig:streamConfig];
[onScreenControls setLevel:OnScreenControlsLevelCustom]; [onScreenControls setLevel:(OnScreenControlsLevel)settings.onscreenControls.intValue];
} }
- (OnScreenControlsLevel) getCurrentOscState { - (OnScreenControlsLevel) getCurrentOscState {
@@ -22,6 +22,7 @@
@property (weak, nonatomic) IBOutlet UIBarButtonItem *upButton; @property (weak, nonatomic) IBOutlet UIBarButtonItem *upButton;
-(void)simulateSettingsButtonPress; -(void)simulateSettingsButtonPress;
-(void)reloadStreamConfig;
#endif #endif
@end @end
@@ -397,7 +397,7 @@ static NSMutableSet* hostList;
} }
UIAlertController* applistAlert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Connection Failed"] UIAlertController* applistAlert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Connection Failed"]
message:serverInfoResp.statusMessage message:serverInfoResp.statusMessage
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[Utils addHelpOptionToDialog:applistAlert]; [Utils addHelpOptionToDialog:applistAlert];
[applistAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]]; [applistAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]];
@@ -614,7 +614,11 @@ static NSMutableSet* hostList;
_streamConfig.appID = app.id; _streamConfig.appID = app.id;
_streamConfig.appName = app.name; _streamConfig.appName = app.name;
_streamConfig.serverCert = app.host.serverCert; _streamConfig.serverCert = app.host.serverCert;
_streamConfig.serverCodecModeSupport = app.host.serverCodecModeSupport;
[self reloadStreamConfig];
}
- (void) reloadStreamConfig {
DataManager* dataMan = [[DataManager alloc] init]; DataManager* dataMan = [[DataManager alloc] init];
TemporarySettings* streamSettings = [dataMan getSettings]; TemporarySettings* streamSettings = [dataMan getSettings];
@@ -666,7 +670,6 @@ static NSMutableSet* hostList;
_streamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO; _streamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
} }
_streamConfig.serverCodecModeSupport = app.host.serverCodecModeSupport;
switch (streamSettings.preferredCodec) { switch (streamSettings.preferredCodec) {
case CODEC_PREF_AV1: case CODEC_PREF_AV1:
@@ -59,8 +59,54 @@
#endif #endif
} }
- (void)reConfigStreamView{
[_streamView setupStreamView:_controllerSupport interactionDelegate:self config:self.streamConfig]; - (void)configOscLayoutTool{
[self.view removeGestureRecognizer:_oscLayoutTapRecoginizer];
if((_settings.touchMode.intValue == RELATIVE_TOUCH || _settings.touchMode.intValue == REGULAR_NATIVE_TOUCH) && _settings.onscreenControls.intValue == OnScreenControlsLevelCustom){
_oscLayoutTapRecoginizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(layoutOSC)];
_oscLayoutTapRecoginizer.numberOfTouchesRequired = 4; //tap 4 fingers to invoke OSC rebase
_oscLayoutTapRecoginizer.tapDownTimeThreshold = 1;
_oscLayoutTapRecoginizer.delaysTouchesBegan = NO;
_oscLayoutTapRecoginizer.delaysTouchesEnded = NO;
[self.view addGestureRecognizer:_oscLayoutTapRecoginizer];
/* sets a reference to the correct 'LayoutOnScreenControlsViewController' depending on whether the user is on an iPhone or iPad */
_layoutOnScreenControlsVC = [[LayoutOnScreenControlsViewController alloc] init];
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
if (isIPhone) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
_layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
}
else {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
_layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
_layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen;
}
_layoutOnScreenControlsVC.view.backgroundColor = UIColor.clearColor;
_layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
}
}
- (void)configExitGesture{
[self.view removeGestureRecognizer:_exitSwipeRecognizer];
_exitSwipeRecognizer = [[CustomEdgeSwipeGestureRecognizer alloc] initWithTarget:self action:@selector(expandSettingsView)];
_exitSwipeRecognizer.edges = _settings.swipeExitScreenEdge.intValue;
_exitSwipeRecognizer.normalizedThresholdDistance = _settings.swipeToExitDistance.floatValue;
_exitSwipeRecognizer.delaysTouchesBegan = NO;
_exitSwipeRecognizer.delaysTouchesEnded = NO;
[self.view addGestureRecognizer:_exitSwipeRecognizer];
}
- (void)reConfigStreamViewRealtime{
_settings = [[[DataManager alloc] init] getSettings]; //StreamFrameViewController retrieve the settings here.
[self configOscLayoutTool];
[self configExitGesture];
[self->_streamView disableOnScreenControls]; //don't know why but this must be called outside the streamview class, just put it here. execute in streamview class cause hang
[self.mainframeViewcontroller reloadStreamConfig]; // reload streamconfig
[_streamView setupStreamView:_controllerSupport interactionDelegate:self config:self.streamConfig]; //reinitiate setupStreamView process.
[self->_streamView reloadOnScreenControlsRealtimeWith:(ControllerSupport*)_controllerSupport
andConfig:(StreamConfiguration*)_streamConfig]; //reload OSC here.
} }
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
@@ -70,7 +116,7 @@
#if !TARGET_OS_TV #if !TARGET_OS_TV
[[self revealViewController] setPrimaryViewController:self]; [[self revealViewController] setPrimaryViewController:self];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reConfigStreamView) // //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated. selector:@selector(reConfigStreamViewRealtime) // //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated.
name:@"SettingsViewClosed" name:@"SettingsViewClosed"
object:nil]; object:nil];
#endif #endif
@@ -143,37 +189,8 @@
[self.view addGestureRecognizer:_playPauseTapGestureRecognizer]; [self.view addGestureRecognizer:_playPauseTapGestureRecognizer];
#else #else
_exitSwipeRecognizer = [[CustomEdgeSwipeGestureRecognizer alloc] initWithTarget:self action:@selector(expandSettingsView)]; [self configExitGesture]; // swipe & exit gesture configured here
_exitSwipeRecognizer.edges = _settings.swipeExitScreenEdge.intValue; [self configOscLayoutTool]; //_oscLayoutTapRecoginizer will be added or removed to the view here
_exitSwipeRecognizer.normalizedThresholdDistance = _settings.swipeToExitDistance.floatValue;
_exitSwipeRecognizer.delaysTouchesBegan = NO;
_exitSwipeRecognizer.delaysTouchesEnded = NO;
[self.view addGestureRecognizer:_exitSwipeRecognizer];
if((_settings.touchMode.intValue == RELATIVE_TOUCH || _settings.touchMode.intValue == REGULAR_NATIVE_TOUCH) && _settings.onscreenControls.intValue == OnScreenControlsLevelCustom){
_oscLayoutTapRecoginizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(layoutOSC)];
_oscLayoutTapRecoginizer.numberOfTouchesRequired = 4; //tap 4 fingers to invoke OSC rebase
_oscLayoutTapRecoginizer.tapDownTimeThreshold = 1;
_oscLayoutTapRecoginizer.delaysTouchesBegan = NO;
_oscLayoutTapRecoginizer.delaysTouchesEnded = NO;
[self.view addGestureRecognizer:_oscLayoutTapRecoginizer];
/* sets a reference to the correct 'LayoutOnScreenControlsViewController' depending on whether the user is on an iPhone or iPad */
_layoutOnScreenControlsVC = [[LayoutOnScreenControlsViewController alloc] init];
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
if (isIPhone) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
_layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
}
else {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
_layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
_layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen;
}
_layoutOnScreenControlsVC.view.backgroundColor = UIColor.clearColor;
_layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
}
#endif #endif
_tipLabel = [[UILabel alloc] init]; _tipLabel = [[UILabel alloc] init];
@@ -263,6 +280,7 @@
- (void)oscLayoutClosed{ - (void)oscLayoutClosed{
// Handle the callback // Handle the callback
[self->_streamView disableOnScreenControls]; // add this to get realtime back menu working.
[self->_streamView reloadOnScreenControlsWith:(ControllerSupport*)_controllerSupport [self->_streamView reloadOnScreenControlsWith:(ControllerSupport*)_controllerSupport
andConfig:(StreamConfiguration*)_streamConfig]; andConfig:(StreamConfiguration*)_streamConfig];
[self->_streamView showOnScreenControls]; [self->_streamView showOnScreenControls];