shure 27 Posted June 4, 2023 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
shure 27 Posted June 4, 2023 Author 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.
softworkz 4569 Posted June 4, 2023 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.
shure 27 Posted June 6, 2023 Author 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.
shure 27 Posted June 8, 2023 Author Posted June 8, 2023 So I need reload index.html after changing server
shure 27 Posted June 8, 2023 Author 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
softworkz 4569 Posted June 8, 2023 Posted June 8, 2023 Are you aiming for that plugin to become included in the official plugin catalog?
shure 27 Posted June 9, 2023 Author 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
softworkz 4569 Posted June 9, 2023 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..?
shure 27 Posted June 9, 2023 Author 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
shure 27 Posted June 9, 2023 Author Posted June 9, 2023 (edited) For example As server manager, I provide External Players and Dark Theme. Edited June 9, 2023 by shure
shure 27 Posted June 9, 2023 Author Posted June 9, 2023 As user, I choose to use External Players provided by server manager and my own script Photo Carousel
shure 27 Posted June 9, 2023 Author Posted June 9, 2023 more details https://github.com/Shurelol/Emby.CustomCssJS/blob/main/README_EN.md
softworkz 4569 Posted June 9, 2023 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?
softworkz 4569 Posted June 9, 2023 Posted June 9, 2023 You were asking about Android - how do you interact with the Android app to modify it?
shure 27 Posted June 9, 2023 Author 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
shure 27 Posted June 9, 2023 Author 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
softworkz 4569 Posted June 9, 2023 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?
shure 27 Posted June 9, 2023 Author 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
softworkz 4569 Posted June 9, 2023 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..
shure 27 Posted June 9, 2023 Author 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
softworkz 4569 Posted June 9, 2023 Posted June 9, 2023 Ah, you're right, MainActivity is exported to js. But how do you change the js files?
shure 27 Posted June 9, 2023 Author 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
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