Video in Android WebView, setDownloadListener not working?

1,334 views
Skip to first unread message

hdezela

unread,
Mar 31, 2011, 1:47:33 PM3/31/11
to phonegap
Here is my App.java:

package com.phonegap.orbem;

import android.content.pm.ActivityInfo;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.webkit.DownloadListener;

import com.phonegap.*;

public class App extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
super.loadUrl("file:///android_asset/www/index.html");
appView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent, String
contentDisposition, String mimeType, long size) {
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "video/mp4");
try { startActivity(intent); }
catch (ActivityNotFoundException ex) { Log.w("VideoError: ",
"Couldn't find activity to view mimetype: " + mimeType); }
}
});
}
}

It works for RTMP, it goes straight to the video player, but when I
tray to play a video over HTTP...it goes to the browser...is my code
wrong or should ALL video be served through RTMP even if it is a
static file?

phoneydev

unread,
Apr 25, 2011, 11:25:56 AM4/25/11
to phonegap
> It works for RTMP, it goes straight to thevideoplayer, but when I
> tray to play avideoover HTTP...it goes to the browser...is my code
> wrong or should ALLvideobe served through RTMP even if it is a
> static file?

I have the same problem. Did you ever get a fix for this? When I click
the link, it loads the video through the browser instead of playing it
directly.

Simon MacDonald

unread,
Apr 25, 2011, 11:41:08 PM4/25/11
to phon...@googlegroups.com
I've seen a number of people having problems with video in the past couple of days.  Can someone open up an issue on github?


Simon Mac Donald
http://hi.im/simonmacdonald



--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com

Reply all
Reply to author
Forward
0 new messages