Samsung Smart TV YouTube JavaScript Player API - youtube

i was developed and launched an app for Samsung Smart TV
on(2011 TV) (SDK 2.5) and everything is ok.
and made it by YouTube JavaScript Player API v2
Now i'm trying to convert it to (2012 TV) (SDK 3.5)by use YouTube JavaScript Player API v3
im just change the version value from [apiplayer?version=2&enablejsapi=1 ] to==>[apiplayer?version=3&enablejsapi=1 ]
but nothing shown on tv or emulator just show a youtube word but no video
this is my youtube create function
function createYoutube() {
if (Main.onLine && !youtubeCreated)
{
youtubeCreated = true;
var html = "<object type='application/x-shockwave-flash' id='playerObject' style='width:507px; height:285.1px;'> "+
"<param name='movie' value='http://youtube.googleapis.com/apiplayer?version=3&enablejsapi=1'></param>"+
"<param name='allowScriptAccess' value='always'></param>"+
"<param name='wmode' value='transparent'></param> "+
"</object>";
var player = document.getElementById("player")
widgetAPI.putInnerHTML(player,html);
}
function onYouTubePlayerReady()
{
YouTubePlayer = document.getElementById('playerObject');
YouTubePlayer.addEventListener('onStateChange','onPlayerStateChange');
YouTubePlayer.addEventListener('onError', 'onPlayerError');
refreshPlayer();
}
i tried use http://www.youtube.com/apiplayer?enablejsapi=1&version=3
but nothing changed .

i think you are using the wrong param use this
<param name="movie" value="http://www.youtube.com/apiplayer?&enablejsapi=1&version=3&controls=1&fs=1"></param>
insted of
<param name='movie' value='http://youtube.googleapis.com/apiplayer?version=3&enablejsapi=1'></param>

version=2 implies that the ActionScript 2 runtime will be used. (This version has been deprecated for a few years now and will be shut down soon.) version=3 implies that the ActionScript 3 runtime will be used. It might be that your platform doesn't support the ActionScript 3 runtime, in which case you'd need to follow up with Samsung.

Related

YouTube API: differentiating between Premiered and Livestream

I am using YouTube data API and trying to differentiate prior livestreams vs premiered content. The liveStreamingDetails in the video list is populated for both livestreams and premiered content. Is there a way I can differentiate between the two?
Below is my python code for getting live stream start time. If its not populated, then I know that video is not live stream. But the problem is that this value is getting populated for premiered content as well.
vid_request = youtube.videos().list(part = 'contentDetails, statistics, snippet, liveStreamingDetails, status',id = ','.join(vid_ids))
vid_response = vid_request.execute()
for videoitem in vid_response['items']:
try:
livestreamStartTime = videoitem['liveStreamingDetails']['actualStartTime']
except:
livestreamStartTime = ''
Any pointers on what could work would really help?

vlc onlistnener needed to know the end of the video

Im using VLC to play video but I need to know when the video ends. so basically I need a onlistener. Can someone give me a simple code for onlistener for VLC. Here is the code I'm using to play VLC :
int vlcRequestCode = 42; Uri uri = Uri.parse("/storage/emulated/0/Download/hero.mp4");
vlcIntent.setComponent(new ComponentName("org.videolan.vlc", "org.videolan.vlc.gui.video.VideoPlayerActivity"));
vlcIntent.setDataAndTypeAndNormalize(uri, "video/*");
vlcIntent.putExtra("title", " Concert Collection");
vlcIntent.putExtra("from_start", true);
vlcIntent.putExtra("position", 90000l);
vlcIntent.putExtra("position", 90000l);
startActivityForResult(vlcIntent, vlcRequestCode);

How to implement IndexDB in IOS

I am developing a mobile application using phonegap, Initially I have developed using WEBSQL but now I m planning to move it on INDEXDB. The problem is it does not have direct support on IOS , so on doing much R&D I came to know using IndexedDB Polyfil we can implement it on IOS too
http://blog.nparashuram.com/2012/10/indexeddb-example-on-cordova-phonegap.html
http://nparashuram.com/IndexedDBShim/
Can some please help me how to implement this as there are not enough documentation for this and I cannot figure out a any other solution / api except this
I have tested this on safari 5.1.7
Below is my code and Error Image
var request1 = indexedDB.open(dbName, 5);
request1.onsuccess = function (evt) {
db = request1.result;
var transaction = db.transaction(["AcceptedOrders"], "readwrite");
var objectStore = transaction.objectStore("AcceptedOrders");
for (var i in data) {
var request = objectStore.add(data[i]);
request.onsuccess = function (event) {
// alert("am again inserted")
// event.target.result == customerData[i].ssn;
};
}
};
request1.onerror = function (evt) {
alert("IndexedDB error: " + evt.target.errorCode);
};
Error Image
One blind guess
Maybe your dbName contains illegal characters for WebSQL database names. The polyfill doesn't translate your database names in any kind. So if you create a database called my-test, it would try to create a WebSQL database with the name my-test. This name is acceptable for an IndexedDB database, but in WebSQL you'll get in trouble because of the - character. So your database name has to match both, the IndexedDB and the WebSQL name conventions.
... otherwise use the debugger
You could set a break point onto your alert(...); line and use the debugger to look inside the evt object. This way you may get either more information about the error itself or more information to share with us.
To do so, enable the development menu in the Safari advanced settings, hit F10 and go to Developer > Start debugging JavaScript (something like that, my Safari is in a different language). Now open then "Scripts" tab in the developer window, select your script and set the break point by clicking on the line number. Reload the page and it should stop right in your error callback, where you can inspect the evt object.
If this doesn't help, you could get the non-minified version of the polyfill and try set some breakpoints around their open function to find the origin of this error.
You could try my open source library https://bitbucket.org/ytkyaw/ydn-db/wiki/Home. It works on iOS and Android.

youtube embed - force subtitles in specific language with default

i'm embedding youtube videos with subtitles in specific language (Hebrew, in my case).
im using:
hl=He&cc_load_policy=1
to show the hebrew subtitles and that works fine.
However, if there are no subs in my language, i would like to see the English one (if there are any) as a default. is there a way to force that?
You can force the captions and language using cc_load_policy & cc_lang_pref options via
URL:
http://www.youtube.com/embed/M7lc1UVf-VE?cc_load_policy=1&cc_lang_pref=en
API:
var ytPlayer = new YT.Player(
...
playerVars: {
cc_load_policy: 1,
cc_lang_pref: 'en'
},
....
});
Credits: https://webapps.stackexchange.com/questions/27669/is-there-any-way-to-force-subtitles-in-a-youtube-video
I have not found this anywhere in their api docs, but with your youtube player object you should be able to do the following to change it to english captions:
player.setOption("captions", "track", {"languageCode": "en"}); //Works for html5 ignored by AS3
player.setOption("cc", "track", {"languageCode": "en"}); //Works for AS3 ignored by html5
You can also do:
var module;
if (testplayer.getOptions().indexOf("cc") !== -1) {
module = "cc";
} else if (testplayer.getOptions().indexOf("captions") != -1) {{
module = "captions";
}
var tracklist = testplayer.getOption(module, "tracklist");
// then iterate through the tracklist to see if "he" or "en" is there.
You have cc_load_policy=1 but you can also turn it on via js by:
player.loadModule("captions"); //Works for html5 ignored by AS3
player.loadModule("cc"); //Works for AS3 ignored by html5
to turn it off:
player.unloadModule("captions"); //Works for html5 ignored by AS3
player.unloadModule("cc"); //Works for AS3 ignored by html5
I believe it would be better to just leave out the hl= entirely. (It's not actually one of our officially supported Player parameters.) The subtitles will default to the language preference of the viewer of the video, and my assumption is that it will fall back on English if there are no subtitles in the viewer's preferred language.
The only way I found is changing the URI from
https://www.youtube.com/watch?v=2s3aJfRr9gE
to this pattern
"https://www.youtube-nocookie.com/embed/" + video_id + "?hl=" lang_code
On bash/Linux you can just copy the URI with that structure and then run this command (Spanish code hardcoded) to transform clipboard content (you can make an alias):
xclip -selection c -o | echo "$(cat -)?&hl=es-419" | sed "s|youtube.com/watch?v=|youtube-nocookie.com/embed/|1" | xclip -selection c
You can list the available subtitles ISO 639-1 language codes with youtube-dl:
youtube-dl --list-subs "{video_id or url}"
The only drawback is that the video will cover the complete screen... which might be good thing to stop procrastinating with related videos :)

Flash Media Server & AS3: Publishing works, recording doesn't

I'm currently having an issue with FMS4 developer edition on both Linux (x64) and Windows XP (x86).
When I stream a webcam using ns.publish("foobar", "live") I can watch the live stream on another client, however when i use ns.publish("foobar", "record"); neither broadcasting nor recording works.
Using the "live" parameter the client appears in the log files and in the administration console as "publishing", using "record" the client appears as "idle".
Is there anything I need to configure besides LIVE_DIR in fms.ini?
Is this a restriction in the developer edition?
Is there something else I'm missing?
Here is the relevant part of the code (condensed):
var camLive:Camera = Camera.getCamera();
var nc:NetConnection = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
var ns:NetStream;
nc.connect("rtmp://192.168.1.63/live/");
function netStatusHandler(event:NetStatusEvent):void {
if (event.info.code == "NetConnection.Connect.Success") {
ns = new NetStream(nc);
ns.attachCamera(camLive);
ns.publish("foobar", "record");
}
}
Thanks in advance!
Fabian
The problem is the live application. You can create an empty folder inside "applications", call it "test", then stream to "rtmp://192.168.1.63/test" with parameter "record". According to forums.adobe.com/thread/827134?tstart=0

Resources