invalidAccessError: getDisplayMedia must be called from a user gesture handler - Safari - safari

I get sharing screen by using mediaDevices.getDisplayMedia() and it work well on Chrome and Safari < 15. But when I try it on Safari 15, I hit the bug:
invalidAccessError: getdisplaymedia must be called from a user gesture handler
I have viewed the answer: Safari getDisplayMedia must be called from a user gesture handler. They said that the reason is:
This safari error occures due to the event (event that should trigger it) having isTrusted property false. This property is set automatically and is not possible to fake.
When I log event.isTrusted on Safari 15, its value is true. But I still hit the above error. Can you guys help me with this, thanks.

You try to enable the experimental feature "Enable MDNS Ice Candidates" in Safari settings, advanced, experimental features

Related

Does Agora support screen share on Safari?

i dont have a straight answer whether Agora supports screen sharing on SAFARI. This 4x api page does not seem to list Safari at all, and there is some chatter on Stack overflow to that effect (at least for 3.x api) https://docs.agora.io/en/Interactive%20Broadcast/screensharing_web_ng?platform=Web
This is a show stopper for me, so appreciate a straight answer YES or NO whether Agora supports screen sharing on safari
When i tried it, I got a getDisplayMedia error:
"getDisplayMedia must be called from a user gesture handler" on Safari 13+. I do indeed create the new client, join and publish the local video upon an actual user click on a button, so not sure why we get this error. Only happens with screen share, camera/mic work
Looks like you answered your own question on the Agora RTE Dev Slack, I'll relay it here for anyone looking for a solution.
How Sri did it was essentially:
AgoraRTC.createScreenVideoTrack(..).then(() => client.join( ..)

Capybara Selenium Navigate To URL Hangs With Popup Alert on Safari

At the end of my tests Capybara automatically navigates to "about:blank" in order to set up the next test. Sometimes the application I'm testing will throw a popup alert if the user leaves the page (which is expected). I have some code to handle this:
begin
page.driver.browser.navigate.to("about:blank")
page.driver.browser.switch_to.alert.accept
rescue Selenium::WebDriver::Error::NoAlertPresentError
# No alert was present. Don't need to do anything
end
This works fine on Firefox, Chrome, and IE. But for some reason on Safari the navigate command hangs, I assume because of the popup. Anyone know a workaround for this?
There is no simple workaround for this at this time in any version of Selenium language bindings. It is a known issue the Selenium team is not interested in resolving. Fundamentally, it is due to the architecture of Safari and consequently the architecture of the Safari Driver.
The JavaScript of the Safari Driver extension does not know about most of the alerts and popups and dialogs that appear as modal Cocoa layer windows.
It also cannot interact with them.
There is a way but it won't be easy and nobody's done it.
You would need to use Cocoa.
So you would want to use RubyCocoa in this case.
(or PyObjC if you used Python)
You would then possibly also want a sidecar app actually written in Objective-C.
The trick would be to use the AX (Accessibility API) and a separate process to observe if there is an alert as the front window and poke at its labels and buttons' text as visible to the AX APIs.
AX APIs are probably exposed in RubyCocoa via the ScriptingBridge.
However, you would need to add your 'app' to the Security preference pane's list of things allowed to control the computer.
With that, you could detect the window and handle it.
It could be fairly brittle across web sites, but if built well, you could handle expected conditions.
You could try to confirm like this which I believe should work across browsers
# click ok to confirm
page.evaluate_script('window.confirm = function() { return true; }')

How to handle "unexpected preroll-complete"?

My app (OS X 10.10, Xcode 6.1.1) uses an AVPlayerView to show a video resource bundled inside the app. Normally the video runs as expected. Sometimes--and I haven't figured out a way to reliably reproduce this--the video does not start to play, and the screen is all black. At the same time, a warning pops up in the console:
<<<< Boss >>>> figPlaybackBossPrerollCompleted: unexpected preroll-complete notification
How can I programmatically recover from this? I tried Googling parts of the error description but there was only one result (an email to the Apple Mailing List).
Perhaps a notification my view controller can listen for?
Alternatively, if you know a way I can force this state to reproduce, that would help too, as I could then put a breakpoint in.
UPDATE: I still haven't been able to force this problem to reproduce, but I have seen it a couple of times since the first post, and I can say for sure that it's not related to the NSNotifications AVPlayerItemNewErrorLogEntryNotification, AVPlayerItemPlaybackStalledNotification or AVPlayerItemFailedToPlayToEndTimeNotification. My View Controller is listening for those, and didn't hear them when the bug presented.
Thanks!

Is it possible to enable or disable VoiceOver within an iOS app?

I would like to be able to turn VoiceOver on or off within my iOS app. The reason for this is I am trying to help a person with disabilities which render her unable to read messages (hence the need for VoiceOver), and who is also unable to triple click the home-button due to motor coordination problems. The way to the setting through Settings>General>Accessibility>VoiceOver>VoiceOver>Flipswitch is far too long and complicated.
Is it possible, without jailbreaking the device, to change this setting in an app? The app doesn't need to make it to the App Store, if that helps.
Alternatively, is it easy to do this with a jailbroken device?
Another approach may be to simulate the triple-click on the home-button that automatically turns on VoiceOver. Is there any way to do this?
Get the app aHomeIcon.
Open the app and tap URL.
Insert the url: prefs:root=General&path=ACCESSIBILITY
Tap 'Done'.
Insert a name to be shown below the icon.
Tap the export button at the bottom of the page. Safari opens.
Add a bookmark and select 'to home-screen'.
Now you can tap that icon and you are redirected to the accessibility part of the settings app.
See this link for reference.

Is it okay to change UI in the OnActivated event on iPhone in CocoaTouch?

Is one allowed to change/setup the UI in the applications OnActivated event?
It seems like I get sometimes incorrect screen setups and wonder if it is actually allowed what I'm doing.
The Apple documentation states, "If your application was previously in the background, you could also use it [applicationDidBecomeActive] to refresh your application’s user interface."