Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a failure mechanism from Dash to HLS ? #4114

Closed
rishigohil opened this issue Feb 21, 2017 · 5 comments
Closed

Need a failure mechanism from Dash to HLS ? #4114

rishigohil opened this issue Feb 21, 2017 · 5 comments

Comments

@rishigohil
Copy link

rishigohil commented Feb 21, 2017

Observed behaviour

I am trying to set up a mechanism where videojs can load the source dynamically according to its tech order or similar. Am I doing something wrong here?

Turns out VP9 is not supported on Safari and it should switch to HLS but it's not switching to HLS for Safari.

Can I catch the not supported type error and switch the source if it's not handled dynamically?

Thanks.

Code
<script src="../../../Scripts/dash.all.min.js"></script>
<script src="../../../Scripts/videojs-dash.js"></script>
<script src="../../../Scripts/videojs-contrib-hls.js"></script>
<script src="../../../Scripts/videojs-responsive-layout.js"></script>
<script type="text/javascript" src="//vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>

<video id="dashVideo" class="video-js vjs-default-skin embed-responsive-item vjs-16-9 vjs-big-play-centered" width="640" height="264" controls preload="auto" />

<script type="text/javascript">
        var player = videojs('dashVideo', {
            techOrder: ['html5', 'flash'],
            controlBar: { volumeMenuButton: { inline: false } },
            plugins: { responsiveLayout: {} },
            autoplay: true,
            sources: [{
                type: "application/dash+xml",
                src: "./VP9/manifest.mpd"
            },
            {
                type: "application/x-mpegURL",
                src: "./HLS/playlist.m3u8"
            }]
        });

        if (!player.isIOS || !player.isAndroid) {
            player.pause();
            (function playerReady() {
                setTimeout(function () { player.play(); }, 250);
            })();
        }
    </script>

One hack to bypass this issue is to provide empty key systems object (https://github.com/videojs/videojs-contrib-dash#protected-content) and This will automatically skip DASH sources on Safari since it only supports HLS FairPlay DRM.

Updated Code with Workaround
<script src="../../../Scripts/dash.all.min.js"></script>
<script src="../../../Scripts/videojs-dash.js"></script>
<script src="../../../Scripts/videojs-contrib-hls.js"></script>
<script src="../../../Scripts/videojs-responsive-layout.js"></script>
<script type="text/javascript" src="//vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>

<video id="dashVideo" class="video-js vjs-default-skin embed-responsive-item vjs-16-9 vjs-big-play-centered" width="640" height="264" controls preload="auto" />

<script type="text/javascript">
        var player = videojs('dashVideo', {
            techOrder: ['html5', 'flash'],
            controlBar: { volumeMenuButton: { inline: false } },
            plugins: { responsiveLayout: {} },
            autoplay: true,
            sources: [{
                type: "application/dash+xml",
                src: "./VP9/manifest.mpd",
                keySystemOptions: [{}]
            },
            {
                type: "application/x-mpegURL",
                src: "./HLS/playlist.m3u8"
            }]
        });

        if (!player.isIOS || !player.isAndroid) {
            player.pause();
            (function playerReady() {
                setTimeout(function () { player.play(); }, 250);
            })();
        }
    </script>

Is there any permanent solution?

Thanks !

@gkatsev
Copy link
Member

gkatsev commented Feb 21, 2017

It should be automatically seeing that application/dash+xml is not supported and then switching to application/x-mpegURL. Maybe videojs-dash has a bug? @forbesjo thoughts?
Otherwise, you can listen to the error event from the player, see what the code is, and then change the source.

@forbesjo
Copy link
Contributor

dash.js does support Safari in general, in this case the specific source does not work with Safari. The general scenario this bug brings up is falling back to a different source when some kind of error happens

@rishigohil
Copy link
Author

@gkatsev That's one way to do it. But I was wondering shouldn't it switch automatically to the next available source if the default one is not supported?

@gkatsev
Copy link
Member

gkatsev commented Feb 21, 2017

No reason other than effort. See #1805.

@gkatsev
Copy link
Member

gkatsev commented Feb 22, 2017

Seems like this one should be closed in favor of #1805.

@gkatsev gkatsev closed this as completed Feb 22, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants