shiyiya / oplayer

:zap: Another HTM5 video player.
https://oplayer.vercel.app
MIT License
147 stars 19 forks source link

When subtitle default is true it does not show #96

Closed MuhammadTufailAli closed 11 months ago

MuhammadTufailAli commented 1 year ago

I am using subtitle in Oplayer. Following is my code .use( [ ui({ theme: { primaryColor: "#D98420" }, coverButton: true, pictureInPicture: false, miniProgressBar: false,

            controlBar: false, //chrome cast ko uper la k jana k lia
            //subtitle are added
            subtitle: {
              color: "white",
              fontSize: 24,
              fontWeight: 700,
              fontFamily: "Roboto",
              background: true,
              source: [
                {
                  name: "English",
                  default: true,
                  src: MediaToPlay?.srt_file,
                },
              ],
            },

          hls({ forceHLS: true }),

          // chromecast,
          conditionToChromeCast && otherBrowser && chromecast,
        ].filter(Boolean)
      )

      When subtitle    default: true, then it does not show but if i do    default: false and then enable it manually subtitle starts showing. Please help me resolve this issue
MuhammadTufailAli commented 1 year ago

i console my Oplayer when it was created My currentSubtitle is { "name": "English", "default": true, "src": "https://streambe1.nayatel.com/movies/Navalny.1080p-HD.srt" } but isShow:false

If i reload page then isShow gets true why is this behaviour

shiyiya commented 1 year ago

pls upload srt file

MuhammadTufailAli commented 1 year ago

Upload srt file where i don't understand what you said. Can you please explain?

MuhammadTufailAli commented 1 year ago

I also added my movie link and srt link in Oplayer playground it is also not showing over there

My code const player = Player.make("#app", { // isLive: true, source: { src: "https://5c7da495a96a8.streamlock.net/vodedge/_definst_/http/movies/Navalny.1080p-HD.mp4/playlist.m3u8", poster: "https://ohplayer.netlify.app/poster.png", title: "君の名は" }, autoplay: true, videoAttr: { // crossOrigin: "anonymous" } }) .use([ ui({ subtitle: { background: true, source: [ { name: "Japanese", default: true, src: "https://streambe1.nayatel.com/movies/Navalny.1080p-HD.srt"

      },
      {
        name: "CH & JP",
        src: "https://ohplayer.netlify.app/君の名は.srt"
      }
    ]
  },

 If i reload then subtitles starts showing and if i make subtitle default:false and manually open it then its start showing
shiyiya commented 1 year ago

source cannot access

MuhammadTufailAli commented 1 year ago

So what should i do

MuhammadTufailAli commented 1 year ago

i also added Oplayer playground src { name: "Japanese", default: true, src: "https://ohplayer.netlify.app/君の名は-jp.srt" }

      But it is also now showing if default: true,
MuhammadTufailAli commented 1 year ago

Please give me solution

shiyiya commented 1 year ago

https://oplayer.vercel.app/preview/ is ok?

MuhammadTufailAli commented 1 year ago

Yes above is working fine but in my case subtitle are not showing Can you please use movie src as https://5c7da495a96a8.streamlock.net/vodedge/_definst_/http/movies/Navalny.1080p-HD.mp4/playlist.m3u8 and use following subtitle https://streambe1.nayatel.com/movies/Navalny.1080p-HD.srt and check if subtitle show or not In this way we will check where problem exists?

MuhammadTufailAli commented 1 year ago

??

shiyiya commented 1 year ago

Unable to access your resources and subtitle files

shiyiya commented 1 year ago

No time this week, looking at it next week, provide your srt file

eritpchy commented 12 months ago

Same issue on @oplayer/ui": "1.2.34-beta.1 & Chrome 117.0.5938.149 (Official Build) (x86_64)

shiyiya commented 12 months ago

Same issue on @oplayer/ui": "1.2.34-beta.1 & Chrome 117.0.5938.149 (Official Build) (x86_64)

reproduction repo?

eritpchy commented 12 months ago

Same issue on @oplayer/ui": "1.2.34-beta.1 & Chrome 117.0.5938.149 (Official Build) (x86_64)

reproduction repo?

Not yet. but I just got workaround this problem. image

shiyiya commented 12 months ago

Same issue on @oplayer/ui": "1.2.34-beta.1 & Chrome 117.0.5938.149 (Official Build) (x86_64)

reproduction repo?

Not yet. but I just got workaround this problem. image

所以只是写法错了。

eritpchy commented 12 months ago
image

差不多, 我感觉和这个src 有关系

image

很奇怪, 如果用之前的写法刚刷新页面进去第一次是ok的, 然后重新加载oplayer就挂了

image

这两cues都没了

shiyiya commented 12 months ago

切换视频源会重建cue 重新加载是怎么个加载法?

MuhammadTufailAli commented 12 months ago

I am using subtitle in Oplayer. Following is my code .use( [ ui({ theme: { primaryColor: "#D98420" }, coverButton: true, pictureInPicture: false, miniProgressBar: false,

        controlBar: false, //chrome cast ko uper la k jana k lia
        //subtitle are added
        subtitle: {
          color: "white",
          fontSize: 24,
          fontWeight: 700,
          fontFamily: "Roboto",
          background: true,
          source: [
            {
              name: "English",
              default: true,
              src: MediaToPlay?.srt_file,
            },
          ],
        },

      hls({ forceHLS: true }),

      // chromecast,
      conditionToChromeCast && otherBrowser && chromecast,
    ].filter(Boolean)
  )

  When subtitle    default: true, then it does not show but if i do    default: false and then enable it manually subtitle starts showing. Please help me resolve this issue
eritpchy commented 12 months ago

我代码是放在vue的onMounted 里面的, 重新加载大概就是...关了vue这个页面,再打开.

onMounted(() => {
  emit('load');
  const player = Player.make('#oplayer', {
    source: {
      poster: webdav_thumbnail_link(props.selection.item),
      title: props.selection.item.basename,
    }
  }).use([
    ui({
      controlBar: { back: "always" },
      fullscreen: true,
    }),
    hls({
      forceHLS: true,
      withBitrate: true,
      active(instance, lib) {
        instance.on(lib.Events.MANIFEST_PARSED, (...payload) => {
          console.log(payload);
        });
      }
    }),
    dash({
      withBitrate: true,
      active(instance, lib) {
        instance.on("streamInitialized", (payload) => {
          console.log(payload);
        });
      }
    }),
    mpegts(),
  ]).create()

  fetch(...).then(() => {
    player.changeSource({
       src: videoUrlList[0].value,
       poster: webdav_thumbnail_link(props.selection.item),
       title: props.selection.item.basename,
    })
    player.context.ui.subtitle.changeSource(subtitleUrlList)
  })
})
MuhammadTufailAli commented 12 months ago

subtitle

Look Even i used default: true, but when player is made the subtitle does not show and in console isShow is false

MuhammadTufailAli commented 12 months ago

If i reload this page then isSHow get true and also if i do default: false and then manually turn on sutitle it works fine

shiyiya commented 12 months ago

@eritpchy changeshource -》 changesubtitle

eritpchy commented 12 months ago

MediaToPlay?.srt_file Try this. type: 'srt'

{
  name: "English",
  default: true,
  src: MediaToPlay?.srt_file,
  type: 'srt',
},
eritpchy commented 12 months ago

@eritpchy 关页面重新拿不应该啊

哈哈哈, 可能就是加载视频然后再加载字幕太快了导致的吧

eritpchy commented 12 months ago

@eritpchy changeshource -》 changesubtitle

我搜索了下代码, 没有changesubtitle这个方法吧

MuhammadTufailAli commented 12 months ago

@eritpchy i also tried to do this but still in console i get isShow:false why this wired behavior?

MuhammadTufailAli commented 12 months ago

"@oplayer/ui": "^1.2.32", My ui version

eritpchy commented 12 months ago

"@oplayer/ui": "^1.2.32", My ui version

Maybe you should upgrade to @oplayer/ui": "1.2.34-beta.1 ?

MuhammadTufailAli commented 12 months ago

Is it working fine in 1.2.34?

eritpchy commented 12 months ago

Not sure..

MuhammadTufailAli commented 12 months ago

@shiyiya ????

eritpchy commented 12 months ago
image

@MuhammadTufailAli

shiyiya commented 12 months ago

Are you using oplayer, may i put it in oplayer readme?

Who use OPlayer?

eritpchy commented 12 months ago

@shiyiya 还没发布, 且太小众, 都不好意思了😅

shiyiya commented 12 months ago

@shiyiya 还没发布, 且太小众, 都不好意思了😅

那就点个star先 🤣

shiyiya commented 12 months ago

"@oplayer/ui": "^1.2.32", My ui version

try upgrade all oplayer

npm update @oplayer/core @oplayer/ui @oplayer/xxx
MuhammadTufailAli commented 12 months ago

Okay i hope nothing will crash after that 🤣

MuhammadTufailAli commented 12 months ago

i updated my Oplayer all dependencies now my "@oplayer/ui": "^1.2.32", But still subtitle is not showing. Still isShow is false. Why it is still not resolved

shiyiya commented 12 months ago

1.2.34-beta.2

npm i @oplayer/ui@1.2.34-beta.2

shiyiya commented 11 months ago

close,no respond

eritpchy commented 9 months ago

Are you using oplayer, may i put it in oplayer readme?

Who use OPlayer?

  • NGEWIBU.TV : Nonton Anime Sub Indo | Nonton Anime Subtitle Indonesia Gratis
  • Animex : Watch Anime for free in HD quality with English subbed or dubbed.
  • UPV : free animes no ad
  • Feel free to submit yours in Let me know!

https://github.com/eritpchy/aliyundrive-webdav/releases 已经发布, 用了你的oplayer😃