I am developing a streaming website. It works, however, at some time, I have installed a software called OBS which installed a virtual camera. Since then, when the web site tries to use the camera, it uses the OBS virtual camera, instead of my physical camera. But this occurs only in my PC. When the camera is to be used, this permission dialog appears:
In my laptop, this works, that is, in that same dialog, it shows a combobox allowing to choose which camera to use.
In the web site, I am starting the camera this way:
navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
});
Can I do something with the getUserMedia function or this problem is only related to the PC configuration?
This has to do with Google Chrome. Assuming that OBS's deviceID stays the same, then use navigator.mediaDevices.enumerateDevices() to get a list of all available devices.
(MDN's example is quite handy):
navigator.mediaDevices.enumerateDevices()
.then(function(devices) {
devices.forEach(function(device) {
console.log(device.kind + ": " + device.label +
" id = " + device.deviceId);
});
})
.catch(function(err) {
console.log(err.name + ": " + err.message);
});
However, if you would like to be able to switch cameras mid stream, then I would recommend using WebRTC's "official" example, however, you will need to use stream.replaceTracks to view it in real time.
It sounds to me like your web software lacks a user user interface to let your user choose a camera or virtual camera, as #divinelemom suggested. It's a good idea to do that. Example code doing that is here.
https://webrtc.github.io/samples/src/content/devices/input-output/
In the meantime, use this URL to see Chrome's interface for choosing the default camera.
chrome://settings/content/camera
It gives you a page like this. Your choice is "sticky" in the sense that it will be used by your web app after you set it.
Related
in my windows phone 8 application i am using custom uri association to launch another application through my phone.
i.e
await Windows.System.Launcher.LaunchUriAsync(new Uri("sixtag:"));
but my app is not able to get certified for store because of this. the testing team tells that you app terminates unexpectedly while executing this.
now, i don't know how to deal with this.
is there any way to throw exception if the app which i am launching is not installed on phone ?
or i should try something else so my task gets accomplished and app gets certified for store as well.
You do not need to wrap your launch in try/catch or check for success as described in the other answers. As soon as you call LaunchUriAsync, the platform takes over and will automatically handle the possibility of no app being installed by asking the user if she wishes to search in the store.
A couple of things to double-check:
1) Ensure that you can successfully back into your app following the navigation to sixtag.
2) Ensure that your call to LaunchUriAsync is the direct result of a user action (eg. tapping a button)
try
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("sixtag:"));
}
catch
{
MessageBox.Show("please install Sixtag from the app store","AppMissing", MessageBoxButton.OK);
}
you can perhaps display another button and on clicking directly navigate to the app store. See if this solves your problem. Do vote it up if it does :)
You are needed to handle that as shown here . Also Read out Remarks given there.
One Quick Question:
I want to navigate to settings(cellular..) from an secondary livetitle.
The Problem is the targetUrl for the Shelltitle(selectedShortcutsMenuControl.TargetUrl) in my app looks like this: "cellular",
and thats not an valid Uri format.
Exception : "An exception of type 'System.UriFormatException' occurred
in System.ni.dll but was not handled in user code"
StandardTileData data = new StandardTileData();
data.Title = selectedShortcutsMenuControl.Title;
data.BackgroundImage = myUri;
ShellTile.Create(new Uri(selectedShortcutsMenuControl.TargetUrl,UriKind.RelativeOrAbsolute), data);
Is there a way to fix this or is there a way, to directly navigate to cellular Settings form the livetitle?
<ctl:MenuData x:Key="ShortcutsMenuControlData">
<ctl:MenuItemData Title="Cellular" TargetUrl="wifi" Image="/Images/Item-fc0d2405-5b0f-4f3d-ba3e-5b93fbfe2c44.png"/>
<ctl:MenuItemData Title="WiFi" TargetUrl="cellular" Image="/Images/Item-c9f6c2c7-44e1-4079-ad90-e31b8a59333e.png"/>
<ctl:MenuItemData Title="Airplain Mode" TargetUrl="plaine" Image="/Images/Item-10845593-26f7-485a-bef7-cf9b9b0cf9fe.png"/>
<ctl:MenuItemData Title="Bluetooth" TargetUrl="bluetooth" Image="/Images/Item-294e2b67-5534-43b3-ae4e-aecf180c9274.png"/>
</ctl:MenuData>
So inorder to navigate to the native phone settings you need to use the built in URI schemes.
They can be found on MSDN here
Specifically for the ones you are asking for the codes are
ms-settings-airplanemode: Launches the Airplane Mode Settings app.
ms-settings-cellular: Launches the Cellular Settings app.
ms-settings-bluetooth: Launches the Bluetooth Settings app.
ms-settings-wifi: Launches the Wi-Fi Settings app.
replace your target url's with these and it should work
i am trying to get user current position in mobile web application
my app work in all android telephone device except samsung galaksy s2 telephone device ..
it give errror POSITION UNAVAILABLE error
this is demo link.you can view source
this is code
navigator.geolocation.getCurrentPosition(handle_geolocation_query1, handle_errors) ;
function handle_errors(error) {
switch (error.code) {
case error.PERMISSION_DENIED: alert("user did not share geolocation data");
break;
case error.POSITION_UNAVAILABLE: alert("could not detect current position");
break;
case error.TIMEOUT: alert("retrieving position timed out");
break;
default: alert("unknown error");
break;
}
}
function handle_geolocation_query1(position) {
$('#map_canvas').gmap('addMarker', {
'id':'m_1',
'position': new google.maps.LatLng(position.coords.latitude,position.coords.longitude),
'bounds': true,
'icon': 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/geolocationmarker/images/gpsloc.png'
}).click(function () {
$('#map_canvas').gmap('openInfoWindow',{ 'content': '<font color="#2a2a2a" size="4">Location </font><br/><font color="#4a4a4a">Your current location</font>' }, this);
});
var map = $('#map_canvas').gmap('get', 'map');
map.setZoom(14);
map.setCenter(new google.maps.LatLng(41.01802007732287, 28.971880674362183));
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
}
edited:
i used phonegap to produce android apk file
when i work this apk file application it give error POSITION UNAVAILABLE error but when i call this page from web it works it does not give error ... this is web link and you can download apk from here
Your code is working fine in browser but not in mobile.
On checking your source code it seems you're specifying the sensor parameter as false.
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
You missed this while checking the documentation.
Specifying the Sensor Parameter
Use of the Google Maps API requires that you indicate whether your
application is using a sensor (such as a GPS locator) to determine the
user's location. This is especially important for mobile devices.
Applications must pass a required sensor parameter to the tag
when including the Maps API javascript code, indicating whether or not
your application is using a sensor device.
Applications that determine the user's location via a sensor must pass
sensor=true when loading the Maps API JavaScript.
Hope you understand.
On my device, I had my settings for Location mode set to "Device only".
In this case, I wasn't able to get a good connection of location and hence get Position Unavailable.
I change my Settings > Location > Mode and change it to High Accuracy.
It took me a lot of days to get this problem to work unknowingly that the problem is in the device itself. I did my best capability to fix the codes, and even traced back to the plugin's code.
Please respect my post. Some people might have this problem as well. Thank you.
I had the same error with Messenger webview, the location for Messenger was denied in phone settings so the error was resolved after allowing the location sharing for the Messenger app.
I am experimenting with azure mobile services and have implemented the authentication example here. This works on most devices ( iOs, IE9 and chrome on desktop, IE10 Surface RT, android ) but on a WP8 device ( a Nokia 920, to be precise ) it returns
"Cannot reach window opener. It may be on a different Internet Explorer zone"
after attempting to return from the authenication providers pop-up. This is mentioned briefly in the link above, but only wrt to connecting to the service from localhost. This is not the case here and other devices work fine. It does not seem to be a problem with any particular authentication provider - all ( facebook, google, twitter, windows connect ) return the same message. And as these other devices work, it seems unlikely that the service is mis-configured, but there could very well be something subtle that I'm missing.
The way I got the authentication to work is not to use Facebook JavaScript SDK, but another flow, described here https://developers.facebook.com/docs/facebook-login/login-flow-for-web-no-jssdk/#step2
For handling the response when I get the redirect back from Facebook, I used the following code:
function handleLoginResponse() {
var frag = $.deparam.fragment();
if (frag.hasOwnProperty("access_token")) {
client.login("facebook", { access_token: frag.access_token }).then(
function () {
// do your thing when logged in
}, function (error) {
alert(error);
});
}
}
This code makes use of jQuery BBQ plugin, found here http://benalman.com/projects/jquery-bbq-plugin/.
This way I can get Facebook auth to work on WP8 and I'm able to pass the access token to Mobile Services login.
A slight problem is that now the access token sticks in my site URL, which I think is a problem if the user decides to share the URL, for example. I think I can get around this by e.g. putting the info in a cookie (or local storage) and then redirecting to the plain URL of my site.
I am developing iPad application using phonegap (cordova 1.9.0). I need to get current position of the user.
I used following code and it works fine when Location services are enabled.
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
function onSuccess(position) {
console.log(position.coords.latitude + "-" + position.coords.longitude);
}
function onError(error) {
alert('code: ' + error.code
'message: ' + error.message + '\n');
}
My problem is that this code not working when Location services are disabled. I need to get current location if Location service are enabled or disabled.
Anyone tell me how to get current location in this situtation?
You can't get the current location when location services are disabled. That would be a violation of a user's privacy. The point of disabling location services on a device is to prevent applications from getting the current location.
What I've done is display my own dialog with a lengthy explanation of why I need location services before calling getCurrentPosition(). I explain that the app won't work without it. I also say something like:
Your device may also ask you for permission.
This increases the chances of someone saying yes to the iPhone dialog.