KML file rendering issue - smooth text - kml
We have KML files that have some very tightly-defined polylines in them (used to draw text mostly, but not solely). When we pull in the same KML file into Cesium (1.6 or 1.7), or OpenLayers, or GoogleEarth, I get the same results:
Cesium renders the text in a very jagged manner.
OpenLayers & GoogleEarth both render the text smoothly.
We’ve looked at the removeDuplicates() methods that we think are responsible for the “thinning” of data. If we set the EPSILON to be a higher value, the “text polylines” are rendered nicely. Can we override the removeDuplicatesEpsilon variable somewhere?
Inside the removeDuplicates() method, once it’s determined that we have at least 1 point to remove, it looks like compares each subsequent point to the previous point in the list. Shouldn’t it compare each point to the previously-accepted point? (as opposed to just the previous point in the list, which may not be included either).
Cesium code:
var removeDuplicatesEpsilon = CesiumMath.EPSILON7;
PolylinePipeline.removeDuplicates = function(positions) {
if (!defined(positions)) {
throw new DeveloperError('positions is required.');
}
var length = positions.length;
if (length < 2) {
return undefined;
}
var i;
var v0;
var v1;
for (i = 1; i < length; ++i) {
v0 = positions[i - 1];
v1 = positions[i];
if (Cartesian3.equalsEpsilon(v0, v1, removeDuplicatesEpsilon)) {
break;
}
}
if (i === length) {
return undefined;
}
var cleanedPositions = positions.slice(0, i);
for (; i < length; ++i) {
v0 = positions[i - 1];
v1 = positions[i];
if (!Cartesian3.equalsEpsilon(v0, v1, removeDuplicatesEpsilon)) {
cleanedPositions.push(Cartesian3.clone(v1));
}
}
return cleanedPositions;
};
Sample KML -
<?xml version="1.0" encoding="utf-16"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Document id="c7e47ca6-242c-4e1a-b4ca-02aff9d98ee4">
<name>Letters</name>
<Placemark id="c00e3314-bc14-4a1e-aa66-d3d70e217cda1">
<name>C</name>
<styleUrl>#S0</styleUrl>
<LineString>
<coordinates>-93.7997582661072,28.2156338033321,0 -93.7997341817777,28.2156233335357,0 -93.7997105791612,28.2156025354265,0 -93.7996990187067,28.215581878842,0 -93.7997036750268,28.2155796151045,0 -93.7997150749106,28.2155995642938,0 -93.7997375535976,28.215619372004,0 -93.7997595506083,28.2156291343859,0 -93.7998041869331,28.2156291344279,0 -93.7998263445402,28.2156193720874,0 -93.7998486627121,28.2155995644193,0 -93.799860223207,28.2155798982196,0 -93.7998713020103,28.2155500452192,0 -93.799871302029,28.2154999600916,0 -93.7998602232594,28.215470107084,0 -93.7998486627993,28.2154504408918,0 -93.79982634469,28.2154306331999,0 -93.7998041871417,28.2154208708285,0 -93.799759550904,28.2154208707865,0 -93.7997375539044,28.2154306331165,0 -93.7997150751844,28.2154504407663,0 -93.799703675239,28.215470389905,0 -93.7996990189326,28.2154681261704,0 -93.7997105794524,28.2154474696035,0 -93.7997341821035,28.2154266715762,0 -93.7997582664183,28.2154164848056,0 -93.7998056322006,28.21541648485,0 -93.7998295559378,28.2154266716658,0 -93.7998533191013,28.2154474697376,0 -93.7998647189985,28.2154684092942,0 -93.7998766005805,28.2154993941569,0 -93.7998766005639,28.2155506111568,0 -93.7998647189493,28.2155815960297,0 -93.7998533190173,28.2156025355605,0 -93.7998295557876,28.2156233336253,0 -93.7998056319859,28.2156338033766,0 -93.7997582661072,28.2156338033321,0 </coordinates>
</LineString>
</Placemark>
<Placemark id="c00e3314-bc14-4a1e-aa66-d3d70e217cda2">
<name>O - outer</name>
<styleUrl>#S0</styleUrl>
<LineString>
<coordinates>-93.7995333556067,28.2156193715947,0 -93.7995556738038,28.2155995639742,0 -93.7995672343623,28.2155798977991,0 -93.7995783132305,28.2155500448223,0 -93.7995783133866,28.2154999596947,0 -93.7995672347159,28.2154701066634,0 -93.7995556743001,28.2154504404467,0 -93.7995333562743,28.2154306327072,0 -93.7995111987138,28.2154208702886,0 -93.7994665624956,28.2154208701515,0 -93.7994445654692,28.2154306324346,0 -93.7994220866754,28.2154504400365,0 -93.7994106866767,28.2154701061829,0 -93.7993994471974,28.2154999591456,0 -93.7993994469574,28.2155500442731,0 -93.7994106861621,28.2155798973185,0 -93.7994220859925,28.215599563564,0 -93.7994445646446,28.2156193713221,0 -93.7994665616286,28.2156291337509,0 -93.7995111979339,28.215629133888,0 -93.7995333556067,28.2156193715947,0 </coordinates>
</LineString>
</Placemark>
<Placemark id="c00e3314-bc14-4a1e-aa66-d3d70e217cda3">
<name>O - inner</name>
<styleUrl>#S0</styleUrl>
<LineString>
<coordinates>-93.7994652771049,28.2156338026944,0 -93.7994411928333,28.2156233328466,0 -93.7994175902544,28.2156025346871,0 -93.7994060298579,28.21558159511,0 -93.7993941484081,28.2155506101895,0 -93.7993941486561,28.2154993931896,0 -93.7994060303933,28.2154684083745,0 -93.7994175909711,28.2154474688642,0 -93.7994411936987,28.2154266708872,0 -93.7994652780122,28.2154164841678,0 -93.7995126438043,28.2154164843132,0 -93.7995365675037,28.21542667118,0 -93.7995603306005,28.2154474693023,0 -93.7995717304402,28.2154684088833,0 -93.7995836119713,28.2154993937713,0 -93.7995836118142,28.2155506107712,0 -93.7995717300805,28.2155815956187,0 -93.7995603300911,28.2156025351253,0 -93.7995365668139,28.2156233331395,0 -93.7995126429933,28.2156338028398,0 -93.7994652771049,28.2156338026944,0 </coordinates>
</LineString>
</Placemark>
<Placemark id="c00e3314-bc14-4a1e-aa66-d3d70e217cda4">
<name>N</name>
<styleUrl>#S0</styleUrl>
<LineString>
<coordinates>-93.7993079697249,28.215631538367,0 -93.7991525469176,28.2154261036618,0 -93.7991525454582,28.2156315375975,0 -93.7991472468299,28.2156315375682,0 -93.7991472483541,28.2154184635286,0 -93.7991528680389,28.2154184635597,0 -93.7993084514863,28.2156238982652,0 -93.7993084526457,28.2154184643294,0 -93.7993135906132,28.2154184643519,0 -93.799313589421,28.2156315383915,0 -93.7993079697249,28.215631538367,0 </coordinates>
</LineString>
</Placemark>
<Placemark id="c00e3314-bc14-4a1e-aa66-d3d70e217cda5">
<name>D - outer</name>
<styleUrl>#S0</styleUrl>
<LineString>
<coordinates>-93.7990499914568,28.2154208681741,0 -93.7989722794574,28.2154208676656,0 -93.7989387219477,28.2154306297883,0 -93.7989167247776,28.215450437311,0 -93.7989051640743,28.2154701034143,0 -93.7988940850263,28.2154999563369,0 -93.7988940845493,28.2155500414644,0 -93.7989051630401,28.2155798945499,0 -93.798916723389,28.2155995608385,0 -93.7989387202291,28.2156193686758,0 -93.7989722776264,28.2156291312649,0 -93.7990499897774,28.2156291317735,0 -93.7990499914568,28.2154208681741,0 </coordinates>
</LineString>
</Placemark>
<Placemark id="c00e3314-bc14-4a1e-aa66-d3d70e217cda6">
<name>D - inner</name>
<styleUrl>#S0</styleUrl>
<LineString>
<coordinates>-93.7989716353721,28.2156338002082,0 -93.7989361511849,28.2156233301936,0 -93.7989120670252,28.2156025319439,0 -93.7989006673004,28.2155815923255,0 -93.7988887859973,28.2155506073613,0 -93.7988887864877,28.2154993903614,0 -93.7989006683714,28.21546840559,0 -93.7989120684759,28.215447466121,0 -93.7989361529804,28.2154266682341,0 -93.798971637284,28.2154164816816,0 -93.7990551294986,28.2154164822266,0 -93.7990551277566,28.2156338007532,0 -93.7989716353721,28.2156338002082,0 </coordinates>
</LineString>
</Placemark>
<Placemark id="c00e3314-bc14-4a1e-aa66-d3d70e217cda7">
<name>S</name>
<styleUrl>#S0</styleUrl>
<LineString>
<coordinates>-93.798701722344,28.2156337980995,0 -93.7986662382611,28.2156233280153,0 -93.7986424752182,28.2156028126893,0 -93.7986464893054,28.215599275651,0 -93.7986688072375,28.2156193665025,0 -93.7987023646879,28.2156291291575,0 -93.7987476432453,28.215629129548,0 -93.7987812009125,28.2156193674718,0 -93.7988030375251,28.2156001259057,0 -93.7988030377204,28.2155813086054,0 -93.7987917986145,28.2155619252865,0 -93.7987808804753,28.2155524458179,0 -93.7987585624292,28.2155422588161,0 -93.7986895208716,28.2155220260795,0 -93.7986657578042,28.2155118390668,0 -93.7986537158051,28.2155010862216,0 -93.7986418344649,28.2154800050847,0 -93.798641834845,28.2154480298286,0 -93.7986662405537,28.2154266660558,0 -93.7987017248053,28.2154164795729,0 -93.7987484483853,28.2154164799759,0 -93.7987839324884,28.2154266670708,0 -93.7988075349079,28.2154471823538,0 -93.7988036813654,28.2154507194153,0 -93.7987812029095,28.2154306285844,0 -93.7987476455143,28.2154208659486,0 -93.7987023670453,28.2154208655581,0 -93.7986688094332,28.215430627615,0 -93.7986471333646,28.2154498691614,0 -93.798647133023,28.2154787317685,0 -93.7986582115585,28.2154982565818,0 -93.7986691296813,28.2155077360687,0 -93.7986914477116,28.2155179230851,0 -93.7987604891892,28.2155381558207,0 -93.7987842522715,28.215548342817,0 -93.7987964549006,28.2155590956521,0 -93.7988081757464,28.2155801767744,0 -93.7988081755213,28.2156019652309,0 -93.7987839304126,28.2156233290302,0 -93.7987484460192,28.2156337985024,0 -93.798701722344,28.2156337980995,0 </coordinates>
</LineString>
</Placemark>
</Document>
<Style id="S0">
<LineStyle>
<color>ff007fff</color>
</LineStyle>
<PolyStyle>
<color>ff004080</color>
</PolyStyle>
</Style>
</Document>
</kml>
This does appear to be a bug in Cesium. I've opened pull request #2609 to fix it.
Related
Why does this .kml file load at latitude zero/longitude zero?
I created this .kml file by hand, outlining an area in New Hampshire, US. It loads fine in Google MyMaps, but if I load it in Google Earth, it apparently gets placed at "Null Island" (latitude 0, longitude 0). What's wrong with the file? <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://earth.google.com/kml/2.0"> <Document> <Placemark> <LineString> <coordinates> -71.21122, 43.25277, 0. -71.20669, 43.24993, 0. -71.20720, 43.24918, 0. -71.20512, 43.24787, 0. -71.20566, 43.24733, 0. -71.20576, 43.24718, 0. -71.20669, 43.24557, 0. -71.20763, 43.24572, 0. -71.20746, 43.24666, 0. -71.20855, 43.24638, 0. -71.20868, 43.24588, 0. -71.20961, 43.24596, 0. -71.21044, 43.24290, 0. -71.21673, 43.24390, 0. -71.21122, 43.25277, 0. </coordinates> </LineString> </Placemark> </Document> </kml> Thank you
KML coordinates are longitude,latitude; no spaces allowed. Your KML should be: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://earth.google.com/kml/2.0"> <Document> <Placemark> <LineString> <coordinates> -71.21122,43.25277,0. -71.20669,43.24993,0. -71.20720,43.24918,0. -71.20512,43.24787,0. -71.20566,43.24733,0. -71.20576,43.24718,0. -71.20669,43.24557,0. -71.20763,43.24572,0. -71.20746,43.24666,0. -71.20855,43.24638,0. -71.20868,43.24588,0. -71.20961,43.24596,0. -71.21044,43.24290,0. -71.21673,43.24390,0. -71.21122,43.25277,0. </coordinates> </LineString> </Placemark> </Document> </kml> example displaying with the Google Maps Javascript API v3 code snippet: function initMap() { const map = new google.maps.Map(document.getElementById("map"), { zoom: 11, center: { lat: 41.876, lng: -87.624 }, }); const ctaLayer = new google.maps.KmlLayer({ url: "http://www.geocodezip.com/geoxml3_test/kml/SO_20201106_removeSpaces.kml", map: map, }); } /* Always set the map height explicitly to define the size of the div * element that contains the map. */ #map { height: 100%; } /* Optional: Makes the sample page fill the window. */ html, body { height: 100%; margin: 0; padding: 0; } <!DOCTYPE html> <html> <head> <title>KML Layers</title> <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap&libraries=&v=weekly" defer></script> <!-- jsFiddle will insert css and js --> </head> <body> <div id="map"></div> </body> </html>
How to modify and XML on the fly?
I am reading a XML file and send it to a REST API. However before sending it I would like to modify some values. This is how I send the data: data = await readFile(path.resolve(__dirname, file), 'utf8'); const config = { headers: { 'Content-Type': 'text/plain', 'Content-Length': data.length, }, }; result = await axios.post( 'https://someRestapi.com/', data, config, ); And I want to change the name Simon to Zimon in the author name for example. <?xml version="1.0" encoding="UTF-8"?> <Document schemaVersion="12" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Author> <Name> <First>Simon</First> <Second>SomeName</Second> </Name> </Author> </Document> Is there an easy solution to do this?
Had to do something similar recently and ended up using fast-xml-parser. Applied to your case, you could do: const xmlString = `<?xml version="1.0" encoding="UTF-8"?> <Document schemaVersion="12" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Author> <Name> <First>Simon</First> <Second>SomeName</Second> </Name> </Author> </Document>`; const xmlToJsonParser = require('fast-xml-parser'); const J2xParser = require("fast-xml-parser").j2xParser; const tObj = xmlToJsonParser.getTraversalObj(xmlString,{ignoreAttributes :false}); const jsonObj = xmlToJsonParser.convertToJson(tObj,{ignoreAttributes :false}); jsonObj.Document.Author.Name.First = "Zimon"; let result = new J2xParser({format:true, ignoreAttributes :false}).parse(jsonObj); result = `<?xml version="1.0" encoding="UTF-8"?>\n${result}`; console.log(result); This will print: <?xml version="1.0" encoding="UTF-8"?> <Document schemaVersion="12" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Author> <Name> <First>Zimon</First> <Second>SomeName</Second> </Name> </Author> </Document>
Groovy question to read xml and base64decode
I want to modify the incoming message (As shown in the Modified XML) output. Incoming XML <xml> <Body> <Request> <Container> <name>test</name> <Numbers> <sn>//base64encodedstring//</sn> <sn>//base64encodedstring//</sn> <sn>//base64encodedstring//</sn> </Numbers> </Container> </Request> </Body> </xml> Modified XML <xml> <Body> <Request> <Container> <name>test</name> <Numbers> <sn>//Decodedstring//</sn> <sn>//Decodedstring//</sn> <sn>//Decodedstring//</sn> </Numbers> </Container> </Request> </Body> </xml> As per the answer received: I can create an array of ListOfResults. def listOfResults = new XmlSlurper() .parseText(xml) .Body.Request.Container.Numbers.sn .collect { new String(it.text().decodeBase64()) } I can do the following def data = "<xml><Body><Request><Container><name>test</name><Numbers>" for (i= 0; i <listOfResults.size(); i++) { data = data +"<sn>" +listOfResults[i] + "</sn>"; } data = data + "<Numbers></Container></Request></Body></xml>"; Modified data <xml><Body><Request><Container><name>test</name> <Numbers> <sn>decoded string</sn> <sn>decoded string</sn> <sn>decoded string</sn> </Numbers> </Container></Request></Body></xml> Is this the fastest way to do this operation? Is there any other better way?
You should be able to do (assuming your XML is in a string variable called xml): def listOfResults = new XmlSlurper() .parseText(xml) .Body.Request.Container.Numbers.sn .collect { new String(it.text().decodeBase64()) }
Cannot parse kml file to be treated as xml
I want to parse a kml file to be treated like a xml file : var parser = require('xml2json'); router.get('/', function (req, res) { var xml = "D:/Axes2019.kml"; var json = parser.toJson(xml); console.log("to json -> %s", json); res.render("index"); }); At runtime I get There are errors in your xml file: not well-formed (invalid token) Here is the kml : <?xml version="1.0" encoding="utf-8" ?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document id="root_doc"> <Schema name="Axes_2K19" id="Axes_2K19"> <SimpleField name="Name" type="string"></SimpleField> <SimpleField name="Denomin" type="string"></SimpleField> </Schema> <Folder><name>Axes_2K19</name> <Placemark> <name>9O_6</name> <Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style> <ExtendedData><SchemaData> <SimpleData name="Denomin">Antanimena</SimpleData> </SchemaData></ExtendedData> <MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>47.5282959843938,-18.8881931524494 47.5273060204005,-18.8883147269749 47.525771678897,-18.8898762249651 47.525391488082,-18.8909217497064 47.5247125759123,-18.8915497434633 47.5244138545577,-18.8919299342784 47.5243188068539,-18.8924866422575 47.5259255656555,-18.8935536658841 47.5268466231657,-18.8952758397545 47.5265207453242,-18.8961312690883 47.5276816851343,-18.8957442891516 47.5279871956107,-18.8964978816599 47.529947,-18.89907 47.52965,-18.901435 47.5292802275261,-18.9017841358174 47.5286065539348,-18.9019002864366 47.5276076586099,-18.9018770563128 47.5269339850186,-18.9021906629845 47.5268062193375,-18.9027481859566 47.526667,-18.903358 47.526247,-18.903399 47.525913,-18.903094 47.525489,-18.903003 47.524572,-18.902694 47.523774,-18.902588 47.523368,-18.9026 47.522878,-18.902871 47.522666,-18.903034 47.5223273311563,-18.9027936605133 47.521073,-18.901036 47.520669,-18.900556 47.518254,-18.89732 47.5166722429164,-18.8951662207165 47.516752829692,-18.8950896025168 47.5168139317873,-18.8943258263259 47.5166917275968,-18.8930121312776 47.5173638506447,-18.8917595383246 47.5187879970001,-18.8904753419999 47.516371167,-18.887820824 47.5151030731197,-18.8858937371787 47.5153169304532,-18.8838162659395 47.5165084213109,-18.8805396660807 47.5159890535012,-18.8784851081272 47.5159886221055,-18.8784787989658 47.5193198602536,-18.8783563269751 47.521029,-18.877701 47.5222222097789,-18.8787229395467 47.5236810223034,-18.8789367968802 47.526064004019,-18.8796089199281 47.529757529473,-18.8805918742828 47.5292090646449,-18.8815425466514 47.5290563094068,-18.8836505689382 47.5292090646449,-18.8857662289869 47.5285674926446,-18.8872937813686 47.5282959843938,-18.8881931524494</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry> </Placemark> ... </Folder> </Document></kml> So how to fix it ?
I checked your sample KML for XML and KML Schema validity, and it looked fine to me. Maybe your parser wants more of the namespaces defined? See below for what I usually include at the top of my KMLs: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> ... </kml> Or maybe some of the rest of your file (which you replaced with "..." contains XML errors? Make sure all your IDs are valid too (start with a letter, no forbidden characters, etc.).
Setup a clearkey server for shaka player didn't work?
I've created a test html page for playing a MPEG-CENC protected MPEG-DASH video, and I can play if I specify kid: key pair in player.configure(). Then I want to setup a clearkey server. Refer to DRM Configuration section of Shaka Player documents, I changed the code to specify the url to get the license like below. But the page never get touched when I set a breakpoint in Page_Load event in Visual Studio. There is no error on console of browser. The browser I use is Firefox 53.0.2 and Chrome 58.0.3029.96. Did I miss something? <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.1.0/shaka-player.compiled.js"></script> <title>MPEG-DASH Player Test</title> <script> //MPEG-DASH stream encrypted with MPEG-CENC: var manifestUri = '/dashtest_encrypted/stream.mpd'; function initApp() { // Install built-in polyfills to patch browser incompatibilities. shaka.polyfill.installAll(); // Check to see if the browser supports the basic APIs Shaka needs. if (shaka.Player.isBrowserSupported()) { // Everything looks good! initPlayer(); } else { // This browser does not have the minimum set of APIs we need. console.error('Browser not supported!'); } } function initPlayer() { // Create a Player instance. var video = document.getElementById('video'); var player = new shaka.Player(video); // Configue player.configure({ drm: { servers: { 'org.w3.clearkey': '/clearkey/GetLic.aspx' }, clearKeys: { //'kid': 'key' } } }); // Attach player to the window to make it easy to access in the JS console. window.player = player; // Listen for error events. player.addEventListener('error', onErrorEvent); // Try to load a manifest. // This is an asynchronous process. player.load(manifestUri).then(function () { // This runs if the asynchronous load is successful. console.log('The video has now been loaded!'); }).catch(onError); // onError is executed if the asynchronous load fails. } function onErrorEvent(event) { // Extract the shaka.util.Error object from the event. onError(event.detail); } function onError(error) { // Log the error. console.error('Error code', error.code, 'object', error); alert(error.code); } document.addEventListener('DOMContentLoaded', initApp); </script> </head> <body> <video id="video" autoplay controls></video> </body> </html> Here is the content of stream.MPD: <?xml version="1.0" ?> <MPD mediaPresentationDuration="PT12M3.022S" minBufferTime="PT15.48S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:cenc="urn:mpeg:cenc:2013"> <!-- Created with Bento4 mp4-dash.py, VERSION=1.7.0-614 --> <Period> <!-- Video --> <AdaptationSet maxHeight="720" maxWidth="1280" mimeType="video/mp4" minHeight="720" minWidth="1280" segmentAlignment="true" startWithSAP="1"> <!-- MPEG Common Encryption --> <ContentProtection cenc:default_KID="7a4e12f1-8610-291f-386c-7ac1b9425abf" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"/> <SegmentTemplate duration="15482" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/> <Representation bandwidth="1901600" codecs="avc1.64001F" frameRate="30000/1001" height="720" id="video/avc1" scanType="progressive" width="1280"/> </AdaptationSet> <!-- Audio --> <AdaptationSet mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1"> <!-- MPEG Common Encryption --> <ContentProtection cenc:default_KID="7a4e12f1-8610-291f-386c-7ac1b9425abf" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"/> <SegmentTemplate duration="15482" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/> <Representation audioSamplingRate="44100" bandwidth="200442" codecs="mp4a.40.2" id="audio/und/mp4a"> <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/> </Representation> </AdaptationSet> </Period> </MPD>
After a very long time testing and comparison, I noticed that my .mpd file didn't have cenc:pssh tag, which resulted this problem. I recreated the .mpd and Shaka Player FINALLY asked the server. The corrected .mpd is below: <?xml version="1.0" ?> <MPD mediaPresentationDuration="PT12M3.022S" minBufferTime="PT15.48S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:cenc="urn:mpeg:cenc:2013"> <!-- Created with Bento4 mp4-dash.py, VERSION=1.7.0-614 --> <Period> <!-- Video --> <AdaptationSet maxHeight="720" maxWidth="1280" mimeType="video/mp4" minHeight="720" minWidth="1280" segmentAlignment="true" startWithSAP="1"> <!-- EME Common Encryption --> <ContentProtection schemeIdUri="urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b" value="cenc"> <cenc:pssh>AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAF6ThLxhhApHzhsesG5Qlq/AAAAAA==</cenc:pssh> </ContentProtection> <!-- MPEG Common Encryption --> <ContentProtection cenc:default_KID="7a4e12f1-8610-291f-386c-7ac1b9425abf" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"/> <SegmentTemplate duration="15482" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/> <Representation bandwidth="1901627" codecs="avc1.64001F" frameRate="30000/1001" height="720" id="video/avc1" scanType="progressive" width="1280"/> </AdaptationSet> <!-- Audio --> <AdaptationSet mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1"> <!-- EME Common Encryption --> <ContentProtection schemeIdUri="urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b" value="cenc"> <cenc:pssh>AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAF6ThLxhhApHzhsesG5Qlq/AAAAAA==</cenc:pssh> </ContentProtection> <!-- MPEG Common Encryption --> <ContentProtection cenc:default_KID="7a4e12f1-8610-291f-386c-7ac1b9425abf" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"/> <SegmentTemplate duration="15482" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/> <Representation audioSamplingRate="44100" bandwidth="200442" codecs="mp4a.40.2" id="audio/und/mp4a"> <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/> </Representation> </AdaptationSet> </Period> </MPD>