Giter Club home page Giter Club logo

gdx-video's Introduction

libGDX Logo

GitHub Actions Build Status

Latest Version Snapshots

Discord Chat

Cross-platform Game Development Framework

libGDX is a cross-platform Java game development framework based on OpenGL (ES), designed for Windows, Linux, macOS, Android, web browsers, and iOS. It provides a robust and well-established environment for rapid prototyping and iterative development. Unlike other frameworks, libGDX does not impose a specific design or coding style, allowing you the freedom to create games according to your preferences.

Open Source, Feature Packed, and Fostering a Large Third-Party Ecosystem

libGDX is released under the Apache 2.0 License, offering unrestricted usage in both commercial and non-commercial projects. While not mandatory, we appreciate any credit given to libGDX when you release a game or app using it. Check out our showcase for a selection of popular libGDX-powered games. With libGDX, you gain access to a comprehensive set of tools and features to develop multi-platform 2D and 3D games using Java.

Moreover, libGDX boasts a vibrant third-party ecosystem, with numerous tools and libraries that streamline development tasks. Explore the awesome-libgdx repository for a curated list of libGDX-centered libraries, serving as an excellent starting point for newcomers in the libGDX community.

An example game created with libGDX: Pathway by Robotality. Discover more captivating games in our Showcase.

Getting Started with libGDX / Documentation

Thanks to Gradle, you can easily set up libGDX without the need to download the framework itself. Your favorite build tool can handle everything for you. Additionally, we offer a convenient setup tool that automates project creation and downloads all the necessary components. Check out our website for instructions on getting started or refer to our comprehensive wiki.

We provide the libGDX javadocs online for easy reference. Additionally, the javadocs are bundled with every libGDX distribution, ensuring smooth integration with your preferred IDE.

Community & Contribution

Stay up to date with the latest libGDX news by following our blog. For engaging discussions and support, join our official libGDX Discord.

Reporting Issues

Use the Issue Tracker here on GitHub to report any issues you encounter. Before submitting, please read our Getting Help guide, which walks you through the process of reporting an issue effectively.

Contributing to the Codebase

libGDX benefits greatly from contributions made by our dedicated developer community. We appreciate any assistance in making libGDX even better. Check out the CONTRIBUTING.md file for details on how to contribute. Note that contributing involves working directly with libGDX's source code, a process that regular users do not typically undertake. Refer to the Working with the Source article for guidance.

You can also support our infrastructure (build server, web server, test devices) by contributing financially through our Patreon!

gdx-video's People

Contributors

caresilabs avatar dasisdormax avatar frosty-j avatar gjroelofs avatar jltrem avatar lucas-kakele avatar manuel-freire avatar mattkwilson avatar maxwangmandoe avatar mgsx-dev avatar mrstahlfelge avatar pokemmo avatar rbogie avatar simonit avatar tom-ski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gdx-video's Issues

Black screen while play on Android hardware device

I am trying to draw a video into a sprite, but after starting to play the video, I see one frame from the video for a split second and then just a black screen
And at the same time on AVD everything work fine
I tried different options and the result is the same, tried draw video to mash and replace MediaPlayer to ExoPlayer, but nothing

Playing streaming video

Hello. I am interested in using gdx-video for playing streaming video. Video is received from the internet and should be played in libgdx game. Is there a way to expand this code to support this feature? I have working code that plays .mp4 video and would like to modify it to play streaming video. It would be enough if you can provide few tips on how to do this.

IllegalStateException when trying to replay video

Hi, so I'm trying to replay a video once it completes, but trying to do this throws an IllegalStateException.

Here's the error:

10-31 13:37:27.575 29607-30226/com.brainwavebank E/BufferQueueProducer: [unnamed-29607-0] connect(P): already connected (cur=3 req=3)
10-31 13:37:27.576 2404-2892/? E/MediaPlayerService: setVideoSurfaceTexture failed: -22
10-31 13:37:27.576 2404-2892/? D/NuPlayerDriver: reset(0xe63de8e0)
10-31 13:37:27.576 2404-30997/? D/NuPlayerDriver: notifyResetComplete(0xe63de8e0)
10-31 13:37:27.578 29607-30226/com.brainwavebank E/BufferQueueProducer: [unnamed-29607-0] connect(P): already connected (cur=3 req=3)
10-31 13:37:27.578 2404-16337/? E/MediaPlayerService: setVideoSurfaceTexture failed: -22
10-31 13:37:27.578 2404-16337/? D/NuPlayerDriver: reset(0xe63de8e0)
10-31 13:37:27.581 29607-30226/com.brainwavebank D/ufoEGL: Surface destroy: ANDROID_NATIVE_WINDOW_MAGIC
10-31 13:37:27.673 29607-30226/com.brainwavebank E/AndroidRuntime: FATAL EXCEPTION: GLThread 2525
                                                                   Process: com.brainwavebank, PID: 29607
                                                                   java.lang.IllegalStateException
                                                                       at android.media.MediaPlayer.prepareAsync(Native Method)
                                                                       at com.badlogic.gdx.video.VideoPlayerAndroid.play(VideoPlayerAndroid.java:175)
                                                                       at com.brainwavebank.restingstate.Screens.GameScreen.render(GameScreen.java:232)
                                                                       at com.badlogic.gdx.Game.render(Game.java:46)
                                                                       at com.brainwavebank.restingstate.Screens.GameRenderer.render(GameRenderer.java:42)
                                                                       at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:459)
                                                                       at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
                                                                       at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)

Here is the initial method creating the video:

 private void createVideo()
    {
        try
        {
            videoPlayer = VideoPlayerCreator.createVideoPlayer(videoViewPort);
            videoPlayer.play(Gdx.files.internal("restvideo.mp4"));
        }
        catch(Exception e)
        {
            Gdx.app.log("EXCEPTION", e.toString());
            videoPlayer = null;
        }
    }

Here is the check for looping the video if it is done in the batch.

if(videoPlayer != null)
        {
            videoViewPort.apply();

            if(videoPlayer.isBuffered()) {
                if (!videoPlayer.render()) {
                    try {
                        videoPlayer.play(Gdx.files.internal("restvideo.mp4"));
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

Not sure if this is a bug or me doing it wrong, anyone?

[Question] Will it be possible to create demo videos of libgdx projects using this extension?

It will be great not to grab the screenshots manually and then convert them using third-party tools to video. If possible it will be very useful to create such videos using this extension with pretty interface, and awesome if it will be possible to collect audio at the same time, at least on desktop :)

So the question is - is it possible? I mean not now, but is it possible for implementation in general? May be you already have some plans about it?

And of course thanks for a great work 👍

FileNotFoundException on Android

I have a following snippet in Scala which works on desktop, but fails on Android 4.1 (Genymotion emulator):

val videoFile = Gdx.files.internal("vid/a.ogg")
println("video file exists: " + videoFile.exists())
video = VideoPlayerCreator.createVideoPlayer()
video.play(videoFile)

Log from failure (it doesn't crash the app, just skips playing the video):

  12-06 07:47:39.993    2124-2138/xxx.android I/System.out﹕ video file exists: true
  12-06 07:47:39.997    2124-2138/xxx.android W/System.err﹕ java.io.FileNotFoundException: a.ogg
  12-06 07:47:39.997    2124-2138/xxx.android W/System.err﹕ at android.content.res.AssetManager.openAssetFd(Native Method)
  12-06 07:47:39.997    2124-2138/xxx.android W/System.err﹕ at android.content.res.AssetManager.openFd(AssetManager.java:331)
  12-06 07:47:39.997    2124-2138/xxx.android W/System.err﹕ at com.badlogic.gdx.video.VideoPlayerAndroid.a(Unknown Source)
  12-06 07:47:39.997    2124-2138/xxx.android W/System.err﹕ at xxx.a.a.a(Unknown Source)
  12-06 07:47:39.997    2124-2138/xxx.android W/System.err﹕ at com.badlogic.gdx.backends.android.h.onSurfaceChanged(Unknown Source)
  12-06 07:47:39.997    2124-2138/xxx.android W/System.err﹕ at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505)
  12-06 07:47:39.997    2124-2138/xxx.android W/System.err﹕ at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Notice the video file exists: true followed by java.io.FileNotFoundException: a.ogg, I'm very confused 😕.

Could this be related?

12-06 07:47:39.961      123-123/? E/WVMExtractor﹕ Failed to open libwvm.so

Any help would be appreciated.

no uniform with name 'camTransform' in shader

Hello, everything works on my SG4 Mini as expected.
If i try to play the video on nVIDIA Shield this error happens:

04-02 15:30:40.469: E/AndroidRuntime(25994): java.lang.IllegalArgumentException: no uniform with name 'camTransform' in shader
04-02 15:30:40.469: E/AndroidRuntime(25994): at com.badlogic.gdx.graphics.glutils.ShaderProgram.fetchUniformLocation(ShaderProgram.java:292)
04-02 15:30:40.469: E/AndroidRuntime(25994): at com.badlogic.gdx.graphics.glutils.ShaderProgram.fetchUniformLocation(ShaderProgram.java:282)
04-02 15:30:40.469: E/AndroidRuntime(25994): at com.badlogic.gdx.graphics.glutils.ShaderProgram.setUniformMatrix(ShaderProgram.java:548)
04-02 15:30:40.469: E/AndroidRuntime(25994): at com.badlogic.gdx.graphics.glutils.ShaderProgram.setUniformMatrix(ShaderProgram.java:536)
04-02 15:30:40.469: E/AndroidRuntime(25994): at sk.maniacs.beatmania.common.VideoPlayerAndroid.render(VideoPlayerAndroid.java:277)
04-02 15:30:40.469: E/AndroidRuntime(25994): at sk.maniacs.beatmania.screens.GameScreenSM.render(GameScreenSM.java:300)
04-02 15:30:40.469: E/AndroidRuntime(25994): at sk.maniacs.beatmania.BeatManiaGame.render(BeatManiaGame.java:648)
04-02 15:30:40.469: E/AndroidRuntime(25994): at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:416)
04-02 15:30:40.469: E/AndroidRuntime(25994): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
04-02 15:30:40.469: E/AndroidRuntime(25994): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Any clues why?

Native Crash in VideoDecoder destructor

Hi,

i stumbled upon a nasty bug that happens quite often when calling VideoPlayer.dispose() (or VideoPlayer.stop()), on desktop (Mac). I traced the error down to the VideoDecoder destructor where it seems like something is deallocated a second time or was never allocated (pointer being freed was not allocated, see crash report below). I couldn't debug any further because I wasn't able to (re)compile the native libs. I am using the prebuilt ones you offered in another issue.

Here's the crash report:

[snip]
System Integrity Protection: enabled

Crashed Thread:        34  Java: LWJGL Application

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000000000000c
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0xc:
--> 
    __TEXT                 0000000102795000-00000001027a7000 [   72K] r-x/rwx SM=COW  /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/bin/java

Application Specific Information:
abort() called
*** error for object 0x1044df2f0: pointer being freed was not allocated

[snip]

Thread 33 Crashed:: Java: LWJGL Application
0   libsystem_kernel.dylib        	0x00007fffa0409f06 __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff922db4ec pthread_kill + 90
2   libsystem_c.dylib             	0x00007fff8ce426df abort + 129
3   libjvm.dylib                  	0x0000000102a8536f os::abort(bool) + 25
4   libjvm.dylib                  	0x0000000102baa472 VMError::report_and_die() + 2304
5   libjvm.dylib                  	0x0000000102a86f9a JVM_handle_bsd_signal + 1131
6   libjvm.dylib                  	0x0000000102a831ff signalHandler(int, __siginfo*, void*) + 47
7   libsystem_platform.dylib      	0x00007fff8d2a452a _sigtramp + 26
8   ???                           	0x00007f87c0f1d790 0 + 140221034387344
9   libgdx-video-desktop64.dylib  	0x000000012ec95bbf VideoDecoder::~VideoDecoder() + 15
10  ???                           	0x00000001035b6c64 0 + 4351290468
11  ???                           	0x000000010359f33d 0 + 4351193917
12  ???                           	0x000000010359f33d 0 + 4351193917
13  ???                           	0x000000010359f33d 0 + 4351193917
14  ???                           	0x000000010359f382 0 + 4351193986
15  ???                           	0x000000010359f0c0 0 + 4351193280
16  ???                           	0x000000010359f0c0 0 + 4351193280
17  ???                           	0x000000010359f0c0 0 + 4351193280
18  ???                           	0x000000010359f33d 0 + 4351193917
19  ???                           	0x0000000103e17da4 0 + 4360076708
20  ???                           	0x000000010445e21c 0 + 4366656028

Any idea?

gdx-jnigen transitivity

I'm trying to implement this into my existing project via a tool to test it and I'm having issues where gdx-jnigen must be manually added as a dependency due to the use of JniGenSharedLibraryLoader at com.badlogic.gdx.video.FfMpeg.loadLibraries(FfMpeg.java:49). I've noticed that it was explicitly excluded as a transitive dependency, however it's included in with extensions such as gdx-box2d which also use native libraries.

https://github.com/libgdx/gdx-video/blob/master/gdx-video-desktop/src/com/badlogic/gdx/video/FfMpeg.java#L47-L52

In the meantime, I've just added it to my dependencies

implementation "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion"

Stack trace

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: com/badlogic/gdx/jnigen/JniGenSharedLibraryLoader
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:134)
Caused by: java.lang.NoClassDefFoundError: com/badlogic/gdx/jnigen/JniGenSharedLibraryLoader
        at com.badlogic.gdx.video.FfMpeg.loadLibraries(FfMpeg.java:49)
        at com.badlogic.gdx.video.CommonVideoPlayerDesktop.play(CommonVideoPlayerDesktop.java:75)
        at com.riiablo.video.VideoPlayerTool$3.run(VideoPlayerTool.java:102)

build.gradle (before adding gdx-jnigen)

dependencies {
  implementation "com.badlogicgames.gdx-video:gdx-video:1.3.2-SNAPSHOT"
  implementation "com.badlogicgames.gdx-video:gdx-video-lwjgl:1.3.2-SNAPSHOT"
}

Race condition in VideoPlayerAndroid

MediaPlayer initialization is performed on the main looper thread, but not all accesses to 'player' are correctly synchronized:

  • stop()
  • dispose()
  • isPlaying()
  • setVolume()

In addition, the done/prepared flag should be made volatile since they're also written to from the looper thread.

Why is the initialization of the MediaPlayer done on the main looper anyway? Can't you use the current thread's looper (or create it if one doesn't exist yet)?

Error running desktop player on Ubuntu 14.04

Hi. Desktop version work great on Windows, but running the same project on Ubuntu get this error:

/usr/lib/jvm/java-7-oracle/bin/java: symbol lookup error: /tmp/jnigen/4185592305/libgdx-video-desktop.so: undefined symbol: __wrap_memcpy

Exception: Could not open file!

Hi,

I have tried to play an MP4 video, but there i get this exception:

java.lang.Exception: Could not open file!
	at com.badlogic.gdx.video.VideoDecoder.loadStream(Native Method)
	at com.badlogic.gdx.video.VideoPlayerDesktop.play(VideoPlayerDesktop.java:140)
	at com.pentaquin.gameclient.gamestate.IntroScene.initialize(IntroScene.java:69)
	at com.pentaquin.gameclient.Game.initialize(Game.java:48)
	at com.pentaquin.engine.adapter.GameAdapter.create(GameAdapter.java:47)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
Exception in thread "LWJGL Application" java.lang.NullPointerException
	at com.badlogic.gdx.video.VideoPlayerDesktop.renderTexture(VideoPlayerDesktop.java:249)
	at com.badlogic.gdx.video.VideoPlayerDesktop.render(VideoPlayerDesktop.java:228)
	at com.pentaquin.gameclient.gamestate.IntroScene.draw(IntroScene.java:238)
	at com.pentaquin.engine.component.scene.SceneComponent.draw(SceneComponent.java:45)
	at com.pentaquin.engine.adapter.GameAdapter.beforeDraw(GameAdapter.java:166)
	at com.pentaquin.engine.adapter.GameAdapter.render(GameAdapter.java:58)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
[VideoPlayer::loadFile] Error opening file: Invalid data found when processing input

@robbiedobbie Which file formats are supported?

playing multiple simultaneous videos without scaling

I'm attempting to use gdx-video, with some modification, to show simultaneous videos at their true size. I've created a VideoPlayer for each video by providing an OrthographicCamera and Mesh. This construction does not work with the current VideoPlayerAndroid.java's player.setOnPreparedListener for a few reasons, but I've replaced the code with the following:

      player.setOnPreparedListener(new OnPreparedListener() {
            @Override public void onPrepared (MediaPlayer mp) {

                float w = mp.getVideoWidth();
                float h = mp.getVideoHeight();

                cam.viewportWidth = w;
                cam.viewportHeight = h;
                cam.position.set(w/2f, h/2f, 0);
                cam.update();

                mesh.setVertices(
                        new float[] {
                                0, 0, 0, 0, 1,
                                w, 0, 0, 1, 1,
                                w, h, 0, 1, 0,
                                0, h, 0, 0, 0
                        });

                 prepared = true;
                 if (sizeListener != null) {
                      sizeListener.onVideoSize(w, h);
                 }
                 mp.start();
            }
      });

I've loaded two videos -- 320x240 and 640x360 -- and they are rendered at the particular positions by calling Gdx.gl.glViewport(locX, locY, videoWidth, videoHeight) prior to rendering and then afterwards calling glViewport to set it back to the device extents.

A screenshot from a Galaxy Tab 2 7" is shown below. The correct outline of video placement is the 1px red border. I'm having trouble setting the camera and mesh so that the video is displayed in the correct proportion. Can you provide some guidance?

gdx-video

Play a video using modelInstance

I want to manage the texture using model instance as it manages the transforms and all. I figured I can achieve this if i can play it on the GLTexture instance instead of the Android Texture. But I can't figure out a way to replace android Texture with GLTexture of libGDX. Android's Media Player requires a Surface in which we can pass a SurfaceTexture but not GLTexture.

 private int[] textures = new int[1];
 GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textures[0]);
 player.setSurface(new Surface(new SurfaceTexture(textures[0])));

Any help would be appreciated

Android video playback audio works but no video

Hello,

Revisiting this extension after some inactivity and am currently trying to get mp4 video working on android. I have created a Screen that should be playing video. The problem is that the screen remains blank but the audio plays in the background.

Can you provide any guidance? Ideally I want to be able to render video on android onto a specific texture (in an Actor) so that I can put it in a stage and have other Actors rendered on top of the video.

Below is an excerpt of my Screen class:
`public VideoPlayer videoPlayer;

boolean videoLoaded = false;

@Override
public void show() {

    videoPlayer = VideoPlayerCreator.createVideoPlayer();
    videoPlayer.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    videoPlayer.setOnVideoSizeListener(new VideoPlayer.VideoSizeListener() {
        @Override
        public void onVideoSize(float v, float v2) {
            videoLoaded = true;
        }
    });

    try {
        videoPlayer.play(Gdx.files.absolute("/path/to/file.mp4"));

    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }

    Gdx.gl.glEnable(GL20.GL_CULL_FACE);
    Gdx.gl.glCullFace(GL20.GL_BACK);

}

@Override
public void render(float delta) {

    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if(videoLoaded) {
        if (!videoPlayer.render()) { // As soon as the video is finished, we start the file again using the same player.
            try {
                videoLoaded = false;
                videoPlayer.play(Gdx.files.absolute("/path/to/file.mp4"));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
    }

}`

NPE when playing ogg video without audio

Exception in thread "LWJGL Application" java.lang.NullPointerException
    at com.badlogic.gdx.video.RawMusic.read(RawMusic.java:46)
    at com.badlogic.gdx.backends.lwjgl.audio.OpenALMusic.fill(OpenALMusic.java:240)
    at com.badlogic.gdx.backends.lwjgl.audio.OpenALMusic.play(OpenALMusic.java:85)
    at com.badlogic.gdx.video.VideoPlayerDesktop.render(VideoPlayerDesktop.java:205)
    at ...

[VideoPlayer::loadFile] Could not find audio stream!

iOS support

I was wondering if there is any chance of iOS support (or maybe someone can point me towards a iOS/robovm solution).

Getting MP4 files to work on windows/linux

Hello,

So after some elbow grease I was able to get this library incorporated into my project and is happy to see that I can play OGV files on windows and MP4 on android. I am currently trying to make an app that will need to be able to play MP4 files on android, windows, and linux.

I have tried and failed to get MP4 files to play on Windows so either I am doing something wrong or MP4 is currently not supported. If that is the case how do I go about getting this library to play MP4 files on windows/linux?

Regards,

N

Write out video files

Hello everyone.
Is it possible to write video files with this? Not recording, just load/save (eventually, trimming)

Thanks.

trouble getting started using gdx-video for Android with Android Studio

I am new to Java/Android development. Using Android Studio 1.5.1. I've built gdx-video and gdx-video-android to two jar files using jdk1.8.0_66\bin\jar.exe cfv filename.jar *. I added the two files to a libs folder just under my libgdx project (at the same level as core and android folders). In my project's build.gradle I added these lines to both the core and android dependencies blocks:

compile fileTree(dir: '../libs', include: '*.jar')

then resync'd gradle and added the following inside the ApplicationAdapter's create():

    videoPlayer = VideoPlayerCreator.createVideoPlayer();
    videoPlayer.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    videoPlayer.setOnVideoSizeListener(new VideoPlayer.VideoSizeListener() {
        @Override
        public void onVideoSize(float v, float v2) {
            videoLoaded = true;
        }
    });

Android Studio asks to import the unknown class com.badlogic.gdx.video.VideoPlayer, I respond with Alt+Enter and it prompts again for the same import. If I add com.bad.logic.gdx.video.VideoPlayer manually, .video is not recognized.

What step am I missing? Thank you.

Screen flickers to black if you loop a video

I have a loopable video that I am looping by doing this in the render loop (Android):

Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
 if (videoPlayer != null) {
            if (!videoPlayer.render()) {
                try {
                    videoPlayer.play(movieFile);
                } catch (FileNotFoundException e) {
                    videoPlayer = null;
                    Gdx.app.log("EXCEPTION", "Could not loop video", e);
                }
            }
        }

Whenever the video is done playing, it will flicker once to black before it resumes playing. Currently I remove the glClear to make it less visible, but this is not really an approach I'd like to keep in the future.

Anyone have any suggestions or is this a limitation in the android mediaplayer?

Android Playback Issue

After trying various formats, gdx-video seems to work perfectly on desktop. On Android, the video plays just fine, but whenever the video begins playback, it is consistently about 5 seconds into the video, thus causing the first few seconds of the video to be omitted. I've tried using some different formats, just in case it was just .webm videos, but encoding in other formats produces the same or worse results.(Black screen with....ogv on Android, I believe. I'll just stick to .webm) Whenever I playback the same video in Android's Media Player, it works just fine. One solution would be to add a delay at the beginning of each video, but that isn't very elegant. I tried poking around the code to see if there is something that I can call to reset the video once it is loaded, but that hasn't gotten me anywhere. lol I My current game focuses on audio-video sync, so this harms the experience on Android. Any clues as to why it starts so far into the video?

Support VP8 and WebM on desktop

It would be nice to have one format of video which could be used on desktop and Android (after all e.g. tablets and desktops are closing fast). From what I read FFmpeg library can be compiled with VP8 and WebM support (unfortunately I have no clue how to do that).

gdx video with lwjgl3

I'm trying to use this library for my libgdx project and I think it works fine with the compiled library but I get the error "com.badlogic.gdx.backends.lwjgl3.audio.OpenALAudio cannot be cast to com.badlogic.gdx.backends.lwjgl.audio.OpenALAudio" because I'm using lwjgl3 and RawMusic uses lwjgl, could you please send me a compiled library for lwjgl3? because I tried to built it and i get java.lang.NoClassDefFoundError when I try to use it

Cant download gdx-video-desktop-natives.jar

Hello, i tried the maven build but i can't download the gdx-video-desktop-natives.jar
I can't find it in any of my repos including the one mentioned in read.me

Could you help?

Shader is null when using custom mesh in VideoPlayerAndroid.java

When you try to create a video player using a custom mesh you get a NullPointerException: Attempt to invoke virtual method 'void com.badlogic.gdx.graphics.glutils.ShaderProgram.begin()' on a null object reference. When I opened up VideoPlayerAndroid.java I noticed shader is never instantiated in the third constructor:

`
public VideoPlayerAndroid () {
this(new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
}

 public VideoPlayerAndroid (Viewport viewport) {
	  shader = new ShaderProgram(vertexShaderCode, fragmentShaderCode);
	  setupRenderTexture();

	  this.viewport = viewport;
	  cam = viewport.getCamera();
	  mesh = new Mesh(true, 4, 6, VertexAttribute.Position(), VertexAttribute.TexCoords(0));
	  //@formatter:off
	  mesh.setVertices(new float[] {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0});
	  //@formatter:on
	  mesh.setIndices(new short[] {0, 1, 2, 2, 3, 0});
 }

 public VideoPlayerAndroid (Camera cam, Mesh mesh, int primitiveType) {
	  this.cam = cam;
	  this.mesh = mesh;
	  this.primitiveType = primitiveType;
	  customMesh = true;
	  setupRenderTexture();
 }

`

Errors such as java.lang.UnsatisfiedLinkError

I apologize for my lack of experience, but can you create a video or a written tutorial about how to get this working? I tried to get this working, but I was just taking shots in the dark and ended up asking others in #libgdx on freenode and, after a few pointers, I was able to get rid of the "NoClassDefFoundError", but now i get this error. I don't know if the error is in the code that I am using(I am using your sample code) or in the .jar files that I added to the build path. It doesn't help that no one has ever tried using this.

The error: http://pastebin.com/T9RnjV5r
The code that I'm using: http://pastebin.com/MjxttDTN

Rendering Video Texture on 3D Plane

Hello,

I wanted to render video texture on 3d plane. I tried doing for 3D for the modelbatch using the 2D example provided in the library, however, I got the GL thread error.

I would be grateful if someone can help me with this.

Thanks :)

Setting up gdx-video?

Can anyone give me a hint how to set up this library?
I try many times and still not work.
I set the "Gradle dependency declarations" as readme said in build.gradle but still not working.

Starting VideoPlayer from libgdx render thread

Hello,
i use the VideoPlayer in a Screen.
I do vPlayer = VideoPlayerCreator.createVideoPlayer();
vPlayer.play(...)

in the initialize method (method which is called before the screen switch)

If i do this - no events are called..
I figured out that this is due to the fact that there is no Looper on LibGdx render thread.

So i added a handler to initialize and start the player.
But the rendering then crashes on vPlayer.render() because there is a different GL context on textures for the mediaplayer.

I also try to call Looper.prepare() on the render thread but i get error that only one looper can exist.

Can you please suggest how can i create a working video player on a render thread of LibGDX game/screen?

Thanx

jnigenBuild cant find -<library>

Im trying to build gdx-video with mp4 support for a project and when i execute jnigenBuild i get this error:

 [exec] '/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/jni/target/linux32/VideoDecoder.o'
 [exec] '/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/jni/target/linux32/com_badlogic_gdx_video_FfMpeg.o'
 [exec] '/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/jni/target/linux32/com_badlogic_gdx_video_VideoDecoder.o'
 [exec] '/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/jni/target/linux32/memcpy_wrap.o'
 [exec] '-lavformat'
 [exec] '-lavcodec'
 [exec] '-lavutil'
 [exec] '-lswscale'
 [exec] '-lswresample'
 [exec] '-lpthread'
 [exec] '-L/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/FFmpeg/build-linux32/libavcodec'
 [exec] '-L/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/FFmpeg/build-linux32/libavformat'
 [exec] '-L/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/FFmpeg/build-linux32/libavutil'
 [exec] '-L/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/FFmpeg/build-linux32/libswscale'
 [exec] '-L/home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/FFmpeg/build-linux32/libswresample'
 [exec] 
 [exec] The ' characters around the executable and arguments are
 [exec] not part of the command.
 [exec] /usr/bin/ld: cannot find -lavformat
 [exec] /usr/bin/ld: cannot find -lavcodec
 [exec] /usr/bin/ld: cannot find -lavutil
 [exec] /usr/bin/ld: cannot find -lswscale
 [exec] /usr/bin/ld: cannot find -lswresample
 [exec] collect2: error: ld returned 1 exit status

   BUILD FAILED
   /home/roiniti/Escritorio/ffmpg/gdx-video-master/gdx-video-desktop/jni/build-linux32.xml:160: exec returned: 1
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:645)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:497)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
    at org.apache.tools.ant.Task.perform(Task.java:350)
    at org.apache.tools.ant.Target.execute(Target.java:449)
    at org.apache.tools.ant.Target.performTasks(Target.java:470)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.Main.runBuild(Main.java:834)
    at org.apache.tools.ant.Main.startAnt(Main.java:223)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

Im executing at the shell "./gradlew jnigenBuild" on debian

Minimum SDK supported?

I couldn't find anywhere what the minimum device API this library supports? I am only asking since I'm having some issues with playback on lower API emulators, but it seems work on actual devices.

Gradle / Maven Coordinates

With gradle i get the following build error:

Could not find com.badlogicgames.gdxvideo:gdx-video:0.0.1.
Searched in the following locations:
    https://repo1.maven.org/maven2/com/badlogicgames/gdxvideo/gdx-video/0.0.1/gdx-video-0.0.1.pom
    https://repo1.maven.org/maven2/com/badlogicgames/gdxvideo/gdx-video/0.0.1/gdx-video-0.0.1.jar

Why this JARs arent available in Maven Central anymore?

Video playback issues on Windows

Hello,

Setup: I was able to recompile the native libraries for desktop with support for mp4. The device I was testing on was a mini PC (Windows 10, Intel Atom Cherry Trail X5 z8300, 2GB RAM). The Libgdx project is just a desktop project that just plays a video upon starting up.

Issue: As far as I can tell, video playback is fine with some videos and just freezes with others.

Additional information: I went and enabled debugging in the videodecoder.cpp and noticed that the issue seems to occur when the number of buffer frames drops to zero (assuming that the buffer index caught up to the buffered frames). In nextVideoFrame(), I noticed that its locking but not unlocking when the number of buffered frames is less than 1 (not sure if this is intentional since the following issue occurs after unlocking). After adding in an unlock before returning, I don't hit the freezing issue anymore but then the video starts skipping back and forth in between frames. (Seemingly jumping back a couple of frames?)

I'm still trying to figure out how everything works so I'm might be doing something completely wrong. Please let me know if you have any idea on what's happening or any suggestions/advice to address this issue.

Thanks!

Issues with Android project? Build Path Issues?

Sorry to bother you again. While the desktop project worked just fine, the Android project is giving me issues. As stated in the previous issue, I compiled the .jars in Mac OS X 10.10.2. I then switched over to Windows, and was able to get the desktop project working with jars created in Mac. However, whenever I tried adding "gdx-video-android.jar" to my Android project, it resulted in the error "Conversion to Dalvik format failed with error 1". I assumed that the problem could be due to the fact that they were compiled on a different operating system, so I recompiled "gdx-video-android" in Windows.(Although, there were some errors upon importing, Syntax errors, fixed by changing java compliance to 1.5, and issues like "The method isBuffered() of type VideoPlayerAndroid must override a superclass method") Eclipse recommends getting rid of the @OverRide annotations. Not sure why these errors were only present when I import it into Eclipse in Windows. I ignored these errors(didn't wan't to alter the classes) and compiled anyway. While adding the newly generated jar file doesn't result in the "conversion to dalvik" issue, it results in this error(http://pastebin.com/KKAnEwjs). Assuming this problem stems from the errors when importing in Windows, could you provide your compiled gdx-video-android.jar(that has worked in the past, of course)? Is this jar the only .jar that I need to add to the build path of the android project?

Framerate issues on Desktop (mp4 video)

Hello,

I am currently experiencing framerate issues when playing mp4 videos on desktop. At first I thought it was a decoding speed issue but when i commented out the line
showAlreadyDecodedFrame = true;
At the bottom of the render function in VideoPlayerDesktop and then play the video then the video renders very smoothly (albeit at fast forward pace of 60 ish frames per second).

I understand that the variable showAlreadyDecodedFrame is being used to try to play the videos at the framerate they should be at (25 fps or whatever) my syncing the video play time via frame timestamp and the application play time but it seems I am just getting jerky video. Is there any code tweak recommendations you can make regarding this to make the playback timing sync smoother?

Regards,

N

java.lang.UnsatisfiedLinkError

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.video.FfMpeg.register()V
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:131)
Caused by: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.video.FfMpeg.register()V
	at com.badlogic.gdx.video.FfMpeg.register(Native Method)
	at com.badlogic.gdx.video.FfMpeg.loadLibraries(FfMpeg.java:78)
	at com.badlogic.gdx.video.VideoPlayerDesktop.play(VideoPlayerDesktop.java:130)

OS: Ubuntu 16.04 LTS amd64 (need cross-platform solution)

Can anybody help?

PS: Issue#2 already tried.

Video/audio out of sync on some platforms

Hi,

When playing a video in a Windows VM running on a Mac, everything is fine and video and audio are in sync. On the same machine, not in a VM (so on native MacOS), audio is about one second ahead, breaking lipsync. This also happens on other native Windows machines I tried. The only difference is that the machines where it does not work have a lot more computing power than the VM where it works. Could it be that modern machines introduce a sync issue due to their speed?

I added some debug statements and audio.play() is called less than 10ms before the first frame renders, so it seems they start correctly at about the same moment. I suspect video is playing too slow then and audio runs ahead (audio does sound normal, not too fast).

Is this a known issue?

Thanks for any help.

ffmpeg codec arguments

Maybe this is outside the scope of this project, but I was wondering if I can customize the parameters of ffmpeg and get a stream decoded from a specific codec into a format that LibGDX can handle. When passing in the raw file, I'm seeing [VideoPlayer::loadFile] Error opening file: Invalid data found when processing input, however vlc can play the file fine, and once I convert the file using -c:v vp8 -c:a libvorbis to a webm video like the test video, it works alright.

image

Android - Failed to Resolve

Hello,

Hope your day is going well. I was trying to add the gdx-video library to the Gradle build file, however, I am getting the error message - Failed to resolve: com.badlogicgames.gdxvideo:gdx-video-android:1.9.12.

I would be grateful if someone can help me with this.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.