[enter image description here][1]I am trying to create an automatic zoom for my camera. However, I haven't even been getting close to figure it out. https://developer.apple.com/documentation/avfoundation/avcapturedevice/1624614-ramp
I've been attempting to use this ramp function but get an error every time I try to call the function.
I would just like the zoom to go from all the way "zoomed out" to all the way "zoomed in" in a 5 second time interval. Please help me understand what I need to do in order to create the function.
func autoZoom() {
let camera = AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeVideo)
do { try camera?.lockForConfiguration()
camera?.videoZoomFactor = 5
camera?.ramp(toVideoZoomFactor: 1, withRate: 0.4)
} catch{
}
}
Related
It seems impossible to disable or change the red backgrounded LIVE label in the AVPlayerViewController's transport bar on tvOS 15.2. Also, it is enabled by default ever since 15.2 came out. Here is a picture of the label shown here:
I have tried to play around with some of the available options like this one:
guard let pvc = playerRenderController as? AVPlayerViewController else { return }
pvc.transportBarIncludesTitleView = false
It does hide the LIVE label but it also hides the title (Straight Rhythm) from the image.
Furthermore, the label text seems to be specific to the locale, so in Danish it would be DIREKTE instead of LIVE.
Here is a video that showcases this feature (time 03:08):
Any suggestions on how to hide/change this label?
Hello I found a workaround to do it.
After you play the stream call this function with parameters the playerViewController.view
private func removeLiveLabel(view: UIView) {
let list = ["_AVPlayerViewControllerContainerView", "_AVFocusContainerView", "UIView"]
for subview in view.subviews where list.contains(String(describing: type(of: view))) {
for subSubview in subview.subviews {
if subSubview.value(forKey: "class").debugDescription.contains("_AVxOverlayPlaybackAuxiliaryMetadataView") {
subSubview.removeFromSuperview()
return
}
}
removeLiveLabel(view: subview)
}
}
This function will search the subviews of the AVPlayerViewController object controls and will remove the badge from the view without removing the Title.
if (response.success) {
this.redirectURL = response.data.loginUrl;
// this.URL='http://'+location.host+'/login'+'/'+this.redirectURL;
this.router.navigate(['/login?token=', this.redirectURL]);}
Here is the code ,it should move me to cognito page but its moving to login page in angular I am not sure where I am wrong
use +(plus) instead of ,(comma)
this.router.navigate(['/login?token='+this.redirectURL]);}
If you want to use query params, you can also adopt this approach.
this.router.navigate(['login'], { queryParams: { token: 20 } });
Most likely the reason behind the issue you are facing is that the comma-separated navigation turns to slash-separated one, e.g.
let redirectURL = '1234'
this.router.navigate(['/login?token=', redirectURL])
// this line above results to /login?token=/1234'
So in order to avoid that you should either use the solution that I suggest or the one mentioned by abhishek sahu, where the usage of + for concatenation is encouraged.
How do I make a notification appear on card load?
In the docs I found this: https://developers.google.com/apps-script/reference/card-service/notification?hl=en
But I'm not sure how to use it correctly in my situation.
Wanted result
When the user clicks a button a card is updated via CardService.newNavigation().updateCard(card) and once the card is updated a notification is shown.
edit
The error shown happens when i try to return a card that fetches some data and the notification as an array [card, notification]. When I return only one of the above it works as expected.
The error is shown bellow.
The value returned from Apps Script has a type that cannot be used by the add-ons platform. Also make sure to call build on any builder before returning it. Value:values {
proto_value {
type_url: "type.googleapis.com/caribou.api.proto.addons.templates.publicapi.ContextualAddOnMarkup.Card"
value: "\n\017\n\rVyber projekt\022\375\001\022\372\001B\367\001\n\020dropdown_project\020\003\032\017\n\aVyberte\020\001\032\002-1\032\023\n\005Await\020\000\032\b105966.0\032!\n\024\342\233\265\357\270\217 Freelo addons\020\000\032\a31512.0\032\031\n\vgmail addon\020\000\032\b104757.0\032\020\n\002ll\020\000\032\b105967.0\032\022\n\004test\020\000\032\b104596.0\032\023\n\005test2\020\000\032\b104741.0\032\022\n\004null\020\000\032\b105969.0\032\022\n\004null\020\000\032\b105968.0\"\021\n\rshowToDoLists \000*\aProjekt\022G\022+\")\n\'\n\021Vytvo\305\231it Projekt\022\022\022\020\n\016newProjectForm\022\030\"\026\n\024\n\006Logout\022\n\022\b\n\006logOut\"\fprojectsCard"
}
}
values {
proto_value {
type_url: "type.googleapis.com/caribou.api.proto.addons.templates.publicapi.SubmitFormResponseMarkup"
value: "\022\027\022\025Projekt byl vytvo\305\231en"
}
}
Example on Photo
I have two viewers to compare models. I created a docking panel for properties, and I want this panel to float in two viewers. Is it possible and who will tell you how to do it?
There are two options:
Option1:
Use the 'Autodesk.SplitScreen' extension, which will render up to 4 regions. You load it like this..
loadExtension('Autodesk.SplitScreen');
This simple extension can set up to four cameras, and render four regions. By default, it's just two (left and right). Here's the source code for how the core of it works, just in case you want to write your own...
https://autodeskviewer.com/viewers/latest/extensions/SplitScreen/SplitScreen.js
this.renderScenePart = function (scene) {
// Left
if (shouldRenderForViewport[0]) {
this.renderer.setViewport(0, vpVertStart, vpWidth, vpHeight);
this.context.renderScenePart.apply(this.context, arguments);
}
// Right
if (shouldRenderForViewport[1]) {
this.renderer.setViewport(vpWidth, vpVertStart, vpWidth, vpHeight);
this.context.renderScenePart.apply(this.context, arguments);
}
// Bottom left
if (shouldRenderForViewport[2]) {
this.renderer.setViewport(0, 0, vpWidth, vpHeight);
this.context.renderScenePart.apply(this.context, arguments);
}
// Bottom right
if (shouldRenderForViewport[3]) {
this.renderer.setViewport(vpWidth, 0, vpWidth, vpHeight);
this.context.renderScenePart.apply(this.context, arguments);
}
this.renderer.setViewport(0, 0, this.width, this.height);
this.renderer.enableViewportOnOffscreenTargets(false);
Option2:
For something more advanced, and specific to just 2D, you could also try the 'Autodesk.Viewing.PixelCompare' extension. Here's a blog post with much more detail and a demo...
BLOG: https://forge.autodesk.com/blog/compare-two-2d-documents-using-forge-viewer
ok, two more options:
option A:
if the second image is 'static'... why not just take a 'screenshot' and place it in the right side panel?
You can use the viewer.getScreenShot() command to retrieve a PNG blog, and paint it into the canvas.
// Get the full image
viewer.getScreenShot(viewer.container.clientWidth, viewer.container.clientHeight, function (blobURL) {
screenshot.src = blobURL;
});
For more details on drawing images to a canvas, see here: https://forge.autodesk.com/blog/screenshot-markups
option B:
if the two panels can be independently controlled, then perhaps try to sync the camera state, with some kind of button press (or action).
with the help of these blog articles:
https://forge.autodesk.com/blog/map-forge-viewer-camera-back-navisworks
Get the Camera position and restore it in Forge Viewer for a virtual visit
for example:
viewer.getState();
viewer.restoreState();
or restore camera position using navigation object:
const nav = this.navigation;
nav.getTarget();
nav.getPosition();
nav.getCameraUpVector();
i am trying to toggle Cesiums viewer.requestRenderMode setting, to explore some performance differences.
I created a toggle Button for the requestRenderMode property and call the following function:
function toggleRenderMode() {
console.info("toggleRenderMode");
requestRenderMode = !requestRenderMode;
viewer.requestRenderMode = requestRenderMode
if(requestRenderMode){
viewer.maximumRenderTimeChange = Infinity;
console.info("enabling requestRenderMode");
}else{
viewer.maximumRenderTimeChange = 0;
console.info("disabling requestRenderMode");
}
console.info("viewer.requestRenderMode:",viewer.requestRenderMode);
}
the console output shows me that the viewers requestRenderMode is set according to the code, however it seems that this has no effect on the rendering.
So can this property only be set at the time of Cesium viewers creation?
Thanks a lot!
viewer.requestRenderMode does not exist in the API, what you want is viewer.scene.requestRenderMode.