-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add MatroskaJS Chapter Codec #835
base: master
Are you sure you want to change the base?
Conversation
Rather than reinventing the wheel with a custom language, we can reuse and well-known one. The goal of Matroska Script was to be similar to JavaScript/ECMAStrip/ActionScript. But, in JS, integers can only use 56 bits. So not all ChapterUID (64-bit unsigned integer) can be addressed with the current Matroska Script stable API. Rather than adding a different GotoAndPlay that is compatible with JavaScript (using a string), we start from scratch with ECMAScript 6th Edition (ES6).
This API is meant for interactive movies. The author adds choices in a chapter and retrieves the user choice at the end of this chapter. Depending on the choice, different actions can be performed. The choice rendering and user interaction is the responsibility of the player.
Not sure it should go in the "historical" Chapter Codec document, ie make the specification for what existed so far. Or if it should be a document on its own. Maybe each command will need its own IANA registry. |
## MatroskaJS | ||
|
||
This is the case when `ChapProcessCodecID` = 2. This is a script language build for | ||
Matroska purposes. It uses the [@!ECMAScript] 6th Edition (ES6) syntax. The commands are stored as text commands, in UTF-8. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to use ES5 instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be better (less constraint) but we don't have a working solution with that.
Also there are things that could make the JS usage cleaner like let and const or static arrays and typed arrays. For example you could have a global function that gets the list of choices in an array and call the MatroskaJS engine. Then each (enter) chapter would just had the array and that call.
Rather than reinventing the wheel with a custom language, we can reuse and well-known one.
The goal of Matroska Script was to be similar to JavaScript/ECMAStrip/ActionScript.
But, in JavaScript, integers can only use 56 bits. So not all
ChapterUID
(64-bit unsigned integer) can be addressedwith the current Matroska Script stable API, if an ECMAScript interpreter was used.
Rather than adding a different
GotoAndPlay()
that is compatible with JavaScript (using a string), we start fromscratch with ECMAScript 6th Edition (ES6). We cannot handle the original
GotoAndPlay()
with that engine anyway.The implementation of the Choice handling is almost complete in VLC by a Google Summer of Code student.
Fixes #658
Draft on top of #833