Local video files won't play in Cordova Android App - Web App Development

I'm building an app in Cordova where the first page of the app contains a video tag set to autoplay. I don't get any 404 errors loading the file... The file just won't play. The video is just black with a 0:00 time length that doesn't change.
The strange thing is I get two network requests in Chrome remote dev tools for the video file: the first shows a (success) status, and the second has a status of (cancelled). I've tried using two different URLs for the file:
file:///android_asset/www/video/nameofmyvideo.mp4 with the video file actually in /www/video/nameofmyvideo.mp4.
and
android.resource://mypackagename/raw/nameofmyvideo with the video file actually in /www/res/raw/nameofmyvideo and /platforms/android/res/raw/nameofmyvideo
I'm running the latest cordova (3.4.1-0.1.0) and testing on a kindle fire running CM-11 (4.4.2).
Here's the the markup I'm using:
HTML:
<video width="400px" height="300px" autoplay controls>
<source src="file:///android_asset/www/video/video-test.mp4" type="video/mp4">
</video>
OR
HTML:
<video width="400px" height="300px" autoplay controls>
<source src="android.resource://my.package.name/raw/videotest" type="video/mp4">
</video>
Is this an android pathing issue? The app runs fine as-is in iOS. I've also tried using webm, with no success.
Also it seems that the double network load issue (one success, one cancelled) happens regardless of whether the file can actually load. I loaded the same mp4 file over http hosted on my website and the video played fine (but still showed both requests).

Try using a relative path instead...
HTML:
<source src="video/video-test.mp4" type="video/mp4">
This is obviously assuming you're in the root folder - I'm guessing you're still in index.html in the www folder.

I dont think phonegap / browser can play mp4 files. Its a limitation of cross platform. Try flv format
Sent from my Nexus 4 using XDA Premium 4 mobile app

jaison thomas said:
I dont think phonegap / browser can play mp4 files. Its a limitation of cross platform. Try flv format
Sent from my Nexus 4 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
That's not correct - it's a regular html5 browser control, which is capable of playing mp4 videos.

.MP4 is supported, not .FLV.
http://developer.android.com/guide/appendix/media-formats.html
It looks like the Android Web view is blocking access to the video files, which this Cordova plugin fixes:
Http://github.com/jaeger25/Html5Video
This plugin is for Android only. You could probably make changes to the JavaScript to make it work on other platforms.
Sent from my SM-N900V using XDA Free mobile app

I experimented with that plugin and couldn't get it to work. Maybe reverting back to an older version of Cordova would work.
Sent from my SM-N900V using XDA Free mobile app

DieHappy said:
I experimented with that plugin and couldn't get it to work. Maybe reverting back to an older version of Cordova would work.
Sent from my SM-N900V using XDA Free mobile app
Click to expand...
Click to collapse
Did you get any further with this? I'm currently experiencing the same problem. All the possible solutions found online tell me to include the video files in the app's folder, but in my case the video's need to be downloaded afterwards so they can't be in the app's folder...

I have the same problem, even developing an Android cross walk application, the video Html5 tag only works fine with videos located in a http server, with local files includes in the application only works in full screen mode, otherwise only the audio is played, the video is showed as a black screen.
I think the issue is related to the Web browser of Android, I tested the application in the latest version of the chrome Mobile browser and the behaviour is exactly the same.
Did you find a solution for this issue?
Thanks a lot in advance.
Regards
David

Hi,
I've recently released an open source app that uses html5 video player and a mp4 video.
Check the app in store using the links at zland.io
After starting the app, close the dialog and click on the (?) question sign in the upper right corner, then click on "crosshair explained".
To see how its done clone github.com/zland/zland-help-overlay and check the file components/HelpOverlay.jsx
HTML:
<video controls style={videoStyle}>
<source src="assets/zland-help-overlay/videos/crosshair.mp4"
type='video/mp4;codecs="avc1.42E01E, mp4a.40.2"' />
</video>
The video is done with android built in video capturing and then edited with iMovie.
@ddiegomercado cordova recently introduced a Content-Security-Policy module. For development be sure to set it to:
HTML:
<meta http-equiv="Content-Security-Policy" content="">
in your index.html
This means the webview can load content from anywhere.
Also be sure to install cordova-plugin-whitelist and set this to your config.xml
HTML:
<!-- access origin -->
<plugin name="cordova-plugin-whitelist" version="1" />
<access origin="*" />

Thanks a lot, I will try

Related

Youtube links in browser

When I open this link in my browser it doesn't play a video:
/v/fa2_TWLREtU&autoplay=1 (add youtube.com before /)
but whenever I change it to:
/watch?v=fa2_TWLREtU (add youtube.com before /)
it plays just fine, only problem is FriendStream uses the first format.
Is this normal? Or does the browser doesn't support SWF's or something?
when i try to open youtube stuff, it will open the video with the built-in youtube app. maybe you set some app as a default youtube app - did you check the "set to default settings" within applications preferences (dont know the correct english terms)?
Youtube app doesn't play some videos it says not available in mobile but if u play it in the browser it works
Sent from my HTC Vision using XDA App
I mean when playing them in the BROWSER, the first link doesn't work the second one does. Why is that?
This doesn't concern the youtube app, but the flash player in the browser

[APP] XMBC

Download
xbmcapp-armeabi-v7a-debug-20120714.apk (7d51bbed16ca71690735517344bd2329)
Instructions
Download the APK to an SD card.
Use the file browser to navigate to the SD card and open the .apk file.
If a permissions dialog pops up blocking external application installs, choose remove ban.
Accept permissions prompt.
Launch XBMC from the app menu.
Known issues
App can take a minute to load on initial launch.
Mouse clicking doesn't seem to work.
Direct keyboard alpha numeric entry doesn't seem to work, but arrow navigation works.
Hardware decoding only available on some devices. No hardware decoding on Mali400 devices such as the MK802 and Mini X.
Tested on my GNex: works fine!
Also tested on Gtab 10.1: Doesn't work because Tegra2 doesn't support Neon.
ENJOY!
source: http://xbmc.org/theuni/2012/07/13/xbmc-for-android/
Extra info:
XBMC is an award-winning free and open source (GPL) software media player and entertainment hub for digital media. XBMC is available for Linux, OSX, and Windows. Created in 2003 by a group of like minded programmers, XBMC is a non-profit project run and developed by volunteers located around the world. More than 50 software developers have contributed to XBMC, and 100-plus translators have worked to expand its reach, making it available in more than 30 languages.
While XBMC functions very well as a standard media player application for your computer, it has been designed to be the perfect companion for your HTPC. Supporting an almost endless range of remote controls, and combined with its beautiful interface and powerful skinning engine, XBMC feels very natural to use from the couch and is the ideal solution for your home theater.
Currently XBMC can be used to play almost all popular audio and video formats around. It was designed for network playback, so you can stream your multimedia from anywhere in the house or directly from the internet using practically any protocol available. Use your media as-is: XBMC can play CDs and DVDs directly from the disk or image file, almost all popular archive formats from your hard drive, and even files inside ZIP and RAR archives. It will even scan all of your media and automatically create a personalized library complete with box covers, descriptions, and fanart. There are playlist and slideshow functions, a weather forecast feature and many audio visualizations. Once installed, your computer will become a fully functional multimedia jukebox.
It is difficult to put into words all that XBMC can do, head to the gallery to see some examples, or take the plunge and Try it Today.
nvm
I've noticed that video playback is very choppy when streaming
Sent from my Galaxy Nexus using xda premium
Ack so many posts about this all over XDA
Video playback is choppy because it has no hardware accell for video yet its a 3rd party compile unreleased pre beta
Jezz_X said:
Ack so many posts about this all over XDA
Video playback is choppy because it has no hardware accell for video yet its a 3rd party compile unreleased pre beta
Click to expand...
Click to collapse
Wow didn't realize you ran xda with an iron fist. I bow before you.
Sent from my Galaxy Nexus using xda premium
Cozzeck said:
Wow didn't realize you ran xda with an iron fist. I bow before you.
Sent from my Galaxy Nexus using xda premium
Click to expand...
Click to collapse
Mouse clicking is a problem since the tolerance for click vs swipe seems to be too low. A quick tap works.
Jezz_X said:
Ack so many posts about this all over XDA
Video playback is choppy because it has no hardware accell for video yet its a 3rd party compile unreleased pre beta
Click to expand...
Click to collapse
True, still a alpha build
Sent from my Galaxy Nexus using xda app-developers app

App for Streaming Video

I have looked around, and can't find any information in threads that are not at least a year old. I use airplayit on my ipad to stream videos stored on my desktop to the tablet and it works fairly well. However, their android app crashes on my phone when I try to add a computer for it to stream from. I also tried an app called skifta from the play store, however it crashes when I open it. I am trying to find, Ideally, one program that will work for both my ipad and my phone, but if that is not possible, just a good one for my phone would suffice.
Any ideas?
I like BS player. It has a LAN mode that you can use to stream media. It so far Plays all of my .mkv files without stutters.
I use Plex media server
Sent from my SPH-D710 using xda premium
Somewhat on this same note...Do any of you use p2p4u.net for streaming sports? If so, have you been able to use it on your E4GT?
Sent from my SPH-D710 using Tapatalk 2
shakewell said:
I use Plex media server
Sent from my SPH-D710 using xda premium
Click to expand...
Click to collapse
This seems to be exactly what I was looking for. 5 bucks is the most I've paid for an android app, but I just might have to do it.
I for one would love to see Google do for video files what they did for music (Google Play Music). Streaming videos via your pc to phone while on the same network is a nice feature but having it in the cloud would be a plus.
I use bs player as a player, but have set up an ftp server on my home pc and navigate to it through es file explorer.
Sent from my SPH-D710
Okay in the process of trying to find an app that could stream video files as well as music & document files I came across an app called ZumoCast. This app is specifically made to run on certain Motorola devices but doing some searches here on XDA I found a patched version, installed it on my phone and thus far it works flawlessly (well almost), no widget support & album art doesn't always show up.
I haven't tried it while I'm away from home so I can't really tell you how well things would stream outside the network but in house it works great.
Attached you will find the apk & here is the link to the windows install file (sorry iOS users no support for you guys at this time)
Enjoy
EL TEJANO said:
Okay in the process of trying to find an app that could stream video files as well as music & document files I came across an app called ZumoCast. This app is specifically made to run on certain Motorola devices but doing some searches here on XDA I found a patched version, installed it on my phone and thus far it works flawlessly (well almost), no widget support & album art doesn't always show up.
I haven't tried it while I'm away from home so I can't really tell you how well things would stream outside the network but in house it works great.
Attached you will find the apk & here is the link to the windows install file (sorry iOS users no support for you guys at this time)
Enjoy
Click to expand...
Click to collapse
Thanks. I'll have to give this a try. I was getting weird errors with plex and it didn't want to play back most of my video files for some reason
I use ES file explorer to access all my files: system, network, ftp, and cloud. They all stream flawlessly and I just play them on DICE player. Love the new popup player.

[Q] S-Note Sketching On-screen Recording Path for Note-2?

Hi
I did a screen-recording while sketching in S-Note. A recording functions that's built-in. I was able to play them back within the S-note app.
But, I could not find the recorded video / smb files - however I did find static image sketches' smb files.
Any pointers would be great help.
Thanks in advance
tushonline said:
Hi
I did a screen-recording while sketching in S-Note. A recording functions that's built-in. I was able to play them back within the S-note app.
But, I could not find the recorded video / smb files - however I did find static image sketches' smb files.
Any pointers would be great help.
Thanks in advance
Click to expand...
Click to collapse
YES i found out this too.
Now the question is Where are those videos saved!
Are you sure it saves as a video file ?, could the static images you found actually be animated gif image
unreal1992 said:
YES i found out this too.
Now the question is Where are those videos saved!
Click to expand...
Click to collapse
Exactly my question
paulus3476 said:
Are you sure it saves as a video file ?, could the static images you found actually be animated gif image
Click to expand...
Click to collapse
No, they don't appear like an animated gif, If I open it using VLC, it only shows a thumbnailimage.jpg - where as the file is over 3MB.
Also - was not able to extract .smb file neatly. Any clue on that?
try changing the file extension to .gif and open it with any programme that you know is capable of playing animated gif images correctly. It may well be a video file of some type proprietary to samsung, which only samsung app will play - I can think of other video files that cannot be played by any other software other than the app that they are designed for.
I thought the on screen recording doesn't work yet.
Oh snap! I don't have a witty tapatalk signature!
It's available in snote only and not available as advertised. .
Sent from my GT-N7100 using xda app-developers app

Html5 video tag doesn't work in Android with local video files

Hi everyone.
I am not able to reproduce local video files, using video tag of Html5 in an Android application, even developing an Android cross walk application, the video Html5 tag only works fine with videos located in a http server, with local files includes in the application only works in full screen mode, otherwise only the audio is played, the video is showed as a black screen.
I think the issue could be related to the Web browser for Android, I tested the application in the latest version of the chrome Mobile browser and the behaviour is exactly the same.
Anyone know how to solve this issue?
By the way, the Android version where I am trying is 4.1
Thanks a lot in advance.
Regards
David
the issue is not with browser.its with the video. i too had the same issue when playing mp4 videos locally in webview. i tried different versions/ encoders when converting video and it worked without any code changes. just try converting the mp4 to different encoder or better try with a 3gp format. it will work
Thanks si much, I did some tests just related to you mean, but it doesn't work for me, may be if you could me the encoder, format, bitrate, etc. I will able to solve as you did.
Do you remember the combination you used.
Thanks a lot
Regards
David
I was able to execute correctly the app in other device, with mp4 and with webM video format, but in the initial device doesn't work fine, there, the video only works in full screen mode or if the video is located in Internet, if the video is located locally it only is reproduced if I tap the full screen icon of the Html5 video tag controls.
For this reason, I am not sure that the problem is related to the video, but with the Web browser, or may be with the device, the app works fine in other device with Android 4.2 and Android 4.4.
Any idea about how to try to solve for Android 4.1?
Thanks a lot in advance.
Regards
David
The problem is that the local files have "file://" protocol so they can't be played by just using the video tag, you need to use a video cordova plugin like:
https://github.com/moust/cordova-plugin-videoplayer
https://github.com/nchutchind/Streaming-Media-Cordova-Plugin
Hope I helped
Suggestion
I would suggest checking that the local file exists.
Perhaps a popup-box or console log that displays the url, and manually navigate to the URL.
This is almost always the issue for me -- other than file corruption it's self.

Categories

Resources