- motion control demo1

- feat: movable on-screen functional buttons
This commit is contained in:
TrueZhuanjia
2025-10-04 16:44:43 +08:00
parent b96e2d1bdf
commit 67af68fcf1
27 changed files with 731 additions and 245 deletions
@@ -45,8 +45,6 @@
- (id)initWithRefreshRate:(float)arg1 videoDynamicRange:(int)arg2;
@end
@implementation StreamFrameViewController {
ControllerSupport *_controllerSupport;
StreamManager *_streamMan;
@@ -91,6 +89,7 @@
LayoutOnScreenControlsViewController *_layoutOnScreenControlsVC;
ToolboxViewController* toolBoxViewController;
MicHandler* micHandler;
MotionHandler *_motionHandler;
#else
UITapGestureRecognizer *_menuTapGestureRecognizer;
@@ -332,7 +331,6 @@
// Insert at index 0 to ensure it doesn't cover OSC controls (CALayers)
if([_streamView.superview isKindOfClass:[UIScrollView class]]){
[_streamView removeFromSuperview];
NSLog(@"removeFromSuperview %f", CACurrentMediaTime());
}
[self.view insertSubview:_streamView atIndex:0];
@@ -435,6 +433,10 @@
[self startDisplayLink];
}
_motionHandler = [MotionHandler sharedInstance];
_streamView.onScreenControls.instanceReceiverDelegate = _motionHandler;
[_streamView.onScreenControls sendInstance];
NSLog(@"frameview gestures: %d", (uint32_t)[self.view.gestureRecognizers count]);
NSLog(@"streamview gestures: %d", (uint32_t)[_streamView.gestureRecognizers count]);
}
@@ -775,6 +777,7 @@
}
- (void)openWidgetLayoutTool{
[_streamView saveRelocatedWidgetViews];
_streamView.widgetToolOpened = true;
[self->_streamView disableOnScreenControls];
[self->_streamView clearOnScreenWidgets]; // clear all onScreenKeyboardButtons before entering edit mode
@@ -785,6 +788,7 @@
}
- (void)switchWidgetProfile{
[_streamView saveRelocatedWidgetViews];
_streamView.widgetToolOpened = true;
[self->_streamView disableOnScreenControls];
[self->_streamView clearOnScreenWidgets]; // clear all onScreenKeyboardButtons before entering edit mode
@@ -1063,6 +1067,7 @@
- (void)applicationWillResignActive:(NSNotification *)notification {
//[self.pipController startPictureInPicture];
//sleep(1);
[_streamView saveRelocatedWidgetViews];
#if !TARGET_OS_TV
#endif
@@ -1143,6 +1148,7 @@
- (void)expandSettingsView{
self.mainFrameViewcontroller.settingsExpandedInStreamView = true; //notify mainFrameViewContorller that this is a setting expansion in stream view, some settings shall be disabled.
[_streamView saveRelocatedWidgetViews];
[self.mainFrameViewcontroller expandSettingsView];
}
@@ -1556,6 +1562,22 @@
[self reConfigStreamViewRealtime];
}
- (void)startGyroUpdate{
[_motionHandler startGyroUpdate];
}
- (void)startAccelUpdate{
[_motionHandler startAccelUpdate];
}
- (void)stopGyroUpdate{
[_motionHandler stopGyroUpdate];
}
- (void)stopAccelUpdate{
[_motionHandler stopAccelUpdate];
}
#if !TARGET_OS_TV
// Require a confirmation when streaming to activate a system gesture
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures {