upload a .mp4 video using the REST API (VoD) to ant media server - ant-media-server

when uploading my video,I get the following error message: {"success": false, "message": "notMp4File", "dataId": null, "errorId": 0}
except here is my file; it's in .mp4 extension: 1- Introduction---.mp4 (type: "video/mp4"; size: 1255840 bytes)

I have found the solution to this problem and I will leave this answer in case someone comes across this mistake:
in my example, the name of our video will be zoom_1.mp4
http://localhost:5080/LiveApp/rest/v2/vods/create?name=zoom_1.mp4
where zoom_1.mp4 is the name of my video
in the form, I pass a field of type file (accept="video/*")

Related

Firestore extension for image resizing caught in infinite loop

Just want to preface this with, I know the functionality is new, only let out into the wild a week ago! Definitely will be patient with it.
I've just set the Resize Image extension up and the test run (just uploading an image) is causing an infinite loop of uploads and deletes (and error messages), where the newly resized images appear to be attempting to create new images, or something similar. My input for Cloud Storage path for resized images is images and this is leading to this error:
Deleting temporary resized file: 'images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/images/_200x200'
I'm currently seeing an issue where a single image is causing the function to run until it hits:
Error when resizing image { Error: Backend Error
...
code: 503,
errors:
[ { domain: 'global',
reason: 'backendError',
message: 'Backend Error' } ],
response: undefined,
message: 'Backend Error' }
Any ideas for a solution to this? I uninstalled the extension to stop the infinite loop but not sure how to make the extension run smoothly.
The only steps I've taken so far were the setup guide of accepting a few things and changing the path to images.
Where's the best place to report this? Happy to delete this on SO if it's not the right place.
This looks like a bug on the firebase extension.
It's already logged here:github
It occurs when your file name does not have an extension like .jpg or .png. As a work around, you might want to rename any files uploaded to the storage bucket to have an extension

Invalid schema for REST JSON CreatePassengerNameRecord response

I am trying to test the integration for the Sabre CreatePassengerNameRecord rest API. As the first step, I tried downloading the JSON schemas for the Request and Response and tried to generate the POJOs using jsonschema2pojo. But it looks like the schema files are all pointing to dependent references using a URL http://services.sabre.com which is non existing. Hence the POJO generation is getting failed. This is happening for both the request and response. I was able to fix the request schema by changing the URL for XMLSchemaTypes.json dependency to provided URL link in documentation, but the response has a reference which is not specified anywhere (Please check the Response schema section of question ).
API Link: https://developer.sabre.com/docs/rest_apis/air/book/create_passenger_name_record/
Response Schema:
In the response, there is a reference to http://services.sabre.com/STL_Payload/v02_02 which is not existing.
File : http://files.developer.sabre.com/doc/providerdoc/STPS/create_passenger_name_record/v200/CreatePassengerNameRecord2.0.0RS.json
....
"CreatePassengerNameRecordRS" : {
"type" : "object",
"title" : "CreatePassengerNameRecordRS",
"properties" : {
"version" : {
"type" : "string",
"minLength" : 1,
"maxLength" : 255
},
"ApplicationResults" : {
"$ref" : "http://services.sabre.com/STL_Payload/v02_02#/definitions/ApplicationResults"
....
It would be great it you could provide the latest file for the STL_Payload or update the documentation to the latest working version.
The missing files were added to the documentation page.
This should allow you to move forward.
The id-s are still used as tags and not as absolute resource pointers so you still need to play with it they way you described to make the auto-generation working out of the box.
We will consider your request to convert them to resource pointers in the future.
Just one more hint: if you are using Java-API version of jsonschema2pojo please use this for config:
GenerationConfig config = new DefaultGenerationConfig() {
public String getRefFragmentPathDelimiters() {
return "#/";
}
};
You need it because the default path delimiters in jsonschema2pojo are "#/." and the "." does not work with some of the types declared in the schema like Text.Long
+1 Sabre please make JSON schema available on http://services.sabre.com as it is problematic when generating models using Quicktype. Types are not being resolved correctly.

AlpacaJS - How to access file uploaded in File Field in Handlebars

I have a form with the following super basic file field:
Schema-
"file_upload": {
"type": "string"
}
Options-
"file_upload": {
"type": "file"
}
I want to access the file uploaded somehow, but particularly through Handlebars.js.
A regular field, say "file_checkbox" can be rendered using {{file_checkbox}} in handlebars but I can not figure out how to access the file.
Using basic javascript (document.getElementById('fieldId').files), I can see that the file has uploaded as anticipated.
But, trying to get the value of the Alpaca Form ($.alpaca($("#formDiv")).getValue()) yields the data from the regular fields (i.e. file_checkbox) and nothing from the file field.
When I submit the alpaca form all of the other data is properly saved, but again nothing from the file field (not even the name of the field with an empty/nil value)!
I've spent many hours searching and haven't found anything on the Alpaca website, Github Issues, or stack overflow! This is my first question so please let me know if there is any additional information I can provide.
Thank you!
That's normal with Alpaca, there will be no data for your file input set in your form data object, you should use the function selectionHandler to set the file(s) selected (you can use either File or Base64 data) to your form data like this :
"file-upload": {
"type": "file",
"selectionHandler": function(files, data) {
// files for multiple or use files[0] to get only one file
// and if you want to use base64 data you could use data
this.data = files;
}
}
And here's a fiddle for that.

Uploading .kml files to WordPress

I'm trying to upload .kml files to WordPress. I had this working at one point but the latest WordPress update seems to have broken it.
I'm using this function
function my_myme_types($mime_types){
$mime_types['kml'] = 'application/vnd.google-earth.kml+xml'; //Adding kml extension
$mime_types['kmz'] = 'application/vnd.google-earth.kmz'; //Adding kmz files
return $mime_types;
}
add_filter('upload_mimes', 'my_myme_types', 1, 1);
I get this error when uploading
"Sorry, this file type is not permitted for security reasons."
For KML/KMZ files to be properly supported, you'll have to use text/xml and application/zip instead, because WordPress compares the declared MIME type to the 'real' detected MIME type (see function wp_check_filetype_and_ext in wp-includes/functions.php for more details)
function add_upload_mimes($mimes) {
$mimes['kml'] = 'text/xml';
$mimes['kmz'] = 'application/zip';
return $mimes;
}
add_filter('upload_mimes', 'add_upload_mimes');
Update (2019-02-28) : kml is detected as text/xml and not application/xml, changing the code accordingly should resolve the issue described in the comments below.
This may be related as of after the latest wordpress update:
Trying to upload xml file and getting the same error message, updating upload_mimes WordPress filter hook doesn't work as well as using some file uploading or mime type managing plugins which essentially using the same filter hook.
Solution: update wp-config.php and add in the following line
define( 'ALLOW_UNFILTERED_UPLOADS', true );
and then remove this line after uploading the files to avoid potential security risk

import a google static map directly in fpdf

I wanted to place a google static map in a pdffile generated by using the fpdf extension.
and used code to make a tempfile first. Using this code. However I run into an error ('can't open image file').
// define the mapurl
$fullURL = 'http://maps.googleapis.com/maps/api/staticmap?center=Amsterdam&z=14&size=100x100&sensor=false';
// create a tempfile
$tempF = tmpfile();
fwrite($tempF, file_get_contents($fullURL));
//Rewind to the start of file
rewind($tempF);
// place the image in the pdf.
if (!empty($tempF)) {
$this->Image($tempF,$start_x, $this->GetY(),0,100);
}
fclose($tempF); // remove the tempfile
Note: OP's own answer extracted from the question.
Then I found out it can be done much easier... I don't need to use a tempfile. If I put the url in the image variable and give a format the thing works in two lines.. I don't use the height and width parameters in fpdf because they stretch the image into a unreadable form.
$fullURL = "http://maps.googleapis.com/maps/api/staticmap?center=". \
$row-Google_coor."&zoom=10&size=2200x200\
&markers=color:blue%7Clabel:D%7C".$row->Google_coor;
$this->Image($fullURL,$start_x, $this->GetY(),0,0,"PNG");
Saddly when using this function sometimes the program returns an error. The image could not be found. But when I put the url string in the browser the image shows up fine. Hopefully this is also a minor fallback.
Lets see if I find a solution on the google apis site https://developers.google.com/maps/documentation/staticmaps/?csw=1
For what it is worth I had this problem as well, I found that my server had an outgoing connections manager, this would automatically block the request, I had to add the ip, once this was done it worked fine.
I had a problem similiar to the OP's. I was getting an error when using FPDF and trying to get the static map image from Google Maps and into my PDF. I was getting "FPDF error: Missing or incorrect image file". What I did is to register in the Google Developer Console and get an API Key, just like they say in the documentation
Hope this helps.
You can download the image and use it with fpdf
$url ="https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284&key=".$googleApiKey;
$img = __DIR__.'/img/map.png';
file_put_contents($img, file_get_contents($url));
$pdf->Image($img,null,null,170);
Hope that this will be helpful

Resources