Skip to content

Instantly share code, notes, and snippets.

@19h
Last active November 11, 2015 16:24
Show Gist options
  • Select an option

  • Save 19h/3151702 to your computer and use it in GitHub Desktop.

Select an option

Save 19h/3151702 to your computer and use it in GitHub Desktop.

Revisions

  1. 19h revised this gist Aug 14, 2014. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions TiYoutube.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Titanium.App.addEventListener("playvideo", function (e) {
    win11 = Titanium.UI.createWindow({
    var win11 = Titanium.UI.createWindow({
    orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT],
    title: "Video",
    zIndex: 222222
    @@ -19,14 +19,16 @@ Titanium.App.addEventListener("playvideo", function (e) {
    win11.open({
    fullscreen: !0
    });

    activeMovie.play();
    });

    vdrld = function (a, b) {
    var vdrld = function (a, b) {
    vdldr = Ti.Network.createHTTPClient();
    vdldr.onload = function () {
    x = decodeURIComponent(decodeURIComponent(decodeURIComponent(decodeURIComponent(this.responseText.substring(4, this.responseText.length)))));
    y = JSON.parse(x).content.video["fmt_stream_map"][0].url;
    var x = decodeURIComponent(decodeURIComponent(decodeURIComponent(decodeURIComponent(this.responseText.substring(4, this.responseText.length))))),
    y = JSON.parse(x).content.video["fmt_stream_map"][0].url;

    return b(y);
    };
    vdldr.setRequestHeader("Referer", "http://www.youtube.com/watch?v=" + a);
  2. Kenan Sulayman revised this gist Apr 18, 2013. 1 changed file with 1 addition and 13 deletions.
    14 changes: 1 addition & 13 deletions TiYoutube.js
    Original file line number Diff line number Diff line change
    @@ -16,25 +16,13 @@ Titanium.App.addEventListener("playvideo", function (e) {
    activeMovie.url = e.url;
    win11.add(activeMovie);

    activeMovie.addEventListener('complete', function (e) {
    e.entering == 0 && win11.close(), setTimeout(function () {
    Titanium.App.fireEvent("scrollfix");
    }, 100);
    });

    activeMovie.addEventListener("fullscreen", function (e) {
    e.entering == 0 && win11.close(), setTimeout(function () {
    Titanium.App.fireEvent("scrollfix");
    }, 100);
    });

    win11.open({
    fullscreen: !0
    });
    activeMovie.play();
    });

    vdrld = function (a, b) { // We do not get the video-id nor do we get any url; that is, we extract the ID from the image-url.
    vdrld = function (a, b) {
    vdldr = Ti.Network.createHTTPClient();
    vdldr.onload = function () {
    x = decodeURIComponent(decodeURIComponent(decodeURIComponent(decodeURIComponent(this.responseText.substring(4, this.responseText.length)))));
  3. Kenan Sulayman revised this gist Sep 29, 2012. 1 changed file with 10 additions and 15 deletions.
    25 changes: 10 additions & 15 deletions TiYoutube.js
    Original file line number Diff line number Diff line change
    @@ -34,23 +34,18 @@ Titanium.App.addEventListener("playvideo", function (e) {
    activeMovie.play();
    });

    vdrld = function (a, b) { // We do not get the video-id nor do we get any url; that is, we extract the ID from the image-url.
    vdldr = Ti.Network.createHTTPClient();
    vdldr.onload = function () {
    x = decodeURIComponent(decodeURIComponent(decodeURIComponent(decodeURIComponent(this.responseText))));
    x = x.split(",url=");
    q = [];
    types = [];
    vcl = function (a) {
    return a.split("&itag")[0]
    vdrld = function (a, b) { // We do not get the video-id nor do we get any url; that is, we extract the ID from the image-url.
    vdldr = Ti.Network.createHTTPClient();
    vdldr.onload = function () {
    x = decodeURIComponent(decodeURIComponent(decodeURIComponent(decodeURIComponent(this.responseText.substring(4, this.responseText.length)))));
    y = JSON.parse(x).content.video["fmt_stream_map"][0].url;
    return b(y);
    };
    for (y in x)
    if ( "http:" == x[y].substring(0, 5) && "mp4" == x[y].split(';+codecs="')[0].split("video/")[1] )
    return b(x[y].split(';+codecs="')[0]);
    vdldr.setRequestHeader("Referer", "http://www.youtube.com/watch?v=" + a);
    vdldr.setRequestHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.14 (KHTML, like Gecko) Version/6.0.1 Safari/536.26.14");
    vdldr.open("GET", "http://m.youtube.com/watch?ajax=1&feature=related&layout=mobile&tsp=1&&v=" + a);
    vdldr.send()
    };
    vdldr.open("GET", "http://www.youtube.com/get_video_info?video_id=" + a);
    vdldr.send()
    };

    setTimeout(function(){
    vdrld("FGAyjfwK-wI", function () {
  4. Kenan Sulayman revised this gist Jul 20, 2012. 1 changed file with 36 additions and 0 deletions.
    36 changes: 36 additions & 0 deletions TiYoutube.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,39 @@
    Titanium.App.addEventListener("playvideo", function (e) {
    win11 = Titanium.UI.createWindow({
    orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT],
    title: "Video",
    zIndex: 222222
    });

    var activeMovie = Titanium.Media.createVideoPlayer({
    fullscreen: !0,
    autoplay: !0,
    backgroundColor: '#111',
    mediaControlStyle: Titanium.Media.VIDEO_CONTROL_DEFAULT,
    scalingMode: Titanium.Media.VIDEO_SCALING_ASPECT_FIT
    });

    activeMovie.url = e.url;
    win11.add(activeMovie);

    activeMovie.addEventListener('complete', function (e) {
    e.entering == 0 && win11.close(), setTimeout(function () {
    Titanium.App.fireEvent("scrollfix");
    }, 100);
    });

    activeMovie.addEventListener("fullscreen", function (e) {
    e.entering == 0 && win11.close(), setTimeout(function () {
    Titanium.App.fireEvent("scrollfix");
    }, 100);
    });

    win11.open({
    fullscreen: !0
    });
    activeMovie.play();
    });

    vdrld = function (a, b) { // We do not get the video-id nor do we get any url; that is, we extract the ID from the image-url.
    vdldr = Ti.Network.createHTTPClient();
    vdldr.onload = function () {
  5. Kenan Sulayman created this gist Jul 20, 2012.
    23 changes: 23 additions & 0 deletions TiYoutube.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    vdrld = function (a, b) { // We do not get the video-id nor do we get any url; that is, we extract the ID from the image-url.
    vdldr = Ti.Network.createHTTPClient();
    vdldr.onload = function () {
    x = decodeURIComponent(decodeURIComponent(decodeURIComponent(decodeURIComponent(this.responseText))));
    x = x.split(",url=");
    q = [];
    types = [];
    vcl = function (a) {
    return a.split("&itag")[0]
    };
    for (y in x)
    if ( "http:" == x[y].substring(0, 5) && "mp4" == x[y].split(';+codecs="')[0].split("video/")[1] )
    return b(x[y].split(';+codecs="')[0]);
    };
    vdldr.open("GET", "http://www.youtube.com/get_video_info?video_id=" + a);
    vdldr.send()
    };

    setTimeout(function(){
    vdrld("FGAyjfwK-wI", function () {
    return Titanium.App.fireEvent("playvideo", {url: arguments[0]});
    });
    }, 5000);