Buscar
Social
Ofertas laborales ES

Foro sobre Java SE > Reproductor de video desde URL

Hola, tengo un gran problema que no logro resolver, busque pero no encuentro nada que me ayude. El problema es que me gustaría reproducir un video alojado en una web (youtube porejemplo). En mi aplicación java. No se me ocurre como hacerlo, tendría que ser algo así como los navegadores web, van descargando el video y reproduciendolo a la vez pero no se como hacerlo y no encuentro información en google ya que al usar el término "video" me muestra videos sobre otras cosas. Espero que puedan ayudarme. Saludos!

julio 11, 2014 | Registered Commentermanuel2014

Pues que raro, porque a mi me ha salido la solucion en la primera busqueda en Google:

"play youtube video from java swing app" -> Search:

http://stackoverflow.com/questions/20440484/embed-a-youtube-video-to-jframe

julio 11, 2014 | Unregistered CommenterUnoPorAhi

Muchas gracias :D me cuesta buscar algunas cosas sobre java en google, muchas veces salen resultados de javascript y en casos como en este me salian videos de youtube por poner esas palabras también me salian resultados de aplicaciones para reproducir videos en celulares con SO java :/ Gracias nuevamente, mañana lo reviso bien. saludos!

julio 12, 2014 | Registered Commentermanuel2014

No logro hacer funcionar la aplicación :/ usa la librería DJNativeSwing pero al parecer esa librería esta más echa para eclipse y yo uso netbeans, en el paquete de la librería viene incluido también 2 archivos y los pasos para poder usarla en netbeans, pero se me es imposible entenderla. Estos son los pasos:


1. Create main application
With dependencies:
- Auto Update Service
- Lookup
- Progress API

Change compilation level to 1.6 -> to be set for all modules due to the use of certain annotations.


2. In "platform.properties", add this line:
run.args.extra=-J-Dsun.awt.disableMixing=true


3. Create wrapped library DJNS-SWT (chrriis.dj.nativeswing.swtimpl)
With JARs (remove unneeded):
- DJNativeSwing.jar
- DJNativeSwing-SWTAPI.jar
- jna_WindowUtils.jar
- jna-4.0.0.jar
- ckeditor_3.0.1.zip
- FCKeditor_2.6.3.zip
- TinyMCE_3.4.3.2.zip
- MozillaInterfaces-1.8.1.3.jar
- SyntaxHighlighter_1.5.1.zip
With dependencies:
- Auto Update Services
- Lookup
- Module System API
- Progress API
- Utilities API

Add to module manifest:
OpenIDE-Module-Install: chrriis/dj/nativeswing/swtimpl/netbeans/NativeCoreInstaller.class


4. Create platform-dependant modules
For each platform to support (remove unwanted ones, package names are important!):
Create module DJNativeSwing-SWTCore-win32-win32-x86 (chrriis.dj.nativeswing.swtcore.win32.win32.x86)
Create module DJNativeSwing-SWTCore-win32-win32-x86_64 (chrriis.dj.nativeswing.swtcore.win32.win32.x86_64)
Create module DJNativeSwing-SWTCore-gtk-linux-x86 (chrriis.dj.nativeswing.swtcore.gtk.linux.x86)
Create module DJNativeSwing-SWTCore-gtk-linux-x86_64 (chrriis.dj.nativeswing.swtcore.gtk.linux.x86_64)
Create module DJNativeSwing-SWTCore-cocoa-macosx-x86 (chrriis.dj.nativeswing.swtcore.cocoa.macosx.x86)
Create module DJNativeSwing-SWTCore-cocoa-macosx-x86_64 (chrriis.dj.nativeswing.swtcore.cocoa.macosx.x86_64)
with JARs:
- DJNativeSwing-SWTCore.jar
- swt-4.3-win32-win32-x86.jar (use appropriate JAR, with a different name for each platform)
with dependencies:
- DJNS-SWT
- Lookup

Change module type from Autoload to Regular.

In each package (e.g.: chrriis.dj.nativeswing.swtcore.win32.win32.x86), create an APIProvider class:
package chrriis.dj.nativeswing.swtcore.win32.win32.x86;
import chrriis.dj.nativeswing.swtimpl.internal.NativeCoreObjectFactory;
import chrriis.dj.nativeswing.swtimpl.netbeans.NativeCoreAPIProvider;
import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service=NativeCoreAPIProvider.class)
public class APIProvider implements NativeCoreAPIProvider {
@Override
public NativeCoreObjectFactory getObjectFactory() {
return new NativeCoreObjectFactory(APIProvider.class.getClassLoader());
}
}


5. Use it in your application
With dependencies:
- DJNS-SWT
- Lookup
- Utilities API

In main UI class:
static {
NativeInterfaceNetBeansHandler.initialize();
}

Then it is ready:
NativeInterface.open();
JWebBrowser webBrowser = new JWebBrowser(options);
...

julio 13, 2014 | Unregistered CommenterManuel2014

Esas instrucciones son para crear una aplicación NetBeans Platform, con soporte de DJNativeSwing.

Mira mejor estos ejemplos de uso:

http://djproject.sourceforge.net/ns/documentation/Snippets.html

julio 13, 2014 | Registered Commenterchoces

gracias por el link, recien hoy pude conectarme. Sigo con el mismo problema, me da este error:


Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/SWT
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.initialize_(SWTNativeInterface.java:213) at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.initialize_(SWTNativeInterface.java:213)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.initialize(NativeInterface.java:71)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.open_(SWTNativeInterface.java:337)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:100)
at youtube.VisorYoutube.main(VisorYoutube.java:40)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWT
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 5 more
Java Result: 1

Al parecer es debido a que no ecuentra la clase "swt.jar" y que yo sepa esa clase esta en el eclipse. Poreso es que pienso que debería utilizar los JAR que trae la libreria DJNativeSwing dentro de la carpeta netbeans, pero dentro de esa carpeta esta el txt con lo que publique en el mensaje anterior y no entiendo nada de nada de lo que explica :/

julio 18, 2014 | Unregistered CommenterManuel2014

Probe usando las 2 librerias que vienen dentro de la carpeta netbeans pero me da el mismo error :/

julio 18, 2014 | Registered Commentermanuel2014

Descargue la libreria y ya funciona, ahora voy a probar lo de youtube. Una cosa, supongo que no tendré que compilar mi aplicacion con la libreria swt para que funcione no? ya tengo demaciadas librerias y se esta poniendo pesada la aplicación, la libreria pesa casi 2MB es demaciado :/

Edito: ya funciona bien, pero al cerrar la aplicacion me da un error:

NativeSwing[1]: #
NativeSwing[1]: # A fatal error has been detected by the Java Runtime Environment:
NativeSwing[1]: #
NativeSwing[1]: # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x5c8d074b, pid=4452, tid=5620
NativeSwing[1]: #
NativeSwing[1]: # JRE version: Java(TM) SE Runtime Environment (8.0_05-b13) (build 1.8.0_05-b13)
NativeSwing[1]: # Java VM: Java HotSpot(TM) Client VM (25.5-b02 mixed mode windows-x86 )
NativeSwing[1]: # Problematic frame:
NativeSwing[1]: # V [jvm.dll+0xd074b]
NativeSwing[1]: #
NativeSwing[1]: # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
NativeSwing[1]: #
NativeSwing[1]: # An error report file with more information is saved as:
NativeSwing[1]: # C:\Users\\Documents\NetBeansProjects\PruebasVarias\hs_err_pid4452.log
NativeSwing[1]: #
NativeSwing[1]: # If you would like to submit a bug report, please visit:
NativeSwing[1]: # http://bugreport.sun.com/bugreport/crash.jsp
NativeSwing[1]: #
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:189)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2296)
at java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2589)
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2599)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readUnshared(ObjectInputStream.java:461)
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.readMessageFromChannel(OutProcessSocketsMessagingInterface.java:116)
at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface$2.run(MessagingInterface.java:392)

Saben a que puede deberse? apenas cierro la aplicacion me sale en la consola. Probe con los dos códigos que me pasaron que son basicamente los mismos, tengo windows 32bits y la libreria es la version 4.4 win32 x86

julio 18, 2014 | Registered Commentermanuel2014

Ya lo solucione de otra forma, la libreria DJNativeSwing es una cagada, 5MB en librerias para tener un navegador web no gracias :/ no tendrian que haber utilizado el SWT de eclipse, trae muchas funciones innecesarias para este caso, me habia puesto a limpiar el código pero no terminaba mas, son muchas clases, la librerias de nativeswing si la resumi a mas de la mitad, quedo liviana, pero la SWT es muy grande y no me hiba a pasar toda la semana sintetizandola para lo que necesito, pero bue ya lo termina y quedo bien :D gracias!

julio 20, 2014 | Unregistered CommenterManuel2014

Y entonces, como lo has resuelto?


Un saludo

julio 21, 2014 | Unregistered CommenterUnoPorAhi

lo resolvi con javafx, pero ahora tengo otro problema, pero me parece mas correcto crear un nuevo post ya que es otro el problema. Gracias!

julio 24, 2014 | Unregistered CommenterManuel2014

Quiero jugar archivo swf en aplicación JavaFX . pero hay tantos problemas usando NetBeans . ¿hay alguna otra manera de hacer este trabajo please me ayudan a resolver este problema . saludos!

octubre 13, 2014 | Unregistered CommenterAKAS