Android Question VideoView in streaming problems

rbirago

Active Member
Licensed User
Longtime User
Hi, I have to play videos in streaming mode and VideoView gives this opportunity. The problem is that there is no OnPrepared event to start properly the play action: sometimes it plays the video and sometimes not.
Looking at the Thread "VideoView Buffer Loading Percentage And VideoView Controls Skin" there are some interesting answers: first calling the Java Onprepared directly, but it works well in debug mode and not in release mode. In that thread it's exposed another library (VideoViewPlus) that implements the events for this job, but trying it with the given sample it triggers me always the error event 1 (-8000000) that means "unspecified error".
I'm using B4A 6.30 and I've tried to run the sample both with API 19 and API 21...but it never works.
Any suggestion?
thank you
Roberto
 

moster67

Expert
Licensed User
Longtime User
Can you post the unfiltered logs when using VideoViewPlus?
As an alternative, you can try B4ATextureVideoView (very similar - read the thread for further information)
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
perhaps there is a way to pickup the log file...but I don't know how...so I've taken a snapshot from IDE.
is the log of the sample got on the forum (vvbuff2.b4a)
 

Attachments

  • error 1.png
    error 1.png
    81.2 KB · Views: 317
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
I have just tried B4ATextureVideoView (using the sample) but on the emulator I only hear audio and don't see video
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
You can copy the logs by right clicking in the log area.
Your error is not very specific. Are you playing a local video or a video in streaming (remote server)?
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
I have just tried B4ATextureVideoView (using the sample) but on the emulator I only hear audio and don't see video
Always use a real device when testing video and then try again.
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
ok, I've tried B4ATextureVideoView on a real device and it works well (thank you!!). Instead vvbuff2.b4a (VideoViewPlus) gives the same error both in debug and in release mode.
Do you think that B4ATextureVideoView is the right choice vs VideoViewPlus?
thanks
Roberto
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
It should work fine with VideoViewPlus too unless I messed something up when writing the wrapper although I noted no-one has reported any problems as of today.
If you want, you can upload your project and I can have a look at it.
In any case, B4ATextureVideoView should be just fine.
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
really this issue made me crazy. I've done lots of tests simulating my app structure and at last I noticed that calling the play as a separate activity from main if I use SetScreenOrientation (in my app I have to change phone orientation) after the LoadVideo it doesn't trigger the Prepared event, otherwise all is ok.
Really I can't understand this behavior, but you can check it using this sample
 

Attachments

  • test3TextureVideoView.zip
    461.5 KB · Views: 291
Upvote 0

moster67

Expert
Licensed User
Longtime User
I tried your project and I did not receive any crash when the screenorientation was set to landscape. It seems to work fine. I moved the vv.play statement from the Prepared-event into your PlayVideo(aClipName)-sub since you are calling the video from your Main-activity.

However, I am not sure, I understand your problem. Maybe you can explain it a bit more?
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
well,I try.
The tests are made connecting an Android 5.01 smartphone via USB.
Trial #1:
I comment the "setOrientation.." line and I run in release mode:
The clip is displaying in portrait mode well. I close the app and this is the log:

B4X:
LogCat connected to: 96502aef
--------- beginning of system
--------- beginning of crash
--------- beginning of main
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
PlayClip
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (playclip) Create, isFirst = true **~i:** Activity (playclip) Resume **
loading clip http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8
Prepared http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8
** Activity (playclip) Pause, UserClosed = true **~i:** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **

Trial #2:
I uncomment the "setOrientation.." line and I run in release mode:
No display on the smartphone. I close the app and this is the log:

B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
PlayClip
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (playclip) Create, isFirst = true **
** Activity (playclip) Resume **
loading clip http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8
** Activity (playclip) Pause, UserClosed = false **
** Activity (playclip) Create, isFirst = false **
** Activity (playclip) Resume **
** Activity (playclip) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **

Do you need any other infos?

thanks
Roberto
 
Upvote 0
Top