Reputation: 651
I have this code :
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String url = "http://people.sc.fsu.edu/~jburkardt/data/mp4/cavity_flow_movie.mp4";
videoPlayer(url);
}
public void videoPlayer(String url){
getWindow().setFormat(PixelFormat.TRANSLUCENT);
VideoView videoHolder = (VideoView) findViewById(R.id.videoView1);
videoHolder.setMediaController(new MediaController(this));
videoHolder.setVideoPath(url);
videoHolder.requestFocus();
videoHolder.start();
}
If's work fine but, if the url is http://www.tuoregalo.com/video2.avi it not work....why ? The error message is "Impossibile to visual the video"
Upvotes: 0
Views: 948
Reputation: 3001
I have also faced this problem it works when the file on the url is of mp4 type but as you try one avi file it doesent work because all off android phones including simulator dosent support avi format nativily avi format works fine with iPhone but not with android your code is absolutly fine.
you can play avi in android by converting it to android please check this http://www.snowfoxsoft.com/tutorial/how-to-convert-avi-to-android-phone.html
see some limitations
Since its introduction in the early 90s, new computer video techniques have been introduced which the original AVI specification did not anticipate:
AVI does not provide a standardized way to encode aspect ratio information, with the result that players cannot select the right one automatically (though it may be possible to do so manually).[2] There are several competing approaches to including a time code in AVI files, which affects usability of the format in film and television post-production, although it is widely used. For WAV audio files, Broadcast Wave extensions were designed to standardize post-production metadata, but an equivalent for AVI files has not emerged. AVI is not intended to contain variable frame rate material. Workarounds for this limitation increase overhead dramatically. AVI was not intended to contain video using any compression technique which requires access to future video frame data beyond the current frame. Approaches exist to support modern video compression techniques (such as MPEG-4) which rely on this function, although this is beyond the intent of the original specification and may cause problems with playback software which does not anticipate this use. AVI cannot contain some specific types of variable bitrate (VBR) data reliably (such as MP3 audio at sample rates below 32 kHz). Overhead for AVI files at the resolutions and frame rates normally used to encode standard definition feature films is about 5 MB per hour of video, the significance of which varies with the application. More recent container formats (such as Matroska, Ogg and MP4) solve all these problems, although software is freely available to both create and correctly replay AVI files which use these more recent techniques.
Upvotes: 1