Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用PHP实现从mplayer_Php_Popen_Mplayer_Slave - Fatal编程技术网

用PHP实现从mplayer

用PHP实现从mplayer,php,popen,mplayer,slave,Php,Popen,Mplayer,Slave,我正在尝试使用mplayer为特定的视频格式制作一个用PHP编写的跨平台播放器。 PHP脚本构建视频文件并启动mplayer,同时继续构建视频文件。 有时PHP脚本速度不够快,mplayer崩溃,因为它不再缓冲视频。 因此,如果需要缓冲,我需要控制mplayer暂停它。 我做了一个功能——只是为了测试——在5秒钟后尝试停止视频。 (以下是命令列表:) 但是,即使输出为: resource(5) of type (stream) Pausing...done! 视频没有停止 怎么了?在VB.NE

我正在尝试使用mplayer为特定的视频格式制作一个用PHP编写的跨平台播放器。
PHP脚本构建视频文件并启动mplayer,同时继续构建视频文件。
有时PHP脚本速度不够快,mplayer崩溃,因为它不再缓冲视频。
因此,如果需要缓冲,我需要控制mplayer暂停它。
我做了一个功能——只是为了测试——在5秒钟后尝试停止视频。
(以下是命令列表:)

但是,即使输出为:

resource(5) of type (stream)
Pausing...done!
视频没有停止

怎么了?

在VB.NET中,我使用以下代码来播放静音和暂停音乐。请随意使用。我想你的问题可能是发送命令的功能

    Private Sub funPlayMusic()
    ps = New Process()
    ps.StartInfo.FileName = "D:\Music\mplayer.exe "
    ps.StartInfo.UseShellExecute = False
    ps.StartInfo.RedirectStandardInput = True

    'ps.StartInfo.CreateNoWindow = True
    args = "-fs  -noquiet -identify -slave " '
    args += "-nomouseinput -sub-fuzziness 1 "
    args += " -vo direct3d, -ao dsound "
    '    -wid will tell MPlayer to show output inisde our panel
    '    args += " -vo direct3d, -ao dsound  -wid ";
    '    int id = (int)panel1.Handle;
    '    args += id;
End Sub


  Public Function SendCommand(ByVal cmd As String) As Boolean
    Try
        If ps IsNot Nothing AndAlso ps.HasExited = False Then
            ps.StandardInput.Write(cmd + vbLf)
            Return True
        Else
            Return False
        End If

    Catch ex As Exception
        Return False
    End Try
End Function 


   Public Sub Playsong(ByVal Songfilelocation As String)

    Try
        ps.Kill()
    Catch
    End Try
    Try
        ps.StartInfo.Arguments = args + " """ + Songfilelocation + """"
        ps.Start()

        SendCommand("set_property volume " + "80")
    Catch e As Exception
        MessageBox.Show(e.Message)
    End Try

End Sub


  Private Sub btnPause_Click(sender As Object, e As EventArgs) Handles       btnPlayPause.Click
    SendCommand("pause")


   End Sub


    Private Sub btnMute_Click(sender As Object, e As EventArgs) Handles btnMute.Click
    SendCommand("mute")


  End Sub

在VB.NET中,我使用以下代码来播放静音和暂停音乐。请随意使用。我想你的问题可能是发送命令的功能

    Private Sub funPlayMusic()
    ps = New Process()
    ps.StartInfo.FileName = "D:\Music\mplayer.exe "
    ps.StartInfo.UseShellExecute = False
    ps.StartInfo.RedirectStandardInput = True

    'ps.StartInfo.CreateNoWindow = True
    args = "-fs  -noquiet -identify -slave " '
    args += "-nomouseinput -sub-fuzziness 1 "
    args += " -vo direct3d, -ao dsound "
    '    -wid will tell MPlayer to show output inisde our panel
    '    args += " -vo direct3d, -ao dsound  -wid ";
    '    int id = (int)panel1.Handle;
    '    args += id;
End Sub


  Public Function SendCommand(ByVal cmd As String) As Boolean
    Try
        If ps IsNot Nothing AndAlso ps.HasExited = False Then
            ps.StandardInput.Write(cmd + vbLf)
            Return True
        Else
            Return False
        End If

    Catch ex As Exception
        Return False
    End Try
End Function 


   Public Sub Playsong(ByVal Songfilelocation As String)

    Try
        ps.Kill()
    Catch
    End Try
    Try
        ps.StartInfo.Arguments = args + " """ + Songfilelocation + """"
        ps.Start()

        SendCommand("set_property volume " + "80")
    Catch e As Exception
        MessageBox.Show(e.Message)
    End Try

End Sub


  Private Sub btnPause_Click(sender As Object, e As EventArgs) Handles       btnPlayPause.Click
    SendCommand("pause")


   End Sub


    Private Sub btnMute_Click(sender As Object, e As EventArgs) Handles btnMute.Click
    SendCommand("mute")


  End Sub

您是否尝试过在不使用\n的情况下暂停?你试过暂停吗?(如中所示)我已经尝试过了,但没有一个有效…您是否尝试过在没有\n的情况下暂停
pause
?你试过暂停吗?(如中所示)我已经试过了,但没有一个有效。。。