I am writing an application that runs on Android TV 5.1 or newer that uses the WebView as the display rendering engine. I am able to set the desired display orientation, but the WebView rotates back to landscape within the display and maintains the correct aspect ratio.
I have tried using CSS to perform a transform but the aspect ratio is not correct. I have not found a method to force the WebView to rotate and fit the parent window.
Is there any method to set the orientation and size of the WebView itself? I see the same behavior on multiple devices.
This behavior is device specific. Some of the devices I have tested rotate as expected, another device rotates the display, but the WebView rotates back into landscape. The remaining devices I have tested do not rotate at all.
I will make this will be a known limitation of running this application on Android TV devices.
Related
In Nativescript Angular, Is there anyway to detect orientation change and not allow content auto rotate but handling the content rotation manually? For example when rotating orientation from portrait to landscape, I want the content on the screen to stay still but i need to know that the screen is currently in landscape mode.
Im using nativescript-orientation plugin but this only allow me to disable the rotation. Once the rotation is disabled i could not detect the orientation change when the screen is landscape or portrait.
If you want to detect the orientation by yourself then you have to get the sensor data. I have never done this myself so I will just tell you where you can start. For IOS, you have get the sensor data from coremotion. You would require the data from the accelerometer and magnetometer sensors's data.
You can use the plugin nativescript-coremotion or You can directly access the IOS native methods yourself to do it.
I have an iOS app that only supports portrait. When rotating the device the video captured by the RTCCameraVideoCapturer (WebRTC) rotates to landscape orientation, even when the rest of the UI stays in portrait. How to avoid this?
Do you have access to RTCCameraVideoCapturer codebases ? Also, I am not sure which version of the WebRTC codebases you are working with. And, in your application ; is landscape mode is the only mode that you are intending to support ?
There should be rotation calculation method that listen to rotation changes. You can just disabled it, or can use your preferred fixed set of rotation in spite of default.
For example, taking from this sample codebase ; you can just only use RTCVideoRotation_90 to have landscape orientation only.
I am using adaptive layout with size classes (iOS10).
For an iPad I want to support portrait & landscape views, but for iPhone I only want to support portrait. I don't want to rotate screen for compact height.
iPad is all fine and I have set-up the iPhone views using size classes, so I am thinking I need to somehow detect what size class will be transitioned to and disable rotation if it would go to compact height.
I can see a method called traitCollectionDidChange, but not sure if this is the correct time in the lifecycle to detect this.
There are a few related questions, but I don't see anything that covers this specific scenario.
I just made an ios app through cordova, iphone app looks fine because I am using always portrait mode for iphones but for ipads I am using always landscape mode with locked rotation. The problem is when I ma build an app and run it on my ipad the landscape works fine the rotation is locked but the main issue is that I have set 100% height on body, and somehow its not working on iPad landscape. Looks like that 100% doesnt detect landscape mode and automatically was set 1024px for height because if I am set 768px height for body in inspect then the whole app looks fine as should.
Any ideas what can be the issue there ?
Don't set width and height if you set the scale
From apple doc
You do not need to set every viewport property. If only a subset of
the properties are set, then Safari on iOS infers the other values.
For example, if you set the scale to 1.0, Safari assumes the width is
device-width in portrait and device-height in landscape orientation.
i think about extending support within one of my apps to handle a second screen via AppleTV.
The question is:
If i just mirror my App, the nice 46" LCD TV shows only a 4:3 Letterbox Image of my App. Is it possible to use the full 16:9 ratio if i change my app to render a different screen for Apple TV / AirPlay?
Absolutely. In iOS 5, a mirrored AirPlay screen can be used as a secondary UIScreen, which can have content different from what is on the device screen. That's what you want to do.
You can see how to do this here:
https://github.com/quellish/AirplayDemo
Your device screen is mirrored until you start using that secondary UIScreen, and you can remove the window you attach the to the UIScreen and go back to mirroring. This lets you control when you're putting custom content on there, and when you're just mirroring.
Absolutely - see Real Racing HD 2 for a great example!