Let's say, this is the link I'm using to show in android webview using KOTLIN. But, Only a blank page is coming.
https://vimeo.com/user92933894/review/307846259/0b380ce589
Now, here is my code:
var url = intent.getStringExtra("link")
println(url)
val videoPreferences = VideoPreferences(this)
val pointPreferences = PointPrefernce(this)
var videoIds = videoPreferences.getVideoId()
paidvideo.settings.javaScriptEnabled=true
paidvideo.settings.setSupportZoom(true)
paidvideo.webViewClient = object : WebViewClient(){
}
paidvideo.loadUrl(url)
Here the url is getting the link as extras of an intent. And the link is coming perfectly. And youtube link is working perfectly, but not the vimeo's one. BTW, I don't need autoplay option.
At last I found the answer. Actually, here "Uncaught TypeError: Cannot call method 'getItem' of null" error happened. and to solve this error, I needed to add this following line.
paidvideo.settings.domStorageEnabled = true
making domStorageEnabled true solves the problem.
Related
Currently, I was trying to play a video from url in ExoPlayer version 2.18.1. The video play works fine but the problem arises when I try to fetch the title of the video. I searched everywhere but nowhere it shows any solution for the case that title is not being fetched.
I tried to use the onMediaMetadataChanged but that does not work. I even tried using exoPlayer#mediaMetadata but that does not work either. So, i tried placing exoPlayer#mediaMetadata in onPlayerStateChanged but that did not work either. I tried with different properties like
albumTitle
title
displayTitle
but none of them give me the result. Only I get null. What can i do to get the title? This is my code I am using to play the video in case that makes any difference:
exoPlayer = ExoPlayer.Builder(this).build()
binding.player.player = exoPlayer
val url = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
val mediaItem = MediaItem.fromUri(url)
exoPlayer.addMediaItem(mediaItem)
exoPlayer.playWhenReady = true
exoPlayer.addListener(this)
exoPlayer.prepare()
PS: I am using this for my video sample.
I'm trying to get location.reload() to work in a webView. But I can not load it with a url. I have to load it like this:
web_view.loadData(filterString(editor.cleanText), "text/html", "UTF-8")
But then the js code dosn't seeem to be able to relaod the webView. filterString removes comments because it says Unexpected end of input" otherwise
How do I make this work?
Yes I had the same problem sometimes this won't work:
window.open('[YOUR_HTML_PAGE]');
by example
window.open('index.html');
So I use this and this should normally work.
window.open('[YOUR_HTML_PAGE]', '_self', false);
by example
window.open('index.html', '_self', false);
Try window.location.href=page to access. In my case, running fine!
I'm been using the WebView in my project to show a couple of webpages in app.
On Android this works fine. but on iOS it's open the default browser insted of showing it in app, like when you use
Device.OpenUri(new Uri(e.Url))
My code look like this
webView = new WebView
{
Source = new UrlWebViewSource
{
Url = "http://www.google.com",
},
VerticalOptions = LayoutOptions.FillAndExpand
};
this.Content = webView ;
Any one here who know how to make the iOS open the page in-app ?
Using Device.OpenUri will often even according to the Xamarin documentation here, navigate outside the application.
If you want to host the content within your application, the best approach would be to embed the Webview, that it looks like your doing, and set the .Source to a url.
I don't understand why your using Device.OpenUri if you have a WebView instance already on your page.
Just set the .Source property of the WebView to point at some url.
For example:-
WebView objMyWebView = new WebView();
objMyWebView.Source = "http://www.google.com";
I am newbie in Titanium and trying to fetch video lists of a particular channel from YouTube using THIS tutorial.
The problem is, all time i get "No videos were found for this search" message(used inside catch exception) and from Chrome console i get the exception message:
"No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin localhost:8020 is therefore not allowed access. Failed to load resource: the server responded with a status of 503 (Service Unavailable)"
Can anyone point me out what solution would be for this problem? From some googling, i see that is not the problem inside the code, it's a server-side problem, so how can i overcome this YouTube response problem?
And i also checked that, this line var doc = this.responseXML.documentElement; always results to null that's what no videos are found. I used instead:
if (!this.responseXML)
{
//if not XML you have to convert it to XML
doc = Titanium.XML.parseString(this.responseText).documentElement;
}
else
{
//if it is XML, then just set the doc variable
doc = this.responseXML.documentElement;
}
Still doc is null alltime! Thanks in advance for any suggestion.
Well, i solved the problem. In fact that was a browser issue, when i tested in desktop, browser uses localhost:8020 as the address and YouTube didn't response back for that address.
Later, i tested it a real android device and voila!, it works..var doc = this.responseXML.documentElementclearly contains the responseXML and then it extract video information by var items = doc.getElementsByTagName("entry").
Hope that could help someone someday!
In a phonegap-android application i want to open an external link within the application.
For this i used a plugin childBrowser and it works fine.
But the external link is taking time to load for which i want to show a wait/loading message.
I also tried to open the external link through ajax-call, updating the div with the response page. and until reponse is not received i am showing a loading message but the problem with this approach is that page loses its styles and other structure.
I guess this is because i am putting entire external page inside the div tag which cannot render the entire page as the browser can do it.
Code snippet looks like-
<script type="text/javascript">
function loadPage(url) {
var xmlhttp = new XMLHttpRequest();
// Callback function when XMLHttpRequest is ready
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState === 4){
if (xmlhttp.status === 200) {
document.getElementById('container').innerHTML = xmlhttp.responseText;
}
}
};
xmlhttp.open("GET", url , true);
xmlhttp.send();
}
</script>
How can i achieve this, can I override childBrowser?
Also
if i want to open the page in applications' web view then how can i achieve the same for web-view.
EDIT: As per Same origin policy one cannot call to a outside domain using xhr request.
Okay understood. i checked in browser and got expected error: 'XMLHttpRequest cannot load'
But then how does it shows/opens the url in mobile?
Ofcourse the page is not fully functional and thats my original issue.
i would post this as a separate question, but its related to my original question
Thanx.
Any hints/suggestions would be great.