Skip to content

Commit

Permalink
Fix video player controller
Browse files Browse the repository at this point in the history
  • Loading branch information
adimiz1 committed Mar 17, 2024
1 parent b0a9732 commit b841da5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/video/cld_video_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class CldVideoController extends VideoPlayerController
((assetType != null) ? video.assetType(assetType) : null);
((deliveryType != null) ? video.deliveryType(deliveryType) : null);

if ((automaticStreamingProfile == null || automaticStreamingProfile) &&
if ((automaticStreamingProfile != null && automaticStreamingProfile) &&
transformation == null) {
video.transformation(Transformation()
.transcode(Transcode.streamingProfile(StreamingProfile.auto())));
Expand Down
18 changes: 18 additions & 0 deletions test/cld_video_controller_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,24 @@ void main() {
cloudinary: cloudinary,
);

final String expectedUriString =
'https://res.cloudinary.com/test/video/upload/'
'sample_public_id';
expect(controller.dataSource.toString(), expectedUriString);
});

test(
'CldVideoController constructor builds correct URI with specific cloudinary and automatic streaming profile',
() {
Cloudinary cloudinary = CloudinaryObject.fromCloudName(cloudName: "test");
cloudinary.config.urlConfig.analytics = false;
final String publicId = 'sample_public_id';

final CldVideoController controller = CldVideoController(
publicId: publicId,
cloudinary: cloudinary,
automaticStreamingProfile: true);

final String expectedUriString =
'https://res.cloudinary.com/test/video/upload/sp_auto/'
'sample_public_id.m3u8';
Expand Down

0 comments on commit b841da5

Please sign in to comment.