Replace Youtube flash with Quicktime Player

Discussion in 'PowerPC Macs' started by cyberghoser1, Apr 5, 2011.

  1. cyberghoser1 macrumors member

    cyberghoser1

    Joined:
    Nov 18, 2009
    Location:
    Athens, Hellas
    #1
    Some 'old' ibooks g4 cannot play decently flash or youtube videos embedded, MacTubes fixes that, in my case i use MacTubes and set as player QuickTime and videos are playing very good, however, there are some tricks-scripts to allow playing embedded videos with quicktime player instead of flash player directly on the browser, i wanted to see if there is something we can use to do that, and there is, a simple script, that you can save as a bookmark, and when you are on the desired video page in youtube for example, click on it, choose the type of the video(default is 18, MP4) and watch youtube without MacTubes, you may ask what's the need to do this since MacTubes does the job? I don't know i kinda like to have many options :)
    For example my graphic card is an ATI Mobility Radeon 9200 with 32MB VRAM and youtube is choppy, at least for me :p

    So here is the script code to add as a bookmark:

    Code:
    javascript:(function() {
        function get_filetype(fmt_id) {
            switch(fmt_id) {
                case '13':
                case '17':
                case '36':
                    return '3GP';
                case '43':
                case '45':
                    return 'WebM';
                case '5':
                case '34':
                case '35':
                    return 'FLV';
                case '18':
                case '22':
                case '37':
                case '38':
                    return 'MP4';
                default:
                    return 'unknown';
            }
        }
        function get_video_url(fmt_url_map, chosen_fmt_id) {
            fmt_url_map=fmt_url_map.substring(fmt_url_map.indexOf(chosen_fmt_id+'|')+chosen_fmt_id.length+1);
            if(fmt_url_map.indexOf(',')!==-1) {
                return fmt_url_map.substring(0, fmt_url_map.indexOf(','));
            } else {
                return fmt_url_map;
            }
        }
        (function main() {
            var args=yt.getConfig('SWF_CONFIG')['args'];
            var fmt_quality_list='';
            var chosen_fmt_id=0;
            var fmt_info=args['fmt_list'].split(',');
            var fmt_resolution='';
            var player=document.getElementById('watch-player');
            var avail_fmt_ids=null;
            var video_url='';
            var start_time='';
            var start_time_split=null;
            var begin=0;
            var offset=0;
            while(offset<fmt_info.length) {
                if(get_filetype(fmt_info[offset].split('/')[0])==='FLV') {
                    fmt_info.splice(offset, 1);
                } else {
                    offset++;
                }
            }
            avail_fmt_ids=new Array(fmt_info.length);
            for(var i in fmt_info) {
                avail_fmt_ids[i]=fmt_info[i].split('/')[0];
                fmt_resolution=fmt_info[i].split('/')[1];
                fmt_quality_list+=(avail_fmt_ids[i]+' = '+fmt_resolution+' ('+get_filetype(avail_fmt_ids[i])+')\n');
            }
            loop: while(true) {
                chosen_fmt_id=prompt('Please enter a format id.\n'+fmt_quality_list, avail_fmt_ids[0]);
                if(chosen_fmt_id===null) {
                    return;
                }
                for(var i in avail_fmt_ids) {
                    if(chosen_fmt_id===avail_fmt_ids[i]) {
                        break loop;
                    }
                }
            }
            do {
                start_time=prompt('Enter the start time in hours, minutes and seconds in hh:mm:ss format.', '0:0:0');
                if(start_time===null) {
                    return;
                }
            } while(start_time.split(':').length>3);
            start_time_split=start_time.split(':');
            if(start_time_split.length===1) {
                begin=(parseInt(start_time)*1000);
            } else {
                for(var i in start_time_split) {
                    begin+=(parseInt(start_time_split[start_time_split.length-1-i])*1000*Math.pow(60, i));
                }
            }
            video_url=get_video_url(args['fmt_url_map'], chosen_fmt_id);
            player.innerHTML='<embed src="'+video_url+'&begin='+begin+'" scale="tofit" />';
        }());
    }());
    Just save it as a bookmark and go on a video page in youtube, click that bookmark and enjoy :)

    I am not the creator of that script of course you can find it in youtube, tested under TenFourFox, i tested some other scripts under GreaseMonkey also but they didnt work.
     
  2. Behemecoatyl macrumors member

    Joined:
    Apr 5, 2011
    #2
    Use download helper and view the videos directly.
     
  3. zen.state macrumors 68020

    zen.state

    Joined:
    Mar 13, 2005
    #3
    You've obviously never used Mactubes.
     
  4. Behemecoatyl macrumors member

    Joined:
    Apr 5, 2011
    #4
    Why would I want to use something that doesn't work as good as downloading the video directly?
     
  5. zen.state macrumors 68020

    zen.state

    Joined:
    Mar 13, 2005
    #5
    Because 95% of the video I or anyone else would ever watch on youtube is nothing we would ever want to save so why put it on your hard drive in the first place? Seems like a very primitive high maintenance method.
     
  6. Behemecoatyl macrumors member

    Joined:
    Apr 5, 2011
    #6
    FYI its already saved to your HD in the cache.
     
  7. zen.state macrumors 68020

    zen.state

    Joined:
    Mar 13, 2005
    #7
    Only whatever amount you designate to use for cache. Once it goes above that it dumps things from the oldest on. This does not at all compare to your very inefficient method of directly downloading every single video you want to watch.

    Not sure if you realize this but streaming as been around for well over a decade. Try it out sometime..
     
  8. Hallivand macrumors regular

    Hallivand

    Joined:
    Aug 26, 2010
    Location:
    Sydney, Australia
  9. Behemecoatyl macrumors member

    Joined:
    Apr 5, 2011
    #9
    It does actually. The 720p and 1080p videos play far cleaner outside the browser than in flash.

    Let me know when youtube starts streaming.
     
  10. zen.state macrumors 68020

    zen.state

    Joined:
    Mar 13, 2005
    #10
    Youtube started streaming when youtube started. I guess you don't understand what it is to begin with.

    Based on all your posts I have seen in a few different threads you seem to just like to disagree with people. Living your life must really suck.
     
  11. RMT25 macrumors member

    Joined:
    Feb 13, 2011
    #11
    opera

    does this script only work on Safari? i tried it using Opera 10.63 and nothing happened.

    love the MacTubes app though :cool:
     
  12. cyberghoser1 thread starter macrumors member

    cyberghoser1

    Joined:
    Nov 18, 2009
    Location:
    Athens, Hellas
    #12
    It works under TenFourFox, since i updated to Leopard i didnt test it in safari yet.
     

Share This Page