*Situation is -*I have to design a webpage that works on both desktop and on mobile devices, that plays an embeded youtube video (not autostarted) which then i can use interact with the video to get the play state etc (using this to count the total time watched, excluding pause/buffer/stop time)
I've managed to build the website using both the IFrame API and Javascript API from Youtube.
*However the problem is-*With Javascript API, the player on the desktop works and the view gets counted too but it doesnt work when i view it on a mobile device. The place where it should show the video (the div tag) doesnt react.
With the IFrame API, everything works in terms of functionality but when i press play on the video, the views do not get counted - accessed from both desktop and mobile. I've tested the viewcount several times, with different IP etc but while javascript API web gets counted instantly, IFrame API web is still not getting counted..
Does anyone have any suggestion to this problem?
Just to remind you, the crucial aspect of the webpage that i need are:
Embeded Youtube player
Being able to interact with the player (e.g. getState() or getDuration())
Website fully functional with mobile access
Valid view count
Thank you all in advance!! :)
Are you sure that the views are really being counted via the javascript api? I have always read that view counts only are considered valid when initiated using the actual YT play button. Meaning you can't initiate play via any API call and have the view count.
Here is a a somewhat dated blog post from Google/Youtube team explaining - https://groups.google.com/forum/#!msg/youtube-api-gdata/7SsbvOJMWL0/rBCBqnFaxRgJ
I'm trying to find something that says this has changed but so far no luck.
** EDIT **
So I went back to the iFrame and Javascript API pages and if you do a search for 'view count' the first piece of content you'll find is a line stating --
"Note: A playback only counts toward a video's official view count if it is initiated via a native play button in the player."
Re-reading your post I'm not sure if you are using the API's to play the video or just to get data from its current state. If you are using it to actually initiate play then the view counts are not actually being counted. If you are seeing something different I'd love to see and learn from it.
Related
I'm currently coding an app which displays a livestream embedded with an iframe loaded with WKWebView (loadHTMLString).
I want to show a "Loading" icon and label whenever the livestream is loading (or even buffering but not a big deal if I can't check if buffering).
Solutions I found:
1) Trying to listen for a media to be played with Javascript which then will send a message to the Swift code and put the "Loading" label in front.
Problem: It will be difficult to listen for a media to be played due to same-site policy (I can't access the body of an iframe downloaded from another source) and as I looked on loads of sites it seems to be difficult to send a message to Swift (I'm new to Swift).
2) Trying to look at the title of the song playing on the device (the title that is shown on the Control Center) because I noticed that whenever a livestream is being played in my app it would appear in the Control Center with the name of the site hosting the livestream.
I tried to look at multiple things but couldn't find one actually working.
3) Trying to look if something is being played with MPNowPlayingInfoCenter.default().nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] (and an infinite loop with timer which might not be the greatest solution)
Or something like that.
But it seems like it always throws me nil
As said before, I'm new to Swift (started like 2 days ago) and don't really understand lots of things but if someone could explain to me how I could solve my problem (if there is one) I would be super grateful!
My question is related to developing HTML5 based apps for TV, using YouTube API to play videos. I've tried to find Google forum to post my question, but they recommend it here. Currently IFrame API is the recommended way. However, I would like to know the extents and proper way to use it for TV. It seems to me that embedding videos on TV will greatly limit possibilities for user. So to concrete questions:
How to avoid "Playback on other websites has been disabled..." error? I'm not playing back from website after all. Meanwhile XBMC/Kodi can playback those videos just fine. Are they using some old deprecated API? I've tried to set origin var in playerVars to https://www.youtube.com/tv, but then the player object is failed to initialize.
How the advertisements are going to be presented/interacted? So far I haven't seen anything with "Skip Ad" button using IFrame API. Only small banner image on left bottom side. But on TV there is no way to click on it. YouTube original TV app is showing "Skip Ad" type ads. Is there some special way for TV apps to present ads in proper way for devices with limited input, like TV?
Similarly the 'i' button appearing on top right side is not useful at all on TV. How to avoid it as well?
So I would like to know the extents I can achieve in my HTML5 based app, presenting YouTube videos, comparing to native YouTube application. Both the legal way and the tricks to achieve best experience for TV users are in interest.
my friends and I are making a website that acts like a radio station called Musare with playlists of YouTube videos that play after each other.
Recently Chrome introduced a new 'feature' that automatically disables autoplaying of videos in background tabs with no option to turn this off. This breaks our site because users don't want to keep going back to the site to start a song. This also broke other big sites, like YouTube playlists, Facebook chat notification sound and a lot of music sharing sites.
By now, a lot of sites have found solutions to bypass this, like dubtrack.fm, YouTube, Facebook and probably some other sites as well.
There is someone working on making an option for it at https://codereview.chromium.org/1414853003/, but that might take weeks or even months for it to be in the main Google Chrome.
If anyone knows how to bypass this, please let me know.
Thanks in advance :)
Already tried:
Starting another video before the current one ends - no success
Messing around with the Player Variables - no success
Other things probably - no success
Extra notes:
We are using the YouTube API. We use YT.Player and the youtubePlayer.loadVideoById(id)
SoundCloud streaming works fine with SC.Stream.
The source code for our project is at https://github.com/Musare/Musare
So I have found out how to bypass it finally, after many hours of trying and researching.
If you just initialize the iframe player of YouTube by using the YT.Player constructor, you can then just use the player variable and use yourPlayerVariable.loadVideoById(id).
You have to first go to the tab for it to start, but after that it will be able to load and play video's without you having to go back to the tab. If you remove and re-add the iframe, you will have to go back for it to start again.
This is an interesting and weird problem, and I'm really not sure what's going on here. Maybe someone can offer me some insight. I have a simple form with a list of songs from both youtube and soundcloud. When the user clicks on one of the links(songs), it sends an ajax call to a script containing the essential ingredients of either a custom html5 youtube player (based on the Tubeplayer plugin), or a custom html5 soundcloud player (based on soundcloud's custom sc-player plugin).
The ajax calls work great. When the user clicks a track in the list, the appropriate plugin pops into the specified div and begins to play the song or video. There is a really wierd issue I'm having however. When I go from a youtube video to a soundcloud song, it works great. The youtube plugin is completely replaced by the soundcloud plugin. Playback on youtube stops and playback on soundcloud begins. But when a soundcloud song is playing and I click a youtube track in the list, the youtube plugin shows up and begins to play, but the soundcloud track continues to play also, even though the content in the div has been completely replaced with the youtube plugin via ajax.
I even tried taking the calls to the soundcloud plugin's js files and putting them into the script that the ajax calls to, so that even they would be replaced when the youtube plugin is called, but I'm still having the issue. Any idea as to what might be going on here? I'm really not very knowledgeable about jquery. Thanks in advance!!
I am trying to integrate a webpage into an iPad application. Something like the Final Hour app where the app is a native app using slideshows. some of the slideshow pages have a small part that is loaded from a website.
The only way I would have known this was when I didn't have internet access the small area where the website loads into said there was no internet connection.
How can I implement something like this? I understand the website aspect but I don't understand what iOS API they use to setup some sort of canvas or frame to hold the website.
Here is an image of the app. The webpage would be loaded into the "blue" box outline.
You are indeed looking for a UIWebView. You need to build the controls yourself if you want your users to navigate in the website. If you just want to show one page, with no Back or Reload button, then you can use it as is.
Note that you should try to make it clear to your users that your app might not work properly if no Internet connection is available.