Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cloudflare/stream-react

Package Overview
Dependencies
Maintainers
68
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudflare/stream-react - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

9

dist/stream-react.cjs.development.js

@@ -11,3 +11,2 @@ 'use strict';

var scriptLocation = "https://embed.videodelivery.net/embed/r4xu.fla9.latest.js";
var streamScript = /*#__PURE__*/document.querySelector("script[src=\"" + scriptLocation + "\"]");

@@ -41,4 +40,6 @@ function useStreamElement(containerRef, streamRef) {

React.useEffect(function () {
if (streamScript === null) {
streamScript = document.createElement("script");
var existingScript = document.querySelector("script[src=\"" + scriptLocation + "\"]");
if (existingScript === null) {
var streamScript = document.createElement("script");
streamScript.setAttribute("data-cfasync", "false");

@@ -56,3 +57,3 @@ streamScript.setAttribute("defer", "true");

window.__stream.initElement(streamElement);
} // no dependencies in the dependancy array means this only fires on mount
} // no dependencies in the dependency array means this only fires on mount
// and the cleanup only fires on unmount.

@@ -59,0 +60,0 @@

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r="https://embed.videodelivery.net/embed/r4xu.fla9.latest.js",o=document.querySelector('script[src="'+r+'"]');function a(e,n,r){t.useEffect((function(){if(n.current){var t=n.current;!1===r||void 0===r?t.removeAttribute(e):t.setAttribute(e,r.toString())}}),[e,r,n])}function u(e,n,r){t.useEffect((function(){n.current&&(n.current[e]=r)}),[e,r,n])}function d(e,n,r){void 0===r&&(r=i),t.useEffect((function(){if(n.current){var t=n.current;return t.addEventListener(e,r),function(){return t.removeEventListener(e,r)}}}),[r,e,n])}var i=function(){};exports.Stream=function(e){var i=e.src,l=e.adUrl,c=e.controls,s=e.muted,f=e.autoplay,m=e.loop,p=e.preload,h=e.height,v=e.width,g=e.poster,y=e.currentTime,E=e.volume,b=e.streamRef,S=e.onAbort,A=e.onCanPlay,w=e.onCanPlayThrough,C=e.onDurationChange,P=e.onEnded,_=e.onError,L=e.onLoadedData,T=e.onLoadedMetaData,j=e.onLoadStart,k=e.onPause,x=e.onPlay,R=e.onPlaying,D=e.onProgress,q=e.onRateChange,M=e.onSeeked,U=e.onSeeking,O=e.onStalled,V=e.onSuspend,W=e.onTimeUpdate,z=e.onVolumeChange,B=e.onWaiting,F=e.onStreamAdStart,G=e.onStreamAdEnd,H=e.onStreamAdTimeout,I=t.useRef(null),J=null!=b?b:I,K=t.useRef(null);return function(e,n){t.useEffect((function(){if(e.current){var t=e.current,r=document.createElement("stream");return n.current=r,t.appendChild(r),function(){t.removeChild(r)}}}),[n,e])}(K,J),a("ad-url",J,l),a("src",J,i),a("autoplay",J,f),a("controls",J,c),a("loop",J,m),a("preload",J,p),a("height",J,h),a("width",J,v),a("poster",J,g),a("muted",J,s),u("autoplay",J,null!=f&&f),u("controls",J,null!=c&&c),u("currentTime",J,null!=y?y:0),u("muted",J,null!=s&&s),u("loop",J,null!=m&&m),u("volume",J,null!=E?E:1),u("preload",J,"string"==typeof p?p:!0===p?"auto":"none"),d("abort",J,S),d("canplay",J,A),d("canplaythrough",J,w),d("durationchange",J,C),d("ended",J,P),d("error",J,_),d("loadeddata",J,L),d("loadedmetadata",J,T),d("loadstart",J,j),d("pause",J,k),d("play",J,x),d("playing",J,R),d("progress",J,D),d("ratechange",J,q),d("seeked",J,M),d("seeking",J,U),d("stalled",J,O),d("suspend",J,V),d("timeupdate",J,W),d("volumechange",J,z),d("waiting",J,B),d("stream-adstart",J,F),d("stream-adend",J,G),d("stream-adtimeout",J,H),function(e){t.useEffect((function(){if(null===o)return(o=document.createElement("script")).setAttribute("data-cfasync","false"),o.setAttribute("defer","true"),o.setAttribute("type","text/javascript"),o.setAttribute("src",r),void document.head.appendChild(o);var t=e.current;window.__stream&&t&&window.__stream.initElement(t)}),[])}(J),n.createElement("div",{style:{height:h,width:v},ref:K})};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r="https://embed.videodelivery.net/embed/r4xu.fla9.latest.js";function a(e,n,r){t.useEffect((function(){if(n.current){var t=n.current;!1===r||void 0===r?t.removeAttribute(e):t.setAttribute(e,r.toString())}}),[e,r,n])}function o(e,n,r){t.useEffect((function(){n.current&&(n.current[e]=r)}),[e,r,n])}function u(e,n,r){void 0===r&&(r=d),t.useEffect((function(){if(n.current){var t=n.current;return t.addEventListener(e,r),function(){return t.removeEventListener(e,r)}}}),[r,e,n])}var d=function(){};exports.Stream=function(e){var d=e.src,i=e.adUrl,l=e.controls,c=e.muted,s=e.autoplay,f=e.loop,m=e.preload,p=e.height,h=e.width,v=e.poster,g=e.currentTime,y=e.volume,E=e.streamRef,b=e.onAbort,S=e.onCanPlay,A=e.onCanPlayThrough,w=e.onDurationChange,C=e.onEnded,P=e.onError,_=e.onLoadedData,L=e.onLoadedMetaData,T=e.onLoadStart,j=e.onPause,k=e.onPlay,x=e.onPlaying,R=e.onProgress,D=e.onRateChange,q=e.onSeeked,M=e.onSeeking,U=e.onStalled,O=e.onSuspend,V=e.onTimeUpdate,W=e.onVolumeChange,z=e.onWaiting,B=e.onStreamAdStart,F=e.onStreamAdEnd,G=e.onStreamAdTimeout,H=t.useRef(null),I=null!=E?E:H,J=t.useRef(null);return function(e,n){t.useEffect((function(){if(e.current){var t=e.current,r=document.createElement("stream");return n.current=r,t.appendChild(r),function(){t.removeChild(r)}}}),[n,e])}(J,I),a("ad-url",I,i),a("src",I,d),a("autoplay",I,s),a("controls",I,l),a("loop",I,f),a("preload",I,m),a("height",I,p),a("width",I,h),a("poster",I,v),a("muted",I,c),o("autoplay",I,null!=s&&s),o("controls",I,null!=l&&l),o("currentTime",I,null!=g?g:0),o("muted",I,null!=c&&c),o("loop",I,null!=f&&f),o("volume",I,null!=y?y:1),o("preload",I,"string"==typeof m?m:!0===m?"auto":"none"),u("abort",I,b),u("canplay",I,S),u("canplaythrough",I,A),u("durationchange",I,w),u("ended",I,C),u("error",I,P),u("loadeddata",I,_),u("loadedmetadata",I,L),u("loadstart",I,T),u("pause",I,j),u("play",I,k),u("playing",I,x),u("progress",I,R),u("ratechange",I,D),u("seeked",I,q),u("seeking",I,M),u("stalled",I,U),u("suspend",I,O),u("timeupdate",I,V),u("volumechange",I,W),u("waiting",I,z),u("stream-adstart",I,B),u("stream-adend",I,F),u("stream-adtimeout",I,G),function(e){t.useEffect((function(){if(null===document.querySelector('script[src="'+r+'"]')){var t=document.createElement("script");return t.setAttribute("data-cfasync","false"),t.setAttribute("defer","true"),t.setAttribute("type","text/javascript"),t.setAttribute("src",r),void document.head.appendChild(t)}var n=e.current;window.__stream&&n&&window.__stream.initElement(n)}),[])}(I),n.createElement("div",{style:{height:p,width:h},ref:J})};
//# sourceMappingURL=stream-react.cjs.production.min.js.map
import React, { useRef, useEffect } from 'react';
var scriptLocation = "https://embed.videodelivery.net/embed/r4xu.fla9.latest.js";
var streamScript = /*#__PURE__*/document.querySelector("script[src=\"" + scriptLocation + "\"]");

@@ -33,4 +32,6 @@ function useStreamElement(containerRef, streamRef) {

useEffect(function () {
if (streamScript === null) {
streamScript = document.createElement("script");
var existingScript = document.querySelector("script[src=\"" + scriptLocation + "\"]");
if (existingScript === null) {
var streamScript = document.createElement("script");
streamScript.setAttribute("data-cfasync", "false");

@@ -48,3 +49,3 @@ streamScript.setAttribute("defer", "true");

window.__stream.initElement(streamElement);
} // no dependencies in the dependancy array means this only fires on mount
} // no dependencies in the dependency array means this only fires on mount
// and the cleanup only fires on unmount.

@@ -51,0 +52,0 @@

{
"name": "@cloudflare/stream-react",
"version": "0.2.0",
"version": "0.3.0",
"license": "BSD-3-Clause",

@@ -5,0 +5,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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