diff options
Diffstat (limited to 'demo')
| -rw-r--r-- | demo/dist/demo.js | 2 | ||||
| -rw-r--r-- | demo/dist/demo.js.map | 2 | ||||
| -rw-r--r-- | demo/index.html | 4 | ||||
| -rw-r--r-- | demo/src/js/demo.js | 3 | 
4 files changed, 6 insertions, 5 deletions
| diff --git a/demo/dist/demo.js b/demo/dist/demo.js index 6b8b3956..5a85dc5c 100644 --- a/demo/dist/demo.js +++ b/demo/dist/demo.js @@ -1,3 +1,3 @@ -!function(){"use strict";var e,t,o,i;document.addEventListener("DOMContentLoaded",function(){window.shr&&window.shr.setup({count:{classname:"button__count"}});var e="tab-focus";document.addEventListener("focusout",function(t){t.target.classList.remove(e)}),document.addEventListener("keydown",function(t){9===t.keyCode&&window.setTimeout(function(){document.activeElement.classList.add(e)},0)});var t=new window.Plyr("#player",{debug:!0,title:"View From A Blue Moon",iconUrl:"../dist/plyr.svg",keyboard:{global:!0},tooltips:{controls:!0},captions:{active:!0},keys:{google:"AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c"},ads:{tagUrl:"http://go.aniview.com/api/adserver6/vast/?AV_PUBLISHERID=58c25bb0073ef448b1087ad6&AV_CHANNELID=5a0458dc28a06145e4519d21&AV_URL=127.0.0.1:3000&cb=1&AV_WIDTH=640&AV_HEIGHT=480"}});window.player=t;var o=document.querySelectorAll("[data-source]"),i={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},r=window.location.hash.replace("#",""),a=window.history&&window.history.pushState;function n(e,t,o){e&&e.classList[o?"add":"remove"](t)}function s(e,a){if(e in i&&(a||e!==r)&&(r.length||e!==i.video)){switch(e){case i.video:t.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"}],poster:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt",default:!0},{kind:"captions",label:"French",srclang:"fr",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt"}]};break;case i.audio:t.source={type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",sources:[{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]};break;case i.youtube:t.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://youtube.com/watch?v=bTqVqk7FSmY",provider:"youtube"}]};break;case i.vimeo:t.source={type:"video",sources:[{src:"https://vimeo.com/76979871",provider:"vimeo"}]}}r=e,Array.from(o).forEach(function(e){return n(e.parentElement,"active",!1)}),n(document.querySelector('[data-source="'+e+'"]'),"active",!0),Array.from(document.querySelectorAll(".plyr__cite")).forEach(function(e){e.setAttribute("hidden","")}),document.querySelector(".plyr__cite--"+e).removeAttribute("hidden")}}if(Array.from(o).forEach(function(e){e.addEventListener("click",function(){var t=e.getAttribute("data-source");s(t),a&&window.history.pushState({type:t},"","#"+t)})}),window.addEventListener("popstate",function(e){e.state&&"type"in e.state&&s(e.state.type)}),a){var c=!r.length;c&&(r=i.video),r in i&&window.history.replaceState({type:r},"",c?"":"#"+r),r!==i.video&&s(r,!0)}}),"plyr.io"===window.location.host&&(e=window,t=document,e.GoogleAnalyticsObject="ga",e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,o=t.createElement("script"),i=t.getElementsByTagName("script")[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",i.parentNode.insertBefore(o,i),window.ga("create","UA-40881672-11","auto"),window.ga("send","pageview"))}(); +!function(){"use strict";var e,t,o,i;document.addEventListener("DOMContentLoaded",function(){window.shr&&window.shr.setup({count:{classname:"button__count"}});var e="tab-focus";document.addEventListener("focusout",function(t){t.target.classList.remove(e)}),document.addEventListener("keydown",function(t){9===t.keyCode&&window.setTimeout(function(){document.activeElement.classList.add(e)},0)});var t=new window.Plyr("#player",{debug:!0,title:"View From A Blue Moon",iconUrl:"../dist/plyr.svg",keyboard:{global:!0},tooltips:{controls:!0},captions:{active:!0},keys:{google:"AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c"},ads:{tagUrl:"https://go.aniview.com/api/adserver6/vast/?AV_PUBLISHERID=58c25bb0073ef448b1087ad6&AV_CHANNELID=5a0458dc28a06145e4519d21&AV_URL=127.0.0.1:3000&cb=1&AV_WIDTH=640&AV_HEIGHT=480"}});window.player=t;var o=document.querySelectorAll("[data-source]"),i={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},r=window.location.hash.replace("#",""),a=window.history&&window.history.pushState;function n(e,t,o){e&&e.classList[o?"add":"remove"](t)}function s(e,a){if(e in i&&(a||e!==r)&&(r.length||e!==i.video)){switch(e){case i.video:t.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"}],poster:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt",default:!0},{kind:"captions",label:"French",srclang:"fr",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt"}]};break;case i.audio:t.source={type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",sources:[{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]};break;case i.youtube:t.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://youtube.com/watch?v=bTqVqk7FSmY",provider:"youtube"}]};break;case i.vimeo:t.source={type:"video",sources:[{src:"https://vimeo.com/76979871",provider:"vimeo"}]}}r=e,Array.from(o).forEach(function(e){return n(e.parentElement,"active",!1)}),n(document.querySelector('[data-source="'+e+'"]'),"active",!0),Array.from(document.querySelectorAll(".plyr__cite")).forEach(function(e){e.setAttribute("hidden","")}),document.querySelector(".plyr__cite--"+e).removeAttribute("hidden")}}if(Array.from(o).forEach(function(e){e.addEventListener("click",function(){var t=e.getAttribute("data-source");s(t),a&&window.history.pushState({type:t},"","#"+t)})}),window.addEventListener("popstate",function(e){e.state&&"type"in e.state&&s(e.state.type)}),a){var c=!r.length;c&&(r=i.video),r in i&&window.history.replaceState({type:r},"",c?"":"#"+r),r!==i.video&&s(r,!0)}}),"plyr.io"===window.location.host&&(e=window,t=document,e.GoogleAnalyticsObject="ga",e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,o=t.createElement("script"),i=t.getElementsByTagName("script")[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",i.parentNode.insertBefore(o,i),window.ga("create","UA-40881672-11","auto"),window.ga("send","pageview"))}();  //# sourceMappingURL=demo.js.map diff --git a/demo/dist/demo.js.map b/demo/dist/demo.js.map index 05e96320..15c0af99 100644 --- a/demo/dist/demo.js.map +++ b/demo/dist/demo.js.map @@ -1 +1 @@ -{"version":3,"sources":["demo/src/js/demo.js"],"names":["i","s","a","m","document","addEventListener","window","shr","setup","tabClassName","target","classList","remove","event","keyCode","setTimeout","activeElement","add","player","Plyr","buttons","querySelectorAll","types","currentType","location","hash","replace","historySupport","history","pushState","toggleClass","element","className","state","newSource","type","init","length","video","source","audio","youtube","vimeo","from","forEach","button","parentElement","querySelector","setAttribute","removeAttribute","getAttribute","replaceState","host","GoogleAnalyticsObject","q","push","arguments","l","Date","createElement","getElementsByTagName","async","src","parentNode","insertBefore","ga"],"mappings":"6BAmOcA,EAAGC,EAAYC,EAAGC,EA7NhCC,SAASC,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vBf,GAENR,UACOC,QAAQC,WAAYM,QAAQ,OAAQA,cAMhD9B,iBAAiB,WAAY,YAC5BQ,EAAMoB,OAAS,SAAUpB,EAAMoB,SACrBpB,EAAMoB,MAAME,QAK1BR,EAAgB,KACVW,GAASf,EAAYc,OAGvBC,MACchB,EAAMgB,OAIpBf,KAAeD,UACRM,QAAQuB,mBAED5B,GAEV,GACAe,EAAQ,OAASf,GAKrBA,IAAgBD,EAAMgB,SACZf,GAAa,MAQN,YAAzBjB,OAAOkB,SAAS4B,OACNpD,EAaPM,OAbUL,EAaFG,WAZLiD,sBAYoE,OAXtE,GACIrD,EAAA,IACA,YACKA,EAAA,GAAKsD,EAAItD,EAAA,GAAKsD,OAASC,KAAKC,cAErC,GAAKC,EAAI,EAAI,IAAIC,OACbzD,EAAE0D,cAKW,YAJb1D,EAAE2D,qBAIW,UAJa,KAC5BC,MAAQ,IACRC,IAEyB,4CADzBC,WAAWC,aAAa9D,EAAGC,UAE1B8D,GAAG,SAAU,iBAAkB,eAC/BA,GAAG,OAAQ","file":"demo.js","sourcesContent":["// ==========================================================================\n// Plyr.io demo\n// This code is purely for the https://plyr.io website\n// Please see readme.md in the root or github.com/sampotts/plyr\n// ==========================================================================\n\ndocument.addEventListener('DOMContentLoaded', () => {\n    if (window.shr) {\n        window.shr.setup({\n            count: {\n                classname: 'button__count',\n            },\n        });\n    }\n\n    // Setup tab focus\n    const tabClassName = 'tab-focus';\n\n    // Remove class on blur\n    document.addEventListener('focusout', event => {\n        event.target.classList.remove(tabClassName);\n    });\n\n    // Add classname to tabbed elements\n    document.addEventListener('keydown', event => {\n        if (event.keyCode !== 9) {\n            return;\n        }\n\n        // Delay the adding of classname until the focus has changed\n        // This event fires before the focusin event\n        window.setTimeout(() => {\n            document.activeElement.classList.add(tabClassName);\n        }, 0);\n    });\n\n    // Setup the player\n    const player = new window.Plyr('#player', {\n        debug: true,\n        title: 'View From A Blue Moon',\n        iconUrl: '../dist/plyr.svg',\n        keyboard: {\n            global: true,\n        },\n        tooltips: {\n            controls: true,\n        },\n        captions: {\n            active: true,\n        },\n        keys: {\n            google: 'AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c',\n        },\n        ads: {\n            tagUrl: 'http://go.aniview.com/api/adserver6/vast/?AV_PUBLISHERID=58c25bb0073ef448b1087ad6&AV_CHANNELID=5a0458dc28a06145e4519d21&AV_URL=127.0.0.1:3000&cb=1&AV_WIDTH=640&AV_HEIGHT=480',\n        },\n    });\n\n    // Expose for testing\n    window.player = player;\n\n    // Setup type toggle\n    const buttons = document.querySelectorAll('[data-source]');\n    const types = {\n        video: 'video',\n        audio: 'audio',\n        youtube: 'youtube',\n        vimeo: 'vimeo',\n    };\n    let currentType = window.location.hash.replace('#', '');\n    const historySupport = window.history && window.history.pushState;\n\n    // Toggle class on an element\n    function toggleClass(element, className, state) {\n        if (element) {\n            element.classList[state ? 'add' : 'remove'](className);\n        }\n    }\n\n    // Set a new source\n    function newSource(type, init) {\n        // Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video\n        if (!(type in types) || (!init && type === currentType) || (!currentType.length && type === types.video)) {\n            return;\n        }\n\n        switch (type) {\n            case types.video:\n                player.source = {\n                    type: 'video',\n                    title: 'View From A Blue Moon',\n                    sources: [{\n                        src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4',\n                        type: 'video/mp4',\n                    }],\n                    poster: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg',\n                    tracks: [\n                        {\n                            kind: 'captions',\n                            label: 'English',\n                            srclang: 'en',\n                            src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',\n                            default: true,\n                        },\n                        {\n                            kind: 'captions',\n                            label: 'French',\n                            srclang: 'fr',\n                            src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt',\n                        },\n                    ],\n                };\n\n                break;\n\n            case types.audio:\n                player.source = {\n                    type: 'audio',\n                    title: 'Kishi Bashi – “It All Began With A Burst”',\n                    sources: [\n                        {\n                            src: 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3',\n                            type: 'audio/mp3',\n                        },\n                        {\n                            src: 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg',\n                            type: 'audio/ogg',\n                        },\n                    ],\n                };\n\n                break;\n\n            case types.youtube:\n                player.source = {\n                    type: 'video',\n                    title: 'View From A Blue Moon',\n                    sources: [{\n                        src: 'https://youtube.com/watch?v=bTqVqk7FSmY',\n                        provider: 'youtube',\n                    }],\n                };\n\n                break;\n\n            case types.vimeo:\n                player.source = {\n                    type: 'video',\n                    sources: [{\n                        src: 'https://vimeo.com/76979871',\n                        provider: 'vimeo',\n                    }],\n                };\n\n                break;\n\n            default:\n                break;\n        }\n\n        // Set the current type for next time\n        currentType = type;\n\n        // Remove active classes\n        Array.from(buttons).forEach(button => toggleClass(button.parentElement, 'active', false));\n\n        // Set active on parent\n        toggleClass(document.querySelector(`[data-source=\"${type}\"]`), 'active', true);\n\n        // Show cite\n        Array.from(document.querySelectorAll('.plyr__cite')).forEach(cite => {\n            cite.setAttribute('hidden', '');\n        });\n        document.querySelector(`.plyr__cite--${type}`).removeAttribute('hidden');\n    }\n\n    // Bind to each button\n    Array.from(buttons).forEach(button => {\n        button.addEventListener('click', () => {\n            const type = button.getAttribute('data-source');\n\n            newSource(type);\n\n            if (historySupport) {\n                window.history.pushState({ type }, '', `#${type}`);\n            }\n        });\n    });\n\n    // List for backwards/forwards\n    window.addEventListener('popstate', event => {\n        if (event.state && 'type' in event.state) {\n            newSource(event.state.type);\n        }\n    });\n\n    // On load\n    if (historySupport) {\n        const video = !currentType.length;\n\n        // If there's no current type set, assume video\n        if (video) {\n            currentType = types.video;\n        }\n\n        // Replace current history state\n        if (currentType in types) {\n            window.history.replaceState(\n                {\n                    type: currentType,\n                },\n                '',\n                video ? '' : `#${currentType}`,\n            );\n        }\n\n        // If it's not video, load the source\n        if (currentType !== types.video) {\n            newSource(currentType, true);\n        }\n    }\n});\n\n// Google analytics\n// For demo site (https://plyr.io) only\n/* eslint-disable */\nif (window.location.host === 'plyr.io') {\n    (function(i, s, o, g, r, a, m) {\n        i.GoogleAnalyticsObject = r;\n        i[r] =\n            i[r] ||\n            function() {\n                (i[r].q = i[r].q || []).push(arguments);\n            };\n        i[r].l = 1 * new Date();\n        a = s.createElement(o);\n        m = s.getElementsByTagName(o)[0];\n        a.async = 1;\n        a.src = g;\n        m.parentNode.insertBefore(a, m);\n    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');\n    window.ga('create', 'UA-40881672-11', 'auto');\n    window.ga('send', 'pageview');\n}\n/* eslint-enable */\n"]}
\ No newline at end of file +{"version":3,"sources":["demo/src/js/demo.js"],"names":["i","s","a","m","document","addEventListener","window","shr","setup","tabClassName","target","classList","remove","event","keyCode","setTimeout","activeElement","add","player","Plyr","buttons","querySelectorAll","types","currentType","location","hash","replace","historySupport","history","pushState","toggleClass","element","className","state","newSource","type","init","length","video","source","audio","youtube","vimeo","from","forEach","button","parentElement","querySelector","setAttribute","removeAttribute","getAttribute","replaceState","host","GoogleAnalyticsObject","q","push","arguments","l","Date","createElement","getElementsByTagName","async","src","parentNode","insertBefore","ga"],"mappings":"6BAoOcA,EAAGC,EAAYC,EAAGC,EA9NhCC,SAASC,iBAAiB,mBAAoB,WACtCC,OAAOC,YACAA,IAAIC,wBAEQ,uBAMjBC,EAAe,qBAGZJ,iBAAiB,WAAY,cAC5BK,OAAOC,UAAUC,OAAOH,cAIzBJ,iBAAiB,UAAW,YACX,IAAlBQ,EAAMC,gBAMHC,WAAW,oBACLC,cAAcL,UAAUM,IAAIR,IACtC,SAIDS,EAAS,IAAIZ,OAAOa,KAAK,kBACpB,QACA,gCACE,qCAEG,uBAGE,qBAGF,gBAGA,uDAIJ,2LAKLD,OAASA,MAGVE,EAAUhB,SAASiB,iBA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AaFG,WAZLiD,sBAYoE,OAXtE,GACIrD,EAAA,IACA,YACKA,EAAA,GAAKsD,EAAItD,EAAA,GAAKsD,OAASC,KAAKC,cAErC,GAAKC,EAAI,EAAI,IAAIC,OACbzD,EAAE0D,cAKW,YAJb1D,EAAE2D,qBAIW,UAJa,KAC5BC,MAAQ,IACRC,IAEyB,4CADzBC,WAAWC,aAAa9D,EAAGC,UAE1B8D,GAAG,SAAU,iBAAkB,eAC/BA,GAAG,OAAQ","file":"demo.js","sourcesContent":["// ==========================================================================\n// Plyr.io demo\n// This code is purely for the https://plyr.io website\n// Please see readme.md in the root or github.com/sampotts/plyr\n// ==========================================================================\n\ndocument.addEventListener('DOMContentLoaded', () => {\n    if (window.shr) {\n        window.shr.setup({\n            count: {\n                classname: 'button__count',\n            },\n        });\n    }\n\n    // Setup tab focus\n    const tabClassName = 'tab-focus';\n\n    // Remove class on blur\n    document.addEventListener('focusout', event => {\n        event.target.classList.remove(tabClassName);\n    });\n\n    // Add classname to tabbed elements\n    document.addEventListener('keydown', event => {\n        if (event.keyCode !== 9) {\n            return;\n        }\n\n        // Delay the adding of classname until the focus has changed\n        // This event fires before the focusin event\n        window.setTimeout(() => {\n            document.activeElement.classList.add(tabClassName);\n        }, 0);\n    });\n\n    // Setup the player\n    const player = new window.Plyr('#player', {\n        debug: true,\n        title: 'View From A Blue Moon',\n        iconUrl: '../dist/plyr.svg',\n        keyboard: {\n            global: true,\n        },\n        tooltips: {\n            controls: true,\n        },\n        captions: {\n            active: true,\n        },\n        keys: {\n            google: 'AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c',\n        },\n        ads: {\n            tagUrl:\n                'https://go.aniview.com/api/adserver6/vast/?AV_PUBLISHERID=58c25bb0073ef448b1087ad6&AV_CHANNELID=5a0458dc28a06145e4519d21&AV_URL=127.0.0.1:3000&cb=1&AV_WIDTH=640&AV_HEIGHT=480',\n        },\n    });\n\n    // Expose for testing\n    window.player = player;\n\n    // Setup type toggle\n    const buttons = document.querySelectorAll('[data-source]');\n    const types = {\n        video: 'video',\n        audio: 'audio',\n        youtube: 'youtube',\n        vimeo: 'vimeo',\n    };\n    let currentType = window.location.hash.replace('#', '');\n    const historySupport = window.history && window.history.pushState;\n\n    // Toggle class on an element\n    function toggleClass(element, className, state) {\n        if (element) {\n            element.classList[state ? 'add' : 'remove'](className);\n        }\n    }\n\n    // Set a new source\n    function newSource(type, init) {\n        // Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video\n        if (!(type in types) || (!init && type === currentType) || (!currentType.length && type === types.video)) {\n            return;\n        }\n\n        switch (type) {\n            case types.video:\n                player.source = {\n                    type: 'video',\n                    title: 'View From A Blue Moon',\n                    sources: [{\n                        src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4',\n                        type: 'video/mp4',\n                    }],\n                    poster: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg',\n                    tracks: [\n                        {\n                            kind: 'captions',\n                            label: 'English',\n                            srclang: 'en',\n                            src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt',\n                            default: true,\n                        },\n                        {\n                            kind: 'captions',\n                            label: 'French',\n                            srclang: 'fr',\n                            src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt',\n                        },\n                    ],\n                };\n\n                break;\n\n            case types.audio:\n                player.source = {\n                    type: 'audio',\n                    title: 'Kishi Bashi – “It All Began With A Burst”',\n                    sources: [\n                        {\n                            src: 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3',\n                            type: 'audio/mp3',\n                        },\n                        {\n                            src: 'https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg',\n                            type: 'audio/ogg',\n                        },\n                    ],\n                };\n\n                break;\n\n            case types.youtube:\n                player.source = {\n                    type: 'video',\n                    title: 'View From A Blue Moon',\n                    sources: [{\n                        src: 'https://youtube.com/watch?v=bTqVqk7FSmY',\n                        provider: 'youtube',\n                    }],\n                };\n\n                break;\n\n            case types.vimeo:\n                player.source = {\n                    type: 'video',\n                    sources: [{\n                        src: 'https://vimeo.com/76979871',\n                        provider: 'vimeo',\n                    }],\n                };\n\n                break;\n\n            default:\n                break;\n        }\n\n        // Set the current type for next time\n        currentType = type;\n\n        // Remove active classes\n        Array.from(buttons).forEach(button => toggleClass(button.parentElement, 'active', false));\n\n        // Set active on parent\n        toggleClass(document.querySelector(`[data-source=\"${type}\"]`), 'active', true);\n\n        // Show cite\n        Array.from(document.querySelectorAll('.plyr__cite')).forEach(cite => {\n            cite.setAttribute('hidden', '');\n        });\n        document.querySelector(`.plyr__cite--${type}`).removeAttribute('hidden');\n    }\n\n    // Bind to each button\n    Array.from(buttons).forEach(button => {\n        button.addEventListener('click', () => {\n            const type = button.getAttribute('data-source');\n\n            newSource(type);\n\n            if (historySupport) {\n                window.history.pushState({ type }, '', `#${type}`);\n            }\n        });\n    });\n\n    // List for backwards/forwards\n    window.addEventListener('popstate', event => {\n        if (event.state && 'type' in event.state) {\n            newSource(event.state.type);\n        }\n    });\n\n    // On load\n    if (historySupport) {\n        const video = !currentType.length;\n\n        // If there's no current type set, assume video\n        if (video) {\n            currentType = types.video;\n        }\n\n        // Replace current history state\n        if (currentType in types) {\n            window.history.replaceState(\n                {\n                    type: currentType,\n                },\n                '',\n                video ? '' : `#${currentType}`,\n            );\n        }\n\n        // If it's not video, load the source\n        if (currentType !== types.video) {\n            newSource(currentType, true);\n        }\n    }\n});\n\n// Google analytics\n// For demo site (https://plyr.io) only\n/* eslint-disable */\nif (window.location.host === 'plyr.io') {\n    (function(i, s, o, g, r, a, m) {\n        i.GoogleAnalyticsObject = r;\n        i[r] =\n            i[r] ||\n            function() {\n                (i[r].q = i[r].q || []).push(arguments);\n            };\n        i[r].l = 1 * new Date();\n        a = s.createElement(o);\n        m = s.getElementsByTagName(o)[0];\n        a.async = 1;\n        a.src = g;\n        m.parentNode.insertBefore(a, m);\n    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');\n    window.ga('create', 'UA-40881672-11', 'auto');\n    window.ga('send', 'pageview');\n}\n/* eslint-enable */\n"]}
\ No newline at end of file diff --git a/demo/index.html b/demo/index.html index 8c5b5ed4..d225f266 100644 --- a/demo/index.html +++ b/demo/index.html @@ -65,9 +65,9 @@                      </svg>Vimeo</button>              </p> -            <!--<p>Monetization options provided by +            <p>Advertisement service provided by                  <a href="https://vi.ai" target="_blank">vi.ai</a> -            </p>--> +            </p>              <div class="call-to-action">                  <span class="button--with-count"> diff --git a/demo/src/js/demo.js b/demo/src/js/demo.js index 17b0999e..fb215ed0 100644 --- a/demo/src/js/demo.js +++ b/demo/src/js/demo.js @@ -52,7 +52,8 @@ document.addEventListener('DOMContentLoaded', () => {              google: 'AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c',          },          ads: { -            tagUrl: 'http://go.aniview.com/api/adserver6/vast/?AV_PUBLISHERID=58c25bb0073ef448b1087ad6&AV_CHANNELID=5a0458dc28a06145e4519d21&AV_URL=127.0.0.1:3000&cb=1&AV_WIDTH=640&AV_HEIGHT=480', +            tagUrl: +                'https://go.aniview.com/api/adserver6/vast/?AV_PUBLISHERID=58c25bb0073ef448b1087ad6&AV_CHANNELID=5a0458dc28a06145e4519d21&AV_URL=127.0.0.1:3000&cb=1&AV_WIDTH=640&AV_HEIGHT=480',          },      }); | 
