I'd like to serve audio ads on JWPlayer.
But when ad was called JWPlayer throws error code "MEDIA_ERR_SRC_NOT_SUPPORTED".
Though Content-Type in the http header is audio/mpeg, in the vast is video/mp4.
Content type in the vast xml will affect the error in JWPlayer?
Following URL is test page.
http://webdemo.dac.co.jp/nt/radio/audio_test.html
javascript code for advertising is below.
advertising: {
client: "vast",
schedule: {
preroll: {
offset: "pre",
tag: 'http://xp1.zedo.com/asw/fnsr.vast?n=2696&c=4/2&d=80&s=0&v=vast2&pu=__page-url__&ru=__referrer__&pw=__player-width__&ph=__player-height__&z=__random-number__',
'skipoffset':1,
},
postroll: {
offset: "post",
tag: 'http://xp1.zedo.com/asw/fnsr.vast?n=2696&c=4/2&d=80&s=0&v=vast2&pu=__page-url__&ru=__referrer__&pw=__player-width__&ph=__player-height__&z=__random-number__',
},
adbreak1: {
offset: 5,
tag: 'http://xp1.zedo.com/asw/fnsr.vast?n=2696&c=4/2&d=80&s=0&v=vast2&pu=__page-url__&ru=__referrer__&pw=__player-width__&ph=__player-height__&z=__random-number__',
},
},
}
While I am not too familiar with the JW player myself, the MediaFile node in the VAST XML should have the correct type attribute.
<MediaFile delivery="progressive" bitrate="300" width="1" height="1" type="audio/mpeg">
Using audio/mpeg tells the player not to expect a video and this prevents a media error.
Related
We are trying to get a PowerBi report embedded in a Powerapps portal to show the mobile view of the report.
As described here, I’m testing with a report which only have mobile enabled pages.
This is the code I use to request the mobile version, as documented here.
let report = (await powerbi.get($('.portal-pbi-embedded')[0]))
let page = (await report.getPages()).find(i=>i.isActive);
console.log(await page.hasLayout(window['powerbi-client'].models.LayoutType.MobilePortrait))
// true
console.log(await report.updateSettings({layoutType: window['powerbi-client'].models.LayoutType.MobilePortrait}))
// {statusCode: 202, headers: {…}, body: undefined}
It appears that PowerBi can see that there is a mobile layout for the active page, and the updateSettings commands executes without errors, but nothing happens.
I also tried embedding the report again, where I request the mobile layout upfront, this gives the same behaviour (only showing the desktop version).
I recognized that the powerbi client version that powewrapps portals uses is a bit old (version 2.6.5). Even though that we are running the latest version of the portal that are available to us (9.3.2205.12).
Question 1: How do we show the mobile version of the report in the portal?
Question 2: Is there a way to update the powerbi client in the portal?
First Question
you should note the following (from docs):
after the report initial load, changing to report mobile layout is
supported only if mobile layout (portrait/landscape) has been set into
the initial embedding configuration object. Otherwise, you must first
call powerbi.reset(HTMLElement) to remove the iframe. Then, you have
to call powerbi.embed(...) using the same container with the mobile
layout setting defined on the embedded configuration object.
So basically, you are facing two options:
First Option - In your Configuration, use the following concept to control your visuals:
let models = window['powerbi-client'].models;
let embedConfig = {
type: 'report',
id: reportId,
embedUrl: 'https://app.powerbi.com/reportEmbed',
tokenType: models.TokenType.Embed,
accessToken: 'H4...rf',
settings: {
layoutType: models.LayoutType.Custom
customLayout: {
pageSize: {
type: models.PageSizeType.Custom,
width: 1600,
height: 1200
},
displayOption: models.DisplayOption.ActualSize,
pagesLayout: {
"ReportSection1" : {
defaultLayout: {
displayState: {
mode: models.VisualContainerDisplayMode.Hidden
}
},
visualsLayout: {
"VisualContainer1": {
x: 1,
y: 1,
z: 1,
width: 400,
height: 300,
displayState: {
mode: models.VisualContainerDisplayMode.Visible
}
},
"VisualContainer2": {
displayState: {
mode: models.VisualContainerDisplayMode.Visible
}
},
}
}
}
}
}
};
...
// Embed the report and display it within the div container.
let report = powerbi.embed(embedContainer, embedConfig);
The second option - use the reset method:
powerbi.reset(HTMLElement)
powerbi.embed(...)
Second Question
I'm not sure that I understood your question correctly, but if I did - take a look here (https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/update-settings)
I've integrated Paypal to my website and everything worked as expected. However when i added a new language (greek) i got a problem when pressing pay with paypal button. When change back to english everything works and button is rendering with no probs.
The error i got from paypal is:
Code i'm using:
<div id="paypal-button-container">
<!--Paypal button will load-->
</div>
// Render the PayPal button into #paypal-button-container
paypal.Buttons({
style: {
color: 'blue',
shape: 'rect',
label: 'pay',
height: 40
},
// Set up the transaction
createOrder: function(data, actions) {
console.log('kostas');
console.log(actions);
return actions.order.create({
purchase_units: [{
amount: {
value: amount,
}
}]
});
},
// Finalize the transaction
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Show a success message to the buyer
console.log(details);
sendData();
function sendData() {
fetch(url, {
method: "POST",
headers: {
"Content-type": "application/json",
"X-CSRFToken": csrftoken,
},
body: JSON.stringify ({
orderID: orderID,
transID: details.id,
payment_method: payment_method,
status: details.status,
}),
})
.then((response) => response.json())
}).render('#paypal-button-container');
Since is the first attempt to work with paypal i would appreciate any help if you can give me any hint on the below error or any idea on how to troubleshoot.
Many Thanks
when i added a new language (greek) i got a problem when pressing pay with paypal button.
You don't show the code you are adding, so it's impossible to say what specifically is triggering the error, but it appears it may be something in the order creation call, which is not the correct place for changing button text.
To change the language of the buttons to something other than the default (auto-detected based on the browser's language), use the locale query string parameter on the SDK src line.
Here is the documentation: https://developer.paypal.com/docs/checkout/reference/customize-sdk/#locale
I´m currently building an Slack app with a modal. I´m using a serverless AWS Stack containing a Lambda function that handles the user interactions. Those interactions are verified in that Lambda.
If the user input is correct, the modal is closed successfully (Lambda returns a 200 response). However, if I return the following as the body when user input is wrong and user submits the modal (as per Slack´s documentation):
{
"response_action" : "errors",
"errors": {
"startDate": "Start date is incorrect.",
},
}
The full response I'm returning at the end of the Lambda function is:
response = {
statusCode: 200,
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
response_action : "errors",
errors: {
"endDate": "Start date is incorrect.",
}
})
};
I receive the error in the next screenshot:
Am I missing something? Thanks a lot.
So I found the problem and here´s the solution in my case (might be helpful to you reader):
The right block type
The modal I built is made of interactive components, like a date picker. These components are blocks of type "section". For better comprehension, they look like this:
However, it seems that´s not compatible with the the feature to display input errors. For that, you have to choose blocks of type "input". Again, for understanding, they look like this:
And that type of block is compatible with displaying error messages as per Slack documentation.
The response from AWS Lambda
When you validate a user input, in the AWS Lambda function, Slack expects you to return the following structure in the response if you want to warn about an error:
{ "response_action": "errors", "errors": { "ticket-due-date": "You may not select a due date in the past" } }
However, it looks like you need to indicate the time of content by adding a header defining content is of JSON type without a statusCode. In my case, response that works is:
response = {
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
response_action : "errors",
errors: {
"test": "That date is invalid. Please, select a future date.",
}
})
And that way, the custom error message appears:
I'm currently doing this inside a Lambda function (many lines of code omitted):
var aws = require('aws-sdk');
exports.handler = (event, context, callback) => {
var ses = new aws.SES();
var params = {
Destination: {
ToAddresses: toAddresses,
},
Message: {
Body: {
Html: {
Data: html
}
},
Subject: {
Data: subject
}
},
Source: source
};
var email = ses.sendEmail(params, (error, data) => {
});
};
When I receive the email inside Microsoft Outlook, it shows this text underneath the subject:
(Optional) This text will appear in the inbox preview, but not the email body.
How do I configure that text to be something else?
I can't find it in the SendEmail API. I tried searching for that text and didn't see anything on Google, either.
I haven't used the SDK for this (I wrote my own), but based on the API docs, it should look something like this:
Message: {
Body: {
Html: {
Data: html
+ },
+ Text: {
+ Data: 'add this section and put the preview data here'
}
},
Subject: {
Data: subject
}
},
http://docs.aws.amazon.com/ses/latest/APIReference/API_Body.html
It looks like the Inbox Preview text in Outlook will be based on the HTML or Text that is set.
Experimenting with the Text property from Michael's answer help me figure this out. In my HTML I found out I had this:
<!-- Visually Hidden Preheader Text : BEGIN -->
<div style="display:none;font-size:1px;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;mso-hide:all;font-family: sans-serif;">
(Optional) This text will appear in the inbox preview, but not the email body.
</div>
Changing that solved my problem. *facepalm* (Someone else gave me the HTML to send and I didn't look through it carefully.)
I'm using that snippet below to get info of my contacts, works fine, I just need to know how to change the size of the picture I get, currently I'm getting a very small pic. I searched through Facebook docs and found nothing.
FB.api('/me/friends', { fields: 'id, name, picture', limit: 3 }, function(response)
{
if (response.error)
{
alert(JSON.stringify(response.error));
}
else
{
alert("Loading friends...");
console.log("fdata: " + response.data);
response.data.forEach(function(item)
{
// feeding my html
});
}
});
Thanks!
Ps.: I'm using a Phonegap plugin to use Facebook API. Probably, the JS methods I'm calling are calling Java methods, so, I don't know which especifically API I'm using, but seems to me the default Graph Api.
I use /user_id/picture?type=large for profile pics.
http://developers.facebook.com/tools/explorer/135669679827333/?method=GET&path=732484576%2Fpicture%3Ftype%3Dlarge
refer to http://developers.facebook.com/docs/reference/api/#pictures
in your case do not call the pictures of the friends, use the id instead
in your html build the image
<image src="https://graph.facebook.com/user_id/picture?type=large&return_ssl_results=1" />
Example:
<div id="friends"></div>
<script>
FB.api('/me/friends', { fields: 'id, name', limit: 3 }, function(response)
{
if (response.error)
{
alert(JSON.stringify(response.error));
}
else
{
alert("Loading friends...");
console.log("fdata: " + response.data);
response.data.forEach(function(item)
{
document.getElementById('friends').innerHTML+='<image src="https://graph.facebook.com/'+item['id']+'/picture?type=large&return_ssl_results=1" />';
document.getElementById('friends').innerHTML+='<br />'+item['name']+'';
});
}
});
</script>
You can go with either of the following 4 based on your needs
FB.api('id?fields=picture&type=large');
or
FB.api('id?fields=picture&type=small');
or
FB.api('id?fields=picture&type=square');
or
FB.api('id?fields=picture&type=normal');