Azure Media Service returns 0 duration with account filter - azure

I am using Azure Media Service v3 to store and encode videos. As a trial, I'd want to show the initial 30 seconds to the User and they can see the rest if they sign up.
So to get the initial 30 seconds, I decided to use the manifest filter as described in the Azure website.
I created an account filter with the following settings and it got created successfully. However, whenever I try to play that video with the URL, I get the manifest file with duration equals to 0 and video fails to play.
Settings I used:
{
"properties": {
"presentationTimeRange": {
"startTimestamp": 0,
"endTimestamp": 300000000,
"presentationWindowDuration": 600000000,
"liveBackoffDuration": 0,
"timescale": 10000000,
"forceEndTimestamp": true
}
}
}
URL I am using to play video:
https://xxx-xxx.streaming.media.azure.net/resource-id/video-name.ism/manifest(filter=free-user)
This is how my original manifest looks:
<?xml version="1.0" encoding="UTF-8"?>
-<SmoothStreamingMedia TimeScale="10000000" Duration="4317653333" MinorVersion="2" MajorVersion="2">
-<StreamIndex Name="aac_und_2_127999_2_1" Language="und" QualityLevels="1" Url="QualityLevels({bitrate})/Fragments(aac_und_2_127999_2_1={start time})" Type="audio" Chunks="72">
<QualityLevel SamplingRate="48000" PacketSize="4" Channels="2" CodecPrivateData="1190" FourCC="AACL" Bitrate="127999" BitsPerSample="16" Index="0" AudioTag="255"/>
<c r="71" d="60160000" t="0"/>
<c d="46293333"/>
</StreamIndex>
-<StreamIndex QualityLevels="5" Url="QualityLevels({bitrate})/Fragments(video={start time})" Type="video" Chunks="72">
<QualityLevel CodecPrivateData="000000016764001FACD9405005BB011000000300100000030320F18319600000000168EBECB22C" FourCC="H264" Bitrate="762429" Index="0" MaxHeight="720" MaxWidth="1280"/>
<QualityLevel CodecPrivateData="000000016764001FACD940F0117EF011000003000100000300320F1831960000000168EBECB22C" FourCC="H264" Bitrate="456443" Index="1" MaxHeight="540" MaxWidth="960"/>
<QualityLevel CodecPrivateData="000000016764001EACD940A02FF97011000003000100000300320F162D960000000168EBECB22C" FourCC="H264" Bitrate="288193" Index="2" MaxHeight="360" MaxWidth="640"/>
<QualityLevel CodecPrivateData="0000000167640015ACD941E08FEB011000000300100000030320F162D9600000000168EBECB22C" FourCC="H264" Bitrate="157781" Index="3" MaxHeight="270" MaxWidth="480"/>
<QualityLevel CodecPrivateData="000000016764000CACD941419F9F011000000300100000030320F14299600000000168EBECB22C" FourCC="H264" Bitrate="99525" Index="4" MaxHeight="180" MaxWidth="320"/>
<c r="71" d="60000000" t="0"/>
<c d="54800000"/>
</StreamIndex>
</SmoothStreamingMedia>
Can anyone tell me what am I doing wrong here?
filter

Can you check if you actually have timestamp 0 in your manifest? The startTimestamp and endTimestamp settings select the range of actual timestamps in your manifest.
You can open the manifest here:
https://xxx-xxx.streaming.media.azure.net/resource-id/video-name.ism/manifest

Related

Properly encode URL for Webtest configuration XML with Terraform on Azure

I'm trying to setup a azurerm_application_insights_web_test with Terraform. Currently having issues with the Url parameter in the configuration WebTest XML.
I'm just not figuring out how I'd have to properly encode the string. For "simple" URLs, it's no problem. But what about eg. https://a.skwar.me/example=yes? The problem is with the "=" (equal) sign in the URL.
If I set Url="https://a.skwar.me/example=yes" in the XML, terraform apply fails:
2021-12-03T08:32:47.4173868Z Error: creating/updating Application Insights Web Test: (Name "dummy3aaiwt" / Resource Group "SharedienDevopsTesting"): insights.WebTestsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Specified argument was out of the range of valid values.\r\nParameter name: Web test 'dummy3aaiwt' is invalid. Ensure it is a well formed XML and that it adheres to the web test schema. Technical error: '=' is an unexpected token. The expected token is ';'. Line 23, position 33." InnerError={"diagnosticcontext":"6a6fb5be-fba9-4110-be6a-beffd2a44ef1","time":"2021-12-03T08:32:47.3359710Z"}
Note: Technical error: '=' is an unexpected token. The expected token is ';'
I tried to simply urlencode() the whole URL. Apply works, but no tests are being done. If I go Azure Portal, I see that the parameter hasn't been decoded; ie. I see https%3A%2F%2Fa.skwar.me%2Fexample%3Dyes. I also cannot save the test, as the URL is invalid (… d'oh!)
I've got this:
resource "azurerm_application_insights_web_test" "dummy3" {
name = "dummy3aaiwt"
location = local.ai_this.location
resource_group_name = local.ai_this.resource_group_name
application_insights_id = local.ai_this.id
kind = "ping"
frequency = 900
timeout = 120
enabled = true
retry_enabled = true
geo_locations = split(",", local.test_locations)
configuration = <<XML
<WebTest
Name="abcdefXML"
Id="${random_uuid.dummy.result}"
Enabled="True"
CssProjectStructure=""
CssIteration=""
Timeout="120"
WorkItemIds=""
xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"
Description=""
CredentialUserName=""
CredentialPassword=""
PreAuthenticate="True"
Proxy="default"
StopOnError="False"
RecordedResultFile=""
ResultsLocale="">
<Items>
<Request
Method="GET"
Guid="${random_uuid.dummy2.result}"
Version="1.1"
Url="${urlencode("https://a.skwar.me/some-exampe?foo=bar")}"
ThinkTime="0"
Timeout="120"
ParseDependentRequests="False"
FollowRedirects="True"
RecordResult="True"
Cache="False"
ResponseTimeGoal="0"
Encoding="utf-8"
ExpectedHttpStatusCode="302"
ExpectedResponseUrl=""
ReportingName=""
IgnoreHttpStatusCode="False" />
</Items>
</WebTest>
XML
}
Using Terraform Version 1.0.11 and provider registry.terraform.io/hashicorp/azurerm v2.86.0 , if I try to use urlencode in the url parameter then I am also facing the same issue that you see in portal as below:
But directly providing the URL using the below code succeeds and URL is also correctly defined in portal and can be saved as well.
resource "azurerm_application_insights_web_test" "example" {
name = "tf-test-appinsights-webtest"
location = data.azurerm_application_insights.example.location
resource_group_name = data.azurerm_application_insights.example.resource_group_name
application_insights_id = data.azurerm_application_insights.example.id
kind = "ping"
frequency = 300
timeout = 60
enabled = true
geo_locations = ["us-ca-sjc-azr", "us-va-ash-azr"]
configuration = <<XML
<WebTest
Name="WebTest1"
Id="ABD48585-0831-40CB-9069-682EA6BB3583"
Enabled="True"
CssProjectStructure=""
CssIteration=""
Timeout="120"
WorkItemIds=""
xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"
Description=""
CredentialUserName=""
CredentialPassword=""
PreAuthenticate="True"
Proxy="default"
StopOnError="False"
RecordedResultFile=""
ResultsLocale="">
<Items>
<Request
Method="GET"
Guid="a5f10126-e4cd-570d-961c-cea43999a200"
Version="1.1"
Url="https://a.skwar.me/some-exampe?foo=bar"
ThinkTime="0"
Timeout="300"
ParseDependentRequests="False"
FollowRedirects="True"
RecordResult="True"
Cache="False"
ResponseTimeGoal="0"
Encoding="utf-8"
ExpectedHttpStatusCode="302"
ExpectedResponseUrl=""
ReportingName=""
IgnoreHttpStatusCode="False" />
</Items>
</WebTest>
XML
}
Output:

Azure LetsEncrypt cannot access .well-known/acme-challenge for my function

I am trying to enable SSL for my azure function using the letsencrypt site-extension for azure as described here. I was following the instructions in that wiki and on this website.
However, I get an error when it tries to verify the website.
The error indicates that the acme-challenge page cannot be accessed (404).
This is my web.config under .well-known/:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<clear />
<add name="ACMEStaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="Either" requireAccess="Read" />
</handlers>
<staticContent>
<remove fileExtension="." />
<mimeMap fileExtension="." mimeType="text/plain" />
</staticContent>
</system.webServer>
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</configuration>
Does anyone have any ideas on what could be going wrong?
Here's how you can do that.
In your function app, create a new proxy for the challenge directory (this is required as the challenge will be a http get to /.well-known/acme-challenge/, and per default a function in a function app will only answer on /api/.
You can setup the proxy in the following way.
proxies.json
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"LetsEncryptProxy": {
"matchCondition": {
"route": "/.well-known/acme-challenge/{code}"
},
"backendUri": "http://%WEBSITE_HOSTNAME%/api/letsencrypt/.well-known/acme-challenge/{code}"
}
}
}
The important setting here is the Route Template: /.well-known/acme-challenge/{*rest} this will match all request that goes to the challenge directory.
Please note that proxies are a preview feature and you have to enable it, for it to work.
Reference:
https://github.com/sjkp/letsencrypt-siteextension/wiki/Azure-Functions-Support
https://blog.bitscry.com/2018/07/06/using-lets-encrypt-ssl-certificates-with-azure-functions/
I figured it out:
Similar to KetanChawda-MSFT's answer, except the proxy needs to hit the api endpoint function that you create.
So here's the function:
// https://YOURWEBSITE.azurewebsites.net/api/letsencrypt/{code}
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, string code, TraceWriter log)
{
log.Info($"C# HTTP trigger function processed a request. {code}");
var content = File.ReadAllText(#"D:\home\site\wwwroot\.well-known\acme-challenge\"+code);
var resp = new HttpResponseMessage(HttpStatusCode.OK);
resp.Content = new StringContent(content, System.Text.Encoding.UTF8, "text/plain");
return resp;
}
And here's the proxy that hits that function when letsEncrypt tries to verify the acme challenge:
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"LetsEncryptProxy": {
"matchCondition": {
"route": "/.well-known/acme-challenge/{code}"
},
"backendUri": "http://%WEBSITE_HOSTNAME%/api/letsencrypt/{code}"
}
}
}

Importing Data GI In web service

I have a requirement to import custom data into Acumatica using web service using web service.
I have created a custom table having 2 string field and one ntext field which will hold XML data.
Created a GI for it and exposed in web service endpoint.
The import JSON Data format is like this.
[
{
"OrderNbr": "1",
"CommandValue": "8",
"Xmldata": "<?xml version=\"1.0\" encoding=\"utf-8\"?><MLW Cmd=\"8\" TStamp=\"2018-12-21T11:38:25\" Id=\"dsgx1\" OrgId=\"157035408\" DevId=\"b9d863ca-REG-4825e4aa-566b5fc7\" RouteId=\"Resource-879-1\" StopId=\"Location230\" LocationKey=\"Location230\" StopType=\"67\"> <GPS Altitude=\"278.46383285522461\" Latitude=\"34.0487467032243\" Longitude=\"-84.673757432107507\" NoOfSat=\"7\" Speed=\"1.3679999828338623\" SatTStamp=\"2018-12-21T11:37:26\" Direction=\"0\" FixQuality=\"A\" /> <FieldData LCode=\"1\" OwnerId=\"Location230\"> <Field FId=\"89815\" Value=\"No\" /> <Field FId=\"89817\" Value=\"No\" /> <Field FId=\"89816\" Value=\"Patrick N\" /> </FieldData> <Job Id=\"Order-878-4\" Status=\"4\"> <Item Status=\"4\" Id=\"TIFTUF\" Mode=\"Manual\" /> </Job></MLW>"
}
]
I have tried in POSTMAN using basic authentication.
I am getting following error
PUT: 400 Bad request
GET: 500 Internal server error.
UPDATE: I have created a custom list page and configured it in the endpoint.
I have tested in POSTMAN and
Following are the endpoint and the JSON string used to create records
http://localhost/XYZ/(W(3))/entity/XYZ/17.200.001.001/MyResposeImport
{
"OrderNbr": {value :"b"},
"CommandValue": {value :"8"},
"Xmldata": {value :"<?xml version='1.0' encoding='utf-8'?><MLW Cmd='8' TStamp='2018-12-21T11:38:25' Id='dsgx1' OrgId='157035408' DevId='b9d863ca-REG-4825e4aa-566b5fc7' RouteId='Resource-879-1' StopId='Location230' LocationKey='Location230' StopType='67'> <GPS Altitude='278.46383285522461' Latitude='34.0487467032243' Longitude='-84.673757432107507' NoOfSat='7' Speed='1.3679999828338623' SatTStamp='2018-12-21T11:37:26' Direction='0' FixQuality='A' /> <FieldData LCode='1' OwnerId='Location230'> <Field FId='89815' Value='No' /> <Field FId='89817' Value='No' /> <Field FId='89816' Value='Patrick N' /> </FieldData> <Job Id='Order-878-4' Status='4'> <Item Status='4' Id='TIFTUF' Mode='Manual' /> </Job></MLW>"}
}
PUT Returns back OK and the response give below
{
"id": "94a00013-37bf-4077-bfb6-2e8662988547",
"rowNumber": 1,
"note": null,
"OrderNbr": {
"value": "b"
},
"ShippingStatus": {},
"XMLData": {},
"custom": {},
"files": []
}
I have checked in the back end and no record added to the table.
I have created the sitemap under the hidden section since the screen is only API call.
What may be the reason for the record not added to the table?
I have solved the Issue. The JSON Data field name is different from DAC label and API is look DAC label not the field name.
I have changed the JSON data to following and it works fine
{
"OrderNbr": {value :"b"},
"ShippingStatus": {value :"8"},
"XMLData": {value :"<?xml version='1.0' encoding='utf-8'?><MLW Cmd='8' TStamp='2018-12-21T11:38:25' Id='dsgx1' OrgId='157035408' DevId='b9d863ca-REG-4825e4aa-566b5fc7' RouteId='Resource-879-1' StopId='Location230' LocationKey='Location230' StopType='67'> <GPS Altitude='278.46383285522461' Latitude='34.0487467032243' Longitude='-84.673757432107507' NoOfSat='7' Speed='1.3679999828338623' SatTStamp='2018-12-21T11:37:26' Direction='0' FixQuality='A' /> <FieldData LCode='1' OwnerId='Location230'> <Field FId='89815' Value='No' /> <Field FId='89817' Value='No' /> <Field FId='89816' Value='Patrick N' /> </FieldData> <Job Id='Order-878-4' Status='4'> <Item Status='4' Id='TIFTUF' Mode='Manual' /> </Job></MLW>"}
}

How to resolve Manifest merger Failed error

I am getting manifest merger failed error when i add elegeant number button library to my gradle files.
Manifest merger failed : Attribute application#icon
value=(#mipmap/app_logoo) from AndroidManifest.xml:20:9-41 is also
present at [com.cepheuen.elegant-number-button:lib:1.0.3]
AndroidManifest.xml:13:9-43 value=(#mipmap/ic_launcher). Suggestion:
add 'tools:replace="android:icon"' to element at
AndroidManifest.xml:18:5-56:19 to override.
I have tried adding all the versions of this library but none works
As the suggestion in error says, you need to add tools:replace="android:icon" to your AndroidManifest.xml. tools:replace means you want to replace the attribute value with your current attribute value in the AndroidManifest.xml.
You can do it something like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.yourapp">
<application
android:name=".YourApp"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
tools:replace="android:icon">
<!-- code omitted here -->
</application>
</manifest>
NOTE : Add this to your build.gradle and make sure you are using the same versions as '26.0.2' -
configurations.all {
resolutionStrategy.eachDependency {
DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.2'
}
}
}
}

libxmljs: how to use xinclude?

I try to use libxmljs with nodejs.
In my sample I want to use the xi:include.
<ord:order xmlns:ord="http://example.org/ord"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.org/ord chapter04ord1.xsd"
xmlns:xi="http://www.w3.org/2001/XInclude">
<number>123ABBCC123</number>
<customer>
<name>Priscilla Walmsley</name>
<number>15466</number>
</customer>
<items>
<xi:include href="/Users/mar/ws_e/libxml/test/resources/chapter5prod.xml" />
</items>
</ord:order>
include File:
<ord:product xmlns:ord="http://example.org/ord"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.org/ord chapter04ord1.xsd">
<number>557</number>
<name>Short-Sleeved Linen Blouse</name>
<size system="US-DRESS">10</size>
<color value="blue"/>
</ord:product>
This is my code:
var xsdDoc = libxml.parseXml(schemaSource);
var xmlDocValid = libxml.parseXml(docSource);
var xmlDocInvalid = libxml.parseXml(xml_invalid);
xmlDocValid.validate(xsdDoc);
console.dir(xmlDocValid);
console.dir(xmlDocValid.validationErrors);
Then I get the error:
Document {
errors: [],
validationErrors:
[ { Error: Element '{http://www.w3.org/2001/XInclude}include': This element is not expected. Expected is ( product ).
So my question is how to use the x:include right at libxmljs?
Kind regards
Markus

Resources