Why Google Slides not Autofit text in placeholders? - google-slides-api

I have a simple slide where the placeholders are all set in: Shrink text on overflow.
Despite this, the text is not reduced and through the Api I discover that the Autofit is not set.
In setting it, however, I get the following error: Autofit types other than NONE are not supported
Code of requests:
requests = [
{
"updateShapeProperties": {
"objectId": 'gda51db96da_1_5',
"shapeProperties": {
"autofit": {
"autofitType": 'TEXT_AUTOFIT'
}
},
"fields": "autofit.autofitType"
}
}
]

This is an open issue, and needs a fix from Google's end.
Ref: https://issuetracker.google.com/issues/191389037

Related

navigator.mediaSession.metadata not updating after page reload

I am currently tying our audio player with mediaSession.
Everything is working as it should, when I hit play and update navigator.mediaSession.metadata, it's properly displayed in the notification on desktop and mobile.
But after I reload the page and hit play, the notification has always default values (website URL as a title and link rel="icon" for the artwork). This only happens after I reload the website. If I close it and open again the notification is working properly again.
Here's how it's done:
//...
initialConfiguration: {
title: 'Initial Title',
artist: 'Initial Artist',
album: '',
artwork: [
{ src: "initial/artwork/url.jpg", sizes: "512x512", type: "image/jpg" },
]
},
currentMetadata: null,
setMediaSessionMetaData: function(){
let self = this;
if ('mediaSession' in navigator) {
if( !self.currentMetadata ){
self.currentMetadata = new MediaMetadata(self.initialConfiguration);
}else{
// Update existing metadata
self.currentMetadata.title = "New Title";
self.currentMetadata.artist = "New Artist";
self.currentMetadata.artwork = [
{ src: "new/artwork/url.jpg", sizes: '512x512', type: "image/jpg" },
];
}
navigator.mediaSession.metadata = self.currentMetadata;
}
},
//...
This function works perfectly fine on first page load, when I hit play for the first time it loads the initialConfiguration and if I call the function again the title and artwork gets updated. But after reload, the notification has always default values ignoring my configuration.
Is there a bug in mediaSession, I didn't find anything regarding this issue on mediaSession github page (https://github.com/w3c/mediasession/issues) and searching this issue gives me zero results.
After Searching for days and not finding anything....
I discovered a workaround. It has to do with the performance.navigation.type when you first open a page it is set to 0 and after a refresh it gets set to 1. I was curious if this had any effect on the mediasession so I figured out how to "Hard Refresh" the page by using window.open(window.location.href, "_self");, because apparently that generates a "Hard Refresh". After that the mediasession works again. so what I did was setup an onload function that checks to see if performance.navigation.type == 1 and if so then do a "Hard Refresh"
window.onload = function() {
if (performance.navigation.type != 0) {
window.open(window.location.href, "_self");
}
};
Now when the user refresh's it will do a "Hard Refresh".
Also make sure to move the window. Onload line to the end of the javascript file or after the initial function

Specify voice in twilio actions json

In one of my situations I need to be able to specify the voice in the default initiation of the autopilot. I have a strange behavior. Despite the style sheet set to a particular voice, the default initiation is not using that voice. Instead it is using may be a default voice? I don't know. However when the next intent is detected the voice switches to the correct voice specified in the style sheet.
{
"actions": [
{
"say": "Hello , May I speak to Mr Peter ?"
},
{
"listen": true
}
]
}
My Style sheet
{
"style_sheet": {
"voice": {
"say_voice": "Polly.Raveena"
},
[...]
}
}

Style the default "No video source" / "No video permissions" black rectangle

When the user is prompted for a permission on Safari, the video element is shown as a black rectangle with a strikethrough play button. How do I change this element's styling? Does it have a specific ID / class / tag?
I'm using Quagga JS as a barcode scanner. AFAIK Quagga creates a video element, then asks for camera permission. The optimal result would be to hide the element using display:none;, but I can't think of any way to accomplish this. I need the element to display the camera feed once the scanner has its permission, but before that it should either paint the screen black or be hidden.
I've fixed it by hiding it via JavaScript and showing it once the Quagga Feedback has finished. Note that a pure CSS solution would be much prettier.
// Hide the preview before it's fully initialised.
$('#videoBoundingBox').hide();
Quagga.init({
inputStream: {
name: "Live",
type: "LiveStream",
target: document.querySelector('#videoBoundingBox')
},
decoder: {
readers: [
"code_128_reader",
"ean_reader"
]
}
}, function (err) {
if (err) {
console.log(err);
setResult(err);
err = err.toString();
if (err.search("NotFoundError")) {
// No camera found. The user is probably in an office environment.
// Redirect to previous orders or show a background image of sorts.
} else if (err.search("NotAllowedError")) {
// The user has blocked the permission request.
// We should ask them again just to be sure or redirect them.
} else {
// Some other error.
}
return;
}
// Hide the preview before it's fully initialised.
$('#videoBoundingBox').show();
setResult("Initialization finished. Ready to start");
console.log("Initialization finished. Ready to start");
Quagga.start();
initializeQuaggaFeedback();
});

iPad iOS Safari getUserMedia acces specific camera ( front or back )

What is the right way to access the the front or back camera.
Currently I'm only able to access the "user" camera ( front ).
I can't switch to back camera using any constraints.
Using a specific device id is also not working:
var constraints = {
video: {
facingMode: "environment",
deviceId: "E858F78F6026428D45DD669617B4A881409AA4DA"
}
};
navigator.mediaDevices.getUserMedia(constraints).
Cany somebody please help me?
It is always accessing the front camera.
Following your question I think you already have successfully called getUserMedia() to get the user's permission to access the camera (otherwise you won't have get the front camera to work). This is needed because the label values in the following JSON will only be filled when the user has already granted access.
On iOS you now have to call navigator.mediaDevices.enumerateDevices() and will get a "response JSON" like that:
[
{
"deviceId":"<firstID>",
"kind":"audioinput",
"label":"iPhone Microphone",
"groupId":""
},
{
"deviceId":"<secondID>",
"kind":"videoinput",
"label":"Back Camera",
"groupId":""
},
{
"deviceId":"<thirdID>",
"kind":"videoinput",
"label":"Front Camera",
"groupId":""
}
]
using the deviceId of the device you want or let the user choose it using a basic UI will give you access to the back camera.
Caution: The deviceId values will change on each invocation of enumerateDevices()!
You can also pass this in as an argument when you are calling getUserMedia.
video: {
facingMode: {
exact: 'environment'
}
}
This will return the back camera's video:
navigator.mediaDevices.getUserMedia({
video: {
facingMode: {
exact: 'environment'
}
}
})

Data Grouping - Monthly (end-of-month)

I'm having a very difficult time trying to get my data to be grouped via month. I've even gone so far as to programmatically filter through my data to return only the last day of the month and calculate the monthly value. I've tried to find a good explanation on the 'dataGrouping' property but have had no luck understanding it nor properly implementing it. Every results returns my series in a daily interval.
My questions are as follows:
Is there a minimum number of data points needed for data grouping to
work?
Under the dataGrouping.units I've tried to use this
documentation but nothing has worked for me - Still results in a
daily interval - Could someone explain this for me?
Any help on this would be GREATLY appreciated.
Are you using HighStock graph?
If yes...
Sure, it takes a lot of data to get grouping. If datagrouping option is enabled, Highstock handle automatically the switch between every grouping mode. So if you don't have a lot of data, it will not work with default settings
So, if you want to group by default, you need to force the grouping.
series:[{
[...]
dataGrouping: {
approximation: "sum",
enabled: true,
forced: true,
units: [['month',[1]]]
}
}]
EDIT
Here is a working example demo (fork of a basic highstock demo)
http://jsfiddle.net/NcNvu/
Hope it helps!
Regards
We tried a Hack around this, where we used Highstock's (Splinechart) RangeSelector, Event and DataGrouping. On click of weekly rangeselectorButton we catch this event through setExtremes. Post catching the event approximate it to "sum". If you are using two series than iterate the object. Currently doing it weekly just extend it for Monthly using corresponding UNIT
events: {
setExtremes: function (e) {
if (e.rangeSelectorButton != undefined) {
var triger = e.rangeSelectorButton;
if (triger.type == 'week') {
$.each(this.series, function (index, obj) {
obj.options.dataGrouping.units[0] = ['week', [1]];
});
} else if (triger.type == 'day') {
$.each(this.series, function (index, obj) {
obj.options.dataGrouping.units[0] = ['day', [1]];
});
}
}
}
},

Resources