Android Example VideoView Alternative JavaScript

stevel05

Expert
Licensed User
For those having problems with the Android Videoview, here is a possible alternative that may be worth trying.

It's a javascript open source HTML5 video player for playing videos in a webview. Information and documentation is available here: VideoJS

It is simple to include the player, I have built the html within the app so the view can be sized. The attached example is very minimal, just loads and sizes the player and streams their demo video. It can also play local files. It shouldn't be too difficult to change the look etc, using css.

The few videos I have tried seem to work OK. Try your videos that the Android player has problems with.

The library is downloaded and included in the example. I've removed the flash content as it is not supported.

A B4j example is here: http://www.b4x.com/android/forum/threads/mediaview-of-b4j-oficial.57008/#post-360951
 

Attachments

Last edited:

Rick Harris

Well-Known Member
Licensed User
Sadly the video won't play. The Webview opens and a still picture with the dolphins shows, but after pressing the play button an empty grey videoview appears with a Flash logo in the middle.
 

stevel05

Expert
Licensed User
Hi Rick, sorry I missed your second response. Are you using the library from the example, or did you download it from their web site?
 

Leni Berry

Active Member
Licensed User
Hi, steve.
i cant play the video. even if i change the video source.
Help me please...
 

stevel05

Expert
Licensed User
It looks like the video it's trying to load may no longer be available. Have you tried a different one, or a local one?
 

Leni Berry

Active Member
Licensed User
Hi Steve,

many thanks. i can play the video now after try with different video source.
here is my edited code in attachment.

My question is how make the video auto play when i call the webview. please help

best rgds,

LB
 

Attachments

stevel05

Expert
Licensed User
It depends how you are accessing the webview, you will need to either call a subroutine in the javascript or inject the javascript directly. You will find the required commands in the VideoJS documentation. I will try to look at your project tomorrow, let me know if you get it working in the meantime.
 

stevel05

Expert
Licensed User
I have tried the code that is available on the videojs website, but nothing made it autoplay. i notice you are using a different version of the videojs, downloaded within the webpage from uscn.tv. It maybe that their version does not support the standard videojs commands.

The other thing I noticed is that it is very browser dependant. I created a stand alone HTML file from the code and ran it in my desktop browsers. Most of them wouldn't play the feed. Microsoft Edge does play it and it autoplays it as well. It seems to be hit and miss as to what functionality you actually get.
 

Leni Berry

Active Member
Licensed User
thank u very much steve.
yeah, i just follow and get it from web source ucsn.tv because it similar using videojs but i dont know what version.
When i open ucsn.tv on my laptop with chrome browser, the browser does play it and it autoplays it as well. but when i play it on my android phone, i hv to click the play button first and the movie will show.

Why is it different between web on laptop and android phone?
 

stevel05

Expert
Licensed User
I'm afraid I don't know the answer to that. It's just down to the way each browser works I would guess.
 
Top