videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
38.1k stars 7.45k forks source link

audio tracker des not work on hls m3u8 video and audio also can not change voice of video #8080

Open beartandgibsondev opened 1 year ago

beartandgibsondev commented 1 year ago

when is display voice can not be change. image on refresh they will gone image console display that image plz tell me how its work with different audio tracks

welcome[bot] commented 1 year ago

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

mister-ben commented 1 year ago

The audio tracks menu will be populated for HLS or DASH streams which have multiple audio. The default bipbop video at https://videojs-http-streaming.netlify.app/ is HLS with two tracks. It's not possible to know what the issue with your HLS without an example.

beartandgibsondev commented 1 year ago

The audio tracks menu will be populated for HLS or DASH streams which have multiple audio. The default bipbop video at https://videojs-http-streaming.netlify.app/ is HLS with two tracks. It's not possible to know what the issue with your HLS without an example.

i use that tool for video encryption https://github.com/protonemedia/laravel-ffmpeg when that source audio tracks not display simple video mp4 that display audio tracks but that not work on it example i add code html

 <video-js id="my-video" class="vjs-default-skin vjs-big-play-centered vjs-16-9 " crossorigin playsinline controls preload="auto" width="640" height="267"  poster="{{ getImage(getFilePath('item_landscape') . '/' . $item->image->landscape) }}"  data-setup='{ "aspectRatio":"640:267", "playbackRates": [0.5,1,1.25, 1.5,1.75, 2] }' controlsList="nodownload">

                             <source src="{{route('video.playlist',['playlist'=>$videoFile ])}}" type="application/x-mpegURL">

                        </video-js>

js

  var player = videojs('my-video', {
                                controls: true,
                                audioTracks: true
                            });
                            const usersAudioTrackList = [{
                            id: 'my-1',
                            kind: 'translation',
                            label: 'kannada',
                            language: 'kannada',
                            src:'https://cdnjs.cloudflare.com/ajax/libs/ion-sound/3.0.7/sounds/glass.mp3',
                            enabled: false,
                            },

                            {
                                id: 'my-2',
                                kind: 'alternative',
                                label: 'tamil',
                                language: 'tamil',
                                src:'https://cdnjs.cloudflare.com/ajax/libs/ion-sound/3.0.7/sounds/door_bump.mp3',
                                enabled: false,
                            },

                            {
                                id: 'my-3',
                                kind: 'translation',
                                label: 'marathi',
                                language: 'marathi',
                                src:'https://cdnjs.cloudflare.com/ajax/libs/ion-sound/3.0.7/sounds/camera_flashing_2.mp3',
                                enabled: false,
                            },
                            {
                                id: 'my-4',
                                kind: 'main',
                                label: 'urdu',
                                language: 'ur',
                                src:'../core/storage/app/public/uploads/audio.mp3',
                                enabled: true,
                        }];
                    usersAudioTrackList.forEach(track => {
                        player.audioTracks().addTrack(
                            new videojs.AudioTrack(track) // Create a track object.
                        );
                        });
and i use hls
player.hlsQualitySelector({
                                displayCurrentQuality: true,
                            });
   link use that
<link href="https://unpkg.com/video.js/dist/video-js.min.css" rel="stylesheet">
   <script src="https://unpkg.com/video.js/dist/video.min.js"></script>
                        <script src="https://unpkg.com/@videojs/http-streaming/dist/videojs-http-streaming.js"></script>
                        <script src="{{asset("core/node_modules/videojs-contrib-quality-levels/dist/videojs-contrib-quality-levels.min.js")}}"></script>
                        <script src="{{asset("core/node_modules/videojs-hls-quality-selector/dist/videojs-hls-quality-selector.min.js")}}"></script>
gkatsev commented 1 year ago

While player.audioTracks() won't complain if you add audio tracks, it isn't meant for usage like that. Video.js only supports multiple audio tracks from the media itself via HLS/DASH (or if the native video element supports multiple audio tracks but most browsers don't, yet)