@folklore/hooks 0.0.17 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs.js CHANGED
@@ -125,7 +125,7 @@ var useDailymotionPlayer = function useDailymotionPlayer() {
125
125
  _params$getVideoId = params.getVideoId,
126
126
  getVideoId = _params$getVideoId === void 0 ? function (url) {
127
127
  if (url === null || url.match(/^https?:/) === null) {
128
- return null;
128
+ return url;
129
129
  }
130
130
 
131
131
  var match = url.match(/\/video\/([^/?]+)/);
@@ -935,7 +935,7 @@ function useYouTubePlayer(id) {
935
935
  _ref$getVideoId = _ref.getVideoId,
936
936
  getVideoId = _ref$getVideoId === void 0 ? function (url) {
937
937
  if (url === null || url.match(/^https?:/) === null) {
938
- return null;
938
+ return url;
939
939
  }
940
940
 
941
941
  var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
@@ -1054,7 +1054,7 @@ function useYouTubePlayer(id) {
1054
1054
  debug$1('iFrame switched');
1055
1055
  destroyPlayer();
1056
1056
  }
1057
- }); // Create player
1057
+ }, [playerElementRef.current, elementRef.current, playerRef.current]); // Create player
1058
1058
 
1059
1059
  react.useEffect(function () {
1060
1060
  var _apiRef$current = apiRef.current,
@@ -1071,7 +1071,7 @@ function useYouTubePlayer(id) {
1071
1071
 
1072
1072
  var player = currentPlayer;
1073
1073
 
1074
- if (player !== null) {
1074
+ if (player !== null && typeof player.loadVideoById !== 'undefined') {
1075
1075
  debug$1('Switch video [ID: %s]', videoId);
1076
1076
  player.loadVideoById(videoId);
1077
1077
  } else {
package/dist/es.js CHANGED
@@ -113,7 +113,7 @@ var useDailymotionPlayer = function useDailymotionPlayer() {
113
113
  _params$getVideoId = params.getVideoId,
114
114
  getVideoId = _params$getVideoId === void 0 ? function (url) {
115
115
  if (url === null || url.match(/^https?:/) === null) {
116
- return null;
116
+ return url;
117
117
  }
118
118
 
119
119
  var match = url.match(/\/video\/([^/?]+)/);
@@ -923,7 +923,7 @@ function useYouTubePlayer(id) {
923
923
  _ref$getVideoId = _ref.getVideoId,
924
924
  getVideoId = _ref$getVideoId === void 0 ? function (url) {
925
925
  if (url === null || url.match(/^https?:/) === null) {
926
- return null;
926
+ return url;
927
927
  }
928
928
 
929
929
  var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
@@ -1042,7 +1042,7 @@ function useYouTubePlayer(id) {
1042
1042
  debug$1('iFrame switched');
1043
1043
  destroyPlayer();
1044
1044
  }
1045
- }); // Create player
1045
+ }, [playerElementRef.current, elementRef.current, playerRef.current]); // Create player
1046
1046
 
1047
1047
  useEffect(function () {
1048
1048
  var _apiRef$current = apiRef.current,
@@ -1059,7 +1059,7 @@ function useYouTubePlayer(id) {
1059
1059
 
1060
1060
  var player = currentPlayer;
1061
1061
 
1062
- if (player !== null) {
1062
+ if (player !== null && typeof player.loadVideoById !== 'undefined') {
1063
1063
  debug$1('Switch video [ID: %s]', videoId);
1064
1064
  player.loadVideoById(videoId);
1065
1065
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@folklore/hooks",
3
- "version": "0.0.17",
3
+ "version": "0.0.20",
4
4
  "description": "React hooks",
5
5
  "keywords": [
6
6
  "javascript",
@@ -48,7 +48,7 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "e4a344b6f9588e581e3bc9a9f2e42f9b6b5bc54c",
51
+ "gitHead": "f7c4b93417b9b7d4b531ea1f79e992e77e1da0ae",
52
52
  "dependencies": {
53
53
  "@folklore/events": "^0.0.3",
54
54
  "@folklore/services": "^0.1.36",