1

I am using VideoJS on my page to load a video and play it. Currently VideoJS on my page supports youtube, vimeo and mp4 video types.

Here is my code:

<video
    id="myVideo"
    ng-show="urlProvided"
    class="video-js vjs-default-skin"
    controls
    width="600"
    data-setup='{ "techOrder": ["html5", "flash", "youtube", "vimeo"]}'
 >
 </video>

JS: this function check type of video and passes the right "type" parameter

function playApropriateType(url) {
                //check if video is from youtube
                if(url.indexOf('youtube') != -1) {
                    scope.player.src({type: 'video/youtube', src: url});
                    scope.player.load();
                }

                //check if video is simple vimeo or mp4
                else if(url.indexOf('mp4') == -1 && url.indexOf('vimeo') != -1){
                    scope.player.src({type: 'video/vimeo', src: url});
                    scope.player.load();
                }

                //check if link is vimeo from payed account
                else if( ((url.indexOf('mp4') != -1) && (url.indexOf('vimeo') != -1)) || url.indexOf('mp4') != -1) {
                    scope.player.src({"type":"video/mp4", "src":url});
                    scope.player.load();
                }
            }

This part works fine.

Now I need to be able to add a kaltura video so I added another "if" statement, something like this:

                //KALTURA NOT WORKING
                else if(url.indexOf('kaltura') != -1) {
                    scope.player.src({"type":"video/webm", "src":url});
                    scope.player.load();
                }

but it says that the format is not supported.

VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported.

NOW: I don't know, is it because VideoJS doesn't support Kaltura videos or it is just that I am missing something?

Octtavius
  • 563
  • 8
  • 29
  • can you play the Kaltura video just by dropping the URL into a browser? that'll answer the supported question. any reason to use webm and not mp4? – Offbeatmammal Mar 24 '17 at 15:27
  • @Offbeatmammal The video plays/works fine. I tried all types mp4, webm, flv, ogg .... because I didn't know what else to do. Unfortunately I got the same error about unsupported media. HERE IS THE LINK https://www.kaltura.com/tiny/m8q7x – Octtavius Mar 24 '17 at 15:37
  • that link is to their embedded player, not to a specific media source. Do you have a link to an actual media asset (eg a URL ending in .mp4, .webm, .ogg, or for HLS .m3u8) – Offbeatmammal Mar 24 '17 at 15:58
  • @Offbeatmammal No, unfortunately. If I would have the link to media asset, I wouldn't have this problem. Currently VideoJS allows you to add video from vimeo and youtube even if it is link to their embedded players and not the direct link to the media asset (this link for example: https://www.youtube.com/watch?v=9L-VK83_0SU OR VIMEO: https://vimeo.com/209248444). So I was wondering if it also supports for Kaltura videos (even if they are competitors) – Octtavius Mar 24 '17 at 16:14

0 Answers0