Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

play local video not work #831

Closed
zhouzhiqiangzzq opened this issue Dec 21, 2015 · 5 comments
Closed

play local video not work #831

zhouzhiqiangzzq opened this issue Dec 21, 2015 · 5 comments
Labels

Comments

@zhouzhiqiangzzq
Copy link

I use Glide load a local video ,but the video not play. my code as below:

String videoPath ="/storage/emulated/0/k/kw.mp4";
Glide.with(MainActivity.this).load(Uri.fromFile(new File(videoPath))).into(mImg);

mImg just an ImageView

where is the mistake, any one any tips?

@TWiStErRob
Copy link
Collaborator

As far as I know Glide is for images (including anim GIF), but doesn't support playing videos. You can get thumbs, but no more. @sjudd is this correct?

Check http://code.tutsplus.com/tutorials/streaming-video-in-android-apps--cms-19888 on how to play videos.

@sjudd
Copy link
Collaborator

sjudd commented Dec 22, 2015

That's correct, we do not support playing videos. Unfortunately playing videos on Android is enormously complex and must remain out of scope for Glide.

@AndroidDeveloperLB
Copy link

@sjudd Is there a way, though, to make a Drawable out of a video (even use ExoPlayer if needed), that will be possible to be drawn without SurfaceView/TextureView ?

@sjudd
Copy link
Collaborator

sjudd commented Aug 28, 2018

It may be possible, but efficient video playback is definitely out of scope for Glide. If you're interested you may be able to write an integration library that allows video playback, but it's not something I'd want to maintain as part of this library.

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Aug 28, 2018

I see, but I wish to say this:

Glide was developed to handle image files initially, and got a lot more than that over the years. Now it can handle GIF animations and even WEBP animations (using GlideWebpDecoder library) . And I'm sure there will be a heic support in the future somehow, maybe by using the new ImageDecoder class of Android, which is expected to be a part of the support library of Google. There is also animated PNG, but I never saw it and I don't think there are many people who need/want it.

Animation content is a kind of video, just without audio. That's also why a lot of websites use WEBM/MP4 instead, as they can sometimes present a better solution. Sometimes they even say it's GIF, even though it's not. Here are some examples:

https://giphy.com/gifs/hot-funny-cartoon-fBEDuhnVCiP16/media - shows GIF, WEBP, and MP4 files . On this case, the MP4 file took 320K and yet the WEBP file took 1.21MB

https://9gag.com/gif - says it's GIF, and probably started as such but usually it's actually webm .

https://gfycat.com/ - has mp4 files

https://imgur.com/gallery/ywKZuaB - sometimes GIF, sometimes mp4 files

And I'm sure there are a lot more.

And it's not just popularity or quality of the animation files. There are articles that claim it's also the expected file size and expected to take less CPU while showing it. See here comparison of WEBM vs GIF:

As I've read, there is the "gifv" extension too, which as I've read is actually video file in disguise (mp4/webM)

So I hope you understand that there is actually a need for those too. Maybe it's possible to handle the video files the same as GIF animations, and take a frame-by-frame solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants