media

MediaPlayer sometimes not preparing when screen is locked

China☆狼群 提交于 2019-12-06 00:52:47
I have a MusicService for MediaPlayback, wich uses a MediaPlayer with the settings: player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); player.setAudioStreamType(AudioManager.STREAM_MUSIC); and those Listeners are set: OnPreparedListener, OnCompletionListener, OnErrorListener, OnSeekCompleteListener The MediaPlayer is used for mp3-Playback. When one Song is finished, onCompletion is called. Then PlayNext is called, wich resets the MediaPlayer, then sets the Datasource with the URI of the next Track. Uri is loaded with: Uri trackUri = ContentUris .withAppendedId(android

mediacodec vs mediaplayer and mediarecorder

孤街浪徒 提交于 2019-12-05 22:40:45
问题 I'm a bit confused about how to play and record video/audio in Android. I don't really understand in what situations one should use these classes: -To play: MediaPlayer vs MediaExtractor + MediaCodec -To record: MediaRecorder vs MediaCodec + MediaMuxer When do I have to use one or the others? Sorry if it's a repeated question, I think it should be a common one but I haven't found any. 回答1: If the high level interfaces (MediaPlayer, MediaRecorder) can do what you want (play back video from a

How to execute command line ffmpeg commands programatically in android?

女生的网名这么多〃 提交于 2019-12-05 17:09:32
I have successfully built ffmpeg for android using the bambuser . Now I have to build a sample converter application like mp4 to 3gp. I know there are command line commands ffmpeg -i video_origine.avi video_finale.mpg . But I don't know how to execute these commands programatically. I have sample code like jint Java_com_example_ndklearning1_MainActivity_logFileInfo(JNIEnv * env, jobject this, jstring filename) { av_register_all(); AVFormatContext *pFormatCtx; const jbyte *str; str = (*env)->GetStringUTFChars(env, filename, NULL); if(av_open_input_file(&pFormatCtx, str, NULL, 0, NULL)!=0) {

How to simulate hardware media control buttons on an Android emulator

别说谁变了你拦得住时间么 提交于 2019-12-05 16:47:09
问题 Android supports hardware play / pause buttons on headsets and attached devices. I am trying to find a way to test support for those devices on an emulator. The Android documentation talks about how to add support for hardware playback controls, but, unfortunately, I can't find documentation of how to emulate them. Thanks! 回答1: You can send keyevents using adb adb shell input keyevent <keycode> keycode for play - 126, pause - 85 (see KeyEvent) 回答2: There is another way to do this, from an

Twitter 'Offline' Access for Developers?

淺唱寂寞╮ 提交于 2019-12-05 12:18:28
I've been working closely with social integrations and the oauth framework for authorization. I know that, like Facebook, Twitter implements an oauth hook for its applications. My question is, is there a way to keep an access token active forever? Much like Facebook has its offline access permission, I would like to be able to only request that the user validate my app once (this is simply for an ease-of-use purpose). When you implement OAuth for Twitter, you receive two tokens called OAuthToken and OAuthTokenSecret. You store these values in a settings file or a cookie or a database (or

Route audio via speaker when headphone plugged it

落爺英雄遲暮 提交于 2019-12-05 09:12:03
How we can route audio output via speaker even when the headset is plugged in? My code: if(audioManager.isWiredHeadsetOn()) { audioManager.setWiredHeadsetOn(false); audioManager.setSpeakerphoneOn(true); audioManager.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL); audioManager.setMode(AudioManager.MODE_NORMAL); } Am I missing something here? Did you try adding <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> to your AndroidManifest.xml ? http://developer.android.com/reference/android/Manifest.permission.html#MODIFY_AUDIO

Web pages to print media — solutions?

大城市里の小女人 提交于 2019-12-05 07:14:19
I've been a big fan of MediaWiki and similar wiki-based text editors. I like the ability to quickly add text, collaborate, and share. However, there's always still the need for nicely formatted print output. Things like headers and footers (that say what I want them to say), page breaks, margins, etc. Most solutions I've seen involve some sort of conversion to a intermediate print-media format (maybe MediaWiki to Microsoft Word or maybe some custom scripting that generates a PDF from the contents of a web page (with a lot of hard-coded references). Is there any more generic solution that

C#: Upload Photo To Twitter From Unity

自作多情 提交于 2019-12-05 06:16:28
问题 currently I am working with unity. In this project, I need to post some status with image to twitter. However, I got a problem to upload the image to the Twitter. Here is the code, which I used to upload the Image: private const string UploadMediaURL = "https://upload.twitter.com/1.1/media/upload.json"; public static IEnumerator UploadMedia(string consumerKey, string consumerSecret, string filePath, AccessTokenResponse response){ Dictionary<string, string> mediaParameters = new Dictionary

Safari blocks play() on video despite being called from click event

淺唱寂寞╮ 提交于 2019-12-05 03:59:06
I'm creating some custom video controls for an html5 element. I've bound a click event handler to a play/pause button which calls .play() on the corresponding video. From my research, Safari will block calls to .play() unless you are in a click handler, however it is blocking my calls to .play() despite the fact that I am triggering it from within a click handler, like so: $('.video-container .play-pause').click(function(event){ var $video = $(event.currentTarget).parent().find('video'); if($video[0].paused) $video[0].play(); else $video[0].pause(); }); And the error: Unhandled Promise

How to play other video formats in JavaFX

大憨熊 提交于 2019-12-05 03:31:25
问题 I am busy with a movie/video-clip player/library. I want to do this in JavafX. Almost 90% of the video clips is in AVI format. I cannot for several reasons covert the movies/video-clips. I also want the program to mark the video files that were played, from start to complete, so that I will know what have been watched. So the program needs to be able to interact with the video player to know when the video has played to the end. JavafX doesn't allow playback for AVI files. What's the