@sage-rsc/talking-head-react 1.0.48 → 1.0.49
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/index.cjs +2 -2
- package/dist/index.js +467 -463
- package/package.json +1 -1
- package/src/components/TalkingHeadAvatar.jsx +18 -5
package/package.json
CHANGED
|
@@ -49,9 +49,15 @@ const TalkingHeadAvatar = forwardRef(({
|
|
|
49
49
|
}, ref) => {
|
|
50
50
|
const containerRef = useRef(null);
|
|
51
51
|
const talkingHeadRef = useRef(null);
|
|
52
|
+
const showFullAvatarRef = useRef(showFullAvatar);
|
|
52
53
|
const [isLoading, setIsLoading] = useState(true);
|
|
53
54
|
const [error, setError] = useState(null);
|
|
54
55
|
const [isReady, setIsReady] = useState(false);
|
|
56
|
+
|
|
57
|
+
// Update ref when prop changes
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
showFullAvatarRef.current = showFullAvatar;
|
|
60
|
+
}, [showFullAvatar]);
|
|
55
61
|
|
|
56
62
|
// Get TTS configuration
|
|
57
63
|
const ttsConfig = getActiveTTSConfig();
|
|
@@ -450,9 +456,10 @@ const TalkingHeadAvatar = forwardRef(({
|
|
|
450
456
|
animationName = animations[animationName];
|
|
451
457
|
}
|
|
452
458
|
|
|
459
|
+
// Respect the showFullAvatar prop value instead of forcing true
|
|
453
460
|
if (talkingHeadRef.current.setShowFullAvatar) {
|
|
454
461
|
try {
|
|
455
|
-
talkingHeadRef.current.setShowFullAvatar(
|
|
462
|
+
talkingHeadRef.current.setShowFullAvatar(showFullAvatarRef.current);
|
|
456
463
|
} catch (error) {
|
|
457
464
|
console.warn('Error setting full body mode:', error);
|
|
458
465
|
}
|
|
@@ -517,7 +524,8 @@ const TalkingHeadAvatar = forwardRef(({
|
|
|
517
524
|
setBodyMovement: (movement) => {
|
|
518
525
|
if (talkingHeadRef.current && talkingHeadRef.current.setShowFullAvatar && talkingHeadRef.current.setBodyMovement) {
|
|
519
526
|
try {
|
|
520
|
-
|
|
527
|
+
// Respect the showFullAvatar prop value instead of forcing true
|
|
528
|
+
talkingHeadRef.current.setShowFullAvatar(showFullAvatarRef.current);
|
|
521
529
|
talkingHeadRef.current.setBodyMovement(movement);
|
|
522
530
|
} catch (error) {
|
|
523
531
|
console.warn('Error setting body movement:', error);
|
|
@@ -528,7 +536,8 @@ const TalkingHeadAvatar = forwardRef(({
|
|
|
528
536
|
playRandomDance: () => {
|
|
529
537
|
if (talkingHeadRef.current && talkingHeadRef.current.setShowFullAvatar && talkingHeadRef.current.playRandomDance) {
|
|
530
538
|
try {
|
|
531
|
-
|
|
539
|
+
// Respect the showFullAvatar prop value instead of forcing true
|
|
540
|
+
talkingHeadRef.current.setShowFullAvatar(showFullAvatarRef.current);
|
|
532
541
|
talkingHeadRef.current.playRandomDance();
|
|
533
542
|
} catch (error) {
|
|
534
543
|
console.warn('Error playing random dance:', error);
|
|
@@ -538,7 +547,8 @@ const TalkingHeadAvatar = forwardRef(({
|
|
|
538
547
|
playReaction: (reactionType) => {
|
|
539
548
|
if (talkingHeadRef.current && talkingHeadRef.current.setShowFullAvatar && talkingHeadRef.current.playReaction) {
|
|
540
549
|
try {
|
|
541
|
-
|
|
550
|
+
// Respect the showFullAvatar prop value instead of forcing true
|
|
551
|
+
talkingHeadRef.current.setShowFullAvatar(showFullAvatarRef.current);
|
|
542
552
|
talkingHeadRef.current.playReaction(reactionType);
|
|
543
553
|
} catch (error) {
|
|
544
554
|
console.warn('Error playing reaction:', error);
|
|
@@ -548,7 +558,8 @@ const TalkingHeadAvatar = forwardRef(({
|
|
|
548
558
|
playCelebration: () => {
|
|
549
559
|
if (talkingHeadRef.current && talkingHeadRef.current.setShowFullAvatar && talkingHeadRef.current.playCelebration) {
|
|
550
560
|
try {
|
|
551
|
-
|
|
561
|
+
// Respect the showFullAvatar prop value instead of forcing true
|
|
562
|
+
talkingHeadRef.current.setShowFullAvatar(showFullAvatarRef.current);
|
|
552
563
|
talkingHeadRef.current.playCelebration();
|
|
553
564
|
} catch (error) {
|
|
554
565
|
console.warn('Error playing celebration:', error);
|
|
@@ -558,6 +569,8 @@ const TalkingHeadAvatar = forwardRef(({
|
|
|
558
569
|
setShowFullAvatar: (show) => {
|
|
559
570
|
if (talkingHeadRef.current && talkingHeadRef.current.setShowFullAvatar) {
|
|
560
571
|
try {
|
|
572
|
+
// Update ref so other methods use the new value
|
|
573
|
+
showFullAvatarRef.current = show;
|
|
561
574
|
talkingHeadRef.current.setShowFullAvatar(show);
|
|
562
575
|
} catch (error) {
|
|
563
576
|
console.warn('Error setting showFullAvatar:', error);
|