media

android之多媒体篇(一)

做~自己de王妃 提交于 2019-11-28 10:19:35
Android 4.0.3(Api Level 15)支持的多媒体格式。 注意:有些设备可能支持其他的文件格式。 1.Audio AAC LC/LTP、HE-AACv1(AAC+)、AMR-NB、AMR-WB、MP3、MIDI、Ogg Vorbis、PCM/WAVE、FLAC(3.1或3.1以上) 2.Image JPEG、PNG、WEBP、GIF、BMP 3.Video H.263、H.264 AVC、MPEG-4 SP、VP8(2.3.3或2.3.3以上) 播放音频、视频主要由MediaPlayer类来控制。 大致步骤: 1.初始化MediaPlayer,附上要播放的媒体。 2.准备播放 prepare 3.开始播放 start 4.在播放结束前:停止或者暂停播放 pause or stop 5.播放完成 complete android只支持有限数量的可同步的MediaPlayer,不释放它们会导致运行时错误,所以当你完成播放的时候,记得: mediaPlayer.release(); 来释放所涉及的资源。 Prepare音频 MediaPlayer可以播放本地文件、Content Providers、远程URL流。 加载: // Load an audio resource from a package resource. MediaPlayer

Android: save a file from an existing URI

爷,独闯天下 提交于 2019-11-28 07:33:38
How to save a media file (say .mp3) from an existing URI, which I am getting from an Implicit Intent? Shiva Use this method, it works void savefile(URI sourceuri) { String sourceFilename= sourceuri.getPath(); String destinationFilename = android.os.Environment.getExternalStorageDirectory().getPath()+File.separatorChar+"abc.mp3"; BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(new FileInputStream(sourceFilename)); bos = new BufferedOutputStream(new FileOutputStream(destinationFilename, false)); byte[] buf = new byte[1024]; bis.read(buf); do {

Android - .nomedia not working for images

无人久伴 提交于 2019-11-28 07:27:16
I have images, which are read from sdcard only by particular application so I want to hide it from image gallery. I have put .nomedia file in it, but this file is ignored, images are still showing in Gallery. I have put it with "." in the beginning. Still not working. Any ideas? I'm guessing you're using Android 4.0, as .nomedia functioned properly until then. The AOSP bug report for the issue explains: MediaScanner on Android 4.0 fails to forget already-indexed files when it encounters a .nomedia file, but it does honor it if it's present on the first pass. So the workaround is to simply

How do I extractor audio to mp3 from mp4 using java in Android?

假装没事ソ 提交于 2019-11-28 06:52:00
问题 I want convert mp4 video to mp3 audio file in Android platform? How can I do it? Actually I test some JAR. Firstly, the JAAD lib be used to test. import java.io.File; import java.io.RandomAccessFile; import java.util.List; import net.sourceforge.jaad.aac.Decoder; import net.sourceforge.jaad.aac.SampleBuffer; import net.sourceforge.jaad.mp4.MP4Container; import net.sourceforge.jaad.mp4.api.AudioTrack; import net.sourceforge.jaad.mp4.api.Frame; import net.sourceforge.jaad.mp4.api.Movie; import

Java RTSP client/server library

廉价感情. 提交于 2019-11-28 06:33:09
Is anyone aware about good RTSP client/server Java library? Search on Google reveals JMF, which is very outdated. Thanks. If you're still interested, Netty provides RTSP support since version 3.2. You can use Netty NIO framework to write your own RTSP server / client implementation. You can try using FMJ . It's a set of libraries that wrap a lot of modern codecs in Java interfaces. There is no java implementation of RTSP protocol. You must do it yourself using a NIO framework (MINA, GRIZZLY, NETTY...) its a possible solution. Red5 has some support or is going to have support for RTSP and is

How can I create a video from a directory of images in C#?

只愿长相守 提交于 2019-11-28 05:31:32
I have a directory of bitmaps that are all of the same dimension. I would like to convert these bitmaps into a video file. I don't care if the video file (codec) is wmv or avi. My only requirement is that I specify the frame rate. This does not need to be cross platform, Windows (Vista and XP) only. I have read a few things about using the Windows Media SDK or DirectShow, but none of them are that explicit about providing code samples. Could anyone provide some insight, or some valuable resources that might help me to do this in C#? At the risk of being voted down, I'll offer a possible

Django: serving ADMIN media files

↘锁芯ラ 提交于 2019-11-28 04:45:12
I've been successfully serving media files for the normal MEDIA files, but when I tried serving admin media files, I failed. please kindly help me locating the problem, as I've tried to troubleshoot the problem for several hours already with no luck (been googling too and read the django doc about serving static files as well). The error as I tried to access localhost:8000/media/a.gif is as following: Page not found: f:\python25\lib\site-packages\django/contrib/admin/media\a.gif I put the admin media files in directory named "media", while I put the normal media files in directory named

Playing video in Java

一曲冷凌霜 提交于 2019-11-28 03:29:23
问题 I need to play a video in my JFrame. I've looked around and I have installed the Java media framework and I've tried numerous ways, media panel doesn't seem to work and I don't understand Player. If someone could tell me an easy way to play a video inside a JFrame or even which methods to call that would be great. ( I also have the .avi file in the same directory as the .class and .java files ) 回答1: JMF is basically dead. I don't have first-hand experience with playing video with Swing, but

Django: how do you serve media / stylesheets and link to them within templates

六月ゝ 毕业季﹏ 提交于 2019-11-28 02:54:05
Variations of this question have been asked, but I'm still unable to get my stylesheets to load correctly when my templates are rendered. I'm attempting to serve static media from the Django process during development - which is strongly discouraged in production, I'm aware. I'll post my configuration and my template, and hopefully someone can help me to understand where I'm going wrong. Note that I did try to follow the example on the Django project website, however it doesn't mention how to refer to your stylesheets from a template. I've also tried many different variations of the same thing

PrimeFaces p:media not working with StreamedContent in a @ViewScoped bean

可紊 提交于 2019-11-28 01:51:42
问题 I have an issue related to Primefaces4 meida type rendering pdf file in browser. I have successfully tried the example in showcase from primefaces website. Now I want to get a new feature, which offers an tree structure with document nodes in the left panel. User could select one document to display it in the center panel. That means it generates pdf media field in backbean once user selects on one document on the tree. related code is shown below: backbean: @ManagedBean @ViewScoped public