Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppendBytes and mp4? #20

Open
SesameWorkshopApps opened this issue Mar 2, 2024 · 9 comments
Open

AppendBytes and mp4? #20

SesameWorkshopApps opened this issue Mar 2, 2024 · 9 comments

Comments

@SesameWorkshopApps
Copy link

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
Copy link
Contributor

ajwfrost commented Mar 4, 2024

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
Copy link

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
Copy link
Contributor

ajwfrost commented Mar 4, 2024

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
Copy link

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

@ajwfrost
Copy link
Contributor

ajwfrost commented Mar 5, 2024

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
Copy link

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

@jonathanlevySW
Copy link

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

@jonathanlevySW
Copy link

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
Copy link
Contributor

ajwfrost commented Apr 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants