media

When to use byte array, and when to use stream?

筅森魡賤 提交于 2020-02-01 03:08:05
问题 I need to send images and small video files (around 5MB, less than 10MB) to a REST service, which I will write. I am wondering whether I should use Byte[] or Stream to accomplish this task. What would be the dividing line in terms of transfer file size between using Byte[] and Stream? 回答1: The amount of free memory you're willing to commit to the transaction is your only real constraint. If you have a 5M file, then you'll need to load the entire thing in to RAM, which will cost 5M. If you

navigator.getUserMedia not working on Android / Chrome

十年热恋 提交于 2020-01-31 09:12:41
问题 do you have any idea of why the following code doesn't work on Android/Chrome ? It works well on Desktop/Chrome . function console_log(data) { console.log(data) var data_str = String(data); var $div = $('<div></div>'); $div.append(data_str); $('.console').append($div); } $(function(){ var constraints = { audio: true, video:false } //--- console_log('navigator.mediaDevices...'); console_log(navigator.mediaDevices); //--- // # TEST 01 # var userMedia = navigator.getUserMedia(constraints,

navigator.getUserMedia not working on Android / Chrome

北慕城南 提交于 2020-01-31 09:12:31
问题 do you have any idea of why the following code doesn't work on Android/Chrome ? It works well on Desktop/Chrome . function console_log(data) { console.log(data) var data_str = String(data); var $div = $('<div></div>'); $div.append(data_str); $('.console').append($div); } $(function(){ var constraints = { audio: true, video:false } //--- console_log('navigator.mediaDevices...'); console_log(navigator.mediaDevices); //--- // # TEST 01 # var userMedia = navigator.getUserMedia(constraints,

Django - Protecting Media files served with Apache with custom login_required decorator

橙三吉。 提交于 2020-01-30 08:03:23
问题 I deployed a Django app using Apache, and I check for authentication in most views using a decorator. @custom_decorator def myView(request): bla bla bla... It's not the @login_required decorator that comes with Django, but it's almost the same thing, except that allows access only to users from certain groups. This works as intended. Also, I'm serving media (user uploaded) files with Apache, like this: Alias /media /path/to/media <Directory /path/to/media> Require all granted </Directory I

Java Music Player: Song information and playing [closed]

半世苍凉 提交于 2020-01-27 03:07:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . In Android, we can use the mediaplayer to play songs on the device, and cursors to get the track information (which the OS keeps track of). My question is, what are the Java equivalents of these? Note: I have seen people mentioning JavaFX, however this does not seem to be installed with the JVM by default and thus

How can I use a MediaBrowserService with a widget?

我的未来我决定 提交于 2020-01-23 03:16:08
问题 My service extends the MediaBrowserService class and it responds to certain MediaController actions such as getMediaController().getTransportControls().onPlay() . However, I didn't find a way to "control" my service from a Widget, because the MediaController class isn't available from it. How can I communicate with my service? 回答1: The recommended approach is to use a MediaButtonReceiver, which will forward commands to your MediaBrowserService , where you can then handle them by adding a call

Downloading the files(which are uploaded) from media folder in django 1.4.3

蹲街弑〆低调 提交于 2020-01-21 03:05:06
问题 I am using django to design the basic web pages that handles the uploading and downloading of the files to/from the media folder Actually the files are uploaded successfully in to the media folder, also files are downloaded successfully but an underscore is appended to the file_name as a last charater like file_one.pdf_ , file_two.pdf_ , file_three.txt_ etc., Below are my codes urls.py urlpatterns = patterns('', url(r'^upload$', 'learn_django.views.upload'), url(r'^files_list$', 'learn_django

ToneGenerator crashes in android 6.0

扶醉桌前 提交于 2020-01-20 07:24:27
问题 In my application i am using ToneGenerator to play simple sound. When test my application by compiling the application with 6.0, my application randomy crashing due to ToneGenerator init method. Below is the exception. java.lang.RuntimeException: Init failed 04-21 12:34:05.497 7166 7166 E MyApplication: at android.media.ToneGenerator.native_setup(Native Method) 04-21 12:34:05.497 7166 7166 E MyApplication: at android.media.ToneGenerator.<init>(ToneGenerator.java:746) I am using the tone

ToneGenerator crashes in android 6.0

本小妞迷上赌 提交于 2020-01-20 07:21:25
问题 In my application i am using ToneGenerator to play simple sound. When test my application by compiling the application with 6.0, my application randomy crashing due to ToneGenerator init method. Below is the exception. java.lang.RuntimeException: Init failed 04-21 12:34:05.497 7166 7166 E MyApplication: at android.media.ToneGenerator.native_setup(Native Method) 04-21 12:34:05.497 7166 7166 E MyApplication: at android.media.ToneGenerator.<init>(ToneGenerator.java:746) I am using the tone

c# extract mp3 file from mp4 file

混江龙づ霸主 提交于 2020-01-17 12:24:27
问题 is there any easy way of extracting a mp3 file from a mp4 file? I've already tried to change the file extension, but that won't let me to edit the mp3 description. thank you! 回答1: Use Xabe.FFmpeg. It's free (non-commercial use), has public repository on GitHub, cross-platform (written in .NET Standard). Extracting mp3 from mp4 just by 3 lines: string output = Path.ChangeExtension(Path.GetTempFileName(), FileExtensions.Mp3); IConversionResult result = await Conversion.ExtractAudio(Resources