I have a video player built into AS3. I am taking a snapshot of a video player using this code:
var uploadUrl = 'http://localhost:8000/assets/uploadframegrab'; var bitmap = new Bitmap(); var graphicsData : Vector.<IGraphicsData>; graphicsData = container.graphics.readGraphicsData(); bitmap.bitmapData = GraphicsBitmapFill(graphicsData[0]).bitmapData; var jpgEncoder:JPGEncoder = new JPGEncoder(85); var jpgStream:ByteArray = jpgEncoder.encode(bitmap.bitmapData); var loader:URLLoader = new URLLoader(); var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream"); var csrf:URLRequestHeader = new URLRequestHeader("X-CSRF-Token", csrfToken); var request:URLRequest = new URLRequest(uploadUrl); request.requestHeaders.push(header); request.requestHeaders.push(csrf); request.method = URLRequestMethod.POST; request.data = jpgStream; loader.load(request);
I need to load encoding into JPG using one of my Laravel routes. My route is as follows:
Route::post('assets/uploadframegrab', ' AssetController@uploadFramegrab ');
When I run the AS3 code, it calls the laravel route, but my $request variable seems empty. The Request Payload property on the network information tab, which displays all my headers and more, contains what looks like the source of the image file.
If I do return Response::json(['filedata' => $request]); all i get is:
filedata: { attributes: {}, request: {}, query: {}, server: {}, files: {}, cookies: {}, headers: {} }
My uploadFramegrab function is just like this:
public function uploadFramegrab(Request $request) { if ($request) { return Response::json(['filedata' => $request]); } else { return Response::json(['error' => 'no file uploaded']); } }
I searched on the Internet, but I can not find anything specifically for downloading from a flash file in laravel. I made this javascript for laravel without any problems. Does anyone know what this could be? If you need more information, please ask.