airsdk / ANE-PlayAssetDelivery

Play Asset Delivery ANE
2 stars 2 forks source link

AppendBytes and mp4? #20

Open SesameWorkshopApps opened 4 months ago

SesameWorkshopApps commented 4 months ago

I'm resurrecting a project that uses NetStream to load mp4 files. I'm currently troubleshooting this process. I'm using the On Demand method for PAD, but I'm receiving the following error: Error #2004: One of the parameters is invalid "appendbytes" Before I even begin to rebuild the methods handling the video clips and troubleshoot the error, I want to make sure that I can even use AppendBytes, or is this still limited to FLVs? If so, should I try the Fast Follow method? Thanks.

ajwfrost commented 4 months ago

Hi

NetSteam.appendBytes() only supports FLV files - although it is possible to repackage an a/v file from an MP4 container to an FLV one.

But what are you actually trying to do? Is this just for handling an MP4 file, or a stream? If you're using on-demand play asset delivery then you'd need to wait for the whole asset pack to finish downloading before you'd be able to access it, so then could use the MP4 file directly in a request to NetStream.play(), which may be simpler?

thanks

jonathanlevySW commented 4 months ago

Apologies, I meant Install Time and not On Demand. This is an application for young children, and assets must either be downloaded at installation, or immediately afterward as parents hand off the device to their kids, who won't be able to manage the process. Ideally, we'd want to do the former, but only if the video clips can be repackaged in FLV format without recompression. Otherwise, we'd have to resort to a Fast Follow approach.

ajwfrost commented 4 months ago

I think the play asset delivery piece is independent of the calls to actually play the video... but I think I see what you mean because of the install-time assets being accessed via the AssetFile mechanism... let me see if there's something we can do there.

thanks

jonathanlevySW commented 4 months ago

Any assistance with the ability to access .mp4 files via Install Time access is greatly appreciated! Thanks.

ajwfrost commented 3 months ago

So, this should work: the normal NetStream.play() method is defined as:

public function play(... arguments):void
Argument can be a String, a URLRequest.url property, or a variable referencing either.

etc...

So, for that argument, instead of using 'null' to put it into data generation mode, and if you don't have the URL of a file, then we can set it up so you can just pass in an IDataInput reference. Classes that implement this include ByteArray, FileStream and com.harman.extension.AssetFile. It's essentially the same as passing in a local file name, but instead of reading data from a file, we read it from the AS3 object via readBytes().

Will get this into the next beta update for AIR 51.0 so that you can check it.. Slight caveat that we're only reading once, within the play() context, so it's not like you can keep adding data to the end of a byte array and we'll keep reading from it. For that, you'd need to use the appendBytes() method still. Although, I can't see why the mechanism we're looking at here couldn't also be used for the appendBytes() mechanism... which could mean that we'd support the same file types across all options...

thanks

jonathanlevySW commented 3 months ago

That sounds like it would work for our needs, thanks. Please let me know when a link to the Beta is available.

jonathanlevySW commented 3 months ago

Greetings @ajwfrost , confirmed that readBytes() is working in the latest Beta release. Thank you! When do you expect this to go to production?

jonathanlevySW commented 3 months ago

So, this is working for me with a caveat: only videos up to a certain file size are playing. Is there a size limit for passing along the byteArray, or is it attempting to play prior to load completion?

ajwfrost commented 3 months ago

Hi

Wasn't aware of any restriction on the length there, so we'll to check on this one. We had been planning one more 51.0 beta, next week, and then the production release hopefully 1-2 weeks later.

thanks