JWplayer casting gives unsupported media file error

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



JWplayer casting gives unsupported media file error



I am trying to Cast video using JwPlayer chromecast. Video URL is provided with hash key and does not have any extension, it plays in mobile app, but while casting it throws an error saying unsupported video format.I have pasted my code below. If i use any other video URL with extension it is casting, but with the given URL it fails to play video.


JWPlayerFragment fragment = (JWPlayerFragment) getFragmentManager().findFragmentById(R.id.playerFragment);

JWPlayerView playerView = fragment.getPlayer();

PlaylistItem video = new PlaylistItem();

MediaSource mediaSource = new MediaSource();
mediaSource.setType(MediaType.MP4);
mediaSource.setFile("url");

video.setSources(Collections.singletonList(mediaSource));

playerView.load(video);

CastManager.getInstance().addMediaRouterButton(chromecastBtn);

playerView.play();



I also tried to use some other library for casting where I am setting Mime type


// implementation 'pl.droidsonroids:casty:1.0.8'
Casty casty = Casty.create(this);
casty.setUpMediaRouteButton(chromecastBtn);

MediaData mediaData = new MediaData.Builder(mediaSource.getFile())
.setStreamType(MediaData.STREAM_TYPE_BUFFERED) //required
.setContentType("video/mp4") //required
.setMediaType(MediaData.MEDIA_TYPE_MOVIE)
.setTitle("title")
.setSubtitle("subtitle")
.build();
casty.getPlayer().loadMediaAndPlay(mediaData);









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS