WebKit2.WebView (and Gnome Browser) doesn't play YouTube videos - webkit

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".

Related

react-native-webp loads some wep images but not all

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.

making VLC play external stream using VB.net

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).

Getting error in using SoundJS

I'm using Flash HTML5Canvas document to publish html files.
I want to add audio playback and started using SoundJS but having problems in using it.
I used the following code in the file.
createjs.Sound.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin, createjs.FlashPlugin]);
But when I publish it and and run it in browser(Chrome, Win7 Pro 64) I get the following error in console.
"Cannot read property registerPlugins of undefined"
When I checked the html source code, soundjs source is not mentioned. easeljs, tween & movieclip sources are mentioned.
How do I get this resolved?
Thanks :)
First I needed to edit the html file produced by flash cc.
I manually added the line
"http://code.createjs.com/soundjs-0.6.1.min.js"></script>
Double clicking the edited html file and running in browser gives HTTP errors.
So in the publish settings of Flash CC, I disabled the 'Overwrite HTML' option and then if I test/publish via Flash CC, Soundjs loads fine. It requires a local server to test it and I missed that part.

MediaPlayer Error (1, -2147483648) android programing

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

Rails asset pipeline can't find one certain image

I have a certain image called ui-icons_ffffff_256x240.png. In production it can be found, among other places, in public/assets/images/ui-icons_ffffff_256x240.png.
When I try to view this image in production, I get the following error:
ActionController::RoutingError (No route matches [GET] "/assets/images/ui-icons_ffffff_256x240.png"):
I find this extremely odd since the image most certainly is there:
$ find . -name ui-icons_ffffff_256x240.png
./vendor/assets/stylesheets/jquery-ui/images/ui-icons_ffffff_256x240.png
./public/assets/jquery-ui/images/ui-icons_ffffff_256x240.png
./public/assets/images/ui-icons_ffffff_256x240.png
All the other images in my app work fine and have been forever. I recently upgraded my version of jQuery UI, though, and this one particular image doesn't want to work. (I think it's the only jQuery UI image I'm actually using.)
I'm on Rails 3.2.1. What could be the issue?
Your js plugin requests the image with invalid asset url.
The asset image can be accessed by
/assets/ui-icons_ffffff_256x240.png
But the requested url is
/assets/images/ui-icons_ffffff_256x240.png
So in your javascript or stylesheet you need to correct asset url manually.