{"id":23576035,"url":"https://github.com/theoplayer/samples-nuxtjs","last_synced_at":"2025-05-16T13:09:59.321Z","repository":{"id":40843376,"uuid":"249742656","full_name":"THEOplayer/samples-nuxtjs","owner":"THEOplayer","description":"A sample app integrating THEOplayer.js as a Nuxt.js component.","archived":false,"fork":false,"pushed_at":"2023-01-26T15:03:17.000Z","size":2620,"stargazers_count":0,"open_issues_count":21,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T23:12:14.732Z","etag":null,"topics":["nuxt","nuxtjs","theoplayer","video-player"],"latest_commit_sha":null,"homepage":"","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/THEOplayer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-24T15:18:28.000Z","updated_at":"2020-05-12T12:09:04.000Z","dependencies_parsed_at":"2023-02-14T18:31:25.299Z","dependency_job_id":null,"html_url":"https://github.com/THEOplayer/samples-nuxtjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/THEOplayer%2Fsamples-nuxtjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/THEOplayer%2Fsamples-nuxtjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/THEOplayer%2Fsamples-nuxtjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/THEOplayer%2Fsamples-nuxtjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/THEOplayer","download_url":"https://codeload.github.com/THEOplayer/samples-nuxtjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535827,"owners_count":22087399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nuxt","nuxtjs","theoplayer","video-player"],"created_at":"2024-12-26T21:11:48.993Z","updated_at":"2025-05-16T13:09:59.301Z","avatar_url":"https://github.com/THEOplayer.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# THEOplayer Nuxt.js Sample\n\n## License\n\nThis projects falls under the license as defined in https://github.com/THEOplayer/license-and-disclaimer.\n\n## Getting started\n\n1. Open your favorite IDE and then a terminal and install Vue CLI component:\n\n```\nnpx create-nuxt-app theoplayer-nuxtjs-sample\n```\n\n2. Follow the installation process (please note this instructions assumes you’ve chosen npm as a module packager)\n\n3. Once the app is created, execute the following commands:\n\n```\ncd theoplayer-nuxtjs-sample\nnpm install\nnpm run dev\n```\n\n4. The default application should be served under: http://localhost:3000/\n\n5. Reference the THEOplayer Web SDK by editing file nuxt.config.js like the following:\n\n```js\nexport default {\n  mode: 'spa',\n  /*\n   ** Headers of the page\n   */\n  head: {\n    title: process.env.npm_package_name || '',\n    meta: [\n      { charset: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      {\n        hid: 'description',\n        name: 'description',\n        content: process.env.npm_package_description || ''\n      }\n    ],\n    link: [\n      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },\n      {\n        rel: 'stylesheet',\n        type: 'text/css',\n        href: '//cdn.theoplayer.com/dash/theoplayer/ui.css'\n      }\n    ],\n    script: [\n      {\n        type: 'text/javascript',\n        src: '//cdn.theoplayer.com/dash/theoplayer/THEOplayer.js'\n      }\n    ]\n  },\n  /*\n   ** Customize the progress-bar color\n   */\n  loading: { color: '#fff' },\n  /*\n   ** Global CSS\n   */\n  css: [],\n  /*\n   ** Plugins to load before mounting the App\n   */\n  plugins: [],\n  /*\n   ** Nuxt.js dev-modules\n   */\n  buildModules: [\n    // Doc: https://github.com/nuxt-community/eslint-module\n    '@nuxtjs/eslint-module'\n  ],\n  /*\n   ** Nuxt.js modules\n   */\n  modules: [],\n  /*\n   ** Build configuration\n   */\n  build: {\n    /*\n     ** You can extend webpack config here\n     */\n    extend(config, ctx) {}\n  }\n}\n```\n\n6. Add the new component named Player.vue under this path: components/Player.vue\n\n```\n\u003ctemplate\u003e\n  \u003cdiv\n    ref=\"theoplayer\"\n    class=\"theoplayer-container video-js theoplayer-skin vjs-16-9 THEOplayer\"\n  \u003e\u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport { mapState } from 'vuex'\nexport default {\n  computed: mapState({\n    source: (state) =\u003e state.source\n  }),\n  mounted() {\n    this.playerInit()\n  },\n  methods: {\n    playerInit() {\n      const player = new window.THEOplayer.Player(this.$refs.theoplayer, {\n        fluid: true,\n        libraryLocation: '//cdn.theoplayer.com/dash/theoplayer/'\n      })\n      player.source = {\n        sources: this.source\n      }\n    }\n  }\n}\n\u003c/script\u003e\n\u003cstyle\u003e\n.THEOplayer {\n  width: 50%;\n  margin: 0 auto;\n}\n\n.video-js.vjs-16-9 {\n  padding-top: 28.12%;\n  width: 50%;\n}\n\u003c/style\u003e\n```\n\n7. Please note that vuex is used to pass the player source, for this purpose add index.js file under this path: store/index.js with following content:\n\n```js\nexport const state = () =\u003e ({\n  source: null\n})\n\nexport const mutations = {\n  setSource(state, source) {\n    state.source = source\n  }\n}\n```\n\n8. Now, we are ready to reference the player component in the index.vue like following:\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv class=\"container\"\u003e\n    \u003cdiv\u003e\n      \u003clogo /\u003e\n      \u003cplayer /\u003e\n      \u003ch1 class=\"title\"\u003e\n        theoplayer-nuxtjs-sample\n      \u003c/h1\u003e\n      \u003ch2 class=\"subtitle\"\u003e\n        THEOplayer nuxtjs sample app\n      \u003c/h2\u003e\n      \u003cdiv class=\"links\"\u003e\n        \u003ca href=\"https://nuxtjs.org/\" target=\"_blank\" class=\"button--green\"\u003e\n          Documentation\n        \u003c/a\u003e\n        \u003ca\n          href=\"https://github.com/nuxt/nuxt.js\"\n          target=\"_blank\"\n          class=\"button--grey\"\n        \u003e\n          GitHub\n        \u003c/a\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\u003cscript\u003e\nimport Logo from '~/components/Logo.vue'\nimport Player from '~/components/Player.vue'\n\nexport default {\n  components: {\n    Logo,\n    Player\n  },\n  created() {\n    this.$store.commit('setSource', [\n      {\n        type: 'application/x-mpegurl',\n        src: '//cdn.theoplayer.com/video/elephants-dream/playlist.m3u8'\n      }\n    ])\n  }\n}\n\u003c/script\u003e\n\n\u003cstyle\u003e\n.container {\n  margin: 0 auto;\n  min-height: 100vh;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n}\n\n.title {\n  font-family: 'Quicksand', 'Source Sans Pro', -apple-system, BlinkMacSystemFont,\n    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n  display: block;\n  font-weight: 300;\n  font-size: 100px;\n  color: #35495e;\n  letter-spacing: 1px;\n}\n\n.subtitle {\n  font-weight: 300;\n  font-size: 42px;\n  color: #526488;\n  word-spacing: 5px;\n  padding-bottom: 15px;\n}\n\n.links {\n  padding-top: 15px;\n}\n\u003c/style\u003e\n```\n\n9. This should result in page which includes THEO player component.\n\n## Build Setup\n\n```bash\n# install dependencies\n$ npm run install\n\n# serve with hot reload at localhost:3000\n$ npm run dev\n\n# build for production and launch server\n$ npm run build\n$ npm run start\n\n# generate static project\n$ npm run generate\n```\n\nFor detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheoplayer%2Fsamples-nuxtjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheoplayer%2Fsamples-nuxtjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheoplayer%2Fsamples-nuxtjs/lists"}