shure 24 Posted June 4, 2023 Share Posted June 4, 2023 In web client and eletron client. JavaScript code "window.location.reload()" works fine. But in android app. If I use this function, the app just crash and I need to reopen it. Thanks for your help Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 4, 2023 Share Posted June 4, 2023 Why do you want to do this? Link to comment Share on other sites More sharing options...
shure 24 Posted June 4, 2023 Author Share Posted June 4, 2023 9 hours ago, softworkz said: Why do you want to do this? In my plugin page, there is a reload button。“onclick = window.location.reload() ” works fine in web client and eletron client. Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 4, 2023 Share Posted June 4, 2023 12 minutes ago, shure said: In my plugin page, there is a reload button。“onclick = window.location.reload() ” works fine in web client and eletron client. What's the purpose of the "reload button"? Reloading destroys all context and should not be needed actually. Link to comment Share on other sites More sharing options...
shure 24 Posted June 6, 2023 Author Share Posted June 6, 2023 On 6/5/2023 at 3:41 AM, softworkz said: What's the purpose of the "reload button"? Reloading destroys all context and should not be needed actually. My plugin let user can add their own javascript code to modify ui for different servers. but the changement such as a style or link node added will be kept when change server. Link to comment Share on other sites More sharing options...
shure 24 Posted June 8, 2023 Author Share Posted June 8, 2023 So I need reload index.html after changing server Link to comment Share on other sites More sharing options...
shure 24 Posted June 8, 2023 Author Share Posted June 8, 2023 In android app, you can use MainActivity.exitApp(); window.open("emby://items", "_blank"); to reload app (if not work, set timeout for window,open less than 200). and typeof MainActivity === "undefined" to determine the environment Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 8, 2023 Share Posted June 8, 2023 Are you aiming for that plugin to become included in the official plugin catalog? Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 3 hours ago, softworkz said: Are you aiming for that plugin to become included in the official plugin catalog? this is the plugin I'm working on https://github.com/Shurelol/Emby.CustomCssJS I'm not sure if it violates the policy about emby plugin Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 9, 2023 Share Posted June 9, 2023 15 minutes ago, shure said: this is the plugin I'm working on https://github.com/Shurelol/Emby.CustomCssJS Interesting - looks like quite a bit of work you have put into it... 17 minutes ago, shure said: I'm not sure if it violates the policy about emby plugin I'm not sure either What does the plugin do, what's the purpose..? Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 23 minutes ago, softworkz said: Interesting - looks like quite a bit of work you have put into it... I'm not sure either What does the plugin do, what's the purpose..? For server managers, they can provide scripts (javascript and css) for their user. For users, they can choose to use the scripts provided by server manager or make their own scripts Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 (edited) For example As server manager, I provide External Players and Dark Theme. Edited June 9, 2023 by shure Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 As user, I choose to use External Players provided by server manager and my own script Photo Carousel Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 Photo Carousel External Players Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 more details https://github.com/Shurelol/Emby.CustomCssJS/blob/main/README_EN.md Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 9, 2023 Share Posted June 9, 2023 Ahh, so this is some kind of Plug-In system for Emby clients, right? I understand the Photo Carousel, it's nice. But why would somebody need all those external players? Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 9, 2023 Share Posted June 9, 2023 You were asking about Android - how do you interact with the Android app to modify it? Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 25 minutes ago, softworkz said: Ahh, so this is some kind of Plug-In system for Emby clients, right? I understand the Photo Carousel, it's nice. But why would somebody need all those external players? just for more choices, if you use web client in a temporary environment and don‘t want to transcode. you can use local player to play Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 26 minutes ago, softworkz said: You were asking about Android - how do you interact with the Android app to modify it? the main fuction is completed, there is a bug that if I add a script node in body, the node will still be there after changing server. so I need to find a way to reload the index to prevent that you use a script in Server A but the script still work after you changing to Server B. for now, I use MainActivity.exitApp(); window.open("emby://items", "_blank"); not stable but work Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 9, 2023 Share Posted June 9, 2023 3 minutes ago, shure said: for now, I use MainActivity.exitApp(); window.open("emby://items", "_blank"); not stable but work Where do you use that code? Do you have your own Android app? Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 31 minutes ago, softworkz said: Where do you use that code? Do you have your own Android app? https://github.com/Shurelol/Emby.CustomCssJS/blob/main/src/README_EN.md in CustomCssJS.js Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 9, 2023 Share Posted June 9, 2023 5 minutes ago, shure said: https://github.com/Shurelol/Emby.CustomCssJS/blob/main/src/README_EN.md in CustomCssJS.js MainActivity.exitApp(); Is Java code, not .js. For changing assets\www\*`* you either need a rooted Android device or a patching apk - that's what I was wondering about.. Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 13 minutes ago, softworkz said: MainActivity.exitApp(); Is Java code, not .js. For changing assets\www\*`* you either need a rooted Android device or a patching apk - that's what I was wondering about.. MainActivity.exitApp(); did work in JavaScript, because in jave this function uses Decorator @JavascriptInterface in apphost.js, you can find Link to comment Share on other sites More sharing options...
softworkz 3341 Posted June 9, 2023 Share Posted June 9, 2023 Ah, you're right, MainActivity is exported to js. But how do you change the js files? Link to comment Share on other sites More sharing options...
shure 24 Posted June 9, 2023 Author Share Posted June 9, 2023 you can also add if (webResourceRequest.getUrl().toString().startwith("file:///android_asset/www/index")) { return false; } in function shouldOverrideIrlLoading() to make window.location.reload() or window.location.href = "index.html" work Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now