Ticket #9301: mythflash.patch

File mythflash.patch, 27.5 KB (added by Jonatan <mythtv@…>, 9 years ago)
  • mythtv/programs/mythbackend/mythxml.cpp

     
    123123    if (sURI == "GetVideoArt"           ) return MXML_GetVideoArt;
    124124    if (sURI == "GetInternetSearch"     ) return MXML_GetInternetSearch;
    125125    if (sURI == "GetInternetSources"    ) return MXML_GetInternetSources;
     126    if (sURI == "GetInternetContent"    ) return MXML_GetInternetContent;
    126127
    127128    return MXML_Unknown;
    128129}
     
    229230                case MXML_GetInternetSources :
    230231                    GetInternetSources( pRequest );
    231232                    return true;
     233                case MXML_GetInternetContent :
     234                    GetInternetContent( pRequest );
     235                    return true;
    232236
    233237                case MXML_GetConnectionInfo    :
    234238                    GetConnectionInfo( pRequest );
     
    16621666    pRequest->FormatActionResponse( list );
    16631667}
    16641668
     1669void MythXML::GetInternetContent( HTTPRequest *pRequest )
     1670{
     1671    pRequest->m_eResponseType   = ResponseTypeHTML;
     1672
     1673    QString grabber =  pRequest->m_mapParams[ "Grabber" ];
     1674
     1675    if (grabber.isEmpty())
     1676        return;
     1677
     1678    QString contentDir = QString("%1internetcontent/").arg(GetShareDir());
     1679    QString htmlFile(contentDir + grabber);
     1680
     1681    // Try to prevent directory traversal
     1682    QFileInfo fileInfo(htmlFile);
     1683    if (fileInfo.canonicalFilePath().startsWith(contentDir) &&
     1684        QFile::exists( htmlFile ))
     1685    {
     1686        pRequest->m_eResponseType   = ResponseTypeFile;
     1687        pRequest->m_nResponseStatus = 200;
     1688        pRequest->m_sFileName       = htmlFile;
     1689    }
     1690    else
     1691    {
     1692        pRequest->FormatRawResponse( QString("<HTML>File %1 does "
     1693                  "not exist!</HTML>").arg(htmlFile) );
     1694    }
     1695}
     1696
    16651697/////////////////////////////////////////////////////////////////////////////
    16661698//
    16671699/////////////////////////////////////////////////////////////////////////////
  • mythtv/programs/mythbackend/mythxml.h

     
    5454    MXML_GetVideoArt            = 17,
    5555    MXML_GetInternetSearch      = 18,
    5656    MXML_GetInternetSources     = 19,
     57    MXML_GetInternetContent     = 20,
    5758
    58     MXML_GetFile                = 20,
    59     MXML_GetFileList            = 21,
    60     MXML_GetFileLinks           = 22,
     59    MXML_GetFile                = 21,
     60    MXML_GetFileList            = 22,
     61    MXML_GetFileLinks           = 23,
    6162
    6263} MythXMLMethod;
    6364
     
    127128
    128129        void    GetInternetSearch( HTTPRequest *pRequest );
    129130        void    GetInternetSources( HTTPRequest *pRequest );
     131        void    GetInternetContent( HTTPRequest *pRequest );
    130132
    131133        void    GetDeviceDesc  ( HTTPRequest *pRequest );
    132134        void    GetFile        ( HTTPRequest *pRequest, QString sFileName );
  • mythplugins/mythbrowser/mythbrowser/bookmarkmanager.cpp

     
    1919#include "bookmarkeditor.h"
    2020#include "browserdbutil.h"
    2121#include "mythbrowser.h"
     22#include "mythflashplayer.h"
    2223
    2324// ---------------------------------------------------
    2425
     
    381382    {
    382383        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    383384
    384         MythBrowser *mythbrowser = new MythBrowser(mainStack, urls, zoom.toFloat());
     385        MythScreenType *mythbrowser;
     386        if (urls[0].startsWith("mythflash://"))
     387            mythbrowser = new MythFlashPlayer(mainStack, urls);
     388        else
     389            mythbrowser = new MythBrowser(mainStack, urls, zoom.toFloat());
    385390
    386391        if (mythbrowser->Create())
    387392        {
  • mythplugins/mythbrowser/mythbrowser/mythflashplayer.h

     
     1#ifndef MYTHFLASHPLAYER_H
     2#define MYTHFLASHPLAYER_H
     3
     4#include <mythscreentype.h>
     5
     6class MythUIWebBrowser;
     7
     8class MythFlashPlayer : public MythScreenType
     9{
     10  Q_OBJECT
     11
     12  public:
     13    MythFlashPlayer(MythScreenStack *parent, QStringList &urlList);
     14    ~MythFlashPlayer();
     15
     16    bool Create(void);
     17    bool keyPressEvent(QKeyEvent *);
     18
     19  private:
     20    QVariant evaluateJavaScript(const QString&);
     21    MythUIWebBrowser*         m_browser;
     22    QString                   m_url;
     23};
     24
     25#endif
  • mythplugins/mythbrowser/mythbrowser/mythbrowser.pro

     
    1616INSTALLS += installimages
    1717
    1818# Input
    19 HEADERS += mythbrowser.h webpage.h
     19HEADERS += mythbrowser.h mythflashplayer.h webpage.h
    2020HEADERS += bookmarkmanager.h bookmarkeditor.h browserdbutil.h
    21 SOURCES += main.cpp mythbrowser.cpp webpage.cpp
     21SOURCES += main.cpp mythbrowser.cpp mythflashplayer.cpp webpage.cpp
    2222SOURCES += bookmarkmanager.cpp bookmarkeditor.cpp browserdbutil.cpp
    2323
    2424include ( ../../libs-targetfix.pro )
  • mythplugins/mythbrowser/mythbrowser/main.cpp

     
    1515#include "bookmarkmanager.h"
    1616#include "browserdbutil.h"
    1717#include "mythbrowser.h"
     18#include "mythflashplayer.h"
    1819
    1920using namespace std;
    2021
     
    3031    float zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4").toFloat();
    3132
    3233    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     34    MythScreenType *mythbrowser;
     35    if (urls[0].startsWith("mythflash://"))
     36        mythbrowser = new MythFlashPlayer(mainStack, urls);
     37    else
     38        mythbrowser = new MythBrowser(mainStack, urls, zoom);
    3339
    34     MythBrowser *mythbrowser = new MythBrowser(mainStack, urls, zoom);
    35 
    3640    if (mythbrowser->Create())
    3741        mainStack->AddScreen(mythbrowser);
    3842    else
  • mythplugins/mythbrowser/mythbrowser/mythflashplayer.cpp

     
     1#include <stdlib.h>
     2#include <iostream>
     3
     4// qt
     5#include <QApplication>
     6#include <QEvent>
     7
     8// myth
     9#include <mythverbose.h>
     10#include <mythcontext.h>
     11#include <libmythui/mythmainwindow.h>
     12#include <mythuiwebbrowser.h>
     13
     14// mythbrowser
     15#include "webpage.h"
     16#include "mythflashplayer.h"
     17
     18using namespace std;
     19
     20MythFlashPlayer::MythFlashPlayer(MythScreenStack *parent,
     21                         QStringList &urlList)
     22    : MythScreenType (parent, "mythflashplayer"),
     23      m_browser(NULL), m_url(urlList[0])
     24{
     25    qApp->setOverrideCursor(QCursor(Qt::BlankCursor));
     26}
     27
     28
     29MythFlashPlayer::~MythFlashPlayer()
     30{
     31    qApp->restoreOverrideCursor();
     32
     33    if (m_browser)
     34    {
     35        m_browser->disconnect();
     36        DeleteChild(m_browser);
     37        m_browser = NULL;
     38    }
     39}
     40
     41bool MythFlashPlayer::Create(void)
     42{
     43    m_browser = new MythUIWebBrowser(this, "mythflashplayer");
     44    m_browser->SetArea(GetMythMainWindow()->GetUIScreenRect());
     45    m_browser->Init();
     46    m_browser->SetActive(true);
     47    m_browser->Show();
     48
     49    BuildFocusList();
     50
     51    SetFocusWidget(m_browser);
     52
     53    m_url.replace("mythflash://", "http://");
     54    VERBOSE(VB_GENERAL, QString("Opening %1").arg(m_url));
     55    m_browser->LoadPage(QUrl::fromEncoded(m_url.toLocal8Bit()));
     56
     57    return true;
     58}
     59
     60QVariant MythFlashPlayer::evaluateJavaScript(const QString& source)
     61{
     62    return m_browser->evaluateJavaScript(source);
     63}
     64
     65bool MythFlashPlayer::keyPressEvent(QKeyEvent *event)
     66{
     67    QStringList actions;
     68    bool handled = GetMythMainWindow()->TranslateKeyPress("TV Playback", event, actions);
     69
     70    for (int i = 0; i < actions.size() && !handled; i++)
     71    {
     72        QString action = actions[i];
     73        handled = true;
     74
     75        if (action == "PAUSE")
     76            evaluateJavaScript("play();");
     77        else if (action == "SEEKFFWD")
     78            evaluateJavaScript("seek(10);");
     79        else if (action == "SEEKRWND")
     80            evaluateJavaScript("seek(-10);");
     81        else if (action == "CHANNELUP")
     82            evaluateJavaScript("seek(60);");
     83        else if (action == "CHANNELDOWN")
     84            evaluateJavaScript("seek(-60);");
     85        else
     86            handled = false;
     87
     88        if (handled)
     89            return true;
     90    }
     91
     92    handled = m_browser->keyPressEvent(event);
     93
     94    if (!handled && MythScreenType::keyPressEvent(event))
     95        handled = true;
     96
     97    return handled;
     98}
  • mythtv/libs/libmythui/mythuiwebbrowser.h

     
    7272    bool CanGoForward(void);
    7373    bool CanGoBack(void);
    7474
     75    QVariant evaluateJavaScript(const QString& scriptSource);
     76
    7577  public slots:
    7678    void Back(void);
    7779    void Forward(void);
  • mythtv/libs/libmythui/mythuiwebbrowser.cpp

     
    322322{
    323323    if (m_browser)
    324324    {
     325        m_browser->hide();
    325326        m_browser->disconnect();
    326327        m_browser->deleteLater();
    327328        m_browser = NULL;
     
    551552        return QUrl();
    552553}
    553554
     555/** \fn MythUIWebBrowser::evaluateJavaScript(const QString& scriptSource)
     556 *  \brief Evaluates the JavaScript code in \a scriptSource.
     557 *  \return QVariant
     558 */
     559QVariant MythUIWebBrowser::evaluateJavaScript(const QString& scriptSource)
     560{
     561    if (m_browser)
     562        return m_browser->page()->mainFrame()->evaluateJavaScript(scriptSource);
     563    else
     564        return QVariant();
     565}
     566
    554567void MythUIWebBrowser::slotLoadStarted(void)
    555568{
    556569    emit loadStarted();
  • mythtv/bindings/python/MythTV/methodheap.py

     
    995995                        find('InternetContent').findall('grabber'):
    996996            yield InternetSource.fromEtree(grabber, self)
    997997
     998    def getInternetContentUrl(self, grabber, videocode):
     999        return "mythflash://%s:%s/Myth/GetInternetContent?Grabber=%s&videocode=%s" \
     1000            % (self.host, self.port, grabber, videocode)
     1001
    9981002    def getPreviewImage(self, chanid, starttime, width=None, \
    9991003                                                 height=None, secsin=None):
    10001004        starttime = datetime.duck(starttime)
  • mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/vimeo_api.py

     
    6161import xml.etree.ElementTree as ET
    6262import inspect
    6363import oauth.oauth_api as oauth
     64from MythTV import MythXML
    6465
    6566from vimeo_exceptions import (VimeoUrlError, VimeoHttpError, VimeoResponseError, VimeoVideoNotFound, VimeoRequestTokenError, VimeoAuthorizeTokenError, VimeoVideosSearchError, VimeoAllChannelError, __errmsgs__)
    6667
     
    669670
    670671        """
    671672        self.config = {}
     673        self.mythxml = MythXML()
    672674
    673675        self.config['debug_enabled'] = debug # show debugging messages
    674676
     
    980982                        if url.get('type') == 'video':
    981983                            if url.text: # Make the link fullscreen and auto play
    982984                                if embed_flag:
    983                                     v_details[url.tag] = self.ampReplace(url.text.strip().replace(u'http://vimeo.com/', u'http://vimeo.com/moogaloop.swf?clip_id=')+u'&autoplay=1')
     985                                    playerUrl = self.mythxml.getInternetContentUrl("nv_python_libs/configs/HTML/vimeo.html", \
     986                                                                                   url.text.strip().replace(u'http://vimeo.com/', ''))
     987                                    v_details[url.tag] = self.ampReplace(playerUrl)
    984988                                else:
    985989                                    v_details[url.tag] = self.ampReplace(url.text.strip())
    986990                            else:
  • mythtv/programs/scripts/internetcontent/nv_python_libs/configs/HTML/vimeo.html

     
     1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
     2<html>
     3    <head>
     4        <style type="text/css">
     5            body {
     6                padding: 0;
     7                margin: 0;
     8            }
     9        </style>
     10        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
     11        <script type="text/javascript">
     12            /* gup function by R.D. Vaughan */
     13            function gup( name )
     14            {
     15                name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
     16                var regexS = "[\\?&]"+name+"=([^&#]*)";
     17                var regex = new RegExp( regexS );
     18                var results = regex.exec( window.location.href );
     19                if( results == null )
     20                    return "";
     21                else
     22                    return results[1];
     23            }
     24
     25            var video_id = gup( 'videocode' );
     26            var myth_player = false;
     27            var paused = false;
     28
     29            function vimeo_player_loaded(swf_id) {
     30                myth_player = document.getElementById(swf_id);
     31                document.getElementById('controls').style.display = '';
     32            }
     33
     34            function play() {
     35                if (paused) {
     36                    myth_player.api_play();
     37                    paused = false;
     38                }
     39                else if (!paused) {
     40                    myth_player.api_pause();
     41                    paused = true;
     42                }
     43            }
     44
     45            function seek(amount) {
     46                if (myth_player) {
     47                    myth_player.api_seekTo(myth_player.api_getCurrentTime() + amount);
     48                }
     49            }
     50
     51            var flashvars = {
     52                clip_id: video_id,
     53                show_portrait: 1,
     54                show_byline: 1,
     55                show_title: 1,
     56                fp_version: 10,
     57                js_api: 1, // required in order to use the Javascript API
     58                js_onLoad: 'vimeo_player_loaded', // moogaloop will call this JS function when it's done loading (optional)
     59                js_swf_id: 'myth_player' // this will be passed into all event methods so you can keep track of multiple moogaloops (optional)
     60            };
     61            var params = {
     62                allowscriptaccess: 'always',
     63                allowfullscreen: 'true',
     64                wmode: 'opaque',
     65               
     66            };
     67            var attributes = {};
     68
     69            // For more SWFObject documentation visit: http://code.google.com/p/swfobject/wiki/documentation
     70            swfobject.embedSWF("http://vimeo.com/moogaloop.swf?autoplay=1", "myth_player", window.innerWidth, window.innerHeight, "9.0.0","expressInstall.swf", flashvars, params, attributes);
     71        </script>
     72    </head>
     73    <body>
     74        <div id="myth_player"/>
     75    </body>
     76</html>
  • mythtv/programs/scripts/internetcontent/nv_python_libs/youtube/youtube_api.py

     
    3838import os, struct, sys, re, time
    3939import urllib, urllib2
    4040import logging
     41from MythTV import MythXML
    4142
    4243try:
    4344    import xml.etree.cElementTree as ElementTree
     
    148149
    149150        """
    150151        self.config = {}
     152        self.mythxml = MythXML()
    151153
    152154        if apikey is not None:
    153155            self.config['apikey'] = apikey
     
    522524                                continue
    523525                            if not elem.get(key) == '5':
    524526                                continue
    525                             item['video'] = self.ampReplace((elem.get('url')+'&autoplay=1'))
     527                            m = re.search("/v/([^?]+)", elem.get("url"))
     528                            if m:
     529                                url = self.mythxml.getInternetContentUrl("nv_python_libs/configs/HTML/youtube.html", \
     530                                                                         m.group(1))
     531                                item['video'] = self.ampReplace(url)
     532                            else:
     533                                item['video'] = self.ampReplace((elem.get('url')+'&autoplay=1'))
    526534                            flash = True
    527535                        continue
    528536            if not item.has_key('video'):
  • mythtv/programs/scripts/internetcontent/nv_python_libs/configs/HTML/youtube.html

     
    11<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    22<html>
    3   <head>
    4   <!-- Author: R.D. Vaughan
    5        Apr 28th, 2010
    6        Purpose: Implement full screen browser video display for the BBC iPlayer
    7   Example:
    8   file:///usr/local/share/mythtv/mythnetvision/scripts/nv_python_libs/configs/HTML/bbciplayer.html?videocode=b00s5nfv
    9   -->
    10     <script type="text/javascript">
    11       function gup( name )
    12         {
    13           name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    14           var regexS = "[\\?&]"+name+"=([^&#]*)";
    15           var regex = new RegExp( regexS );
    16           var results = regex.exec( window.location.href );
    17           if( results == null )
    18             return "";
    19           else
    20             return results[1];
    21         }
     3    <head>
     4        <style type="text/css">
     5            body {
     6                padding: 0;
     7                margin: 0;
     8            }
     9        </style>
    2210
    23       var videocode = gup( 'videocode' );
    24       var embedded = '<embed height="98%" width="100%" type="application/x-shockwave-flash" src="http://s.ytimg.com/yt/swf/watch-vfl170492.swf" id="movie_player" flashvars="rv.7.length_seconds=136&amp;rv.2.thumbnailUrl=http%3A%2F%2Fi2.ytimg.com%2Fvi%2FIFhhaXDziZ4%2Fdefault.jpg&amp;rv.0.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBf04aUZMIVQ&amp;rv.0.view_count=28868&amp;vq=auto&amp;rv.6.author=krlitosito&amp;rv.3.view_count=34084&amp;rv.0.length_seconds=251&amp;rv.4.thumbnailUrl=http%3A%2F%2Fi3.ytimg.com%2Fvi%2FzI9C9j0QgU4%2Fdefault.jpg&amp;fmt_url_map=34%7Chttp%3A%2F%2Fv11.lscache8.c.youtube.com%2Fvideoplayback%3Fip%3D99.0.0.0%26sparams%3Did%252Cexpire%252Cip%252Cipbits%252Citag%252Calgorithm%252Cburst%252Cfactor%26fexp%3D902303%252C906712%26algorithm%3Dthrottle-factor%26itag%3D34%26ipbits%3D8%26burst%3D40%26sver%3D3%26expire%3D1276203600%26key%3Dyt1%26signature%3D977BE213A3E74A1B3597CC270D8990872B299745.B36097223339C126F6C108E54090CDAEFE383D73%26factor%3D1.25%26id%3Db9493e8e24226592%2C5%7Chttp%3A%2F%2Fv14.lscache2.c.youtube.com%2Fvideoplayback%3Fip%3D99.0.0.0%26sparams%3Did%252Cexpire%252Cip%252Cipbits%252Citag%252Calgorithm%252Cburst%252Cfactor%26fexp%3D902303%252C906712%26algorithm%3Dthrottle-factor%26itag%3D5%26ipbits%3D8%26burst%3D40%26sver%3D3%26expire%3D1276203600%26key%3Dyt1%26signature%3D42F8774F51ED24983133B8D8F797908F97D8C371.3B0C17A6728074833130840B82BE167F4CA1035D%26factor%3D1.25%26id%3Db9493e8e24226592&amp;csi_page_type=wwad&amp;cr=CA&amp;rv.1.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPzeRpPSZOjI&amp;rv.6.thumbnailUrl=http%3A%2F%2Fi3.ytimg.com%2Fvi%2FBwBz4h_4POA%2Fdefault.jpg&amp;host_language=en&amp;rv.3.rating=4.92660550459&amp;fmt_list=34%2F0%2F9%2F0%2F115%2C5%2F0%2F7%2F0%2F0&amp;rv.7.id=P5y-yjheRKE&amp;targeting_video_doc_id=&amp;rv.0.rating=4.97297297297&amp;invideo=True&amp;rv.5.id=6oHEgkK9wj0&amp;tk=Rqbx09U3FZ_vusI7vVWVX-zIbWbZAIm1Q2GN6gt7W3SQKWb-qm-Lvw%3D%3D&amp;sffb=True&amp;rv.0.id=Bf04aUZMIVQ&amp;rv.5.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D6oHEgkK9wj0&amp;timestamp=1276178843&amp;rv.0.author=WaspEnterprise&amp;rv.3.thumbnailUrl=http%3A%2F%2Fi3.ytimg.com%2Fvi%2F663CI_o4sTY%2Fdefault.jpg&amp;rv.2.author=8Etech8&amp;rv.6.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBwBz4h_4POA&amp;ad_host=ca-host-pub-4790912793353039&amp;ad_eurl=http%3A%2F%2Fwww.youtube.com%2Fvideo%2FVIDEOCODE&amp;mpu=True&amp;hl=en_US&amp;ad_flags=1&amp;rv.0.thumbnailUrl=http%3A%2F%2Fi3.ytimg.com%2Fvi%2FBf04aUZMIVQ%2Fdefault.jpg&amp;rv.5.length_seconds=282&amp;rv.7.author=krlitosito&amp;rv.5.view_count=7517&amp;rv.1.length_seconds=251&amp;rv.3.id=663CI_o4sTY&amp;rv.2.id=IFhhaXDziZ4&amp;rv.2.length_seconds=316&amp;t=vjVQa1PpcFMjs5n51hkGar4Hp9uA3GYTt6LvegEYo00%3D&amp;rv.6.id=BwBz4h_4POA&amp;cafe_experiment_id=&amp;rv.6.view_count=2565&amp;rv.3.author=krlitosito&amp;rv.4.id=zI9C9j0QgU4&amp;fexp=902303%2C906712&amp;allow_embed=1&amp;ad_host_tier=54235&amp;fmt_stream_map=34%7Chttp%3A%2F%2Fv11.lscache8.c.youtube.com%2Fvideoplayback%3Fip%3D99.0.0.0%26sparams%3Did%252Cexpire%252Cip%252Cipbits%252Citag%252Calgorithm%252Cburst%252Cfactor%26fexp%3D902303%252C906712%26algorithm%3Dthrottle-factor%26itag%3D34%26ipbits%3D8%26burst%3D40%26sver%3D3%26expire%3D1276203600%26key%3Dyt1%26signature%3D977BE213A3E74A1B3597CC270D8990872B299745.B36097223339C126F6C108E54090CDAEFE383D73%26factor%3D1.25%26id%3Db9493e8e24226592%2C5%7Chttp%3A%2F%2Fv14.lscache2.c.youtube.com%2Fvideoplayback%3Fip%3D99.0.0.0%26sparams%3Did%252Cexpire%252Cip%252Cipbits%252Citag%252Calgorithm%252Cburst%252Cfactor%26fexp%3D902303%252C906712%26algorithm%3Dthrottle-factor%26itag%3D5%26ipbits%3D8%26burst%3D40%26sver%3D3%26expire%3D1276203600%26key%3Dyt1%26signature%3D42F8774F51ED24983133B8D8F797908F97D8C371.3B0C17A6728074833130840B82BE167F4CA1035D%26factor%3D1.25%26id%3Db9493e8e24226592&amp;rv.2.rating=4.88311688312&amp;shownextbutton=1&amp;rv.1.id=PzeRpPSZOjI&amp;rv.4.length_seconds=228&amp;ad_logging_flag=1&amp;rv.7.view_count=3940&amp;rv.6.length_seconds=253&amp;length_seconds=295&amp;fmt_map=34%2F0%2F9%2F0%2F115%2C5%2F0%2F7%2F0%2F0&amp;enablejsapi=1&amp;video_id=VIDEOCODE&amp;plid=AASIrYqnNA1liVSJ&amp;afv=True&amp;rv.5.rating=4.98&amp;ad_tag=http%3A%2F%2Fad-g.doubleclick.net%2Fpfadx%2Fcom.ytpwatch.music%2Fmain_6%3Bsz%3DWIDTHxHEIGHT%3Bmpvid%3DAASIrYqpBw0C8F4n%3B%21c%3D6%3Bytexp%3D902303.906712%3Bytps%3Ddefault%3Bklg%3Den%3Bkvid%3DVIDEOCODE%3Bctb%3D1%3Bkt%3DK%3Bko%3Dc%3Bkpid%3D6%3Bkga%3D-1%3Bkr%3DN%3Bshortform%3D1%3Bu%3DVIDEOCODE%7C6%3Bkgg%3D-1%3Bkcr%3Dca%3Bafv%3D1%3Bkhd%3D0%3Bdc_dedup%3D1%3Bkpu%3Desther1208%3B&amp;ad_video_pub_id=ca-pub-6219811747049371&amp;rv.4.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzI9C9j0QgU4&amp;rv.1.author=0rganix&amp;rv.1.rating=4.97674418605&amp;rv.5.thumbnailUrl=http%3A%2F%2Fi3.ytimg.com%2Fvi%2F6oHEgkK9wj0%2Fdefault.jpg&amp;watermark=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Flogo-vfl106645.swf%2Chttp%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Fhdlogo-vfl100714.swf&amp;rv.7.rating=4.73333333333&amp;rv.3.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D663CI_o4sTY&amp;rv.2.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIFhhaXDziZ4&amp;cid=6&amp;rv.7.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DP5y-yjheRKE&amp;rv.2.view_count=31320&amp;ad_channel_code_overlay=invideo_overlay_480x70_cat10%2Cafv_overlay%2Cafv_ugc%2Cytps_default%2Cyt_mpvid_AASIrYqpBw0C8F4n%2Cyt_cid_6%2Cytexp_902303.906712&amp;rv.4.view_count=1325763&amp;ad_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Fad-vfl170492.swf&amp;rv.1.view_count=22657&amp;dclk=True&amp;rv.6.rating=5.0&amp;sk=lsWSaZl1UFLCUxUw44Lon-hoi_2GTCy-C&amp;ctb=True&amp;rv.1.thumbnailUrl=http%3A%2F%2Fi1.ytimg.com%2Fvi%2FPzeRpPSZOjI%2Fdefault.jpg&amp;mpvid=AASIrYqpBw0C8F4n&amp;rv.3.length_seconds=330&amp;rv.5.author=Ulrick31&amp;rv.4.rating=4.90052939537" allowscriptaccess="always" allowfullscreen="true" bgcolor="#000000" />';
    25       document.write('<title>YouTube Full Screen</title>');
    26       document.write(embedded.replace(/VIDEOCODE/g, videocode));
     11        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
     12        <script type="text/javascript">
     13            /* gup function by R.D. Vaughan */
     14            function gup( name )
     15            {
     16                name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
     17                var regexS = "[\\?&]"+name+"=([^&#]*)";
     18                var regex = new RegExp( regexS );
     19                var results = regex.exec( window.location.href );
     20                if( results == null )
     21                    return "";
     22                else
     23                    return results[1];
     24            }
    2725
    28     </script>
    29   </head>
     26            var myth_player = null;
     27
     28            var params = {
     29            allowScriptAccess: "always",
     30                            allowfullscreen: 'true',
     31                            wmode: 'opaque'
     32            };
     33            var atts = { id: "myytplayer" };
     34            swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=ytplayer",
     35                               "myth_player", window.innerWidth, window.innerHeight, "8", null, null, params, atts);
     36
     37            function onYouTubePlayerReady(playerId) {
     38                myth_player = document.getElementById("myytplayer");
     39                var videocode = gup('videocode');
     40                if (videocode != "") {
     41                    myth_player.cueVideoById(videocode);
     42                    myth_player.playVideo();
     43                }
     44            }
     45
     46            function play() {
     47                if (myth_player) {
     48                    var state = myth_player.getPlayerState();
     49                    if (state == 1) // Playing
     50                        myth_player.pauseVideo();
     51                    else if (state != 3) // Video is either unstarted, ended, paused or cued
     52                        myth_player.playVideo();
     53                }
     54            }
     55
     56            function seek(amount) {
     57                if (myth_player) {
     58                    myth_player.seekTo(myth_player.getCurrentTime() + amount, true);
     59                }
     60            }
     61
     62            window.onresize = function() {
     63                document.body.style.width = window.innerWidth;
     64                document.body.style.height = window.innerHeight;
     65                if (myth_player) {
     66                    //             myth_player.setSize(window.innerWidth, window.innerHeight);
     67                    document.getElementById("myytplayer").width = window.innerWidth;
     68                    document.getElementById("myytplayer").height = window.innerHeight;
     69                }
     70            };
     71        </script>
     72    </head>
     73    <body>
     74        <div id="myth_player"/>
     75    </body>
    3076</html>