nova-video-player / aos-AVP

NOVA opeN sOurce Video plAyer: main repository to build them all
Apache License 2.0
3.39k stars 201 forks source link

migrate to jupnp (previously cannot upgrade to cling 2.1.2) #74

Open courville opened 5 years ago

courville commented 5 years ago

Issue is similar to https://github.com/4thline/cling/issues/164 that should have been fixed. No device discovered on Android.

courville commented 4 years ago

Perhaps time to switch to https://github.com/jupnp/jupnp

courville commented 4 years ago

jupnp switch is not possible since it does not contain any AndroidUpnpServiceImpl. Yes I did all the modifications sed -i "s/org.fourthline.cling/org.jupnp/g"

courville commented 4 years ago

Compilation done using java8 Add in pom.xml <additionalparam>--allow-script-in-comments</additionalparam> in javadoc

diff --git a/pom.xml b/pom.xml
index be885ea..81f0c90 100644
--- a/pom.xml
+++ b/pom.xml
@@ -161,6 +161,7 @@
                     <configuration>
                         <quiet>true</quiet>
                         <additionalparam>-Xdoclint:none</additionalparam>
+                       <additionalparam>--allow-script-in-comments</additionalparam>
                     </configuration>
                 </plugin>

Need to install also android sdk 15 via Android Studio it is the easiest or /opt/android-sdk/tools/bin/sdkmanager "platforms;android-15"

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 mvn install -rf :cling-support
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 mvn install -rf :cling-support
courville commented 4 years ago

On macOS:

brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8
JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home mvn install
courville commented 4 years ago

Note that hosts visible are due to:

05-05 19:53:53.819 17645 17845 W trieveRemoteDescriptors: Could not hydrate device or its services from descriptor: (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:00113228-8879-0011-7988-798828321100, Descriptor: http://192.168.0.2:50001/desc/device.xml, Root: true
05-05 19:53:53.819 17645 17845 W trieveRemoteDescriptors: Cause was: org.xml.sax.SAXNotRecognizedException: http://apache.org/xml/features/disallow-doctype-decl
courville commented 4 years ago

See https://github.com/4thline/cling/issues/247

courville commented 4 years ago

Thus this is a seamless issue https://github.com/4thline/seamless/commit/74e66789d11862789f1a9ee570d27d5d18162c11 Reverting this one makes cling happy.

courville commented 4 years ago

In order to work Medialib needs:

    api files('libs/cling-core-2.1.2.jar');
    implementation files('libs/cling-support-2.1.2.jar');
    implementation files('libs/seamless-util-1.1.2.jar');
    implementation files('libs/seamless-http-1.1.2.jar');
    implementation files('libs/seamless-xml-1.1.2.jar');
courville commented 4 years ago

v4-jcifsng.xml is now using cling 2.1.2

courville commented 2 years ago

For jupnp migration see https://github.com/UniversalMediaServer/UniversalMediaServer/pull/2789

courville commented 1 year ago

Tentative migration to jupnp ongoing in dev/jupnp branches. See https://github.com/jupnp/jupnp/issues/144 preventing 2.7.0 usage. See https://github.com/jupnp/jupnp/issues/153 for loss of Android turnkey replacement.

courville commented 1 year ago

Note that I tried to find an open-source Android app using jupnp and so far I failed: all apps listed on f-droid are still using cling.

Dedesese1990 commented 7 months ago

I search for online subtitles and found what I need but when i selected it not loading in the list ...

courville commented 5 months ago

jupnp has been reverted in latest release to get around the following error playing multiple files (it works only with first one):

com.archos...pRawLister org.courville.nova W  failure on (ActionInvocation) (Action, Arguments: 10) Browse response 500 Internal Server Error, Error: Error reading SOAP response message. Can't transform message payload (HTTP response was: 500 Internal Server Error)
2024-04-2

Tested that jupnp fix suggested in https://github.com/jupnp/jupnp/issues/232 makes it work:

diff --git a/bundles/org.jupnp/src/main/java/org/jupnp/transport/impl/PooledXmlProcessor.java b/bundles/org.jupnp/src/main/java/org/jupnp/transport/impl/PooledXmlProcessor.java
index f169d2df..c5ce69e1 100644
--- a/bundles/org.jupnp/src/main/java/org/jupnp/transport/impl/PooledXmlProcessor.java
+++ b/bundles/org.jupnp/src/main/java/org/jupnp/transport/impl/PooledXmlProcessor.java
@@ -134,6 +134,8 @@ public abstract class PooledXmlProcessor {

     private void returnBuilder(DocumentBuilder builder) throws FactoryConfigurationError, ParserConfigurationException {
         builder.reset();
-        builderPool.add(builder);
+        if (builder.isNamespaceAware()) {
+            builderPool.add(builder);
+        }
     }
 }

Waiting for proper jupnp release to make a nova release with this workaround if approved by maintainer.

courville commented 4 months ago

Latest version of jupnp fixes the problem. However I get on sentry these reports:

java.lang.NoClassDefFoundError: org.eclipse.jetty.io.SelectorManager$$ExternalSyntheticLambda1
    at org.eclipse.jetty.io.SelectorManager.<init>(SourceFile:100)
    at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.<init>(SourceFile:532)
    at org.eclipse.jetty.server.ServerConnector.newSelectorManager(SourceFile:227)
    at org.eclipse.jetty.server.ServerConnector.<init>(SourceFile:220)
    at org.eclipse.jetty.server.ServerConnector.<init>(SourceFile:94)
    at org.jupnp.transport.impl.jetty.JettyServletContainer.addConnector(SourceFile:65)
    at org.jupnp.transport.impl.ServletStreamServerImpl.init(SourceFile:61)
    at org.jupnp.transport.RouterImpl.startAddressBasedTransports(SourceFile:403)
    at org.jupnp.transport.RouterImpl.enable(SourceFile:127)
    at org.jupnp.android.AndroidRouter.enable(SourceFile:88)
    at org.jupnp.UpnpServiceImpl.startup(SourceFile:263)
    at com.archos.mediacenter.filecoreextension.upnp2.UpnpServiceManager$2.onServiceConnected(SourceFile:274)
    at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1244)
    at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1261)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5431)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:810)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Perhaps this is due to using an older version of jetty in order to not target API26:

    api 'org.jupnp:org.jupnp:3.0.2'
    api 'org.jupnp:org.jupnp.support:3.0.2'
    api 'org.jupnp:org.jupnp.android:3.0.2'
    // jetty required by jupnp and going above 9.4.14 requires minSdkVersion 26
    implementation ('org.eclipse.jetty:jetty-server:9.4.14.v20181114') {
        exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet'
    }
    implementation ('org.eclipse.jetty:jetty-servlet:9.4.14.v20181114') {
        exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet'
    }
    implementation ('org.eclipse.jetty:jetty-client:9.4.14.v20181114') {
        exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet'
    }

Reverting for now to old cling until it is figured out.

courville commented 3 months ago

Seems that there are still two issues reported to sentry when deployed on user base:

Need to solve these before switching to jupnp. Check release 6.2.79 and 6.2.81 errors: there is a bump new issues (279).