I have been having some issues with my code to play html5 vide.
I created a short presentation in powerpoint and exported it html5, it contain a
video, I have copy the exported files into my assets files in android buy my video
is not playing.
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebChromeClient;
import android.webkit.WebViewClient;
public class WebViewActivity7 extends Activity {
private WebView webView7;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview7);
webView7 = (WebView) findViewById(R.id.webView8);
webView7.getSettings().setJavaScriptEnabled(true);
webView7.getSettings().setAllowFileAccess(true);
webView7.getSettings().setPluginsEnabled(true);
webView7.getSettings().setAllowFileAccess(true);
webView7.setWebChromeClient(new WebChromeClient());
webView7.setWebViewClient(new WebViewClient());
webView7.getSettings().setBuiltInZoomControls(true);
webView7.loadUrl(url);
}
String url ="file:///android_asset/HTML5.html";
}
Everything else on my presentation works like a charm except the video, it does not play and i get the following error, when I tabbed on the video to play it on the scree on my android tablet - Android 4.0:
MediaPlayer Error (1, -2147483648)
I have been trying to get a solution to my problem for the last 5 days, I have read quite a few forums, change my code several times and nothing.
I found on a post that the reasons for the above error are:
File path is in error. Incorrect directory or Url or Uri found.
Media file is in error, incompatible format.
Missing permissions.
I have checked all the above on my app and still can't find how to solve it.
Everything else on my html5 file and folder works fine, so i don't think is a directory problem.
My embedded video files are .mp4 and .webm sand there are supposed to be supported.
I look at the permission of my files and folder and all seems to be fine.
I have an iPad version of my app working fine with the same html5 files and folder and the videos work fine.
Anyone have any idea how can I fix this problem, coding is supposed to be fun but after 5 days on this problems i am having second thoughts.
Thank you.
DPP
Addition to above:
I found in another forum that android does not allow to play video files larger than 1MB, Is this true? One of my videos is 3.2 MB and the other one is 29MB.
Answer:
the data about the video size is not true per what I have observed. I have set up my videos (Video files MP4 only with not HTML5 code) to play from the "res/raw" folder and it is all good. I just can't get them to play from the assets folder embedded on HTML5.
Still looking around for solutions, but having my videos on the "res/raw" folder it is a good alternative to my problem.
DPP
I have solved this problem by using copyAssets into sd card and running the index.HTML from the sdcard. see post Running an html5 site withing android app
Related
Inside a Python GTK+ 3 application I have a simple WebKit2.WebView (no customization) to display a set html string (no live browsing). The html contains a javascript lightbox with some youtube videos. When I open them, the youtube video box shows up but the content doesn't play and I get a black screen saying ("An error occurred. Please try again later. (Playback ID: ...").
Similar image found on the web: https://i.redd.it/gwqswatndiy11.png
I then tried browsing the YouTube website with the Gnome Web browser (v 3.18.11 on Linux Mint 18.3) [based on WebKit] and the same problem occured with every video.
Of course everything works with other browsers (Chromium and Firefox).
Moreover, everything works if I use WebKit1 instead of WebKit2 in my PyGtk+ 3 app.
So I think the problem lies in the Webkit2 options configuration.
Does anyone know how to solve this problem?
Here is an extract of my code. As you can see, I have already tried to set some options but nothing worked.
[Side note: browser_settings.set_enable_media(True) gives me the error AttributeError: 'Settings' object has no attribute 'set_enable_media'; I don't understand why since in the documentation the method exists]
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GtkSource', '3.0')
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk, GtkSource, GLib, WebKit2
self.webview = WebKit2.WebView.new()
browser_settings = self.webview.get_settings()
browser_settings.set_property('javascript-can-access-clipboard', bool(True))
# browser_context = self.webview.get_context()
# cookie_manager = browser_context.get_cookie_manager()
# cookie_manager.set_accept_policy(WebKit2.CookieAcceptPolicy.ALWAYS)
# browser_settings.set_enable_xss_auditor(False)
# browser_settings.set_allow_universal_access_from_file_urls(True)
# browser_settings.set_allow_file_access_from_file_urls(True)
# browser_settings.set_enable_media(True)
# browser_settings.set_enable_media_capabilities(True)
# browser_settings.set_enable_media_stream(True)
# browser_settings.set_enable_mediasource(True)
# browser_settings.set_media_playback_allows_inline(True)
self.webview.set_settings(browser_settings)
I also couldn't initially play Youtube videos on Gnome Web (3.38.1) on Ubuntu Budgie 20.10. But I was able to make it work.
I checked Software, searched "gstreamer" and I see that most GStreamer codecs were already installed.
I was able to make Youtube videos work by installing "ffmpeg plugin for GStreamer" and "GStreamer WPEWebKit plugin".
I am trying to open files (images, pdfs, videos, etc) downloaded with my React-Native app from my server.
So I'm using RNFetchBlob to download the file then I'm doing the following depending if it's an iOS or Android device:
openFile = (item, path) => {
if (Platform.OS === 'ios') {
RNFetchBlob.ios.previewDocument(path)
} else {
// I've tried setting a real mimetype instead of / but it still doesn't work
RNFetchBlob.android.actionViewIntent(path, '/')
}
}
On iOS it works as expected but nothing happens on Android even though I have apps that can read images, pdfs or videos on the device I'm testing on.
Any ideas why this doesn't work or how I could make the same thing with another library ?
Found out the reason for this, it's a know bug of the library and has a PR waiting to be merged (no timeframe from the repo owner).
Here is the link to the PR: https://github.com/joltup/rn-fetch-blob/pull/317
So basically this needs to be added to line 122-123 of file android/src/main/java/com/RNFetchBlob/RNFetchBlob.java:
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
If above is not working do to the below step:
overwrite the 121 line in android/src/main/java/com/RNFetchBlob/RNFetchBlob.java:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 121 line
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // 122 line
I am using this module react-native-webp to load webp images on ios. However, I am not seeing the images from s3 load. Using an image found from google search, works fine. There are absolutely no logs whatsoever to help debug the issue!
This is an example url that doesn't load: http://s3-ap-south-1.amazonaws.com/rupyacard/offers/pictures/000/000/007/1280/dinner.webp
And this here is one that's loading just fine! https://www.gstatic.com/webp/gallery/1.sm.webp
Can't find a reason for either to not work. I thought it might have to do with the image size but a smaller version doesn't help either. Here's a smaller variant: http://s3-ap-south-1.amazonaws.com/rupyacard/offers/pictures/000/000/007/320/dinner.webp
Please give path images to HTTPS or just do following settings in xcode and clean rebuild app
The main problem is Apple can't load HTTP images without settings.
Hi I would like to programmatically make VLC play a video stream. I dont want to embed VLC just make it play. Normally I start VLC to play a local file like this
System.Diagnostics.Process.Start("VLC.exe", link to local file)
when I try the same process but supplying a vid stream I get an error saying the file cant be found.
System.Diagnostics.Process.Start("VLC.exe", "https://www.youtube.com/watch?v=y2C_3swE9sQ&list=PLrEnWoR732-BHrPp_Pm8_VleD68f9s14-&index=37")
It is supposed to be possible as per the instruction on VLC website:
To receive a HTTP stream, start VLC with : % vlc http://www.example.org/your_file.mpg but I can't seam to get it done.
Could someone point me in the right dirrection?
Your code works perfectly with VLC 2.2.1 which is the latest version.
To avoid The system cannot find the file specified error is better specify complete path of executable:
System.Diagnostics.Process.Start(
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe",
"https://www.youtube.com/watch?v=y2C_3swE9sQ&list=PLrEnWoR732-BHrPp_Pm8_VleD68f9s14-&index=37"
)
If you can't upgrade please note that this isn't a VB.NET problem but an incompatibility between new YouTube format and old versions of VLC: google vlc youtube.lua fix for a possible solution (not tested).
I have been able to run my app exactly ONCE on the device (N8). Since then I always get a ClassNotFoundException when I launch it. It goes like this:
ClassNotFoundException:
com.greencod.pinball.nokia.PinballMIDLet
at java.lang.Class.forName at
...rtCldc.loadApplicationClass at
...rt.jvm.loadApplicationClass at ...
Invoker.handleStarRequest at
...l.rt.midp.MidleInvoker.run at
java.lang.Thread.run
Note that the app runs fine on the emulator. Also, the first time that it ran was througth the debugger in eclipse. Now the debugger or a plain install doesn't produce an app that can run. I am new to Nokia development, so I must be doing something stupid, I just don't know what :) I am using the Symbian^3 SDK 0.9.
To get the application on the phone, I click 'create package' from the manifest view, which build the jar/jad files for 2 targets: SymbianEmulator and SymbianDevice, which I installed by scanning the SDK folder. After I have tried uploading the file to the device by dropping it in the Install folder, by using the debuger in eclipse and with the Ovi program on my computer. The phone itself is configured to accept unsigned application.
I am quite lost and any help is welcome.
Additional Info
Eclipse is building the jad for me, so I'm not sure that is the problem. Here is the jad file:
MIDlet-1: Pinball Deluxe,,com.greencod.pinball.nokia.PinballMIDLet
MIDlet-Jar-Size: 1882
MIDlet-Jar-URL: Pinball-MIDLet.jar
MIDlet-Name: Pinball Deluxe MIDLet
MIDlet-Vendor: GreenCod
MIDlet-Version: 0.1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.1
Navi-Key-Hidden: true
Nokia-MIDlet-App-Orientation: portrait
Nokia-MIDlet-On-Screen-Keypad: no
And here is my class declaration:
package com.greencod.pinball.nokia;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
public class PinballMIDLet extends MIDlet { ... }
It has been solved: nokia forums. Basically the problem was that the build.properties of the project were messed up.