Skip to content

nsig solver: solve with js instead of v8 - #28

Open
oSumAtrIX wants to merge 1 commit into
yuliskov:masterfrom
oSumAtrIX:master
Open

nsig solver: solve with js instead of v8#28
oSumAtrIX wants to merge 1 commit into
yuliskov:masterfrom
oSumAtrIX:master

Conversation

@oSumAtrIX

Copy link
Copy Markdown

The challenge test passes. I replaced usages of v8s provider and made the dependency compile only. project compiles and works fine over the system webview.

Considerations:

  • Availability of WebView on Android
  • Old Android/WebView version compatibility (I only tested on Android 13)
  • The minSdkVersion had to be set to 26 so that the webview is available
  • YouTube player script could theoretically be cached so that it isn't reevaluated everytime. Less relevant for this PR but slight optimization possible. State management would be interesting though.

@oSumAtrIX

Copy link
Copy Markdown
Author
image

recommended

@yuliskov

Copy link
Copy Markdown
Owner

Thanks for the efforts, friend. Why "The minSdkVersion had to be set to 26 so that the webview is available"?

@oSumAtrIX

Copy link
Copy Markdown
Author

@oSumAtrIX

Copy link
Copy Markdown
Author

In specific there is the ability to override:

    Suggestion: use a compatible library with a minSdk of at most 17,
           or increase this project's minSdk version to at least 26,
          or use tools:overrideLibrary="androidx.javascriptengine" to force usage (may lead to runtime failures)

But I haven't tried that, not sure if its a good idea.

@oSumAtrIX

Copy link
Copy Markdown
Author

The alternative is to not rely on androidx and just use the minimum APIs

@yuliskov

Copy link
Copy Markdown
Owner

Got it. This looks like a good solution for API 26+, but the standalone V8 is still needed for older devices and for cases where the JavaScript Sandbox service is not supported.

@oSumAtrIX

Copy link
Copy Markdown
Author

WebView itself is available since SDK version 1. So it should be possible to use it in any Android version. The sandbox is also not strictly required; it's provided to isolate YouTube's proprietary VM from the main process as an optional security consideration. I assume V8 does this implicitly.

@oSumAtrIX

Copy link
Copy Markdown
Author

I also noticed cronet, however the only line that actually makes use of cronet in MediaServiceCore is actually commented out:

// addCronetInterceptor(builder)

We can therefore reduce the size even more by removing cronet

@yuliskov

yuliskov commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Got it. Let me know if test this code on old api (e.g. 19)

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

Successfully merging this pull request may close these issues.

2 participants