Setting "origin" in youtube-ios-player-helper breaks programatic functionality - ios

Using the YouTube iOS Player Helper library (https://github.com/youtube/youtube-ios-player-helper downloaded on 2015-06-16), if I add the line:
#"origin": #"example.com",
before:
#"modestbranding": #1
at line 30 in SingleVideoViewController.m, then the programatic controls no longer function to affect the video, and the progress bar no longer updates. Additionally, very few of the status messages are being shows/received.
I assume/hope "origin" would show up in analytics, to signify source, which is why I'm setting it.
Is there a specific format this text needs to be in, or something else I should be setting?
I'm cross posting this issue here as I have got no response to the GitHub issue
https://github.com/youtube/youtube-ios-player-helper/issues/121

You are not passing in a valid url for the origin parameter.
Try #"origin": #"https://example.com" or #"origin": #"http://example.com". Note the http(s)://.

Related

Request Fullscreen in Dart

How does requestFullscreen in Dart works? I want enable Fullscreen-mode on mobile devices.
I wrote following Code. But it changes nothing.
querySelector(".btn").onTouchEnd.listen((l) {
var body = document.body;
body.requestFullscreen();
});
But it didn't worked.I'm becomming on click always same error document.body.requestFullscreen is not a function
Seems to be something like https://api.dartlang.org/stable/1.24.3/dart-html/VideoElement/enterFullscreen.html, so you need to call it on your video element.
Edit: Oh, yes, there's also https://api.dartlang.org/stable/1.24.3/dart-html/Element/requestFullscreen.html -- that might be the one you want.
Edit2: Apparently, this has already been asked and answered, and needs a workaround: How to request fullscreen in compiled dart

YouTube html5player won't play on iPad safari; protocol and port exception

I have a strange error occurring only on safari for iPads. I've added a youtube iframe element to the page that looks like this.
<iframe width="560" height="315" src="http://www.youtube.com/embed/dDAB35SYIr0?rel=0" frameborder="0" allowfullscreen></iframe>
As you can see I say the source is http and my site is http as well. Now on iPad Safari I get this console error message
Blocked a frame with origin "https://www.youtube.com" from accessing a
frame with origin "http://example.com". The frame requesting access
has a protocol of "https", the frame being accessed has a protocol of
"http". Protocols must match.
I think this is weird for two reasons
1. I specifically say "use http"
2. It works on other devices
Now if I change the protocol to https (now I'm on a https site as well) and try this, I get this error instead
Blocked a frame with origin "https://www.youtube.com" from accessing a
frame with origin "https://www.example.com". Protocols, domains, and ports
must match.
All errors references the html5player.js file.
How can I solve this?
Thanks for your help
Ok, so it seems webkit on IPad has a bug, a weird one. I read it here -> https://tmpworldwide.github.io/bugs/ios-tappy-bug.html
I'll quote a bit of it
Applying the :active pseudo-class to a universal selector (*) and including a property of -webkit-tap-highlight-color seems to be the culprit.
*:active {
-webkit-tap-highlight-color: tomato;
}
Now, here is the strange part. The bug is only triggered when the above CSS block is present and there is an input element present on the page with a type attribute value of "search". I know, crazy, right?
Another oddity here is that when you apply focus to the search input, type something in, and then attempt to play video, it will then work.
The solution for now is to change to input type="search" to input type="text".

How To Display Youtube Video Thumbnail?

I have a fragment with a ScrollView and I want to display the YouTube thumbnail of a video as one of the items in the scrollview.
I looked up everywhere but couldn't understand how to, I really need the base.
Please help me, I'm stuck like this for days...
This method supposed to take the VIDEO_ID(from YouTube) and take it's thumbnail.
This thumnbail should be displayed in youTubeThumbnailView.
Here is something I tried:
public void getThumbnail(){
String VIDEO_ID = "xxxxxx";
YouTubeThumbnailView youTubeThumbnailView = new YouTubeThumbnailView(getActivity());
youTubeThumbnailView = (YouTubeThumbnailView)youTubeThumbnailView.findViewById(R.id.thumbnail);
youTubeThumbnailView.//Dont know how to continue :(.
}
Take a look at the updated version of the youtube-android sdk (version 1.2.1 released on 22 Jan 2015).
The changelog states something interesting about thumnails:
The YouTubeThumbnailLoader interface's documentation has been updated to note that you must call the interface's release() method when you are finished with the YouTubeThumbnailLoader. The documentation for the YouTubeThumbnailView class also mentions this requirement.

YouTube API not returning full description

I'm currently using the YouTube API V2 inside my iOS app, however the description seems to be bugged and cuts off. It never returns the full description. It always stops at .... I've never had this issue before, does anyone know what I'm doing wrong or what YouTube did to their API ?
Here's the API request I'm calling : http://gdata.youtube.com/feeds/api/users/DaveDays/uploads?q=&v=2&start-index=1&max-results=50&orderby=published&time=this_week
Example: Instead of returning this description
This is Dave's reaction/parody to Miley Cyrus video We Can't Stop.
iTunes: https://itunes.apple.com/us/album/we-...
Twitter: http://www.twitter.com/davedays
Facebook: http://www.facebook.com/ddays
Instagram: http://www.instagram.com/davedays
Merch!! http://www.westaspenmerch.com/davedays
Credits:
Chris http://www.youtube.com/iamchrisc
Nikki http://www.youtube.com/nikkinhollywood
Joey: http://www.youtube.com/bambamjoey
Matt: http://www.youtube.com/matthewdamc
Parody of Miley Cyrus' song We Can't Stop! Twerking it upp! Hi Miley Cyrus. We can't stop either. Miley Cyrus.
it returns this one
This is Dave's reaction/parody to Miley Cyrus video We Can't Stop. iTunes: https://itunes.apple.com/us/album/we-cant-stop-parody-single/id685057235 Twitter: ...
If you think its a bug, then check and report it at: https://code.google.com/p/gdata-issues/issues/list?q=label:API-YouTube
If additional parameters changes the request into a search request, then it will give a short description.
The url and basic parameters do return the full description. Like in: http://gdata.youtube.com/feeds/api/users/DaveDays/uploads?v=2&start-index=1&max-results=50
The add of the other parameters seems to be the cause.
But, "time=this_week" seems to give the longer description:
http://gdata.youtube.com/feeds/api/users/DaveDays/uploads?v=2&start-index=1&max-results=50&time=this_week
Since its about the uploads of one channel, an option could be to get all videos first and do ordering and/or filtering yourself, later.

How does phoneGap (Cordova) work internally, iOS specific

I have started developing html applications for mutliple platforms. I recently heard about Cordova 2.0(PhoneGap) and ever since I have been curious to know how the bridge works.
After lot of code walking, i saw that the Exec.js is the code where call from JS -> Native happens
execXhr = execXhr || new XMLHttpRequest();
// Changeing this to a GET will make the XHR reach the URIProtocol on 4.2.
// For some reason it still doesn't work though...
execXhr.open('HEAD', "file:///!gap_exec", true);
execXhr.setRequestHeader('vc', cordova.iOSVCAddr);
if (shouldBundleCommandJson()) {
execXhr.setRequestHeader('cmds', nativecomm());
}
execXhr.send(null);
} else {
execIframe = execIframe || createExecIframe();
execIframe.src = "gap://ready";
But want to understand how that works, what is the concept here, what does file:///!gap_exec or gap://ready do? and how does the call propgate to the lower layers (native code layers)
thanks a bunch in advance.
The trick is easy:
There is a webview. This displays your app. The webview will handle all navigation events.
If the browser navigates to:
file:///!gap_exec
or
gap://
the webview will cancel the navigation. Everything behind these strings is re-used as an identifier, to get the concrete plugin/plugin-method and parameter:
pseudo-url example:
gap://echoplugin/echothistext?Hello World
This will cause phonegap to look for an echoplugin and call the echothistext method to send the text "Hello World" to the (native) plugin.
update
The way back from native to javascript is (or may be) loading a javascript: url into the webview.
The concrete implementation is a little bit more complex, because the javascript has to send a callback-id to native code. There could be more than one native call are running at the same time. But in fact this is no magic at all. Just a number to get the correct JSON to the right javascript-callback.
There are different ways to communicate between the platform and javascript. For Android there are three or four different bridges.
I am trying to figure this out in more detail, too. Basically there are 2 Methods on the iOS side that can help ...
- webView:shouldStartLoadWithRequest:navigationType: and
- stringByEvaluatingJavaScriptFromString:script
From the sources it seems cordova sends a "READY" message using webView:shouldStartLoadWithRequest:... and then picks up results with the second message, but I am not sure.
Cordova Sources iOSExec
There is much to learn there.

Resources