Video on Android

Anyone has any idea how to play a local (embedded into app) video on Android?

Thanks in advance.

1 Like

Hey guys, seems im lost !

WebBrowserComponent is not even implemented, anyone has any idea?

Ok, stuff i tried:

File::getSpecialLocation and friends <- fail miserably (even just trying to acces it fails)

file:///android_asset/ <-WebBrowserComponent is not even coded yet

So i think I now need help onto how do i mix a pure Java View with Juce Stuff…

I mean cmon Google its just a video…!!

Cheers and thanks in advance, any help will be appreciated.

Carlos

Yes, sorry - this is stuff that’s in our backlog but just hasn’t made it into reality yet. There will be a java android view that we can embed, just need to write the code to do it…

Hi Jules, any update on this?

I really need to finish some app this week, can you point me at where to start or something?

Cheers J

Oh, it’s not very straightforward - would need all kinds of hackery to be done to load whatever Android’s video view object is… There’s no easy starting point I could point you at, other than copying how the openGL window embedding is done.

1 Like

damn, yeah i don’t do much Java, can i buy you guys a beer or something to get this VideoView /WebBrowsercomponent working in the next 2 weeks?

its funny cause im controlling lights, sound, and other cool stuff with juce, but i can’t play a video on Android :cry:

you can do it Jules !! You’re the grandmaster funkazoid!! please please please x1000

We’re all busy on juce 5 features stuff for the next few weeks, I’m afraid! If it was a task that someone could do in a couple of hours then I’d offer to squeeze it in, but it’s not quite that easy…

you just broke my heart, we may lose a project we are bidding cause of this

:cry: :cry: :cry: :cry: :cry: :cry:

That’s bad timing - Fabian has been building a bunch of clever java wrapper generation code to make it easier for us to quickly add stuff like this, but it’s not ready yet!

2 Likes

I know, Its just that it will be awesome if we could complete this, we’ve built this great app for In Store Marketing for Philips Hue Lights, if we win this the app will run in thousands of stores all over the U.S. and the freaking thing now works! it controls any number of lights, its fast awesome, all juce…

its just missing a demo video that client specified, and since they already have a thousand of those android tablets, its not cost feasible to substitute them for ios devices (which does feature the WBComponent)

Im praying to God that it illuminates my dear British friends…JulesNCo®

cheers J

Hey, poking around i got this awesome tip from Navira:

i will try it later when i get home, but hope this helps Fabian and friends to accomplish some JavaC++Magic

Cheers guys! :slight_smile:

Why don’t you add your JUCE app as a view within an Android app. That way you can then add any custom Android component you need. Use JNI to send messages back and forth. See https://github.com/adamski/juce-native-navigation for an example.

Yay! I got it done in 2 hours!
Thanks Navira!

–Will be awesome if all this wont get overwritten in the next PaidJucer save…

Cheers!!!

App.java

public final void playDemoVideoFullscreen ()
    {
        Uri videoUri = Uri.parse("android.resource://"+getPackageName()+"/raw/video_fullscreen");

        final VideoView videoHolder = new VideoView(this);
        videoHolder.setVideoURI(videoUri);

        videoHolder.setMinimumWidth(1200);
        videoHolder.setMinimumHeight(750);

        setContentView(videoHolder);

        videoHolder.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
        {
            @Override
            public void onPrepared(MediaPlayer mp)
            {
                mp.setLooping(true);
            }
        });

        videoHolder.setOnTouchListener(new View.OnTouchListener()
        {
            @Override
            public boolean onTouch(View v, MotionEvent event)
            {
                videoHolder.stopPlayback();
                setContentView(viewHolder);
                return true;

            }
        });

        videoHolder.start();
    }

JNI_helpers:
METHOD(playDemoVideoInScreen, "playDemoVideoInScreen", "()V") \

NativeMessageBox.h:

static void JUCE_CALLTYPE playDemoVideoInScreen ();

juce_android_Windowing.cpp

    void JUCE_CALLTYPE NativeMessageBox::playDemoVideoFullscreen ()
{
    android.activity.callVoidMethod (JuceAppActivity.playDemoVideoFullscreen);
}
3 Likes