Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binding video events #2

Open
jake3030 opened this issue Dec 4, 2012 · 4 comments
Open

binding video events #2

jake3030 opened this issue Dec 4, 2012 · 4 comments

Comments

@jake3030
Copy link

jake3030 commented Dec 4, 2012

Hi Simon,

How do you bind to events from the media player? If I wanted to find out when the video was finished or started or in the middle of playback, how would I capture those events?

In the logcat i can see that those events are there, but I'm having some trouble intercepting them.

Thanks

Jake

@macdonst
Copy link
Owner

macdonst commented Dec 4, 2012

I didn't build in any support for it. The way the plugin works is by starting a new intent so in actual fact you are in a separate app playing the video. Not quite sure how one would capture these events without pulling the video player into the current app and that'd be a bit of a pain to have to re-write the video player component that the OS provides.

@jake3030
Copy link
Author

jake3030 commented Dec 4, 2012

ya, i am trying to do that now and it's not going so well.

here is what i am trying right now:

private void playVideo2(String url) throws IOException {
        // Create URI
        // Create a new media player and set the listeners
        DroidGap currentCtx = (DroidGap) this.cordova.getContext();
        VideoView vd = currentCtx.getVideoView();
        Uri uri = Uri.parse(url);
        MediaController mc = new MediaController(this.cordova.getActivity());
        vd.setMediaController(mc);
        vd.setVideoURI(uri);
        vd.start();
    }

VideoView needs to access R and I wasnt able to access that through the plugin so I am trying to go through the app class. I know it's seriously bad programming, but I just want to get the events to work for this app. Im not planning to release this back unless I can clean it up. Do you know of a way to access the R variable inside of a plugin?

--jake

@macdonst
Copy link
Owner

macdonst commented Dec 4, 2012

The problem with trying to access R is that R is from a different package in each application. What do you need R for?

@jake3030
Copy link
Author

jake3030 commented Dec 4, 2012

the videoview needs it according to the examples i am finding.

I had another idea. Could we use Broadcastreceiver to intercept the mediaplayer events from the intent?

--jake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants