1212 janus-call( v-else-if ="room && module.type === 'call.janus'" , ref ="janus" , :room ="room" , :module ="module" , :background ="background" , :size ="background ? 'tiny' : 'normal'" , :key ="`janus-${room.id}`" )
1313 janus-channel-call( v-else-if ="call" , ref ="janus" , :call ="call" , :background ="background" , :size ="background ? 'tiny' : 'normal'" , :key ="`call-${call.id}`" , @close ="$emit('close')" )
1414 .iframe-error ( v-if ="iframeError" ) {{ $t('MediaSource:iframe-error:text') }}
15- iframe#video-player-translation ( v-if ="languageIframeUrl" , :src ="languageIframeUrl" , style ="position: absolute; width: 50%; height: 100%; z-index: -1" , frameborder ="0" , gesture ="media" , allow ="autoplay; encrypted-media" , allowfullscreen ="true" )
15+ iframe#video-player-translation ( v-if ="languageIframeUrl" , :src ="languageIframeUrl" , style ="position: absolute; width: 50%; height: 100%; z-index: -1" , frameborder ="0" , gesture ="media" , allow ="autoplay; encrypted-media" , allowfullscreen ="true" , :referrerpolicy = "referrerPolicy" )
1616</template >
1717<script >
1818// TODO functional component?
1919import { mapState , mapGetters } from ' vuex'
2020import isEqual from ' lodash/isEqual'
21- import api from ' lib/api'
21+ import api , { REFERRER_POLICY } from ' lib/api'
2222import JanusCall from ' components/JanusCall'
2323import JanusChannelCall from ' components/JanusChannelCall'
2424import Livestream from ' components/Livestream'
@@ -38,7 +38,8 @@ export default {
3838 iframeError: null ,
3939 iframe: null , // Track the iframe element
4040 languageAudioUrl: null , // URL for the selected language audio
41- languageIframeUrl: null // URL for the language iframe // Added languageIframeUrl to data
41+ languageIframeUrl: null , // URL for the language iframe // Added languageIframeUrl to data
42+ referrerPolicy: REFERRER_POLICY
4243 }
4344 },
4445 computed: {
@@ -125,6 +126,7 @@ export default {
125126 const iframe = document .createElement (' iframe' )
126127 iframe .src = iframeUrl
127128 iframe .classList .add (' iframe-media-source' )
129+ iframe .setAttribute (' referrerpolicy' , this .referrerPolicy )
128130 if (hideIfBackground) {
129131 iframe .classList .add (' hide-if-background' )
130132 }
@@ -169,7 +171,7 @@ export default {
169171 this .destroyIframe ()
170172 this .initializeIframe (mute) // Initialize iframe with the appropriate mute state
171173 // Set the language iframe URL when language changes
172- this .languageIframeUrl = this .getLanguageIframeUrl (languageUrl)
174+ this .languageIframeUrl = this .getLanguageIframeUrl (languageUrl, this . module ? . config ? . enablePrivacyEnhancedMode )
173175 },
174176 getYoutubeUrl (ytid , autoplay , mute , hideControls , noRelated , showinfo , disableKb , loop , modestBranding , enablePrivacyEnhancedMode ) {
175177 const params = new URLSearchParams ({
@@ -183,12 +185,16 @@ export default {
183185 modestbranding: modestBranding ? ' 1' : ' 0' ,
184186 playlist: ytid,
185187 })
188+ const origin = this .getPlayerOrigin ()
189+ if (origin) {
190+ params .set (' origin' , origin)
191+ }
186192
187193 const domain = enablePrivacyEnhancedMode ? ' www.youtube-nocookie.com' : ' www.youtube.com'
188194 return ` https://${ domain} /embed/${ ytid} ?${ params} `
189195 },
190196 // Added method to get the language iframe URL
191- getLanguageIframeUrl (languageUrl , enablePrivacyEnhancedMode ) {
197+ getLanguageIframeUrl (languageUrl , enablePrivacyEnhancedMode = false ) {
192198 // Checks if the languageUrl is not provided the retun null
193199 if (! languageUrl) return null
194200 const params = new URLSearchParams ({
@@ -202,9 +208,20 @@ export default {
202208 showinfo: ' 0' ,
203209 playlist: languageUrl,
204210 })
211+ const origin = this .getPlayerOrigin ()
212+ if (origin) {
213+ params .set (' origin' , origin)
214+ }
205215
206216 const domain = enablePrivacyEnhancedMode ? ' www.youtube-nocookie.com' : ' www.youtube.com'
207217 return ` https://${ domain} /embed/${ languageUrl} ?${ params} `
218+ },
219+ getPlayerOrigin () {
220+ try {
221+ return window .location .origin
222+ } catch (error) {
223+ return ' '
224+ }
208225 }
209226 }
210227}
0 commit comments