Skip to main content
18-Opal
June 20, 2019
Question

Link to Remote Media Resources

  • June 20, 2019
  • 1 reply
  • 1381 views

Hello,

 

Following code doesn't work.

 

$scope.assignTrustedUrl = function()
{
$scope.view.wdg['video-1'].videosrc=$sce.trustAsResourceUrl('<http://example.org/example.mp4>');
};

 

$scope.assignTrustedUrl2 = function()
{
$scope.view.wdg['video-1'].videosrc=$sce.trustAsResourceUrl('<https://youtu.be/zlYZVUXxs_I>');

};

 

how play remote media?

please let me know

 

Thanks.

 

Warm Regards,

SeonHo

1 reply

1-Visitor
June 20, 2019

I was wondering where you got that usage from and then I looked at the Studio help for remote media linking, 🤦

That exact usage show in help produces this error in the console

Error: [$sce:itype] http://errors.angularjs.org/1.5.3/$sce/itype?p0=resourceUrl

which says SCE trust call require a string value for the URL. Which is what we are passing to it.

The "old" way of doing this still works however. Either of these lines will set the video source for a video widget.

$scope.setWidgetProp('video-2', 'videosrc', video); //this is the most reliable method for setting widget properties
//or
$scope.view.wdg['video-2'].videosrc=video;
21-Topaz I
June 20, 2019

I'm looking into this internally. I'll post an update to this thread when I have more information. 

21-Topaz I
June 25, 2019

After some code changes within Studio $sce no longer works. Our help center documentation will be updated to reflect this. We recommend linking to remote media using 

 

$scope.view.wdg['video-1'].videosrc='http://example.org/example.mp4';