@audiowalk/sdk
Advanced tools
Comparing version 1.0.2 to 1.1.2
@@ -1,17 +0,1 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./player/player-controller"), exports); | ||
export * from "./player/player-controller"; |
@@ -1,6 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PlayerController = exports.PlayerStatus = void 0; | ||
const rxjs_1 = require("rxjs"); | ||
var PlayerStatus; | ||
import { BehaviorSubject, combineLatest, map, Subject } from "rxjs"; | ||
export var PlayerStatus; | ||
(function (PlayerStatus) { | ||
@@ -10,15 +7,18 @@ PlayerStatus["playing"] = "playing"; | ||
PlayerStatus["ended"] = "ended"; | ||
})(PlayerStatus || (exports.PlayerStatus = PlayerStatus = {})); | ||
class PlayerController { | ||
})(PlayerStatus || (PlayerStatus = {})); | ||
export class PlayerController { | ||
playerElement; | ||
options; | ||
onPlay = new Subject(); | ||
onPause = new Subject(); | ||
onStop = new Subject(); | ||
currentTime = new BehaviorSubject(0); | ||
totalTime = new BehaviorSubject(0); | ||
progress = combineLatest([this.currentTime, this.totalTime]).pipe(map(([currentTime, totalTime]) => currentTime / totalTime)); | ||
status = new BehaviorSubject(null); | ||
playing = this.status.pipe(map((status) => status === "playing")); | ||
file; | ||
constructor(playerElement, options = {}) { | ||
this.playerElement = playerElement; | ||
this.options = options; | ||
this.onPlay = new rxjs_1.Subject(); | ||
this.onPause = new rxjs_1.Subject(); | ||
this.onStop = new rxjs_1.Subject(); | ||
this.currentTime = new rxjs_1.BehaviorSubject(0); | ||
this.totalTime = new rxjs_1.BehaviorSubject(0); | ||
this.progress = (0, rxjs_1.combineLatest)([this.currentTime, this.totalTime]).pipe((0, rxjs_1.map)(([currentTime, totalTime]) => currentTime / totalTime)); | ||
this.status = new rxjs_1.BehaviorSubject(null); | ||
this.playing = this.status.pipe((0, rxjs_1.map)((status) => status === "playing")); | ||
navigator.mediaSession.setActionHandler("play", () => this.play()); | ||
@@ -101,14 +101,12 @@ navigator.mediaSession.setActionHandler("pause", () => this.pause()); | ||
play() { | ||
var _a; | ||
if (!this.file) | ||
throw new Error("No file opened"); | ||
this.log("Called play"); | ||
(_a = this.playerElement) === null || _a === void 0 ? void 0 : _a.play(); | ||
this.playerElement?.play(); | ||
} | ||
pause() { | ||
var _a; | ||
if (!this.file) | ||
throw new Error("No file opened"); | ||
this.log("Called pause"); | ||
(_a = this.playerElement) === null || _a === void 0 ? void 0 : _a.pause(); | ||
this.playerElement?.pause(); | ||
} | ||
@@ -140,4 +138,3 @@ seekTo(seconds) { | ||
log(message) { | ||
var _a, _b; | ||
const time = ((_a = this.playerElement) === null || _a === void 0 ? void 0 : _a.currentTime) ? Math.round((_b = this.playerElement) === null || _b === void 0 ? void 0 : _b.currentTime) : null; | ||
const time = this.playerElement?.currentTime ? Math.round(this.playerElement?.currentTime) : null; | ||
if (time) | ||
@@ -148,2 +145,1 @@ message += ` @${time}s`; | ||
} | ||
exports.PlayerController = PlayerController; |
{ | ||
"name": "@audiowalk/sdk", | ||
"version": "1.0.2", | ||
"version": "1.1.2", | ||
"repository": { | ||
@@ -8,8 +8,29 @@ "type": "git", | ||
}, | ||
"main": "dist/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.js" | ||
}, | ||
"./package.json": "./package.json", | ||
"./angular": { | ||
"types": "./angular/dist/index.d.ts", | ||
"esm2022": "./angular/dist/esm2022/audiowalk-components.mjs", | ||
"esm": "./angular/dist/esm2022/audiowalk-components.mjs", | ||
"default": "./angular/dist/fesm2022/audiowalk-components.mjs" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"angular/dist" | ||
], | ||
"type": "module", | ||
"scripts": { | ||
"dev": "tsc -w", | ||
"build": "tsc", | ||
"build": "concurrently --kill-others-on-fail --names core,angular \"npm run build:core\" \"npm run build:angular\"", | ||
"build:core": "tsc", | ||
"build:angular": "cd angular && npm run build", | ||
"prepublishOnly": "npm run build", | ||
"release:patch": "npm version patch && git push && npm publish --access public" | ||
"release:patch": "git switch master && npm version patch && git switch release && git merge master --ff-only && git push --follow-tags && git switch master && git push", | ||
"release:minor": "git switch master && npm version minor && git switch release && git merge master --ff-only && git push --follow-tags && git switch master && git push", | ||
"release:major": "git switch master && npm version major && git switch release && git merge master --ff-only && git push --follow-tags && git switch master && git push" | ||
}, | ||
@@ -19,2 +40,3 @@ "author": "", | ||
"devDependencies": { | ||
"concurrently": "^9.0.1", | ||
"typescript": "^5.6.2" | ||
@@ -21,0 +43,0 @@ }, |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
14
1
3
Yes
11173
2
193