{"id":28092608,"url":"https://github.com/boxcast/boxcast-sdk-js","last_synced_at":"2025-05-13T13:22:28.049Z","repository":{"id":41322446,"uuid":"156902831","full_name":"boxcast/boxcast-sdk-js","owner":"boxcast","description":"The official BoxCast SDK for integrating with the BoxCast API in JavaScript applications.","archived":false,"fork":false,"pushed_at":"2023-11-22T14:40:31.000Z","size":3179,"stargazers_count":7,"open_issues_count":18,"forks_count":4,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-05T20:11:32.788Z","etag":null,"topics":["boxcast","javascript","npm","sdk","video-streaming","webpack"],"latest_commit_sha":null,"homepage":"http://boxcast.github.io/boxcast-sdk-js","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boxcast.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-09T18:33:27.000Z","updated_at":"2024-02-28T21:49:10.000Z","dependencies_parsed_at":"2024-09-24T19:46:44.961Z","dependency_job_id":"62d00b6c-66a6-4303-b35b-84874bf1bd70","html_url":"https://github.com/boxcast/boxcast-sdk-js","commit_stats":{"total_commits":131,"total_committers":5,"mean_commits":26.2,"dds":"0.22137404580152675","last_synced_commit":"8a2e8a9e19d391be7d43e870390f7612982ba4c6"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxcast%2Fboxcast-sdk-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxcast%2Fboxcast-sdk-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxcast%2Fboxcast-sdk-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxcast%2Fboxcast-sdk-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxcast","download_url":"https://codeload.github.com/boxcast/boxcast-sdk-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948586,"owners_count":21988975,"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":["boxcast","javascript","npm","sdk","video-streaming","webpack"],"created_at":"2025-05-13T13:22:27.460Z","updated_at":"2025-05-13T13:22:28.035Z","avatar_url":"https://github.com/boxcast.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BoxCast SDK for JavaScript\n\n\nThis library can be used for custom integration projects where the standard BoxCast embedded\nplayer may not suffice.\n\nWe do strongly encourage you to use the standard embedded player instead of this library where possible,\nbecause it is the most robust and well-tested playback option.\n\nSee Related:\n * [BoxCast Embedded Player Documentation](http://boxcast.github.io/boxcast_js_docs/)\n * [BoxCast Example Video Portal](https://github.com/boxcast/example_video_portal_vuejs)\n * [BoxCast API Documentation](http://boxcast.github.io/boxcast_api/)\n * [BoxCast SDK for React Native](https://github.com/boxcast/boxcast-sdk-react-native)\n\n## Getting Started\nThere are a few ways to use this SDK: on the server (node or serverless) via NPM, or in the browser (via NPM or `\u003cscript\u003e` tag). If you are importing it via NPM, please make sure you are importing from the correct entry point (node or browser). If you are unsure which, please contact BoxCast developer support.\n\n**Please note: running the SDK on node or within a severless environment is required to make Authenticated API calls**\n\nYou will need to know your BoxCast account ID and corresponding channel IDs in order to properly\nutilize this library.  Contact BoxCast developer support if you need assistance.\n\n## Running on Node\\Serverless\n```javascript\nnpm install @boxcast/boxcast-sdk-js --save\n\nimport BoxCastSDK from \"@boxcast/boxcast-sdk-js/node\";\nconst { analytics, api } = new BoxCastSDK();\n```\n## Running in Browser\\Client Application\n```javascript\nnpm install @boxcast/boxcast-sdk-js --save\n\nimport BoxCastSDK from \"@boxcast/boxcast-sdk-js/browser\";\nconst { analytics, api } = new BoxCastSDK();\n```\n## Installing via `\u003cscript\u003e` tag\n```html\n\u003cscript src=\"https://js.boxcast.com/libs/boxcast-sdk-js-2.0.2/browser.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const { analytics, api } = new BoxCastSDK();\n\u003c/script\u003e\n```\n\n\n## Public API Queries\n\nUse the `api` object to query the BoxCast API in public scope.  All methods return a promise.  List\nresponses contain both pagination information and resulting data.\n\nNotes:\n\n * Authenticated or restricted broadcasts (ticketed, etc) are not supported and must be\n   viewed in the native boxcast.js player.\n * Your API credentials (client ID, secret) are not required to access these routes.\n\n```javascript\n// List Channels\napi.channels.list(account_id, {\n  s: 'name', // sort by\n  l: 20,     // page limit\n  p: 0       // page number\n});\n\n// List Broadcasts\napi.broadcasts.list(channel_id, {\n  q: 'timeframe:current',\n  s: '-starts_at',\n  l: 20,\n  p: 0\n});\n\n// Get a Broadcast\napi.broadcasts.get(broadcast_id);\n\n// Get Views for a Broadcast\napi.views.get(broadcast_id, {\n  channel_id: channel_id,\n  host: window.location.hostname,\n  extended: true\n});\n```\n\n## Analytics\n\nUse the `analytics` object to ensure your custom video player is properly reporting playback metrics.\n\n```javascript\nanalytics.configure({\n  browser_name: 'My Browser',       // or detected automatically from user agent\n  browser_version: '3.0',           // or detected automatically from user agent\n  player_version: 'my-player v2.1'  // or defaults to current version of boxcast-sdk-js\n});\n\nanalytics.mode('html5').attach({\n  video: document.querySelector('video'),\n  broadcast: broadcast,             // must contain keys: timeframe, id, account_id\n  channel_id: channel_id            // or defaults to broadcast.channel_id\n});\n\n// ... or if using video.js ... //\nanalytics.mode('video.js').attach({\n  player: player, broadcast: broadcast, channel_id: channel_id\n});\n```\n\n## Authenticated API Queries\n\nUse the `api.auth` object to query the BoxCast API in an authenticated scope, using your\nAPI client credentials.  Like the public API quries, all methods return a promise.\n\nNotes:\n\n * When calling `api.auth.authenticate`, an `access_token` is retrieved and stored\n   within the global scope of the application.  This must be called each time the\n   application is reloaded to obtain a new token.\n * Your API credentials (client ID, secret) are required to access these methods, and these\n   values _should never be shared_.  As a result, please do not allow this code to run\n   within a client application in a browser.\n\n```javascript\n// Get an Auth Token\napi.auth.authenticate(CLIENT_ID, CLIENT_SECRET);\n\n// Get Account Details\napi.auth.account();\n\n// Create a Channel\napi.auth.channels.create({name: 'My New Channel'});\n\n// List Channels\napi.auth.channels.list({\n  s: 'name', // sort by\n  l: 20,     // page limit\n  p: 0       // page number\n});\n\n// List Broadcasts\napi.auth.broadcasts.list({\n  q: 'timeframe:past',   // query\n  s: '-starts_at',          // sort by\n  l: 20,                    // page limit\n  p: 0                      // page number\n})\n\n// Find a Broadcast by ID\napi.auth.broadcasts.get(broadcastId);\n\n// Log Out\napi.auth.logout();\n```\n\n## Running Tests\nTests in this SDK are handled by Jest, and in order to run them, you will need a BoxCast Client ID and Client Secret key. These come from the API keys page in your Dashboad within the Settings page. To set these keys, create a file at `./.jest/setEnvVars.ts` with the following lines. Your Client ID and Client Secret should go inside the empty strings.\n```shell\nprocess.env.BOXCAST_SDK_JS__TEST_CLIENT_ID = ''\nprocess.env.BOXCAST_SDK_JS__TEST_CLIENT_SECRET = ''\n```\nOnce you've set these, you can run the tests with `npm run test` or a single test with `npm run test -- test/test-name.ts`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxcast%2Fboxcast-sdk-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxcast%2Fboxcast-sdk-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxcast%2Fboxcast-sdk-js/lists"}