Phonegap Android Webview Video plays audio only

Today I started playing with the phone. When I tried to capture the video, it worked perfectly. Now I want to show the captured video in a web view. so I tried as shown below.

var captureSuccess = function(mediaFiles) {
    var i, path, len;
    for (i = 0, len = mediaFiles.length; i < len; i += 1) {
        path = mediaFiles[i].fullPath;
        videoString = "<video width='320' height='240' controls='controls'><source src="+path+" type='video/mp4' /> <source src="+path+" type='video/ogg' />   <source src="+path+" type='video/webm' />Your browser does not support the video tag.</video>";
        $('#myVideo').html(videoString);
    }


};

// capture error callback
var captureError = function(error) {
    navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
};

// start video capture
function takeVideo(){
    navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1});
}

but in the user interface I see that the player is being added, but it only plays audio, not video. WOT could be the problem. ??

Any help is appreciated and thanks for your time in advance.

+5
source share
1 answer

you have two source tags for the video, this may be a problem, since two different types are indicated there.

<source src="+path+" type='video/mp4' />
<source src="+path+" type='video/webm' />

try deleting one of them.

0
source

All Articles