I'm using the GeckoFX 'GeckoWebBrowser' user control to navigate but I can't play Flash videos of any page, for example if I try to navigate to youtube it always displays this error:
There is a way to enable Flash videos?
UPDATE:
I've set this property:
GeckoPreferences.Default("extensions.blocklist.enabled") = False
...And now the background of the videos are shown but I can't reproduce any video.
About the "Emoticon" who says that this video is unaivailbe : this is because the page is not showing properly so you can see all divisions what should be hidden in the page like you must enable JavaScript in your browser.
i had simmilar problems with GeckoFx my suggestion is moving to WEBKITDOTNET is the best for now as compenent
Here
Related
I'm trying to get Selenium to click on one of the most visited web links from the default Chrome web page.
The problem is that Selenium cannot find the element on the page and I think it has to do with the fact that a web page technically didn't get loaded. When you open up Chrome it has HTML elements there but the address bar is completely empty. I think possibly this is why Selenium can't find the link? The code is simple and finding the XPATH wasn't an issue. I just don't know if this is a function that Selenium will be able to do or not. I'm trying to do the click because the navigate() function will not work when I put in the proxy information due to the fact that Selenium doesn't have a built-in way to handle a proxy with username and password.
At the end of the day I'm trying to get the username/password box to pop up by clicking on the link. When I open the browser with Selenium programmatically and then manually click on the link the username/password box pops up. But I can't get Selenium to find the element to click on programmatically.
var did = driver.FindElement(By.XPath("//*[#id='mv-tiles']/a[1]"));
did.Click();
UPDATE 1:
I was able to find the element when taking into consideration the iframe but clicking still is an issue.
var frm = driver.SwitchTo().Frame("mv-single");
var did = frm.FindElement(By.XPath("//*[#id='mv-tiles']/a[1]"));
//did.Click(); <-- I can see it go to the element but nothing occurs
IJavaScriptExecutor js2 = (IJavaScriptExecutor) driver;
js2.ExecuteScript("arguments[0].click();", did);
The JavaScriptExecuter is able to click the element but Chrome blocks the redirect with the following message:
[21040:24704:1204/150143.743:ERROR:CONSOLE(1)] "Unsafe JavaScript attempt to initiate navigation for frame with URL 'chrome-search://local-ntp/local-ntp.html' from frame with URL 'chrome-search://most-visited/single.html?title=Most%20visited&removeTooltip=Don%27t%20show%20on%20this%20page&enableCustomLinks=1&addLink=Add%20shortcut&addLinkTooltip=Add%20shortcut&editLinkTooltip=Edit%20shortcut'. The frame attempting navigation is targeting its top-level window, but is neither same-origin with its target nor has it received a user gesture. See https://www.chromestatus.com/features/5851021045661696.
", source: (1)
FINAL UPDATE:
I gave up and decided to do the browser extension solution for proxies with passwords: https://stackoverflow.com/a/35293222/5415162
That list of "Most Recent Pages" is actually in an iframe, which is probably why Selenium can't find it. Try updating the selector to account for the iframe, or maybe add a wait clause to allow the iframe to finish loading.
Regardless of that solution, I don't think it will act any differently than just navigating to the target URL. So to fix your root problem have you tried setting the proxy details when creating the ChromeOptions?
i search information how to add video from youtube, example:
I want add video from some youtube link.
I think that it should be in webview, but i need some details, because i can't find any information about my problem.
You can use the webview to play youtube video.
string html=#"<html><body><iframe width=""200"" height=""400"" src=""strUrl""></iframe></body></html>";
var myWebView = ( WebView ) FindViewById ( Resource.Id.myWebView );
var settings=myWebView.Settings;
settings.JavaScriptEnabled=true;
settings.UseWideViewPort=true;
settings.LoadWithOverviewMode=true;
settings.JavaScriptCanOpenWindowsAutomatically=true;
settings.DomStorageEnabled=true;
settings.SetRenderPriority(WebSettings.RenderPriority.High);
settings.BuiltInZoomControls = false;
settings.JavaScriptCanOpenWindowsAutomatically=true;
myWebView.SetWebChromeClient(new WebChromeClient());
settings.AllowFileAccess = true;
settings.SetPluginState(WebSettings.PluginState.On);
myWebView.LoadDataWithBaseURL(null,html,"text/html","UTF-8",null);
Add internet permission in manifest file and enable hardwareAccelerated="true". Follow this my blog entry for more detail : http://appliedcodelog.blogspot.in/2015/09/how-to-play-youtube-video-using-webview.html
Update: Everything below is still correct, but the official YouTube API for Android is now available.
By far, the easiest way to play a YouTube video on Android is to simply fire an Intent to launch the native Android YouTube app. Of course, this will fail if you are not on a certified Google device, that doesn't have the complement of Google apps. (The Kindle Fire is probably the biggest example of such a device). The problem with this approach is that the user will not automatically wind up back at your app when the video finishes; they have to press the Back button, and at this point you've probably lost them.
As a second option, you can use the MediaPlayer API to play YouTube videos. But there are three caveats with this approach:
1) You need to make a call to YouTube's GData webservice API, passing it the ID of the video. You'll get back a ton of metadata, along with it the RTSP URL that you should pass to MediaPlayer to play back an H.264-encoded stream. This is probably the reason why your attempt to use MediaPlayer failed; you probably weren't using the correct URL to stream.
2) The GData/MediaPlayer approach will only play back low-resolution content (176x144 or similar). This is a deliberate decision on the part of YouTube, to prevent theft of content. Of course, this doesn't provide a very satisfactory experience. There are back-door hacks to get higher resolution streams, but they aren't supported on all releases of Android and using them is a violation of YouTube's terms of service.
3) The RTSP streams can be blocked by some internal networks/firewalls, so this approach may not work for all users.
The third option is to embed a WebView in your application. There two approaches you can take here:
1) You can embed a Flash object and run the standard desktop Flash player for YouTube. You can even use the Javascript API to control the player, and relay events back to the native Android app. This approach works well, but unfortunately Flash is being deprecated on the Android platform, and will not work for Android 4.1 and later.
2) You can embed a <video> tag to play YouTube via HTML5. Support for this varies between various releases of Android. It works well on Android 4.0 and later; earlier releases have somewhat spotty HTML5 <video> support. So, depending upon what releases of Android your application must support, you can take a hybrid approach of embedding HTML5 on Android 4.x or later, and Flash for all earlier versions of Android.
There are several threads here on StackOverflow about using HTML5 to play YouTube video; none of them really describe the entire process you must follow in one place. Here's links to a few of them:
Android - How to play Youtube video in WebView?
How to embed a YouTube clip in a WebView on Android
Play Youtube HTML5 embedded Video in Android WebView
All of this will get dramatically easier in the weeks/months to come; at Google I/O 2012, they presented/demoed a new YouTube API for Android that will support direct embedding of YouTube content in your application, with full support back to Android 2.2 (about 95% of the Android userbase as of this writing). It can't arrive fast enough.
Thanks #mportuesisf for this wonderful answer.
Heres some links.
http://docs.xamarin.com/recipes/android/media/video/play_video/
Streaming Youtube Videos
for xamarin forms you can use HtmlWebViewSource
in my VM:
public HtmlWebViewSource VideoSource { get; set; }
in constructor :
VideoSource = new HtmlWebViewSource();
VideoSource.Html = #"<html><body> <div style=' position: relative; padding-bottom: 56.25%; padding-top: 25px;'> <iframe style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;' src='https://www.youtube.com/embed/bVdfj7HXuXE' frameborder='0' allowfullscreen></iframe></div> </body></html>";
in my View :
<WebView VerticalOptions="Fill"
HorizontalOptions="Fill"
Source="{Binding VideoSource}"
/>
firstly you must copy the link above the video youtube when you click on share then choose integrate and select the src of the youtube video
then in your c sharp create :
and you're gonna see the video inside the web view
WebView webview = FindViewById<WebView>(Resource.Id.webView1);
video =("the src of the youtube video");
var uri = Android.Net.Uri.Parse(video);
WebSettings settings = webview.Settings;
settings.JavaScriptEnabled = true;
webview.SetWebChromeClient(new WebChromeClient());
webview.LoadUrl(video);
Hello I'm developing a Windows Phone app for a web based game.
I have however run into a problem that I cant figure out how to solve, and hope some of you bright people in here have an idea.
I use a java script to log into the page no problem, but unfortunately the webpage is very badly designed and show up wrong on Windows Phone. The page will not scale and therefor only show a small part of the hole page and it is only possible to scroll up and down and not side ways.
I have made a quick image here to show better.
Link to image on ImageShack
(I dont have rep to post Images yet :-( )
So the actual game is inside an IFrame in the middle of the page but I can only see a small part of it on the phone and can not scroll horizontally.
I tried to download the page using string html = webBrowser1.SaveToString(); and then used a regex function to extract the webpage from the IFrame. The problem with this is that the page uses a HttpOnly Cookie and this cookie is used by the IFrame also to identify the user. So if I navigate directly to the IFrame Url, it wont recognize the user even though it has the cookie because it is on a different website..
So my question is is there a way to force the web-browser to focus on the IFrame, or some way of stripping out the rest of the page and only show IFrame but still use the same HttpOnly Cookie?
Can you make a wraps that iframe, then use the hastag trick ("http://game.com#divwrapper") to navigate to that div. This will scroll the page down
I am having a problem with iframe and WebBrowser. In my app I have a page with WebBrowser which goes to specific url and should show a google map (embedded with iframe). However, it does not. Getting the error "This content cannot be displayed in a frame. To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame."
But if I go to this url with the emulators browser everything works fine, same with ie in my pc. I also tested with other urls which dont have iframes and the WebBrowser works fine. I have also tried webBrowser.NavigateToString with the same code the url has but doesnt work either. I do have the &output=embed at the end of the map url in iframe. Also tried using my api key in the html.
What should I try next?
Im gonna answer to myself.
Adding this line in c#
webBrowser1.IsScriptEnabled = true;
and this in xaml
IsScriptEnabled="True"
did the trick.
So scripting is disabled in WebBrowser control by default.
Well, now I know.
Found the answer from here: http://www.jeffblankenburg.com/2010/10/18/31-days-of-windows-phone-day-18-webbrowser-control/
I'm converting an application from php/js/css over to c#/silverlight for a client.
In the old system, I used a URL & the jquery prettyPhoto plugin to display a youtube video.
In the new system, silverlight cannot play FLV natively.
Does anybody have a process & code for how to get my link from the silverlight app, over to a div in my aspx page hosting the silverlight control (default.aspx), then playing the video?
Cheers,
Scott
Lets say you have this Javascript function in your host .aspx page:-
function goAheadAndPlayThatVid(urlOfVid)
{
// some code that plays the Vid
}
Now in Silverlight/C# code you can invoke this function with:-
HtmlPage.Window.Invoke("goAheadAndPlayThatVid", "urlOfVidHere");