video-js-contrib-eme can't get initializeMediaKeys to work - video.js

In our use case, we need to reuse the same license for multiple sources for different videos, I came across the initializeMediaKeys function, but when called with the following emeOptions:
var emeOptions = {
keySystems : {
"com.widevine.alpha": {
url : myUrl,
audioRobustness: 'SW_SECURE_CRYPTO',
videoRobustness: 'SW_SECURE_CRYPTO'
}
}
}
I've tried several variations of this object as a parameter but I always get a:
instrument.js:109 VIDEOJS: ERROR: (CODE:5 MEDIA_ERR_ENCRYPTED) Unsupported keySystem or supportedConfigurations.
MediaError {code: 5, message: 'Unsupported keySystem or supportedConfigurations.'}
And opening the media error object I get:
MediaError {code: 5, message: 'Unsupported keySystem or supportedConfigurations.'}
code: 5
message: "Unsupported keySystem or supportedConfigurations."
responseContentType: "application/dash+xml"
responseStatus: 200
responseURL:[REDACTED]
token=[REDACTED]
[[Prototype]]: Object
MEDIA_ERR_ABORTED: 1
MEDIA_ERR_CUSTOM: 0
MEDIA_ERR_DECODE: 3
MEDIA_ERR_ENCRYPTED: 5
MEDIA_ERR_NETWORK: 2
MEDIA_ERR_SRC_NOT_SUPPORTED: 4
code: 0
message: ""
status: null
constructor: ƒ MediaError(value)
[[Prototype]]: Object
Could someone help me or give me a hint? Thanks.

Related

Karate Api : check if a phrase is available response object array

I've a response
{ errors: [
{
code: 123,
reason: "this is the cause for a random problem where the last part of this string is dynamically generated"
} ,
{
code: 234,
reason: "Some other error for another random reason"
}
...
...
}
Now when I validate this response
I use following
...
...
And match response.errors[*].reason contains "this is the cause"
This validation fails, because there is an equality check for complete String for every reason ,
I all I want is, to validate that inside the errors array, if there is any error object, which has a reason string type property, starting with this is the cause phrase.
I tried few wild cards but didn't work either, how to do it ?
For complex things like this, just switch to JS.
* def found = response.errors.find(x => x.reason.startsWith('this is the cause'))
* match found == { code: 123, reason: '#string' }
# you can also do
* if (found) karate.log('found')
Any questions :)

expect is throwing an "AssertionError: expected { Object (browser_, then, ...) } to equal true"

I have an error with the expect on my tests
I'm getting this error
[08:41:37] E/launcher - expected { Object (browser_, then, ...) } to equal true
[08:41:37] E/launcher - AssertionError: expected { Object (browser_, then, ...) } to equal true
at role.element.getText.then (/Users/jburquez/akamai/ConsoleUI/tests/e2e/console_bdd/steps/manage_agents_steps.js:114:109)
at elementArrayFinder_.then (/Users/jburquez/akamai/ConsoleUI/node_modules/protractor/built/element.js:804:32)
at ManagedPromise.invokeCallback_ (/Users/jburquez/akamai/ConsoleUI/node_modules/selenium-webdriver/lib/promise.js:1376:14)
at TaskQueue.execute_ (/Users/jburquez/akamai/ConsoleUI/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/Users/jburquez/akamai/ConsoleUI/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/Users/jburquez/akamai/ConsoleUI/node_modules/selenium-webdriver/lib/promise.js:2927:27)
at /Users/jburquez/akamai/ConsoleUI/node_modules/selenium-webdriver/lib/promise.js:668:7
at process._tickCallback (internal/process/next_tick.js:68:7)
[08:41:37] E/launcher - Process exited with error code 199
[08:41:37] '<anonymous>' errored after 1.42 min
[08:41:37] Error in plugin "gulp-protractor"
Message:
protractor exited with code 199
Details:
domain: [object Object]
domainThrown: true
And this is my code on the step
Then('Validate role {editrole} is selected', { timeout:30 * 1000 }, (editrole) => {
var agentRoles = element.all(by.repeater('ctrl.roles'));
agentRoles.each((role) => {
return role.element(by.xpath(".//div[#class='md-whiteframe-1dp outset inset']/md-checkbox")).getText()
.then((roleSelected) => {
if (editrole === roleSelected) {
expect(element(".//div[#class='md-whiteframe-1dp outset inset']/md-checkbox").isSelected()).to.be.equal(true);
}
});
});
});
What i'm trying to do is verify if an element is checked so reading another suggestions I saw that .isSelected() is the best option for this, but i'm not sure why is throwing this error.
Hope you can help me!!
It looks like you are trying to compare an Object to Boolean.
You have to resolve a promise to do that or else use 'eventually' if you are using 'chai' as your assert library. Sample below:
expect(element(".//div[#class='md-whiteframe-1dp outset inset']/md-checkbox").isSelected()).to.eventually.equal(true);
Or
element(".//div[#class='md-whiteframe-1dp outset inset']/md-checkbox").isSelected().then(function (select) {
expect(select).to.be.true;
});
It takes a little while to figure out the right way of using expect with promises.
I suggest to look at async/await syntax. And also you can try to use browser.wait(ExpectedConditions.elementToBeSelected) here
Then('Validate role {editrole} is selected', { timeout:30 * 1000 }, async (editrole) => {
const agentRoles = element.all(by.repeater('ctrl.roles'))
expect(await agentRoles.count()).not.to.be(0)
await browser.wait(ExpectedConditions.elementToBeSelected(
element(by.cssContainingText('div.md-whiteframe-1dp.outset.inset md-checkbox', editrole))
), 10000, `Expected ${editrole} to be selected`);
});

I am trying to get data over an OpenWeather API in Rust but I am facing some iusse regarding parsing I guess

extern crate openweather;
use openweather::LocationSpecifier;
static API_KEY: &str = "e85e0a3142231dab28a2611888e48f22";
fn main() {
let loc = LocationSpecifier::Coordinates {
lat: 24.87,
lon: 67.03,
};
let weather = openweather::get_current_weather(loc, API_KEY).unwrap();
print!(
"Right now in Minneapolis, MN it is {}K",
weather.main.humidity
);
}
error : thread 'main' panicked at 'called Result::unwrap() on an
Err value: ErrorReport { cod: 0, message: "Got unexpected response:
\"{\\"coord\\":{\\"lon\\":67.03,\\"lat\\":24.87},\\"weather\\":[{\\"id\\":803,\\"main\\":\\"Clouds\\",\\"description\\":\\"broken
clouds\\",\\"icon\\":\\"04n\\"}],\\"base\\":\\"stations\\",\\"main\\":{\\"temp\\":294.15,\\"pressure\\":1018,\\"humidity\\":60,\\"temp_min\\":294.15,\\"temp_max\\":294.15},\\"visibility\\":6000,\\"wind\\":{\\"speed\\":5.1,\\"deg\\":30},\\"clouds\\":{\\"all\\":70},\\"dt\\":1574012543,\\"sys\\":{\\"type\\":1,\\"id\\":7576,\\"country\\":\\"PK\\",\\"sunrise\\":1573955364,\\"sunset\\":1573994659},\\"timezone\\":18000,\\"id\\":1174872,\\"name\\":\\"Karachi\\",\\"cod\\":200}\""
}
The issue is a JSON parsing error due to the deserialized struct not matching OpenWeather's JSON, perhaps the API recently added this? With your example, the OpenWeatherCurrent struct is missing timezone.
But it looks like there is an open PR that will fix this, you can test it by doing the following:
Change your Cargo.toml dependency to openweather = { git = "https://github.com/caemor/openweather" }.
The PR author has also updated the get_current_weather signature so you'll need to change lines 2, 10 to the following:
use openweather::{LocationSpecifier, Settings};
let weather = openweather::get_current_weather(&loc, API_KEY, &Settings::default()).unwrap();

Safari 11 mediaElement['srcObject'] = mediaStream throws Type Error

I am trying to implement WebRTC using this library (RTCMulticonnection) and am encountering a Type Error when trying to set the 'srcObject' on the video mediaElement in Safari Tech Preview 11.
Relevant code:
if (isSafari) {
//I've tried the 4 ways below to set the srcObject but all cause a Type Error
// mediaElement['srcObject'] = window.URL.createObjectURL(stream); throws type error
// mediaElement['srcObject'] = stream; throws type error
// mediaElement['src'] = window.URL.createObjectURL(stream);
// mediaElement.srcObject = stream; // throws type error
}
When I print mediaElement, I get: <video></video>
When I print stream, I get a MediaStream object.
MediaStream {streamid: "722cfcc7-0687-4265-b266-e81b2abf8398", idInstance: "{\"audio\":{\"mandatory\":{},\"optional\":[{\"bandwidth\":…\":[{\"bandwidth\":4194304},{\"facingMode\":\"user\"}]}}", isVideo: 1, isAudio: false, type: "local", …}
Error
TypeError: Type error
[Error] No message (2)
TypeError: Type error — RTCMultiConnection.js:4089
Object audio: {mandatory: {}, optional: [{bandwidth: 1048576}]}
video: {mandatory: {}, optional: [{bandwidth: 4194304}, {facingMode: "user"}]}
Object Prototype
onMediaError (RTCMultiConnection.js:5215)
onLocalMediaError (RTCMultiConnection.js:806)
onLocalMediaError (RTCMultiConnection.js:4995)
(anonymous function) (RTCMultiConnection.js:3365)
promiseReactionJob
The Type Error is caught in this then/catch:
navigator.mediaDevices.getUserMedia(options.localMediaConstraints).then(function(stream) {
stream.streamid = stream.streamid || stream.id || getRandomString();
stream.idInstance = idInstance;
streaming(stream);
}).catch(function(error) {
options.onLocalMediaError(error, options.localMediaConstraints });

Unable to add users to existing chat in Quickblox JS

I have added a feature to QuickBlox chat sample for JS , which allows to add a new user to existing chat
function addUsers(){
var curDlgId = currentDialog._id ;
var curDlgName = currentDialog.name;
$('.users_form.active').each(function(index) {
users_ids[index] = $(this).attr('id');
});
QB.chat.dialog.update(curDlgId,{ push_all : {users_ids}}, onAddUsersCompleted);
}
function onAddUsersCompleted(error,b,c){
}
but I am getting an error on onAddUsersCompleted callback :
error = Object {code: 403, status: "error", message: "Forbidden", detail: "{"errors":["You don't have appropriate permissions to perform this operation"]}"}
Whats wrong ?
Ostap, please try to change
QB.chat.dialog.update(curDlgId,{ push_all : {users_ids}}, onAddUsersCompleted);
to
QB.chat.dialog.update(curDlgId,{ push_all : users_ids}, onAddUsersCompleted);