I'm making post activity that has long html that can have many youtube iframes or 0 iframes (uknown count) in it.
The default webview youtube iframe has a lot of bugs. It is not autoscaling on rotation, it has not full screen button, and it continues to play after exit from activity to other and a bit buggy.
But I found in feedly almost same but without these bugs. Here screenshot.
How did they do it?
YouTube provides API to embed videos on android application. Its easy to use and very flexible. Please refer to this tutorial for integration.
A project that ports the IFrame API to Android can be found on PierfrancescoSoffritti/android-youtube-player.
Very easy to integrate and very smooth, but doesn't seem to work on all devices yet.
The player you posted might do it the same way. Just have a look at the source files.
Related
We want to play some YouTube videos in my React Native app without YouTube branding. We would like to give the user experience as if the video is playing in a native player. We already tried with webview, react-native-youtube-iframe but still, we are not able to achieve our goal. Either top or bottom section has a YouTube logo, then watch and share options are visible. We want to eliminate those. Any possible way to do this in React Native?
URLs of Youtube videos are different for normal videos and embedded videos.
Normal: https://www.youtube.com/watch?v=DGQwd1_dpuc
Embed: https://www.youtube.com/embed/DGQwd1_dpuc
Please change 'watch?v=' with '/embed/'.
You can also hide controls and information by passing 'showinfo=0' or 'controls=0'.
I recently tried to achieve the similar thing in one of my android app if you can somehow use this particular library
This is an android library and as you mentioned you want to do it in android.
android-youtube-player
I have used this library where i used a player with custom control which helps you override the controls and also this share and next button and even the youtube logo.
Let me know if you need any help further.
Edit:
To enable web UI
IFramePlayerOptions options = new IFramePlayerOptions.Builder().controls(1).build();
Then initialize the player with this controls.
You won't see any logo now.
I want to know if it's possible to design my android app UI with HTML5 and CSS3.
If it's possible, is there any performance issue?
Android has WebView which can render HTML content, but it doesn't provide the same user experience as native apps so its use is generally discouraged.
Yes it possible. As rhoadster91 stated, you can use a normal Android WebView which loads your "index.html". All your HTML files should be in the "assets/www" directory. But you'll find plenty tutorials out there which explain everything step by step. Have a look at Googles developer site.
A second possibility would be Phonegap. It is a little tool which helps you to deploy your app for various devices (Android, iOS, WP,...) while coding your app only once in HTML.
I experimented with jquery mobile, native application and phonegap. Building a web application at first seemed very attractive at first as the coding is a lot easier compared to native applications. Here is my opinion based on my research:
Using phonegap slows your application responses, it loads slowly and together with jquery mobile the response and load time increases. So I didnot use it.
Using jquery alone was no different in Gingerbread mobile and on emulator you can clearly see the lag in switching between one div to another div. I didnot use it either.
What I did was use android Webview. I wrote my own javascript and css and placed them on the head section of my page. Used div for changing pages on button click. This approach worked really good giving nearly native performance.
I have a WebView app that includes embedded YouTube videos on a page. But when I go to that page, it gives me an error with a whole bunch of text. I have searched the internet for the past week but with no luck. Can somebody please help me?
P.S. I am new to Android, so snippets would REALLY help :)
Here's the error:
vp.events.addOnDOMLoadHandler(function()
{vp.website.createVideoPlayer('mediaPlayer_cff30e24_42e1_4eb6
'http://youtube.com/v/XXXX', 569, 485, false);});
You need Flash Player in order to view this.
well from CommonsWare
You cannot show them embedded except perhaps on devices that have Flash.
here is the link: https://stackoverflow.com/a/2292459/1084764
however you can override the urlLoading on your webviewclient
I suggest you reading the whole post : play youtube video in WebView
Check if the Adobe Flash Player on your phone is indeed working properly.
I am making a slider with three different videos. I have some problems regarding the youtube videos embedding as if i embed the videos using object parameter, it works fine on each and every device except on MAC. I applied an alternative for this as i embedded the videos using iframe, now its fine everywhere but the problem occured is, the scrolling effect of the screen has stopped working on Android phones. I have tried applying js codes but still its stuck on Android. URL for my design is as follows if anybody wants to test the design on their end:
http://g-axon.com/minisite/
Please provide a proper solution if you have any.
Try not setting the divs with the class oneByOne_item to display:none.
Setting them to display:none will actually remove them from the render DOM.
And you dont need to that since the container is overflow:hidden anyway..
Does anyone know how well the iFrame HTML tag is supported on Android? Some of my preliminary research indicates that it is supported, but scrolling can be hit or miss and should be avoided. Is there documentation on this anywhere or am I going to have to get ahold of devices to test on?
Android supports the iFrame tag but not the scroll attribute. I had the same issue. Leave off the scroll attribute and the iFrame will display.
I don't know how Android handles frames, plus different Android roms use different browsers.
What I do know is that as of HTML5 frames are deprecated, therefore not a very good practise. If not anything you are going to have more and more compatibility issues with new browsers in the future.
Why don't you do the request on the same page? If the downloader.php has the proper headers the download process should start without breaking or changing the current page at all.
Hence sorry to say but Android has no support for iframe though ios have it.