Playback method

public void play(String address){ Uri path = Uri.parse(address); videoView.setVideoURI(path); videoView.setMediaController(new MediaController(getContext())); videoView.setOnCompletionListener(myVideoViewCompletionListener); videoView.setOnPreparedListener(MyVideoViewPreparedListener); videoView.setOnErrorListener(myVideoViewErrorListener); videoView.requestFocus(); videoView.start(); } 

Calling

  @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view=inflater.inflate(R.layout.fragment_video_stream, container, false); ButterKnife.bind(this,view); getGetFragmentComponent().inject(this); videoStreamPresenter.attachView(this); videoView = (VideoView) view.findViewById(R.id.video_view); play("https://ia800900.us.archive.org/24/items/TomThum_2013X/TomThum_2013X.mp4"); return view; } 
  • and? What's happening? Sorry, but psychics just yesterday went on vacation. What codec is used in the video? What version of Android? - Vladyslav Matviienko
  • Nothing happens. On all versions of android - kalugin1912
  • one
    Какой кодек используется в видео? - Vladyslav Matviienko
  • And you really checked on all versions? Maybe even on all devices? - Vladyslav Matviienko

1 answer 1

Information about the codec of your video obtained with ffprobe :

 [STREAM] index=0 codec_name=h264 codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 profile=Main codec_type=video codec_time_base=1/50 codec_tag_string=avc1 codec_tag=0x31637661 width=854 height=480 coded_width=854 coded_height=480 has_b_frames=1 sample_aspect_ratio=1280:1281 display_aspect_ratio=16:9 pix_fmt=yuv420p level=31 color_range=N/A color_space=unknown color_transfer=unknown color_primaries=unknown chroma_location=left timecode=N/A refs=1 is_avc=true nal_length_size=4 id=N/A r_frame_rate=25/1 avg_frame_rate=25/1 time_base=1/25 start_pts=0 start_time=0.000000 duration_ts=17533 duration=701.320000 bit_rate=856730 max_bit_rate=N/A bits_per_raw_sample=8 nb_frames=17533 nb_read_frames=N/A nb_read_packets=N/A DISPOSITION:default=1 DISPOSITION:dub=0 DISPOSITION:original=0 DISPOSITION:comment=0 DISPOSITION:lyrics=0 DISPOSITION:karaoke=0 DISPOSITION:forced=0 DISPOSITION:hearing_impaired=0 DISPOSITION:visual_impaired=0 DISPOSITION:clean_effects=0 DISPOSITION:attached_pic=0 TAG:creation_time=2013-03-14 19:23:12 TAG:language=und TAG:handler_name=VideoHandler [/STREAM] 

If you look in the official documentation on supported media formats , you can see what is supported

H.264 AVC Baseline Profile (BP)

And your video is encoded with

H.264 AVC Main Profile

That is why it is not required to be played on any Android device. On some it is possible and will be, but this is only due to the fact that the manufacturer added this codec to the firmware himself.
In order for the video to play, you will have to recode it into one of the supported formats.