fritzy / node-azure-media Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
I am using sails.js to redirect upload streams to AMS. When trying to pass a stream using
req.file('fieldname')._files[0].stream
I get the following error stack trace:
_http_outgoing.js:301
value = value.replace(/[\r\n]+[ \t]*/g, '');
^
TypeError: value.replace is not a function
at storeHeader (_http_outgoing.js:301:19)
at ClientRequest.OutgoingMessage._storeHeader (_http_outgoing.js:217:9)
at ClientRequest._implicitHeader (_http_client.js:167:8)
at ClientRequest.OutgoingMessage.write (_http_outgoing.js:420:10)
at Request.write (D:\prot1\node_modules\azure-media\node_modules\request\req
uest.js:1378:25)
at PassThrough.ondata (C:\Users\HauskaNimi\AppData\Roaming\npm\node_modules\
sails\node_modules\skipper\node_modules\multiparty\node_modules\readable-stream\
lib\_stream_readable.js:572:20)
at emitOne (events.js:77:13)
at PassThrough.emit (events.js:169:7)
at PassThrough.Readable.read (C:\Users\HauskaNimi\AppData\Roaming\npm\node_m
odules\sails\node_modules\skipper\node_modules\multiparty\node_modules\readable-
stream\lib\_stream_readable.js:405:10)
at flow (C:\Users\HauskaNimi\AppData\Roaming\npm\node_modules\sails\node_mod
ules\skipper\node_modules\multiparty\node_modules\readable-stream\lib\_stream_re
adable.js:781:26)
at resume_ (C:\Users\HauskaNimi\AppData\Roaming\npm\node_modules\sails\node_
modules\skipper\node_modules\multiparty\node_modules\readable-stream\lib\_stream
_readable.js:761:3)
at C:\Users\HauskaNimi\AppData\Roaming\npm\node_modules\sails\node_modules\s
kipper\node_modules\multiparty\node_modules\readable-stream\lib\_stream_readable
.js:753:7
at doNTCallback0 (node.js:407:9)
at process._tickDomainCallback (node.js:377:13)
Here is a dump of the stream logged to console:
PassThrough {
_readableState:
ReadableState {
highWaterMark: 16384,
buffer: [ <Buffer 00 00 00 18 66 74 79 70 6d 70 34 32 00 00 00 00 6d 70 34
32 6d 70 34 31 00 00 21 cd 6d 6f 6f 76 00 00 00 6c 6d 76 68 64 00 00 00 00 d1 2d
ac c7 d1 2d ... > ],
length: 34084,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: false,
sync: false,
needReadable: false,
emittedReadable: true,
readableListening: false,
objectMode: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ end: { [Function: g] listener: [Function: onend] },
prefinish: { [Function: g] listener: [Function] },
drain: [Function],
error: { [Function: g] listener: [Function] } },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
highWaterMark: 16384,
objectMode: false,
needDrain: true,
ending: false,
ended: false,
finished: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 39845,
writing: true,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: [Function],
writelen: 1,
buffer: [ [Object], [Object], [Object], [Object] ],
pendingcb: 5,
prefinished: false,
errorEmitted: false },
writable: true,
allowHalfOpen: true,
_transformState:
TransformState {
afterTransform: [Function],
needTransform: false,
transforming: false,
writecb: [Function],
writechunk: <Buffer 0d>,
writeencoding: 'buffer' },
headers:
{ 'content-disposition': 'form-data; name="file"; filename="motion-test_01_2f
b_a.mp4"',
'content-type': 'video/mp4' },
name: 'file',
filename: 'motion-test_01_2fb_a.mp4',
byteOffset: 247,
byteCount: 8871231,
field: 'file'
}
It seems like a bug to me, since the stream looks fine.
If a request fails due to auth, the lib should get a new token and retry the request exactly once.
Hi, fritzy, thanks for your work!
I tried to use it but encounter an error when initiate the service
Error Message:
[Error: options.uri is a required argument]
and here's my code:
var AzureMedia = require('azure-media');
var api = new AzureMedia("{client_id: '[MYACCOUNT]', client_secret: '[SECRETE]'} ");
api.init(function (err) {
if(err)
console.log(err);
else
console.log('success');
// do your work here or after this callback
});
Any comment on this? thank you!
How can i generate thumbnail from a video ?
Also Azure portal says :
Use Azure Active Directory (AAD) to connect to Azure Media Services API. The Access Control Service (ACS) keys will be deprecated on June 1st, 2018.
Please give us some guide to change this to AAD
npm install azure-media
failed!
When I attempt to set the IsPrimary
flag on an assetfile
object, I get the following error:
.../node_modules/azure-media/node_modules/verymodel/lib/model.js:442
merrors = meta.defs[field].validate(meta.data[field]);
The reason is that meta.defs[field].validate
is a boolean instead of a function. This also occurs if you attempt to call update when setting IsEncrypted
(or any other boolean field).
Note: This might be a bug inside of VeryModel.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.