i am developing for android 1.5 and debugging on my HTC hero. does
anybody have an example of playing video using javascript. I am unable
to use video tags since eclipse won't launch my app cause the video
tag not recognized. I've tried :
navigator.media.startPlaying("file:///sdcard/1206/test.mp4", 1,
function(){}, function(){});
navigator.media.startPlaying("1206/test.mp4", 1, function(){},
function(){});
i've also tried to append the video tag after load but it causes app
to crash. What am i doing wrong?
Thanks in advance, ejder
i've tried this too with no success.
private void bindBrowser(WebView appView)
{
gap = new PhoneGap(this, appView);
geo = new GeoBroker(appView, this);
accel = new AccelListener(this, appView);
//i put this to add the capability but i will have to write my own
functions to create a surface, play the video on it, delete surface
and focus back to the webview
media = new AudioHandler("record.mp3", this);
launcher = new CameraLauncher(appView, this);
// This creates the new javascript interfaces for PhoneGap
appView.addJavascriptInterface(gap, "DroidGap");
appView.addJavascriptInterface(geo, "Geo");
appView.addJavascriptInterface(accel, "Accel");
//added
appView.addJavascriptInterface(media, "Media");
appView.addJavascriptInterface(launcher, "GapCam");
}
Now the question is, will my webview keep running while i watch the
video and will i have access to the phonegap javascript functions
after focusing back to the web view. We will see.
VideoLauncher doesn't do anything but calling a function of gap and
has the same structure as GeoListener etc..
second, i've created a VideoHandler class which is similar to
camerapreview class. gap.startVideo calls this class so the function's
direction is javascript->videolauncher->droidgap and finally oncreate
event of videohandler class.
This class creates a surface view, mediaplayer, mediacontroller and
supposed create a surface and insert in the main view. But somehow,
the application just crashes when i add this functionality. I've
followed exactly same way as the camerapreview and cameralauncher
classes and edited the droidgap class as needed. I was able to call
the videohandler's play function but at that point, the application
crashes.(on onsurfacecreated event actually). Any idea?