I am trying to build a media player in android which will play http streams, I have customized the https://github.com/commonsguy/vidtry player for my needs, now only one issue remains, during playback, if user receives phone call, the video player should store the current position and resume it after call, I have managed to do it, but after phone call all I can hear is audio, no video is shown, I know it has something to do with SurfaceHolder.Callback but I am not sure how to make it work.
Any help will be appreciated.
Thanks
In SurfaceCreated, set the display surface of the player - setDisplay(holder)
Related
I am playing streaming in vlc player and using surfaceView to show streaming, Now, i want to take screenshot of streaming at any time.
Problem
Now problem is that we can not take screenshot of SurfaceView. I also saw a sample of Media Projection but it's asking for permission every time. So on pause method of activity is called every time, Which should not be.
Can Any one help me on this,
Is there any Xml tag which replace SurfaceView to take screenshot or we can remove the permission to capture screen using Media Projection.
I need to develop an Android Service (API level > 21), which should be able to detect video playback on a third party Video player, so that it can further disable the Notification pop-ups during a video playback.
On searching, I found several posts talking about detecting the play-states of videos in a VideoView, such as the following:
How to detect when VideoView starts playing (Android)?
But, I couldn't find anything that can help detecting video playback on a video player, wherein, the video player is installed as a third party app and is not a part of the Android application/ service.
So, the challenges are:
1) The android service needs to detect a video playback
2) Registering package names for video player apps with the Service is out of question, since the Service should be able to detect the playback even when a new video player is installed from the Playstore.
3) Need to extend this idea for online video streaming as well.
Any help in this regard would be really appreciated.
Thanks in advance.
There is no way to implement 100% reliable video playback detection :(
Just and idea: try listening to the audio focus changes... this might help with detection of video playback, assuming the target player respects the audio output stream usage policy, recommended by Google. You might also want to get notified about system UI visibility changes (to detect fullscreen playback).
Audio focus:
https://developer.android.com/guide/topics/media-apps/volume-and-earphones.html
System UI visibility changes:
https://developer.android.com/reference/android/view/View.OnSystemUiVisibilityChangeListener.html
Also, you are correct saying that package name based detector is not an option since detecting active/running package is no longer possible on android 7.
I want to make video player with next option to keep playing video after rotate device.
I created service with MediaPlayer and set SurfaceHolder of SurfaceView after rotate sceen. It works only for Android 4.x. For Android 2.3.X after replace second call setDisplay user doesn't see video, but hears sound of video.
Could you give me direction or example how to implement this option at custom player?
PS. Player shows streaming video.
Okay, I've found solution. It's so easy. I set configChanges="orientation|screenSize" for activity with custom player. In this case activity won't be recreated after rotate device it's changed on the same instance.
As result, I don't need service for keeping MediaPlayer and don't need replace SurfaceHolder.
I am playing a live tv channel in android browser using flash player.
Video takes some time to load in browser so i want to play some animation until video buffering ends.
The weird thing for me is how to know when will video buffering be complete in browser flash player?
I am not an expert in this subject - but i got this reference from another SO question itself:
How to detect when video is buffering?
This refers to the event called NetStream.Buffer.Full event that could be your help.
Is it possible to modify an active call by overlaying a sound track during the call? I looked up the SDK, but couldn't find any API to do this in the documentation.
I am trying to investigate the feasibility of playing a previously recorded call/audio clip onto an ongoing call.
Is it possible to modify an active call by overlaying a sound track during the call?
No, sorry, there is no API to access the in-call audio stream.