WebBluetooth API: How to get current device's id - javascript

I'm using WebBluetooth API in Chrome 80 with experimental flag enabled.
I can retrieved all nearby devices' info with navigator.bluetooth.requestLEScan.
However, when it comes to the current device that I'm making scan from, there doesn't seem to be a way to retrieve information about it.
Is there anyway that I can retrieve information of the current bluetooth device?
I couldn't find anything from here, here, nor here

Web Bluetooth does not have a way to get information about the central device. Please use the GitHub Issue that you filed to discuss use cases for this feature.

Related

Web Bluetooth bypass Pairing Screen for a known device id

Is it possible to connect a bluetooth device whose ID I know without the pairing screen?
classic:
navigator.bluetooth.requestDevice ({filters: [{services: ['heart_rate']}]})
.then (device => {
this.device = device;
return device.gatt.connect ();
instead I would like to do device.gatt.connect () without navigator.bluetooth.requestDevice .. at least for the device that I have already connected once or of which I know the ID.
can someone help me? ..thank you!
The Bluetooth Permissions API integration section of the Web Bluetooth spec does specify a way to do this using a device ID. However, it is not currently implemented in any browser.
There is ongoing work in Chrome to implement a getDevices() method that can return a list of previously granted Bluetooth devices. The status of that API can be checked in Chrome Platform Status.
6/22/20 Edit:
I recently implemented a new permissions backend as well as two APIs that will enable previously permitted Bluetooth devices to be used.
The new permissions backend is implemented behind the chrome://flags/#enable-web-bluetooth-new-permissions-backend. The new backend will persist device permissions granted through requestDevice() until the permission is reset in Site Settings or the Page Info dialog box.
The getDevices() and watchAdvertisements() are implemented behind the chrome://flags/#enable-experimental-web-platform-features flag for Chrome 85.0.4165.0 or greater. The recommended use of these APIs is to use getDevices() to retrieve an array of permitted BluetoothDevices and then calling watchAdvertisements() on these devices to start a scan. When advertisement packets are detected from the devices, the advertisementreceived Event will be fired on the device that it corresponds to. At this point, the Bluetooth device is in range and can be connected to.
Please give this new feature a try, and file any bugs at https://crbug.com using the Blink>Bluetooth component.

Retrieve media info from the current track being played on a specific Chromecast

I'm working on a webpage controling what is being played on a specific Chromecast (there are several on the network) but I'm having trouble with the Google Cast SDK.
I don't want a sender app, nor register a for an API key, just retrieve the media info currently being played.
On an Android smartphone, you get those information automatically as a notification, or directly in the Google Home application as you can see in the 2 screenshots below, even if you are not the one broadcasting the media.
This topic is talking about something similar for an Android app, but I didn't find any similar notions in the Chrome Sender API (javascript).
Using the Chrome Sender API, I'm able to load a media on the chosen chromecast through a basic web app but that's not what I'm looking for. In the online documentation I did not find anything about this particular use case.
FYI the things I have:
ReceiverApplicationId casting to the chromecast
Chromecast IP / Name / Mac address
Does any of you have an idea how I could do that?
Thanks!
Please check this: cast.framework.CastContext.getInstance().getCurrentSession().getMediaSession() which has everything for the currently playing content including a media object which includes:
https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaInfo

Recovering bluetooth device address

I need to write a code to get the address of the device, CONNECTING to my site
So, for an instance, I visit my website with my phone. On button click, I need to get the Bluetooth address of it.
I've seen some examples showing how to get addresses of nearby devices. That's not what I need.
I don't have time for a proper research now, so if you have examples, please, share them with me.
I'd really appreciate your help.
There is this experimental API, but it’s not enabled by default
https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice
Normally a website can not access such private device information, but apps that a user chooses to install can, such as an app written with ReactNative.

Detecting Available Storage with IndexedDB

I have written an offline application that utilises IDB to store images and text that would normally exist in a MySQL DB for offline use.
However, I am trying to figure out a way that I can read the limit on the devices storage for IndexedDB. I am currently using the following method to determine this although it only works in Chrome.
I am using the snippet from here https://stackoverflow.com/a/18350531/4121257 which gets the storageInfo for WebKit based however if someone knows a way to get it on FF & IE & more specifically Safari that would be great.
From what I have gathered this returns the used quota for everything stored by that browser for the domain not just IDB. However, what I am using is the remaning quota. From this I either perform an AJAX request to the server to get the estimated size of all the files that will be stored and work out if there is enough storage or I will calculate the ammount stored in the IDB and work out if there is enough to store more.
I was wondering if someone had a more 'streamlined' approach? And a way to check the remaning quota in FF/IE and especially Safari & even a way to check quota for IDB specifically.
The only API that is currently available and only for chrome is navigator.webkitTemporaryStorage.queryUsageAndQuota().
Firefox had plans to implement this API too.
There are also two experimental APIs navigator.storageQuota.queryInfo(type) and navigator.storage.estimate() available if you run chrome with --enable-experimental-web-platform-features. More details here: https://groups.google.com/a/chromium.org/forum/#!searchin/blink-dev/quota-api/blink-dev/P6eY26vB91c/Ri4ohXOPBQAJ
I think the Storage quota estimate() API is the most interesting one. It is still a draft but chrome and mozilla are currently implementing this API.
Unfortunately there is currently no public info available when and if Edge and Safari will implement this API.
Edge currently has a very different model for quota - rather than a whole-origin limit, each storage type (indexed db, local storage, etc) has its own limit.
Update: This feature was added to Chrome 52 (experimental flag) and Firefox 51 (nightly)
navigator.storage.estimate().then((data)=>console.log(data)) // Object { quota: 2147483648, usage: 0 }

How to access fingerprint and fingerprint algorithm for DTLS handshake

I am working on a WebRTC gateway project and I have a need to access a browsers fingerprint and its algorithm from Javascript. I would like to access this information to send it via a WebSocket signaling channel. I expected to get the fingerprint and hash algo via the browsers answer SDP, but on chrome its missing.
I have searched for an answer and have had no luck.
Here is a screen shot showing the information I want to access (via webrtc-internals):
I'm looking for a cross-browser solution, but if it works in Chrome only for now that would be just fine. The parameters I want are shown in the image as "googFingerprint" and "googFingerprintAlgorithm".
Update: screen shot of the offer
Update: screen shot of the answer
Update: latest offer + answer
There is no known way to access the fingerprint via javascript in the browser. There is a known chrome issue directly related to this question (that I submitted). https://code.google.com/p/chromium/issues/detail?id=417949

Categories