Android Example VideoView Alternative JavaScript

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: https://www.b4x.com/android/forum/threads/mediaview-of-b4j-oficial.57008/#post-360951
 

Attachments

  • VideoJS.zip
    109.2 KB · Views: 2,154
Last edited:

stevel05

Expert
Licensed User
Longtime User
What device / Version of android are you running it on?
 

stevel05

Expert
Licensed User
Longtime 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
Longtime User
Hi, steve.
i cant play the video. even if i change the video source.
Help me please...
 

stevel05

Expert
Licensed User
Longtime 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
Longtime 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

  • VideoJS1.zip
    368.2 KB · Views: 881

stevel05

Expert
Licensed User
Longtime 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
Longtime 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
Longtime 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
Longtime 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