How can i play DRM protected video in electron js desktop app - electron

I have embedded Iframe with source containing video url.
BUt
I am getting error :
ERROR: (CODE:5 MEDIA_ERR_ENCRYPTED) requestMediaKeySystemAccess is disabled by feature policy.
and sometime i get
code: 6001, type: "REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE", headline: "DRM: REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE", message: ""}

Related

IOS iPhone browsers does not accept video files via upload dialog

We are using IOS file upload dialog in order to use video files with our service using react.
All video files are working in android platforms and all browsers in linux and MacOS. However, when we use video files with upload dialog in IOS IPhones such as Iphone 14 Pro Max, then the compress process starts and following that the dialog rejects the video file.
We have been debugging with browserstack using a real phone in a simulator, however no luck until this point.
When we select the file, it firstly runs a compression activity then changes the name of the file to an intermediate file name (as below, the original file name is different), and then upload procedure fails.
Below is the react part which triggers upload mechanism which works with every platform and operating system with exception of IOS.
export const UploadVideo = async (file, signedurl, uploading) =>
{
let resultState = { state: '', data: {} };
if (SERVER_STATUS !== 'localhost')
{
await axios({
method: 'put',
url: signedurl,
data: file,
headers: { 'Content-Type': 'application/octet-stream', },
onUploadProgress: uploading
}).then(function (response)
{
resultState.state = 'success';
}).catch(function (error)
{
resultState.state = 'error';
resultState.data.message = error.message;
window.toastr.error(error.message);
})
} else resultState.state = 'success';
return resultState;
}
The error message I notice here, OS Status error -9806 refers to, according to osstatus.com a secure transport result code. More specifically this one, on Apple's documentation
My take here is that the system is not trusting this URL, I would suggest adding your URL to trusted domains under NSAppTransportSecurity in the Info.plist file. More info on how to do that here.
This is not a solution I would go for for a production app tho, you might want to have a valid certificate for your production URL and app.
Hope this helps.

PERSISTED_QUERY_NOT_FOUND when opening URL

On AirBNB, If I navigate my web browser to a room listing like this one, then open the dev tools console to find out which URL has the JSON string containing the data displayed in the listing.
Thru the dev console, I found that this URL contains that information, which I could see in the console. Here are screenshots from the console: https://imgur.com/a/MKeYSz4
But when I pasted the URL into a new browser window and navigated to it, I saw this message:
{
errors: [
{
message: "PersistedQueryNotFound",
extensions: {
code: "PERSISTED_QUERY_NOT_FOUND"
}
}
]
}
What must I do to directly navigate to that URL and see the same JSON data I saw in my browser's developer's console?
The URL cannot be opened directly in a browser because it uses several headers in the request. If you can examine the request clearly you will some keys such as x-airbnb-api-key.

Youtube v3 playlistItems.insert api returns Video not found 404 error but video was published in the correct playlist

Seems like Youtube v3 playlist item insertion API (https://developers.google.com/youtube/v3/docs/playlistItems/insert) is responding with a wrong error message even though the video is successfully inserted into the playlist.
I went through the documentation and also searched for similar issues but have no clue why the youtube.playlistItems.insert call is failing.
I'm using googleapis node client to make this request. Here goes the code snippet:
let oauthConfig = config.oauthConfig;
let oAuthClient = new Google.auth.OAuth2(oauthConfig.clientId, oauthConfig.clientSecret);
oAuthClient.setCredentials({access_token: credentials.accessToken, refresh_token: credentials.refreshToken});
let youtubeApi = Google.youtube({version: 'v3', auth: _getOauthClient(_channel.credentials)});
youtube.playlistItems.insert({
part: 'snippet',
resource: {
snippet: {
playlistId: playlist.id,
resourceId: {
kind: 'youtube#video',
videoId: video.id
}
}
}
}, function (err) {
});
Here the callback method receives
404 Video not found.
at Request._callback (<proj_dir>/node_modules/google-auth-library/lib/transporters.js:85:15)
at Request.self.callback (<proj_dir>//node_modules/google-auth-library/node_modules/request/request.js:187:22)
The doc mentioned above says,
notFound (404) - videoNotFound - The video that you are trying to add to the playlist cannot be found. Check the value of the videoId property to ensure that it is correct.
Calling the above code with playlist: PL4D56EB46ED904B8A and video: 4HlpCEEwdxk has resulted in this error, but both video and playlist has public visibility and seems correct. More surprisingly the video uploaded correctly and was inserted into the correct playlist (I verified by visiting https://studio.youtube.com/video/4HlpCEEwdxk/edit/basic), so it seems like a false error.
The same code works for different video without any error though. I'm clueless about what is wrong here. Any help is much appreciated. Thanks

Video is uploaded as an image from iOS device, how to upload properly

I have an app that gets the images/videos from the mobile gallery, then uploads one of them to a server,
here are the steps i take, which works fine on Android:
1-get data from mobile storage:
MediaLibrary.getAssetsAsync({
first: 20,
mediaType: [MediaLibrary.MediaType.video, MediaLibrary.MediaType.photo]
})
2-upload to server:
formData.append('images[]', {
uri: localUri,
name: isVideo ? 'untitled.mp4' : 'untitled',//for testing
type: isVideo ? 'video/mp4' : 'image/jpeg'
})
axios.post(`url`, formData, {headers: headers,timeout:999999})
The problem is videos are uploaded as an image (only the first frame of the video), while it gets uploaded successfully on Android, the problem is only present on iOS.
The uri of the retrieved files is as follows:
assets-library://asset/asset.MP4?id=xxx&ext=MP4
Quick notes:
1 - the video is played fine locally using the <Video> component from Expo
2 - i tried using the CameraRoll API, but it gives the same results, and is a little buggy
any help would be appreciated
You can update to expo SDK 36 and you will be able to solve this problem by using localUri returned by MediaLibrary.getAssetInfoAsync
ex.
// get asset id like B84E8479-475C-4727-A4A4-B77AA9980897/L0/001
const info = await MediaLibrary.getAssetInfoAsync(asset.id)
const uri = info.localUri // use this for upload
Reffer this comment on github.
https://github.com/expo/expo/issues/3177#issuecomment-510096711

Inconsistent results from Youtube Data API and getting 150 error code while playing video with Iframe api

This question was posted before. However, I am getting inconsistent results.
I am using the youtube data api v3 and getting some strange results.
I am initially getting a list of videos with the following query:
search?part=snippet&safeSearch=strict&type=video&videoDefinition=high&videoEmbeddable=true&videoSyndicated=true&fields=items(id,snippet)&q='horses riding gopro'
Then I individually query each video:
videos?part=snippet,statistics,contentDetails,status&id=LUThBDjQocU
After that, I am getting the following status information:
status: { uploadStatus: "processed", privacyStatus: "public", license: "youtube", embeddable: true, publicStatsViewable: true }
Playing the same video with youtube iframe api on a mac:
I am receiving the error code 150
while on a linux workstation:
I am not getting an error.
Any hints on how to detect the error code 150 during a query to youtube data api?

Resources