New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

soundcloud-audio

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soundcloud-audio - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

11

dist/soundcloud-audio.js

@@ -1,2 +0,2 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SoundCloudAudio = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;"undefined"!=typeof window?o=window:"undefined"!=typeof global?o=global:"undefined"!=typeof self&&(o=self),o.SoundCloudAudio=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/dmitri/github/soundcloud-html5-audio":[function(require,module,exports){
'use strict';

@@ -138,4 +138,9 @@

SoundCloud.prototype.preload = function (streamUrl) {
SoundCloud.prototype.preload = function (streamUrl, preloadType) {
this._track = {stream_url: streamUrl};
if (preloadType) {
this.audio.preload = preloadType;
}
this.audio.src = this._clientId ?

@@ -251,3 +256,3 @@ _appendQueryParam(streamUrl, 'client_id', this._clientId) :

},{}]},{},[1])(1)
},{}]},{},["/Users/dmitri/github/soundcloud-html5-audio"])("/Users/dmitri/github/soundcloud-html5-audio")
});

@@ -1,1 +0,1 @@

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SoundCloudAudio=t()}}(function(){return function t(e,i,o){function n(r,a){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!a&&l)return l(r,!0);if(s)return s(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[r]={exports:{}};e[r][0].call(d.exports,function(t){var i=e[r][1][t];return n(i?i:t)},d,d.exports,t,e,i,o)}return i[r].exports}for(var s="function"==typeof require&&require,r=0;r<o.length;r++)n(o[r]);return n}({1:[function(t,e,i){"use strict";function o(t){r||(r=document.createElement("a"));var e={};r.href=t||"";for(var i=0,o=a.length;i<o;i++){var n=a[i];e[n]=r[n]}return e}function n(t,e,i){var n=o(t),s=/\?(?:.*)$/,r=s.test(n.search)?"&":"?",a=n.protocol+"//"+n.host+n.port+n.pathname+n.search+r+e+"="+i+n.hash;return a}function s(t){return this instanceof s?(t||console.info("SoundCloud API requires clientId, get it at https://developers.soundcloud.com"),this._events={},this._clientId=t,this._baseUrl="https://api.soundcloud.com",this.playing=!1,this.duration=0,void(this.audio=document.createElement("audio"))):new s(t)}var r,a="protocol hostname host pathname port search hash href".split(" ");s.prototype.resolve=function(t,e){var i=this._baseUrl+"/resolve.json?url="+encodeURIComponent(t)+"&client_id="+this._clientId;this._json(i,function(i){if(this.cleanData(),Array.isArray(i)){var n=i;i={tracks:n},this._playlist=i}else if(i.tracks)this._playlist=i;else{this._track=i;var s=o(t);this._track.stream_url+=s.hash}this.duration=i.duration&&!isNaN(i.duration)?i.duration/1e3:0,e(i)}.bind(this))},s.prototype._jsonp=function(t,e){var i=document.getElementsByTagName("script")[0]||document.head,o=document.createElement("script"),s="jsonp_callback_"+(new Date).valueOf()+Math.floor(1e3*Math.random());window[s]=function(t){o.parentNode&&o.parentNode.removeChild(o),window[s]=function(){},e(t)},o.src=n(t,"callback",s),i.parentNode.insertBefore(o,i)},s.prototype._json=function(t,e){var i=new XMLHttpRequest;i.open("GET",t),i.onreadystatechange=function(){if(4===i.readyState&&200===i.status){var t={};try{t=JSON.parse(i.responseText)}catch(t){}e(t)}},i.send(null)},s.prototype.on=function(t,e){this._events[t]=e,this.audio.addEventListener(t,e,!1)},s.prototype.off=function(t,e){this._events[t]=null,this.audio.removeEventListener(t,e)},s.prototype.unbindAll=function(){for(var t in this._events){var e=this._events[t];e&&this.off(t,e)}},s.prototype.preload=function(t){this._track={stream_url:t},this.audio.src=this._clientId?n(t,"client_id",this._clientId):t},s.prototype.play=function(t){t=t||{};var e;if(t.streamUrl)e=t.streamUrl;else if(this._playlist){var i=this._playlist.tracks.length;if(i){if(this._playlistIndex=t.playlistIndex||0,this._playlistIndex>=i||this._playlistIndex<0)return void(this._playlistIndex=0);e=this._playlist.tracks[this._playlistIndex].stream_url}}else this._track&&(e=this._track.stream_url);if(!e)throw new Error("There is no tracks to play, use `streamUrl` option or `load` method");this._clientId&&(e=n(e,"client_id",this._clientId)),e!==this.audio.src&&(this.audio.src=e),this.playing=e,this.audio.play()},s.prototype.pause=function(){this.audio.pause(),this.playing=!1},s.prototype.stop=function(){this.audio.pause(),this.audio.currentTime=0,this.playing=!1},s.prototype.next=function(){var t=this._playlist.tracks.length;this._playlistIndex>=t-1||this._playlist&&t&&this.play({playlistIndex:++this._playlistIndex})},s.prototype.previous=function(){this._playlistIndex<=0||this._playlist&&this._playlist.tracks.length&&this.play({playlistIndex:--this._playlistIndex})},s.prototype.seek=function(t){if(!this.audio.readyState)return!1;var e=t.offsetX/t.target.offsetWidth||(t.layerX-t.target.offsetLeft)/t.target.offsetWidth;this.audio.currentTime=e*(this.audio.duration||0)},s.prototype.cleanData=function(){this._track=void 0,this._playlist=void 0},s.prototype.setVolume=function(t){this.audio.readyState&&(this.audio.volume=t)},s.prototype.setTime=function(t){this.audio.readyState&&(this.audio.currentTime=t)},e.exports=s},{}]},{},[1])(1)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SoundCloudAudio=t()}}(function(){return function t(e,i,o){function n(r,a){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!a&&l)return l(r,!0);if(s)return s(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[r]={exports:{}};e[r][0].call(d.exports,function(t){var i=e[r][1][t];return n(i?i:t)},d,d.exports,t,e,i,o)}return i[r].exports}for(var s="function"==typeof require&&require,r=0;r<o.length;r++)n(o[r]);return n}({1:[function(t,e){"use strict";function i(t){s||(s=document.createElement("a"));var e={};s.href=t||"";for(var i=0,o=r.length;o>i;i++){var n=r[i];e[n]=s[n]}return e}function o(t,e,o){var n=i(t),s=/\?(?:.*)$/,r=s.test(n.search)?"&":"?",a=n.protocol+"//"+n.host+n.port+n.pathname+n.search+r+e+"="+o+n.hash;return a}function n(t){return this instanceof n?(t||console.info("SoundCloud API requires clientId, get it at https://developers.soundcloud.com"),this._events={},this._clientId=t,this._baseUrl="https://api.soundcloud.com",this.playing=!1,this.duration=0,void(this.audio=document.createElement("audio"))):new n(t)}var s,r="protocol hostname host pathname port search hash href".split(" ");n.prototype.resolve=function(t,e){var o=this._baseUrl+"/resolve.json?url="+encodeURIComponent(t)+"&client_id="+this._clientId;this._json(o,function(o){if(this.cleanData(),Array.isArray(o)){var n=o;o={tracks:n},this._playlist=o}else if(o.tracks)this._playlist=o;else{this._track=o;var s=i(t);this._track.stream_url+=s.hash}this.duration=o.duration&&!isNaN(o.duration)?o.duration/1e3:0,e(o)}.bind(this))},n.prototype._jsonp=function(t,e){var i=document.getElementsByTagName("script")[0]||document.head,n=document.createElement("script"),s="jsonp_callback_"+(new Date).valueOf()+Math.floor(1e3*Math.random());window[s]=function(t){n.parentNode&&n.parentNode.removeChild(n),window[s]=function(){},e(t)},n.src=o(t,"callback",s),i.parentNode.insertBefore(n,i)},n.prototype._json=function(t,e){var i=new XMLHttpRequest;i.open("GET",t),i.onreadystatechange=function(){if(4===i.readyState&&200===i.status){var t={};try{t=JSON.parse(i.responseText)}catch(o){}e(t)}},i.send(null)},n.prototype.on=function(t,e){this._events[t]=e,this.audio.addEventListener(t,e,!1)},n.prototype.off=function(t,e){this._events[t]=null,this.audio.removeEventListener(t,e)},n.prototype.unbindAll=function(){for(var t in this._events){var e=this._events[t];e&&this.off(t,e)}},n.prototype.preload=function(t,e){this._track={stream_url:t},e&&(this.audio.preload=e),this.audio.src=this._clientId?o(t,"client_id",this._clientId):t},n.prototype.play=function(t){t=t||{};var e;if(t.streamUrl)e=t.streamUrl;else if(this._playlist){var i=this._playlist.tracks.length;if(i){if(this._playlistIndex=t.playlistIndex||0,this._playlistIndex>=i||this._playlistIndex<0)return void(this._playlistIndex=0);e=this._playlist.tracks[this._playlistIndex].stream_url}}else this._track&&(e=this._track.stream_url);if(!e)throw new Error("There is no tracks to play, use `streamUrl` option or `load` method");this._clientId&&(e=o(e,"client_id",this._clientId)),e!==this.audio.src&&(this.audio.src=e),this.playing=e,this.audio.play()},n.prototype.pause=function(){this.audio.pause(),this.playing=!1},n.prototype.stop=function(){this.audio.pause(),this.audio.currentTime=0,this.playing=!1},n.prototype.next=function(){var t=this._playlist.tracks.length;this._playlistIndex>=t-1||this._playlist&&t&&this.play({playlistIndex:++this._playlistIndex})},n.prototype.previous=function(){this._playlistIndex<=0||this._playlist&&this._playlist.tracks.length&&this.play({playlistIndex:--this._playlistIndex})},n.prototype.seek=function(t){if(!this.audio.readyState)return!1;var e=t.offsetX/t.target.offsetWidth||(t.layerX-t.target.offsetLeft)/t.target.offsetWidth;this.audio.currentTime=e*(this.audio.duration||0)},n.prototype.cleanData=function(){this._track=void 0,this._playlist=void 0},n.prototype.setVolume=function(t){this.audio.readyState&&(this.audio.volume=t)},n.prototype.setTime=function(t){this.audio.readyState&&(this.audio.currentTime=t)},e.exports=n},{}]},{},[1])(1)});

@@ -137,4 +137,9 @@ 'use strict';

SoundCloud.prototype.preload = function (streamUrl) {
SoundCloud.prototype.preload = function (streamUrl, preloadType) {
this._track = {stream_url: streamUrl};
if (preloadType) {
this.audio.preload = preloadType;
}
this.audio.src = this._clientId ?

@@ -141,0 +146,0 @@ _appendQueryParam(streamUrl, 'client_id', this._clientId) :

{
"name": "soundcloud-audio",
"version": "1.2.1",
"version": "1.2.2",
"description": "Play SoundCloud tracks and playslists in modern browsers with HTML5 Audio API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -85,6 +85,13 @@ # <img src="http://www.officialpsds.com/images/thumbs/Soundcloud-Logo-psd47614.png" width="75" align="left">&nbsp;soundcloud-audio.js

#### `preload(streamUrl)`
#### `preload(streamUrl, preloadType)`
Preloads track data without playing it.
- `preloadType` - This attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience. It may have one of the following values:
* 'none': indicates that the audio should not be preloaded;
* 'metadata': indicates that only audio metadata (e.g. length) is fetched;
* 'auto': indicates that the whole audio file could be downloaded, even if the user is not expected to use it;
See more at [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio#Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio#Attributes)
#### `pause()`

@@ -91,0 +98,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc