Skip to main content
10-Marble
September 2, 2019
Solved

Video widget in iOS

  • September 2, 2019
  • 1 reply
  • 3996 views

Hello, I'm trying to use Video widget with mp4 file from experience server.

when I do:

$scope.setsrc=() => {
$scope.view.wdg['video-1'].videosrc='/Thingworx/FileRepositories/UL.FileRepository/Vid_20190531_125615_1.mp4';
}

And then hit play it works fine in preview and Android, but on iOS I just can't make it work. (when I click play widget resets) 

 

Does anyone have an idea how to solve this?

 

Kind regards

Best answer by RolandRaytchev

Hi @mziemniewicz  and @ClayHelberg,

I think there is another solution I just tested which could be more independent  from the visibility of the Thingworx server. So, for this way you need solely the access of the Experience server

Follwoing steps:

1.) checking the path of the path on the repository:

 

2019-09-06_12-10-35.jpg

 

2.) set the permission of the service LoadBinary of the repositorything  to run for 'es-public-access' 

 

2019-09-06_12-15-07.jpg

 

3.) add the service in the External Data in Vuforia Studio project :

 

2019-09-06_12-17-33.jpg

 

4.) add e.g. a button click event to the video widget play service:

 

2019-09-06_12-20-29.jpg

 

5.) add the following javaScript code;

 

////////////////////Issue with read video from repository
$scope.GetVideoFromTwxRepository = function(path) {
 $scope.$applyAsync(function() {
 
 $rootScope.$broadcast('app.mdl.CAD-Files-Repository.svc.LoadBinary',
 {"path":path}
 );} ,500 );
 
 console.log("after calling GetImageFromTwx");
 
};

////////////////////////////////////////////////////////////////
 $scope.$on('$ionicView.afterEnter', function() {
 // register the LoadBinary-complete event + callback 
 $scope.$root.$on('LoadBinary-complete', function(event, args) { 
 console.log("LoadImage-complete event");
 
 console.log("name="+event.name)
 console.warn(args.data);
 console.warn(args.data[0]);
 var ret_str='data:video/mp4;base64,'+args.data[0].Content;
 $scope.view.wdg['video-1']['videosrc']=ret_str; 
console.warn($scope.view.wdg['video-1']['videosrc'])
 });
 //call the function to laod the mp4 file to video source of the video widget
$timeout( function () {$scope.GetVideoFromTwxRepository(
'/web/c-belt-converyor.mp4'
);},500); 
});
////////////

 

6.) Test it in preview and on mobile device- I tested in Android and IOS Ipad 6 - and it was working fine

 

2019-09-06_12-26-49.jpg

1 reply

21-Topaz I
September 2, 2019

Hi @mziemniewicz,

 

what is the path what you use  here for the setting of the videosrc property ? : '/Thingworx/FileRepositories/UL.FileRepository/Vid_20190531_125615_1.mp4'

Is this a local folder in your project or did you try to use /as the name says/ a FileRepositriy from Thingworx?

 

 

10-Marble
September 4, 2019

the full path is like:

where http://mycloudexperienceservice.com:8080/ this is the same address for Thingworx and the experience service of this particular experience.
21-Topaz I
September 4, 2019

Is it possible on your IOS device to play it from there/the mention repository link/ in other app or browser?