mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-23 19:01:58 +00:00
Fix edgecase
This commit is contained in:
parent
2fca7e9a01
commit
86bd71b89c
2 changed files with 8 additions and 3 deletions
|
@ -58,6 +58,8 @@ class V8Plugin {
|
||||||
val httpClientAuth: ManagedHttpClient get() = _clientAuth;
|
val httpClientAuth: ManagedHttpClient get() = _clientAuth;
|
||||||
val httpClientOthers: Map<String, JSHttpClient> get() = _clientOthers;
|
val httpClientOthers: Map<String, JSHttpClient> get() = _clientOthers;
|
||||||
|
|
||||||
|
var startId: Int = 0;
|
||||||
|
|
||||||
fun registerHttpClient(client: JSHttpClient) {
|
fun registerHttpClient(client: JSHttpClient) {
|
||||||
synchronized(_clientOthers) {
|
synchronized(_clientOthers) {
|
||||||
_clientOthers.put(client.clientId, client);
|
_clientOthers.put(client.clientId, client);
|
||||||
|
@ -148,6 +150,7 @@ class V8Plugin {
|
||||||
synchronized(_runtimeLock) {
|
synchronized(_runtimeLock) {
|
||||||
if (_runtime != null)
|
if (_runtime != null)
|
||||||
return;
|
return;
|
||||||
|
startId + 1;
|
||||||
//V8RuntimeOptions.V8_FLAGS.setUseStrict(true);
|
//V8RuntimeOptions.V8_FLAGS.setUseStrict(true);
|
||||||
val host = V8Host.getV8Instance();
|
val host = V8Host.getV8Instance();
|
||||||
val options = host.jsRuntimeType.getRuntimeOptions();
|
val options = host.jsRuntimeType.getRuntimeOptions();
|
||||||
|
@ -207,6 +210,7 @@ class V8Plugin {
|
||||||
if(isStopped)
|
if(isStopped)
|
||||||
return@busy;
|
return@busy;
|
||||||
isStopped = true;
|
isStopped = true;
|
||||||
|
startId = -1;
|
||||||
|
|
||||||
//Cleanup http
|
//Cleanup http
|
||||||
for(pack in _depsPackages) {
|
for(pack in _depsPackages) {
|
||||||
|
|
|
@ -593,7 +593,6 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
|
||||||
catch(reloadRequired: ScriptReloadRequiredException) {
|
catch(reloadRequired: ScriptReloadRequiredException) {
|
||||||
Logger.i(TAG, "Reload required detected");
|
Logger.i(TAG, "Reload required detected");
|
||||||
StatePlatform.instance.handleReloadRequired(reloadRequired, {
|
StatePlatform.instance.handleReloadRequired(reloadRequired, {
|
||||||
Logger.i(TAG, "ReloadRequired started reloading video");
|
|
||||||
onReloadRequired.emit();
|
onReloadRequired.emit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -689,7 +688,9 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
|
||||||
DefaultHttpDataSource.Factory().setUserAgent(DEFAULT_USER_AGENT);
|
DefaultHttpDataSource.Factory().setUserAgent(DEFAULT_USER_AGENT);
|
||||||
if(audioSource.hasGenerate) {
|
if(audioSource.hasGenerate) {
|
||||||
findViewTreeLifecycleOwner()?.lifecycle?.coroutineScope?.launch(Dispatchers.IO) {
|
findViewTreeLifecycleOwner()?.lifecycle?.coroutineScope?.launch(Dispatchers.IO) {
|
||||||
|
var startId = -1;
|
||||||
try {
|
try {
|
||||||
|
startId = audioSource.getUnderlyingPlugin()?.getUnderlyingPlugin()?.startId ?: -1;
|
||||||
val generated = audioSource.generate();
|
val generated = audioSource.generate();
|
||||||
if(generated != null) {
|
if(generated != null) {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
|
@ -705,11 +706,11 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
|
||||||
val plugin = audioSource.getUnderlyingPlugin();
|
val plugin = audioSource.getUnderlyingPlugin();
|
||||||
if(plugin == null)
|
if(plugin == null)
|
||||||
return@launch;
|
return@launch;
|
||||||
/*
|
if(startId != -1 && plugin.getUnderlyingPlugin()?.startId != startId)
|
||||||
|
return@launch;
|
||||||
StatePlatform.instance.reEnableClient(plugin.id, {
|
StatePlatform.instance.reEnableClient(plugin.id, {
|
||||||
onReloadRequired.emit();
|
onReloadRequired.emit();
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
catch(ex: Throwable) {
|
catch(ex: Throwable) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue