My app is for digital signage and has a screensaver that plays a fullscreen video after a timeout. When the timeout is triggered, the current activity is finished and the screensaver activity is started. The problem I'm having is that when the current activity contains an embedded video, the screensaver breaks with "Can't play this video".
There isn't really much code to show, I think it's a procedural problem. Do I need to do something to the VideoView to clear/release it besides simply finishing the containing activity?
The only relevant LogCat entry I can see seems to be W/ResourceType(16285): Failure getting entry for 0x01080a03 (t=7 e=2563) in package 0 (error -75)
did you try to stop the video playback before finishing the activity ?
You can use :
myVideoView.stopPlayback()
Alos, I saw in other posts that Android usually displays this message, when it is not able to play the media content, for example : unsupported file format, unsupported codecs, erroneous content
Maybe you could try to play the same video as in your screensaver activity, to see whether it is a content problem
Also, you could check the video file path
Related
I am working on implementing voice commands for Android Auto using media player callback methods. I am having trouble getting Auto to recognize that I am asking to play a title on my application: “Play [x] on MyApp”. I understand that it takes a few days after being published for this command to work, but I should still be able to say “Play [x]” while the media session is already running and it should use onPrepareFromSearch and onPlayFromSearch methods to search for and play content.
When I say “Play [x] on MyApp” I get the response “I looked for [x] on MyApp on Google Play Music but it either isn’t available or it can’t be played right now”.
When I say “Play [x]” while my media service is running it will usually redirect me to Google Play Music.
I am able to pause, resume, skip forward and skip backward using voice commands and I see those being logged but when I try to perform a voice search neither onPrepareFromSearch nor onPlayFromSearch are called.
Things I have tried:
Added an <intent-filter> for MEDIA_PLAY_FROM_SEARCH to an activity in my application as to mark my application available to search for media
Implemented onPrepareFromSearch and onPlayFromSearch in my MediaSessionCompat.Callback
Added ACTION_PLAY_FROM_SEARCH and ACTION_PREPARE_FROM_SEARCH as supported actions.
Set the media session flags FLAG_HANDLES_MEDIA_BUTTONS and FLAG_HANDLES_TRANSPORT_CONTROLS
Added support for Android Auto as per the documentation here: https://developer.android.com/training/cars/media/auto
Is there a step I am missing in order to get this to work?
Let's say I have an application with an activity which list a bunch of files. When the user touch one of this files an ACTION_VIEW intent with proper mimeType and stuff is triggered so Android will prompt the user to choose one of the video players installed in the system (or the one that's defaulted).
I'm wondering if there is a way of telling if the playback of the file itself succeded or not. Because if I detect there was an error I can recomend the user other players available on Google Play.
¿Does the default Android Video Player responds the intent with some data? ¿Is there some generalized, common or standard way to get this information?
Any data on the subject is appreciated.
Thanks in advance.
I'm wondering if there is a way of telling if the playback of the file itself succeded or not.
You can tell if there was any eligible activity for the ACTION_VIEW Intent, either by catching ActivityNotFoundException on your startActivity() call, or by calling queryIntentActivities() ahead of time and checking for an empty list.
Once control passes to the third-party activity, that activity is like Las Vegas: what happens in that activity stays in that activity. You have no way of knowing anything about what went on, in terms of "success" or "failure" or anything else.
I have a problem. When I play HTML 5 video object in my webview (<video>), the LogCat returns several error messages like this one:
E/MediaPlayer(17981): mOnBufferingUpdateListener is null.
Failed to send MEDIA_BUFFERING_UPDATE message.
I understand that several listeners are not implemented yet but I am not able to get the player instance.
EDIT
I am on ICS (4.0.3) and I have already tried this solution :
WebView and HTML5 <video>
thanks for previous replies,
Is it possible to get package name of active and runningin service(background) music player. I can able to get the music actions(metachage or playstateChange) but when i use intent.getPackagename, im getting null. can anyone guide me on how to get the package name of music player.
Thanks!
Supplying the file URL and open it in browser does not make sense, because this URLs expire after a wile.
No, insofar as there is nothing magic in Android that denotes a "music player" from anything else.
I am trying to build an Android Service that should get notified when the user starts playing an MP3. I checked LogCat when I start playing a song and saw that the following Intent is logged:
Intent { act=com.android.music.PLAYBACK_VIEWER flg=0x4000000 cmp=com.android.music/.MediaPlaybackActivity }
I couldn't figure out how to write an IntentFilter to let my Service know that this event has occurred and let me know the name of the song that will be played. I searched Android reference but could not find anything on PLAYBACK_VIEWER.
Thanks,
C
I would do neither. First, none of this is part of the SDK and so may change at any point. Second, this will only work for the built-in media player application, not any third-party or OEM-supplied media players, and I expect more people to gravitate to those.